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

fix: 审核子任务查看成本调查表固定表年份报错修复

shiyanyu 3 недель назад
Родитель
Сommit
3507efe90f

+ 3 - 3
public/config.js

@@ -5,7 +5,7 @@
 //var host = 'http://116.204.117.33' // 测试
 // var host = 'http://b463f4b7.natappfree.cc' // 后端服务海鹏
 // var host = 'http://5jrgep.ipx.wanziwk.cn' // 后端服务译文
-var host = 'http://127.0.0.1' // 后端服务译文
+var host = 'http://192.168.1.144' // 后端服务译文
 // var host = 'http://1.71.9.215'
 // var host = 'http://5jrgep.ipx.wanziwk.cn'
 // combine为true时五合一部署, 为false时分五个服务部署
@@ -31,8 +31,8 @@ window.getModuleRootUrl = function (module) {
   if (!combine) {
     modulePort = defaultModulePortMap[module]
   }
-  return "http://5jrgep.ipx.wanziwk.cn";
-  //return host + ':' + modulePort
+  // return "http://5jrgep.ipx.wanziwk.cn";
+  return host + ':' + modulePort
   // return host + modulePort
 }
 window.context = {

+ 1 - 0
src/components/task/cbjsInfo.vue

@@ -32,6 +32,7 @@
             :audited-unit-id="auditedUnitId"
             :catalog-id="catalogId"
             :task-id="taskId"
+            :project-id="selectedProject.projectId"
           />
         </el-tab-pane>
         <el-tab-pane

+ 58 - 0
src/components/task/components/costSurvey.vue

@@ -104,6 +104,8 @@
       :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
       :table-items="tableItems"
       :audit-periods="auditPeriods"
+      :project-audit-periods="projectAuditPeriods"
+      :project-audit-period="projectAuditPeriod"
     />
 
     <!-- 动态表弹窗(查看) -->
@@ -134,6 +136,7 @@
     getSingleRecordSurveyList,
     getDynamicTableData,
   } from '@/api/audit/survey'
+  import { getProjectInformationInfo } from '@/api/auditTaskProcessing'
   import SurveyFormDialog from '@/views/EntDeclaration/auditTaskManagement/components/SurveyFormDialog.vue'
   import FixedTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/FixedTableDialog.vue'
   import DynamicTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/DynamicTableDialog.vue'
@@ -144,6 +147,10 @@
       auditedUnitId: { type: String, default: '' },
       catalogId: { type: String, default: '' },
       taskId: { type: String, default: '' },
+      // 立项项目ID(用于拉取立项信息中的监审期间)
+      projectId: { type: String, default: '' },
+      // 父级可直接传入监审期间(可选,字符串或数组)
+      auditPeriod: { type: [String, Array], default: '' },
     },
     data() {
       return {
@@ -154,6 +161,9 @@
         surveyDetailData: {},
         tableItems: [],
         auditPeriods: [],
+        // 立项信息中的监审期间(原样与数组形式)
+        projectAuditPeriod: '',
+        projectAuditPeriods: [],
         dynamicTableData: [],
         singleDialogVisible: false,
         fixedDialogVisible: false,
@@ -173,6 +183,18 @@
           this.loadList()
         }
       },
+      // 父组件若更新了监审期间,立即解析至本地(作为兜底)
+      auditPeriod: {
+        handler(val) {
+          if (!val) return
+          if (Array.isArray(val)) {
+            this.auditPeriods = val.map((p) => String(p))
+          } else {
+            this.auditPeriods = this.parseAuditPeriod(val)
+          }
+        },
+        immediate: true,
+      },
     },
     created() {
       console.log('auditedUnitId', this.auditedUnitId)
@@ -314,6 +336,8 @@
       async initFixedTableData() {
         this.tableItems = []
         this.auditPeriods = []
+        this.projectAuditPeriod = ''
+        this.projectAuditPeriods = []
         const row = this.currentTemplateRow || {}
         const surveyTemplateId = row.templateId || row.surveyTemplateId || ''
         if (!surveyTemplateId) return
@@ -356,6 +380,40 @@
             const periodStr =
               row.auditPeriod || (res.value && res.value.auditPeriod) || ''
             this.auditPeriods = this.parseAuditPeriod(periodStr)
+            // 优先从立项信息中获取监审期间并覆盖(按需求回显年份)
+            try {
+              if (this.projectId) {
+                const projRes = await getProjectInformationInfo(this.projectId)
+                const projVal = projRes && projRes.value
+                if (projVal) {
+                  // 记录原始与数组两种形式,供弹窗优先使用
+                  if (projVal.auditPeriod) {
+                    this.projectAuditPeriod = projVal.auditPeriod
+                    this.projectAuditPeriods = Array.isArray(
+                      projVal.auditPeriod
+                    )
+                      ? projVal.auditPeriod.map((p) => String(p))
+                      : this.parseAuditPeriod(projVal.auditPeriod)
+                  } else if (
+                    Array.isArray(projVal.auditPeriodArray) &&
+                    projVal.auditPeriodArray.length
+                  ) {
+                    this.projectAuditPeriods = projVal.auditPeriodArray
+                      .map((it) => it && (it.value || it))
+                      .map((p) => String(p))
+                      .filter((s) => s && s.trim())
+                    this.projectAuditPeriod = this.projectAuditPeriods.join(',')
+                  }
+                  // 同步覆盖父级传入/配置解析的 auditPeriods
+                  if (this.projectAuditPeriods.length > 0) {
+                    this.projectAuditPeriod = this.projectAuditPeriods.slice()
+                    console.log(this.projectAuditPeriod, '监审期间')
+                  }
+                }
+              }
+            } catch (e) {
+              // 忽略立项信息拉取失败,保留已有解析结果
+            }
           }
         } catch (e) {
           this.tableItems = []