Просмотр исходного кода

feat: 任务办理流转下一步、退回上一步、办结按钮接口对接;办结监审查询列表接口对接

shiyanyu 1 месяц назад
Родитель
Сommit
6993381be8

+ 21 - 0
src/api/audit/reviewTask.js

@@ -0,0 +1,21 @@
+import request from '@/utils/request'
+
+const url = window.context.form
+
+// 获取审核任务流程
+export function getReviewTask(data) {
+  return request({
+    url: url + '/api/enterprise/reviewTask/doProcessBtn',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 办结监审列表
+export function getCompletedSupervisionList(data) {
+  return request({
+    url: url + '/api/enterprise/reviewTask/completedPageList',
+    method: 'post',
+    data: data,
+  })
+}

+ 1 - 1
src/views/costAudit/auditInfo/auditManage/conclusionMain.vue

@@ -348,7 +348,7 @@
     width: 100%;
     min-height: 100px;
     resize: vertical;
-    border: 1px solid #dcdfe6;
+    /* border: 1px solid #dcdfe6; */
     border-radius: 4px;
     padding: 8px 12px;
     font-size: 14px;

+ 224 - 1
src/views/costAudit/auditInfo/auditManage/mainDetails.vue

@@ -16,7 +16,7 @@
             退回上一步
           </el-button>
           <el-button type="primary" @click="handleAddTask">办结任务</el-button>
-          <el-button type="primary" @click="handleAssign">退回</el-button>
+          <el-button type="primary" @click="handleAssign">回</el-button>
         </div>
       </div>
       <!-- 标签页面 -->
@@ -52,6 +52,43 @@
         </el-tab-pane>
       </el-tabs>
     </el-drawer>
+    <!-- 流转下一步/退回上一步弹窗 -->
+    <el-dialog
+      :visible.sync="showProcessDialog"
+      :title="processDialogTitle"
+      width="600px"
+      :modal="false"
+      custom-class="process-dialog"
+    >
+      <div class="dialog-content">
+        <div class="form-item process-form-item">
+          <label class="form-label">意见:</label>
+          <div class="form-content">
+            <el-input
+              v-model="processParams.content"
+              type="textarea"
+              :rows="6"
+              placeholder="请输入意见"
+              maxlength="500"
+              show-word-limit
+            />
+          </div>
+        </div>
+        <div class="form-item process-form-item">
+          <label class="form-label">发送方式:</label>
+          <div class="form-content">
+            <el-checkbox-group v-model="processParams.sendType">
+              <el-checkbox label="1">站内消息</el-checkbox>
+              <el-checkbox label="2">短信通知</el-checkbox>
+            </el-checkbox-group>
+          </div>
+        </div>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="showProcessDialog = false">取消</el-button>
+        <el-button type="primary" @click="submitProcess">确定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -62,6 +99,7 @@
     getDataPreliminaryReviewButton,
     doProcessBtn,
   } from '@/api/dataPreliminaryReview'
+  import { getReviewTask } from '@/api/audit/reviewTask'
   export default {
     name: 'Details',
     components: {
@@ -103,10 +141,18 @@
         showSupplementDialog: false,
         showAbortDialog: false,
         showRejectDialog: false,
+        showProcessDialog: false, // 流转下一步/退回上一步弹窗
         // 弹窗数据
         additionalParams: {},
         // 当前操作按钮信息
         currentButton: null,
+        // 流转/退回操作参数
+        processParams: {
+          content: '', // 意见
+          sendType: [], // 发送方式
+        },
+        // 当前操作类型:'next' 流转下一步, 'prev' 退回上一步
+        currentProcessType: '',
       }
     },
     computed: {
@@ -141,6 +187,17 @@
 
         return titleParts.join('')
       },
+      // 流转/退回/办结弹窗标题
+      processDialogTitle() {
+        if (this.currentProcessType === 'next') {
+          return '流转下一步'
+        } else if (this.currentProcessType === 'prev') {
+          return '退回上一步'
+        } else if (this.currentProcessType === 'complete') {
+          return '办结任务'
+        }
+        return '操作'
+      },
     },
     watch: {
       visible(newVal) {
@@ -246,9 +303,122 @@
         // 触发父组件刷新列表
         this.$emit('refresh')
       },
+      // 处理返回按钮点击
+      handleAssign() {
+        // 关闭弹窗
+        this.handleClose()
+        // 触发父组件刷新列表
+        this.$emit('refresh')
+      },
       // 处理审核操作按钮点击
       handleAuditPass(item) {},
 
+      // 流转下一步
+      handleNextStep() {
+        this.currentProcessType = 'next'
+        this.processParams = {
+          content: '',
+          sendType: [],
+        }
+        this.showProcessDialog = true
+      },
+
+      // 退回上一步
+      handlePrevStep() {
+        this.currentProcessType = 'prev'
+        this.processParams = {
+          content: '',
+          sendType: [],
+        }
+        this.showProcessDialog = true
+      },
+
+      // 办结任务
+      handleAddTask() {
+        this.currentProcessType = 'complete'
+        this.processParams = {
+          content: '',
+          sendType: [],
+        }
+        this.showProcessDialog = true
+      },
+
+      // 提交流转/退回操作
+      async submitProcess() {
+        if (!this.id) {
+          this.$message.error('缺少任务ID')
+          return
+        }
+
+        // 验证发送方式
+        if (
+          !this.processParams.sendType ||
+          this.processParams.sendType.length === 0
+        ) {
+          this.$message.warning('请选择至少一种发送方式')
+          return
+        }
+
+        try {
+          // 根据操作类型确定key值
+          let keyValue
+          if (this.currentProcessType === 'next') {
+            keyValue = 7 // 流转下一步
+          } else if (this.currentProcessType === 'prev') {
+            keyValue = 6 // 退回上一步
+          } else if (this.currentProcessType === 'complete') {
+            keyValue = 3 // 办结任务
+          }
+
+          const params = {
+            taskId: this.id,
+            processNodeKey: this.currentNode,
+            key: keyValue,
+            sendType: this.processParams.sendType.join(','), // 发送方式用","分割
+            content: this.processParams.content || '', // 意见
+          }
+
+          const response = await getReviewTask(params)
+
+          if (response && response.code === 200) {
+            // 根据操作类型显示成功消息
+            let actionText
+            if (this.currentProcessType === 'next') {
+              actionText = '流转下一步'
+            } else if (this.currentProcessType === 'prev') {
+              actionText = '退回上一步'
+            } else if (this.currentProcessType === 'complete') {
+              actionText = '办结任务'
+            }
+            this.$message.success(response.message)
+            // 关闭弹窗
+            this.showProcessDialog = false
+            // 重置参数
+            this.processParams = {
+              content: '',
+              sendType: [],
+            }
+            this.currentProcessType = ''
+            // 关闭主弹窗
+            this.handleClose()
+            // 触发父组件刷新列表
+            this.$emit('refresh')
+          }
+        } catch (error) {
+          // 根据操作类型显示失败消息
+          let actionText
+          if (this.currentProcessType === 'next') {
+            actionText = '流转下一步'
+          } else if (this.currentProcessType === 'prev') {
+            actionText = '退回上一步'
+          } else if (this.currentProcessType === 'complete') {
+            actionText = '办结任务'
+          }
+          // this.$message.error(actionText + '操作失败')
+          console.error(actionText + '操作失败:', error)
+        }
+      },
+
       // 执行审核操作
       async executeAuditOperation() {
         if (!this.id) {
@@ -276,6 +446,7 @@
             this.showSupplementDialog = false
             this.showAbortDialog = false
             this.showRejectDialog = false
+            this.showProcessDialog = false
             // 关闭主弹窗
             this.handleClose()
             // 触发父组件刷新列表
@@ -364,4 +535,56 @@
     width: calc(100% - 115px);
     margin-left: 115px;
   }
+
+  /* 流转/退回弹窗样式优化 */
+  .process-dialog .dialog-content {
+    padding: 20px 0;
+  }
+
+  .process-dialog .process-form-item {
+    display: flex;
+    align-items: flex-start;
+    margin-bottom: 24px;
+  }
+
+  .process-dialog .process-form-item:last-child {
+    margin-bottom: 0;
+  }
+
+  .process-dialog .form-label {
+    width: 80px;
+    text-align: left;
+    margin-right: 8px;
+    color: #303133;
+    font-size: 14px;
+    line-height: 32px;
+    flex-shrink: 0;
+  }
+
+  .process-dialog .form-content {
+    flex: 1;
+  }
+
+  .process-dialog .form-content .el-textarea {
+    width: 100%;
+  }
+
+  .process-dialog .form-content .el-checkbox-group {
+    display: flex;
+    /* flex-direction: column; */
+  }
+
+  .process-dialog .form-content .el-checkbox {
+    margin-right: 0;
+    margin-left: 12px;
+  }
+
+  .process-dialog .form-content .el-checkbox:last-child {
+    margin-bottom: 0;
+  }
+
+  .process-dialog .dialog-footer {
+    text-align: right;
+    padding-top: 10px;
+  }
 </style>

+ 193 - 126
src/views/costAudit/auditInfo/completedSupervisionQuery/index.vue

@@ -4,14 +4,14 @@
     <div class="search-panel">
       <el-form :model="searchForm" inline>
         <el-form-item label="年度:">
-          <el-select v-model="searchForm.year" placeholder="请选择年度">
-            <el-option
-              v-for="year in years"
-              :key="year"
-              :label="year + '年'"
-              :value="year"
-            ></el-option>
-          </el-select>
+          <el-date-picker
+            v-model="searchForm.year"
+            type="year"
+            placeholder="请选择年度"
+            format="yyyy"
+            value-format="yyyy"
+            style="width: 200px"
+          />
         </el-form-item>
         <el-form-item label="监审项目名称:">
           <el-input
@@ -29,23 +29,94 @@
 
     <!-- 表格视图 -->
     <div v-if="activeTab === 'list'">
-      <CostAuditTable
-        :table-data="tableData"
-        :columns="tableColumns"
-        :loading="loading"
-        :pagination="pagination"
-        :show-index="true"
-        @pagination-change="handlePaginationChange"
+      <el-table
+        v-loading="loading"
+        class="mb10"
+        :data="tableData"
+        style="width: 100%"
+        border
+        default-expand-all
+        row-key="id"
+        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
       >
-        <template slot="operation" slot-scope="scope">
-          <el-button type="text" size="small" @click="backToList(scope.row)">
-            查看
-          </el-button>
-          <el-button type="text" size="small" @click="handleDetail(scope.row)">
-            任务详情
-          </el-button>
-        </template>
-      </CostAuditTable>
+        <el-table-column
+          type="index"
+          label="序号"
+          width="80"
+          header-align="center"
+          align="center"
+        >
+          <template slot-scope="scope">
+            <!-- 只显示父节点的序号 -->
+            <span v-if="scope.row.children">
+              {{ getParentNodeIndex(scope.row) }}
+            </span>
+            <span v-else></span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="projectName"
+          label="成本监审项目名称"
+          show-overflow-tooltip
+          header-align="center"
+          align="left"
+        />
+        <el-table-column
+          prop="auditObject"
+          label="监审对象"
+          header-align="center"
+          align="left"
+        />
+        <el-table-column
+          prop="auditPeriod"
+          label="监审期间"
+          header-align="center"
+          align="center"
+          width="120"
+        />
+        <el-table-column
+          prop="source"
+          label="立项来源"
+          header-align="center"
+          align="center"
+          width="120"
+        />
+        <el-table-column
+          prop="form"
+          label="监审形式"
+          header-align="center"
+          align="center"
+          width="120"
+        />
+        <el-table-column label="操作" align="center" width="160">
+          <template slot-scope="scope">
+            <span v-if="!scope.row.isSubTask" class="action-buttons">
+              <el-button
+                type="text"
+                size="small"
+                @click="handleViewTaskDetail(scope.row)"
+              >
+                任务详情
+              </el-button>
+            </span>
+            <span v-if="scope.row.isSubTask" class="action-buttons">
+              <el-button type="text" size="small" @click="handleView(row)">
+                查看
+              </el-button>
+            </span>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        background
+        layout="total, sizes, prev, pager, next"
+        :current-page="pagination.currentPage"
+        :page-sizes="[10, 20, 30, 40]"
+        :page-size="pagination.pageSize"
+        :total="pagination.total"
+        @current-change="handleCurrentChange"
+        @size-change="handleSizeChange"
+      />
     </div>
 
     <!-- 任务详情视图 -->
@@ -61,17 +132,20 @@
       </el-breadcrumb>
       <taskDetail />
     </div>
+    <!-- 任务信息弹窗 -->
+    <taskInfo ref="taskInfo" />
   </div>
 </template>
 
 <script>
-  import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
+  import { getCompletedSupervisionList } from '@/api/audit/reviewTask'
   import taskDetail from '@/views/costAudit/auditInfo/auditManage/taskDetail.vue'
+  import taskInfo from '@/components/task/taskInfo.vue'
   export default {
     name: 'CompletedSupervisionQuery',
     components: {
-      CostAuditTable,
       taskDetail,
+      taskInfo,
     },
     data() {
       return {
@@ -80,50 +154,8 @@
           year: '2025',
           projectName: '',
         },
-        // 年度选项
-        years: ['2022', '2023', '2024', '2025'],
         // 表格数据
         tableData: [],
-        // 表格列配置
-        tableColumns: [
-          {
-            prop: 'year',
-            label: '立项年度',
-            width: 100,
-          },
-          {
-            prop: 'projectName',
-            label: '成本监审项目名称',
-            showOverflowTooltip: true,
-          },
-          {
-            prop: 'auditObject',
-            label: '监审对象',
-            showOverflowTooltip: true,
-          },
-          {
-            prop: 'auditPeriod',
-            label: '监审期间',
-            width: 150,
-          },
-          {
-            prop: 'source',
-            label: '立项来源',
-            width: 120,
-          },
-          {
-            prop: 'auditType',
-            label: '监审形式',
-            width: 120,
-          },
-          {
-            prop: 'operation',
-            label: '操作',
-            width: 160,
-            fixed: 'right',
-            slotName: 'operation',
-          },
-        ],
         // 分页配置
         pagination: {
           currentPage: 1,
@@ -144,59 +176,90 @@
       this.fetchData()
     },
     methods: {
+      // 获取父节点的连续序号
+      getParentNodeIndex(row) {
+        // 过滤出所有父节点
+        const parentNodes = this.tableData.filter(
+          (item) => item.children && item.children.length > 0
+        )
+        // 找到当前行在父节点数组中的索引
+        const index = parentNodes.findIndex((item) => item.id === row.id)
+        // 返回序号(索引+1)
+        return index + 1
+      },
       // 获取数据
-      fetchData() {
-        this.loading = true
-        // 模拟API请求
-        setTimeout(() => {
-          // 根据用户提供的截图创建模拟数据
-          this.tableData = [
-            {
-              id: 1,
-              year: '2025',
-              projectName: '省内油气管道运输成本监审',
-              auditObject: '山西省油气管道公司、太原市油气公司',
-              auditPeriod: '2023-2024年',
-              source: '年度计划外',
-              auditType: '定期监审',
-              subtasks: [
-                {
-                  name: '子任务',
-                  auditObject: '山西省油气管道公司',
-                  auditPeriod: '2023-2024年',
-                },
-                {
-                  name: '子任务',
-                  auditObject: '太原市油气公司',
-                  auditPeriod: '2023-2024年',
-                },
-              ],
-            },
-            {
-              id: 2,
-              year: '2024',
-              projectName: '太原市电网输配电成本监审',
-              auditObject: '太原热电厂、太原第二热电厂',
-              auditPeriod: '2021-2023年',
-              source: '年度计划内',
-              auditType: '定期监审',
-              subtasks: [
-                {
-                  name: '子任务',
-                  auditObject: '太原热电厂',
-                  auditPeriod: '2021-2023年',
-                },
-                {
-                  name: '子任务',
-                  auditObject: '太原第二热电厂',
-                  auditPeriod: '2021-2023年',
-                },
-              ],
-            },
-          ]
-          this.pagination.total = this.tableData.length
+      async fetchData() {
+        try {
+          this.loading = true
+          const params = {
+            currentPage: this.pagination.currentPage,
+            pageSize: this.pagination.pageSize,
+            year: this.searchForm.year,
+            projectName: this.searchForm.projectName,
+          }
+          const response = await getCompletedSupervisionList(params)
+
+          // 根据API返回格式处理数据
+          if (response.state && response.value) {
+            // 获取记录列表
+            const records = response.value.records || []
+            // 转换数据格式,将childTasks转换为children以适应表格组件
+            this.tableData = records.map((record) => {
+              return {
+                id: record.id,
+                projectName: record.projectName,
+                auditObject: record.auditedUnitName,
+                auditPeriod: record.auditPeriod,
+                source: this.getSourceTypeText(record.sourceType),
+                form: this.getAuditTypeText(record.auditType),
+                isSubTask: record.pid !== '0',
+                children: record.childTasks
+                  ? record.childTasks.map((child) => ({
+                      id: child.id,
+                      projectName: child.projectName,
+                      auditObject: child.auditedUnitName,
+                      auditPeriod: record.auditPeriod, // 子任务可能使用父任务的审核期间
+                      source: '',
+                      form: '',
+                      isSubTask: true,
+                      projectId: child.projectId,
+                      auditedUnitId: child.auditedUnitId,
+                      taskId: child.id,
+                    }))
+                  : [],
+              }
+            })
+            // 设置总数
+            this.pagination.total = response.value.total || 0
+          } else {
+            this.tableData = []
+            this.pagination.total = 0
+            this.$message.warning('未获取到数据')
+          }
+        } catch (error) {
+          this.$message.error('加载列表失败')
+          console.error('加载列表失败:', error)
+          this.tableData = []
+          this.pagination.total = 0
+        } finally {
           this.loading = false
-        }, 500)
+        }
+      },
+      // 获取来源类型文本
+      getSourceTypeText(type) {
+        const typeMap = {
+          1: '年度计划内',
+          2: '年度计划外',
+        }
+        return typeMap[type] || type
+      },
+      // 获取审核类型文本
+      getAuditTypeText(type) {
+        const typeMap = {
+          1: '定期监审',
+          2: '定调价监审',
+        }
+        return typeMap[type] || type
       },
       backToList() {
         this.activeTab = 'list'
@@ -219,20 +282,24 @@
       },
 
       // 处理分页变化
-      handlePaginationChange(pagination) {
-        this.pagination.currentPage = pagination.currentPage
-        this.pagination.pageSize = pagination.pageSize
+      handleCurrentChange(current) {
+        this.pagination.currentPage = current
+        this.fetchData()
+      },
+      handleSizeChange(size) {
+        this.pagination.pageSize = size
+        this.pagination.currentPage = 1
         this.fetchData()
       },
 
-      // 查看任务
+      // 查看任务(打开taskInfo弹窗)
       handleView(row) {
-        // 这里可以实现查看任务的逻辑
-        this.$message.info('查看任务:' + row.projectName)
+        // 打开taskInfo弹窗,传入任务数据和类型
+        this.$refs.taskInfo.open(row, 'chengben')
       },
 
       // 查看任务详情
-      handleDetail(row) {
+      handleViewTaskDetail(row) {
         this.selectedTask = row
         this.activeTab = 'detail'
         this.showTaskDetail = true