Bläddra i källkod

fix: 监审任务管理详情对接成本调查表

shiyanyu 1 månad sedan
förälder
incheckning
a20dc819a6

+ 30 - 9
src/components/task/components/costSurvey.vue

@@ -187,15 +187,35 @@
           const res = await getSurveyDetail(params)
           if (res && res.code === 200 && res.value) {
             const detail = {}
-            if (Array.isArray(res.value)) {
-              res.value.forEach((item) => {
-                if (item && item.rowid !== undefined) {
-                  detail[item.rowid] = item.rvalue
+            const val = res.value
+            if (Array.isArray(val)) {
+              val.forEach((item) => {
+                if (!item || typeof item !== 'object') return
+                const key =
+                  item.rowid !== undefined
+                    ? item.rowid
+                    : item.rowId !== undefined
+                    ? item.rowId
+                    : item.id !== undefined
+                    ? item.id
+                    : undefined
+                const value =
+                  item.rvalue !== undefined
+                    ? item.rvalue
+                    : item.rValue !== undefined
+                    ? item.rValue
+                    : item.value !== undefined
+                    ? item.value
+                    : item.val !== undefined
+                    ? item.val
+                    : ''
+                if (key !== undefined) {
+                  detail[key] = value
                 }
               })
-            } else if (res.value && typeof res.value === 'object') {
-              // 兼容对象结构
-              Object.assign(detail, res.value)
+            } else if (val && typeof val === 'object') {
+              // 兼容对象结构,直接合并
+              Object.assign(detail, val)
             }
             this.surveyDetailData = detail
           }
@@ -351,11 +371,12 @@
         const auditedUnitId = row.auditedUnitId || this.auditedUnitId || ''
         const catalogId = row.catalogId || this.catalogId || ''
         const surveyTemplateId = row.templateId || row.surveyTemplateId || ''
-        if (!uploadId || !auditedUnitId) return
+        // 动态表列表以 uploadId 为主键查询,auditedUnitId 可选
+        if (!uploadId) return
         try {
           const params = {
             uploadId,
-            auditedUnitId,
+            ...(auditedUnitId ? { auditedUnitId } : {}),
             catalogId,
             surveyTemplateId,
           }

+ 1 - 1
src/views/EntDeclaration/auditTaskManagement/components/SurveyFormDialog.vue

@@ -14,7 +14,7 @@
         <!-- 动态生成表单字段 -->
         <el-col
           v-for="(field, index) in effectiveFormFields"
-          :key="field.prop || field.id || `field-${index}`"
+          :key="`${field.prop || field.id || 'field'}-${index}`"
           :span="field.colSpan || 12"
         >
           <el-form-item :label="field.label" :prop="field.prop">

+ 18 - 6
src/views/costAudit/projectInfo/auditTaskManage/taskProgressManage/conclusionTab.vue

@@ -137,13 +137,25 @@
     mounted() {},
     methods: {
       getConclusionDetails() {
-        getConclusionDetail({
-          projectId: this.project.projectId,
-        }).then((res) => {
-          if (res.code === 200) {
-            this.conclusionForm = res.value
+        if (!this.project || !this.project.projectId) return
+        getConclusionDetail({ projectId: this.project.projectId }).then(
+          (res) => {
+            if (res && res.code === 200) {
+              const v = (res && res.value) || {}
+              this.conclusionForm = {
+                pricingCostStructure: v.pricingCostStructure || '',
+                auditContentMethod: v.auditContentMethod || '',
+                costDeductionReason: v.costDeductionReason || '',
+                costAuditConclusion: v.costAuditConclusion || '',
+                defaultConditions: v.defaultConditions || '',
+                otherExplanations: v.otherExplanations || '',
+                conclusionStatus: v.conclusionStatus || '',
+                projectId:
+                  v.projectId || (this.project && this.project.projectId) || '',
+              }
+            }
           }
-        })
+        )
       },
     },
   }

+ 67 - 6
src/views/costAudit/projectInfo/auditTaskManage/taskProgressManage/detailTabs.vue

@@ -105,10 +105,13 @@
         />
       </el-tab-pane>
       <el-tab-pane label="成本调查表" name="survey">
-        <surveyTab
-          :project="project"
-          :is-view="isView"
-          :survey-data="surveyData"
+        <CostSurvey
+          :id="id"
+          ref="costSurveyRef"
+          :disabled="true"
+          :task-id="taskId"
+          :audited-unit-id="taskData.auditedUnitId"
+          :catalog-id="catalogId"
         />
       </el-tab-pane>
       <el-tab-pane label="监审文书" name="auditNotice">
@@ -133,7 +136,7 @@
 <script>
   import basicInfoTab from '@/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/basicInfoTab.vue'
   import materialTab from '@/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/materialTab.vue'
-  import surveyTab from '@/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/surveyTab.vue'
+  import CostSurvey from '@/components/task/components/costSurvey.vue'
   import meetingTab from './meetingTab.vue'
   import conclusionTab from './conclusionTab.vue'
   import workflowTab from './workflowTab.vue'
@@ -144,7 +147,7 @@
     components: {
       basicInfoTab,
       materialTab,
-      surveyTab,
+      CostSurvey,
       meetingTab,
       conclusionTab,
       workflowTab,
@@ -236,6 +239,47 @@
         },
       }
     },
+    computed: {
+      auditedUnitId() {
+        const p = this.project || {}
+        console.log(this.project, '项目')
+        return (
+          p.auditedUnitId ||
+          (p.basicInfo &&
+            (p.basicInfo.auditedUnitId || p.basicInfo.auditedunitid)) ||
+          (p.data &&
+            p.data.basicInfo &&
+            (p.data.basicInfo.auditedUnitId ||
+              p.data.basicInfo.auditedunitid)) ||
+          ''
+        )
+      },
+      catalogId() {
+        const p = this.project || {}
+        return (
+          p.catalogId ||
+          (p.basicInfo && (p.basicInfo.catalogId || p.basicInfo.catalogid)) ||
+          (p.data &&
+            p.data.basicInfo &&
+            (p.data.basicInfo.catalogId || p.data.basicInfo.catalogid)) ||
+          ''
+        )
+      },
+      taskId() {
+        const t = this.taskData || {}
+        const p = this.project || {}
+        return (
+          t.taskId ||
+          t.id ||
+          p.taskId ||
+          (p.basicInfo && (p.basicInfo.taskId || p.basicInfo.taskid)) ||
+          (p.data &&
+            p.data.basicInfo &&
+            (p.data.basicInfo.taskId || p.data.basicInfo.taskid)) ||
+          ''
+        )
+      },
+    },
     mounted() {
       this.handleTabClick()
     },
@@ -244,6 +288,23 @@
       handleDetailClose() {
         this.$emit('detailClose')
       },
+      // 标签切换:切到成本调查表时加载列表
+      handleTabClick(tab) {
+        if (
+          (tab && tab.name === 'survey') ||
+          (!tab && this.activeTab === 'survey')
+        ) {
+          this.$nextTick(() => {
+            if (
+              this.$refs &&
+              this.$refs.costSurveyRef &&
+              this.$refs.costSurveyRef.loadList
+            ) {
+              this.$refs.costSurveyRef.loadList()
+            }
+          })
+        }
+      },
     },
   }
 </script>

+ 1 - 0
src/views/costAudit/projectInfo/auditTaskManage/taskProgressManage/index.vue

@@ -604,6 +604,7 @@
 
       // 任务详情相关方法
       handleViewTaskDetail(row) {
+        console.log(row, '这行')
         this.taskData = row
         this.getProject()
         this.activeView = 'detail'