suhp 1 月之前
父節點
當前提交
474580218c

+ 30 - 0
src/api/home.js

@@ -2,6 +2,7 @@ import request from '@/utils/request'
 
 const url = window.context.form
 
+// 首页列表
 export function getList(params) {
   return request({
     url: `${url}/api/enterprise/home/doList`,
@@ -25,3 +26,32 @@ export function getChartList(params) {
     params,
   })
 }
+
+///任务进度的接口
+
+// 任务进度
+export function getTaskList(data) {
+  return request({
+    url: `${url}/api/costProjectTask/v1/taskList`,
+    method: 'post',
+    data: data,
+  })
+}
+
+// 统计在办和已结事项数量
+export function getItemsCount(data) {
+  return request({
+    url: `${url}/api/costProjectTask/v1/itemsCount`,
+    method: 'post',
+    data,
+  })
+}
+
+// 查询统计
+export function getTaskListStatistics(data) {
+  return request({
+    url: `${url}/api/costProjectTask/v1/taskListStatistics`,
+    method: 'post',
+    data: data,
+  })
+}

+ 5 - 5
src/views/costAudit/auditInfo/auditManage/index.vue

@@ -159,7 +159,7 @@
       <el-pagination
         background
         layout="total, sizes, prev, pager, next"
-        :current-page="currentPage"
+        :current-page="pageNum"
         :page-sizes="[10, 20, 30, 40]"
         :page-size="pageSize"
         :total="total"
@@ -223,7 +223,7 @@
     data() {
       return {
         // 分页相关
-        currentPage: 1,
+        pageNum: 1,
         pageSize: 10,
         total: 0,
         // 搜索相关
@@ -264,7 +264,7 @@
           this.loading = true
           // 调用API获取数据
           const params = {
-            currentPage: this.currentPage,
+            pageNum: this.pageNum,
             pageSize: this.pageSize,
             projectName: this.searchQuery,
           }
@@ -391,7 +391,7 @@
       // 刷新表格数据(可选重置到第一页)
       handleRefresh(payload) {
         if (payload && payload.resetToFirst) {
-          this.currentPage = 1
+          this.pageNum = 1
         }
         this.loadAuditProjectList()
       },
@@ -466,7 +466,7 @@
       },
 
       handleCurrentChange(current) {
-        this.currentPage = current
+        this.pageNum = current
         this.loadAuditProjectList()
       },
       // 查看 - 修改为打开cbjsInfo弹窗

+ 161 - 144
src/views/costAudit/projectInfo/auditTaskManage/taskQueryStatistics/index.vue

@@ -23,15 +23,22 @@
               :show-all-levels="false"
               clearable
               placeholder="请选择地区"
+              @change="handleAreaChange"
             ></el-cascader>
           </el-form-item>
           <el-form-item label="状态:">
-            <el-select v-model="searchForm.status" placeholder="请选择状态">
-              <el-option label="全部" value="全部"></el-option>
-              <el-option label="实地审核" value="实地审核"></el-option>
-              <el-option label="审核中" value="审核中"></el-option>
-              <el-option label="审核通过" value="审核通过"></el-option>
-              <el-option label="办结" value="办结"></el-option>
+            <el-select
+              v-model="searchForm.currentNode"
+              placeholder="请选择状态"
+            >
+              <el-option label="全部" value=""></el-option>
+              <el-option label="材料初审" value="clcs"></el-option>
+              <el-option label="实地审核" value="sdsh"></el-option>
+              <el-option label="意见告知" value="yjgz"></el-option>
+              <el-option label="意见反馈" value="yjfk"></el-option>
+              <el-option label="集体审议" value="jtsy"></el-option>
+              <el-option label="出具报告" value="cjbg"></el-option>
+              <el-option label="归档" value="gd"></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="监审项目名称:">
@@ -65,12 +72,12 @@
       <div class="statistics-info">
         <span>
           在办事项:
-          <span class="pending-count">{{ pendingCount }}</span>
+          <span class="pending-count">{{ statistics.pendingCount }}</span>
         </span>
         <span>
           已结事项:
-          <span class="completed-count">{{ completedCount }}</span>
+          <span class="completed-count">{{ statistics.completedCount }}</span>
         </span>
       </div>
@@ -96,6 +103,18 @@
           </el-button>
         </template>
       </cost-audit-table>
+      <!-- 分页 -->
+      <el-pagination
+        background
+        layout="total, sizes, prev, pager, next"
+        :current-page="pageNum"
+        :page-sizes="[10, 20, 30, 40]"
+        :page-size="pageSize"
+        :total="total"
+        style="margin-top: 20px; text-align: right"
+        @current-change="handleCurrentChange"
+        @size-change="handleSizeChange"
+      />
     </div>
 
     <!-- 详情内容 -->
@@ -113,10 +132,9 @@
 <script>
   import { dictMixin, regionMixin } from '@/mixins/useDict'
   import detailTabs from '@/views/costAudit/projectInfo/auditTaskManage/taskProgressManage/detailTabs.vue'
-  import { taskList } from '@/api/taskProgressManage'
-  import { getAllUnitList } from '@/api/auditEntityManage'
   import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
-  import { getCostProjectDetail } from '@/api/taskCustomizedRelease.js'
+  import { getTaskListStatistics, getItemsCount } from '@/api/home'
+
   export default {
     components: {
       detailTabs,
@@ -134,15 +152,19 @@
         isView: true,
         searchForm: {
           year: '',
-          areaCode: '',
-          status: '全部',
+          areaCode: null,
+          currentNode: null,
           projectName: '',
         },
         tableData: [],
+        // 分页相关
+        pageNum: 1,
+        pageSize: 10,
+        total: 0,
         // 统计数据
         statistics: {
-          pending: 0,
-          completed: 0,
+          pendingCount: 0,
+          completedCount: 0,
         },
         project: {},
         taskData: {},
@@ -168,7 +190,7 @@
             },
           },
           {
-            prop: 'region',
+            prop: 'areaName',
             label: '立项地区',
             width: 100,
             align: 'center',
@@ -179,12 +201,9 @@
             showOverflowTooltip: true,
           },
           {
-            prop: 'auditedUnitId',
+            prop: 'auditedUnitName',
             label: '被监审单位',
             showOverflowTooltip: true,
-            formatter: (row) => {
-              return this.getUnitName(row.auditedUnitId)
-            },
           },
           {
             prop: 'auditPeriod',
@@ -211,13 +230,10 @@
             },
           },
           {
-            prop: 'status',
+            prop: 'currentNodeName',
             label: '状态',
             width: 100,
             align: 'center',
-            formatter: (row) => {
-              return this.getStatusName(row.status)
-            },
           },
           {
             prop: 'operation',
@@ -240,107 +256,119 @@
       },
     },
     mounted() {
-      this.getAllUnitList()
-      this.generateTableData()
+      this.getTaskList()
+      this.getItemsCount()
     },
     methods: {
-      handleReset() {
-        this.searchForm = {
-          year: '',
-          areaCode: '',
-          status: '',
-          projectName: '',
-        }
-        this.generateTableData()
-      },
-      getAllUnitList() {
-        getAllUnitList().then((res) => {
-          this.unitList = res.value || []
+      getItemsCount() {
+        return getItemsCount().then((res) => {
+          this.statistics = res.value
         })
       },
-      getUnitName(unitId) {
-        // 直接处理unitId值
-        if (unitId && typeof unitId === 'string' && unitId.includes(',')) {
-          // 如果包含逗号,分割成数组并查找对应的unitName
-          const unitIds = unitId.split(',')
-          return unitIds
-            .map((id) => {
-              const unit = this.unitList.find((item) => item.unitId == id)
-              return unit ? unit.unitName : ''
+      getTaskList() {
+        return getTaskListStatistics({
+          pageNum: this.pageNum,
+          pageSize: this.pageSize,
+          year: this.searchForm.year,
+          areaCode: this.searchForm.areaCode,
+          currentNode: this.searchForm.currentNode,
+          projectName: this.searchForm.projectName,
+        }).then((res) => {
+          if (res.state && res.value) {
+            // 获取记录列表
+            const records = res.value.records || []
+            // 转换数据格式,将childTasks转换为children以適应表格组件
+            this.tableData = records.map((record, index) => {
+              return {
+                id: record.id,
+                projectName: record.projectName,
+                auditedUnitName: record.auditedUnitName,
+                auditPeriod: record.auditPeriod,
+                source: this.getSourceTypeText(record.sourceType),
+                form: this.getAuditTypeText(record.auditType),
+                status: record.status,
+                statusName: record.statusName,
+                isSubTask: record.pid !== '0' && record.pid !== 0,
+                currentNodeName: record.currentNodeName,
+                currentNode: record.currentNode,
+                projectId: record.projectId,
+                auditedUnitId: record.auditedUnitId,
+                parentIndex: index + 1, // 母计数作为parentIndex
+                year: record.year,
+                sourceType: record.sourceType,
+                auditType: record.auditType,
+                isGd: record.isGd,
+                areaName: record.areaName,
+                warningStatus: record.warningStatus,
+                children:
+                  record.childTasks && record.childTasks.length > 0
+                    ? record.childTasks.map((child) => ({
+                        id: child.id,
+                        projectName: child.projectName,
+                        auditedUnitName: child.auditedUnitName,
+                        auditPeriod: child.auditPeriod || record.auditPeriod,
+                        source: child.sourceType
+                          ? this.getSourceTypeText(child.sourceType)
+                          : '',
+                        form: child.auditType
+                          ? this.getAuditTypeText(child.auditType)
+                          : '',
+                        currentNode: child.currentNode,
+                        status: child.status,
+                        statusName: child.statusName,
+                        isSubTask: true,
+                        currentNodeName: child.statusName,
+                        projectId: child.projectId,
+                        auditedUnitId: child.auditedUnitId,
+                        taskId: child.id,
+                        catalogId: child.catalogId,
+                        year: child.year,
+                        sourceType: child.sourceType,
+                        auditType: child.auditType,
+                        isGd: child.isGd,
+                        warningStatus: child.warningStatus,
+                      }))
+                    : [],
+              }
             })
-            .filter((name) => name) // 过滤空值
-            .join('、')
-        } else {
-          // 单个unitId的情况
-          const unit = this.unitList.find((item) => item.unitId == unitId)
-          return unit ? unit.unitName : ''
-        }
+            // 设置总数
+            this.total = res.value.total || records.length
+          } else {
+            this.tableData = []
+            this.total = 0
+          }
+        })
       },
-      getStatusName(status) {
-        // 100待提交、200审核中、400办结、300中止
-        switch (status) {
-          case '100':
-            return '待提交'
-          case '200':
-            return '审核中'
-          case '400':
-            return '办结'
-          case '300':
-            return '中止'
-          default:
-            return status
+      // 获取来源类型文本
+      getSourceTypeText(type) {
+        const typeMap = {
+          1: '年度计划内',
+          2: '年度计划外',
         }
+        return typeMap[type] || type
       },
-      generateTableData() {
-        this.loading = true
-        taskList({
-          projectName: this.searchForm.projectName,
-          year: this.searchForm.year,
-        })
-          .then((res) => {
-            this.tableData = res.value
-            // 移除不需要的属性
-            this.tableData = this.removeItemFromTree(this.tableData)
-            let parentIndex = 1
-            this.tableData.forEach((item, index) => {
-              if (item.pid == 0) {
-                item.parentIndex = parentIndex++
-              }
-            })
-            this.loading = false
-          })
-          .catch(() => {
-            this.loading = false
-            this.$message.error('获取数据失败')
-          })
+      // 获取审核类型文本
+      getAuditTypeText(type) {
+        const typeMap = {
+          1: '定期监审',
+          2: '定调价监审',
+        }
+        return typeMap[type] || type
       },
-      removeItemFromTree(treeData) {
-        // 边界条件检查
-        if (!treeData || !Array.isArray(treeData)) {
-          return []
+      handleReset() {
+        this.searchForm = {
+          year: '',
+          areaCode: null,
+          currentNode: null,
+          projectName: '',
         }
-
-        // 创建新数组,避免修改原数据
-        return treeData.map((item) => {
-          // 创建当前节点的副本
-          const newItem = { ...item }
-
-          // 如果有hasChildren属性则删除
-          if ('hasChildren' in newItem) {
-            delete newItem.hasChildren
-          }
-
-          // 递归处理子节点 先检查children是否存在且为数组
-          if (
-            newItem.children &&
-            Array.isArray(newItem.children) &&
-            newItem.children.length > 0
-          ) {
-            newItem.children = this.removeItemFromTree(newItem.children)
-          }
-
-          return newItem
-        })
+        this.pageNum = 1
+        this.getTaskList()
+      },
+      generateTableData() {
+        // 查询时重置为第一页
+        this.pageNum = 1
+        this.getTaskList()
       },
       getRowClassName({ row }) {
         if (row.isSubTask) {
@@ -353,38 +381,27 @@
         this.getProject()
         this.activeView = 'detail'
       },
-      getProject() {
-        getCostProjectDetail({
-          id: this.taskData.projectId,
-        })
-          .then((res) => {
-            this.project = {
-              ...res.value,
-            }
-          })
-          .catch(() => {
-            this.project = this.taskData
-          })
-      },
       handleDetailClose() {
         this.activeView = 'list'
       },
-      calculateStatistics() {
-        // 计算在办和办结任务数量
-        let pendingCount = 0
-        let completedCount = 0
-
-        this.tableData.forEach((item) => {
-          if (item.status === '办结') {
-            completedCount++
-          } else {
-            pendingCount++
-          }
-        })
-
-        this.statistics = {
-          pending: pendingCount,
-          completed: completedCount,
+      // 分页处理
+      handleSizeChange(size) {
+        this.pageSize = size
+        this.pageNum = 1
+        this.getTaskList()
+      },
+      handleCurrentChange(current) {
+        this.pageNum = current
+        this.getTaskList()
+      },
+      // 地区选择处理 - 只按上佊中最后一级值
+      handleAreaChange(value) {
+        if (Array.isArray(value) && value.length > 0) {
+          // 只保留最后一级的值
+          this.searchForm.areaCode = value[value.length - 1]
+        } else {
+          // 清空时设为null
+          this.searchForm.areaCode = null
         }
       },
     },