Kaynağa Gözat

fix: 修改bug

shiyanyu 1 ay önce
ebeveyn
işleme
3cf8a6c099

+ 5 - 0
src/components/task/taskComponents/basicInfoTab.vue

@@ -386,6 +386,11 @@
               plannedAuditEndDate: data.plannedAuditEndDate || '',
             }
 
+            // 将 catalogId 传递给父组件
+            if (data.catalogId) {
+              this.$emit('catalog-id-updated', data.catalogId)
+            }
+
             console.log('立项信息加载完成:', {
               areaCode: this.formData.basicInfo.areaCode,
               auditedUnitId: this.formData.basicInfo.auditedUnitId,

+ 82 - 18
src/components/task/taskComponents/surveyTab.vue

@@ -20,7 +20,7 @@
 <script>
   import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
   import SurveyDialog from '@/views/costAudit/baseInfo/catalogManage/surveyDialog.vue'
-  import { getCostProjectSurveyDetail } from '@/api/taskCustomizedRelease'
+  import { getSurveyList } from '@/api/audit/survey'
   export default {
     components: {
       CostAuditTable,
@@ -66,12 +66,13 @@
     watch: {
       project: {
         handler(newVal) {
-          if (newVal && newVal.projectId) {
-            // 如果 projectId 没有变化,不重复加载
-            if (this.projectIdCache === newVal.projectId) {
+          const catalogId = this.getCatalogId(newVal)
+          if (catalogId) {
+            // 如果 catalogId 没有变化,不重复加载
+            if (this.projectIdCache === catalogId) {
               return
             }
-            this.projectIdCache = newVal.projectId
+            this.projectIdCache = catalogId
             // 调用接口加载数据
             this.loadSurveyData()
           }
@@ -81,31 +82,94 @@
       },
     },
     mounted() {
-      // 如果已有 projectId,立即加载
-      if (this.project && this.project.projectId) {
+      console.log('project', this.project)
+      // 如果已有 catalogId,立即加载
+      const catalogId = this.getCatalogId(this.project)
+      if (catalogId) {
         this.loadSurveyData()
       }
     },
     methods: {
+      // 从立项信息中获取 catalogId
+      getCatalogId(project) {
+        if (!project) {
+          return null
+        }
+        // 优先从 project.catalogId 获取
+        if (project.catalogId) {
+          return project.catalogId
+        }
+        // 其次从 project.basicInfo.catalogId 获取(立项信息)
+        if (project.basicInfo && project.basicInfo.catalogId) {
+          return project.basicInfo.catalogId
+        }
+        // 最后从 project.data.basicInfo.catalogId 获取
+        if (
+          project.data &&
+          project.data.basicInfo &&
+          project.data.basicInfo.catalogId
+        ) {
+          return project.data.basicInfo.catalogId
+        }
+        return null
+      },
       // 加载成本调查表数据
       async loadSurveyData() {
-        if (!this.project || !this.project.projectId) {
+        const catalogId = this.getCatalogId(this.project)
+        if (!catalogId) {
           return
         }
 
         try {
           this.loading = true
-          const res = await getCostProjectSurveyDetail(this.project.projectId)
+          const params = {
+            catalogId: catalogId,
+          }
+          const res = await getSurveyList(params)
 
-          if (res && res.value) {
-            // 接口返回的数据格式可能是数组或对象
-            if (Array.isArray(res.value)) {
-              this.internalSurveyData.list = res.value
-            } else if (res.value.records) {
-              this.internalSurveyData.list = res.value.records || []
-            } else {
-              this.internalSurveyData.list = []
-            }
+          console.log('成本调查表列表', res)
+          if (res && res.code === 200 && res.value) {
+            // 处理返回的数据
+            const records = res.value.records || res.value || []
+            // 映射数据格式,转换为组件需要的格式
+            const mappedData = records.map((item, index) => {
+              // 转换表格类型:1=单记录,2=固定表,3=动态表
+              let tableType = ''
+              if (item.templateType === 1 || item.templateType === '1') {
+                tableType = '单记录'
+              } else if (item.templateType === 2 || item.templateType === '2') {
+                tableType = '固定表'
+              } else if (item.templateType === 3 || item.templateType === '3') {
+                tableType = '动态表'
+              } else if (item.tableType) {
+                tableType = item.tableType
+              }
+
+              // 转换是否必填:0=否,1=是
+              const isRequired =
+                item.isRequired === 1 || item.isRequired === '1' ? '是' : '否'
+
+              // 转换是否上传:0=未上传,1=已上传
+              const isUploaded = item.isUpload === 1 || item.isUpload === '1'
+
+              return {
+                index: index + 1,
+                id: item.id,
+                surveyTemplateId: item.surveyTemplateId || '',
+                surveyTemplateName:
+                  item.surveyTemplateName || item.name || item.surveyName || '',
+                dataType: item.dataType || '',
+                tableType: tableType,
+                isRequired: isRequired,
+                isUploaded: isUploaded,
+                isDisabled: item.isDisabled || false,
+                fileUrl: item.fileUrl || '',
+                dataUrl: item.dataUrl || '',
+                templateUrl: item.templateUrl || '',
+                ...item, // 保留其他字段
+              }
+            })
+            this.internalSurveyData.list = mappedData
           } else {
             this.internalSurveyData.list = []
           }

+ 18 - 1
src/components/task/taskDetail.vue

@@ -21,7 +21,12 @@
       >
         <!-- 监审立项信息 -->
         <el-tab-pane label="监审立项信息" name="basicInfo">
-          <basicInfoTab :project="currentProjectData" :is-view="isView" />
+          <basicInfoTab
+            ref="basicInfoTab"
+            :project="currentProjectData"
+            :is-view="isView"
+            @catalog-id-updated="handleCatalogIdUpdated"
+          />
         </el-tab-pane>
 
         <!-- 监审工作方案 -->
@@ -165,6 +170,18 @@
       initData() {
         this.handleTabClick()
       },
+      // 处理 catalogId 更新事件
+      handleCatalogIdUpdated(catalogId) {
+        if (catalogId && this.currentProjectData) {
+          // 更新 currentProjectData 中的 catalogId
+          this.$set(this.currentProjectData, 'catalogId', catalogId)
+          // 同时更新 basicInfo.catalogId,确保 surveyTab 可以获取到
+          if (!this.currentProjectData.basicInfo) {
+            this.$set(this.currentProjectData, 'basicInfo', {})
+          }
+          this.$set(this.currentProjectData.basicInfo, 'catalogId', catalogId)
+        }
+      },
       // 保存
       handleSave() {
         switch (this.activeTab) {

+ 8 - 9
src/views/costAudit/auditInfo/auditManage/index.vue

@@ -83,7 +83,7 @@
                 {{ scope.row.currentNodeName }}-{{ scope.row.statusName }}
               </span>
             </span>
-            <span v-else>{{ scope.row.status }}</span>
+            <span v-else>{{ scope.row.statusName }}</span>
           </template>
         </el-table-column>
         <el-table-column label="操作" align="center" width="260">
@@ -103,8 +103,7 @@
               <el-button
                 v-if="
                   scope.row.currentNode === 'clcs' &&
-                  (scope.row.status === '审核中' ||
-                    scope.row.status === '补充材料')
+                  (scope.row.status === '200' || scope.row.status === '600')
                 "
                 type="text"
                 @click="handleOpenDetails(scope.row)"
@@ -115,7 +114,7 @@
                 v-if="
                   (scope.row.currentNode === 'sdsh' ||
                     scope.row.currentNode === 'yjfk') &&
-                  scope.row.status === '审核中'
+                  scope.row.status === '200'
                 "
                 type="text"
                 @click="handleOpenDetails(scope.row)"
@@ -124,8 +123,7 @@
               </el-button>
               <el-button
                 v-if="
-                  scope.row.currentNode === 'yjgz' &&
-                  scope.row.status === '审核中'
+                  scope.row.currentNode === 'yjgz' && scope.row.status === '200'
                 "
                 type="text"
                 @click="handleOpenDetails(scope.row)"
@@ -134,8 +132,7 @@
               </el-button>
               <el-button
                 v-if="
-                  scope.row.currentNode === 'yjfk' &&
-                  scope.row.status === '已反馈'
+                  scope.row.currentNode === 'yjfk' && scope.row.status === '260'
                 "
                 type="text"
                 @click="handleOpenDetails(scope.row)"
@@ -143,7 +140,7 @@
                 审核
               </el-button>
               <el-button
-                v-if="scope.row.status === '中止'"
+                v-if="scope.row.status === '300'"
                 type="text"
                 @click="handleHf(scope.row)"
               >
@@ -284,6 +281,7 @@
                 source: this.getSourceTypeText(record.sourceType),
                 form: this.getAuditTypeText(record.auditType),
                 status: this.getStatusText(record.status),
+                statusName: record.statusName,
                 isSubTask: record.pid !== '0',
                 currentNodeName: record.currentNodeName,
                 currentNode: record.currentNode,
@@ -299,6 +297,7 @@
                       form: '',
                       currentNode: child.currentNode,
                       status: child.status,
+                      statusName: child.statusName,
                       isSubTask: true,
                       projectId: child.projectId,
                       auditedUnitId: child.auditedUnitId,