shiyanyu 2 недель назад
Родитель
Сommit
d91964d89b

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

@@ -22,6 +22,7 @@
             :audited-unit-id="auditedUnitId"
             :catalog-id="catalogId"
             :task-id="taskId"
+            :project-id="selectedProject.projectId"
           />
         </el-tab-pane>
         <el-tab-pane label="成本调查表" name="costSurvey">

+ 40 - 10
src/components/task/components/costAudit.vue

@@ -127,6 +127,7 @@
     getCostFormVersionsByTemplateId,
     batchSaveOrUpdate,
   } from '@/api/costFormManage'
+  import { getSurveyDetail } from '@/api/audit/survey'
   import {
     getlistBySurveyTemplateId,
     getVerifyTemplateDetail,
@@ -182,6 +183,8 @@
         auditFormList: [],
         // 成本调查表模板列表
         surveyFormList: [],
+        // 调查表详情数据
+        surveyDetailData: null,
         auditForm: {
           surveyTemplateName: '',
           surveyTemplateId: '',
@@ -446,19 +449,46 @@
             // taskId: this.selectedProject.taskId,
             surveyTemplateId: this.auditForm.surveyTemplateId,
           })
-          getVerifyTemplateDetail({
+
+          // 获取模板详情
+          const templateDetailRes = await getVerifyTemplateDetail({
             id: this.auditForm.surveyTemplateId,
-          }).then((res) => {
-            this.auditForm.surveyTemplateName = res.value.surveyTemplateName
-            this.auditForm.catalogId = res.value.catalogId
-            this.auditForm.templateType = res.value.createmode
-            if (res.value.createmode == '1') {
-              this.auditForm.dataTable = res.value.createtemplateid
-            } else if (res.value.createmode == '2') {
-              this.auditForm.historyTemplate = res.value.createtemplateid
-            }
           })
 
+          if (templateDetailRes.code === 200) {
+            this.auditForm.surveyTemplateName =
+              templateDetailRes.value.surveyTemplateName
+            this.auditForm.catalogId = templateDetailRes.value.catalogId
+            this.auditForm.templateType = templateDetailRes.value.createmode
+
+            if (templateDetailRes.value.createmode == '1') {
+              this.auditForm.dataTable =
+                templateDetailRes.value.createtemplateid
+
+              // // 如果是调查表类型,调用 getSurveyDetail 获取调查表详情
+              // if (this.auditForm.dataTable) {
+              //   try {
+              //     const surveyDetailRes = await getSurveyDetail({
+              //       surveyTemplateId: this.auditForm.dataTable,
+              //       taskId: this.selectedProject.taskId
+              //     })
+
+              //     if (surveyDetailRes.code === 200 && surveyDetailRes.value) {
+              //       // 在这里处理调查表详情数据
+              //       console.log('调查表详情数据:', surveyDetailRes.value)
+              //       // 可以根据需要将数据保存到组件的 data 中,或者直接使用
+              //       this.surveyDetailData = surveyDetailRes.value
+              //     }
+              //   } catch (error) {
+              //     console.error('获取调查表详情失败:', error)
+              //   }
+              // }
+            } else if (templateDetailRes.value.createmode == '2') {
+              this.auditForm.historyTemplate =
+                templateDetailRes.value.createtemplateid
+            }
+          }
+
           // 处理表头数据
           if (tableHeadersRes.code == 200) {
             this.parseAndDisplayTableHeaders(tableHeadersRes)

+ 69 - 2
src/components/task/components/submitData.vue

@@ -202,6 +202,8 @@
       :fixed-fields="fixedFields || ''"
       :fixed-fieldids="fixedFieldids || ''"
       :table-items="tableItems"
+      :project-audit-periods="projectAuditPeriods"
+      :project-audit-period="projectAuditPeriod"
     />
 
     <dynamic-table-dialog
@@ -250,6 +252,7 @@
     getSurveyDetail,
     getDynamicTableData,
   } from '@/api/audit/survey'
+  import { getProjectInformationInfo } from '@/api/auditTaskProcessing'
 
   export default {
     name: 'AuditReview',
@@ -279,6 +282,8 @@
         type: [String, Number],
         default: '',
       },
+      // 立项项目ID(用于拉取立项信息中的监审期间)
+      projectId: { type: String, default: '' },
     },
     data() {
       return {
@@ -336,6 +341,22 @@
     },
     mounted() {},
     methods: {
+      // 解析监审期间字符串(如 "2022,2023,2024" 或 "2022-2024")
+      parseAuditPeriod(periodStr) {
+        if (!periodStr) return []
+        const str = String(periodStr)
+        if (str.includes(',')) {
+          return str.split(',').map((p) => p.trim())
+        } else if (str.includes('-')) {
+          const [start, end] = str.split('-').map(Number)
+          if (!isNaN(start) && !isNaN(end) && start <= end) {
+            return Array.from({ length: end - start + 1 }, (_, i) =>
+              String(start + i)
+            )
+          }
+        }
+        return [str].filter(Boolean)
+      },
       // 加载报送资料数据
       async loadMaterialData() {
         try {
@@ -506,7 +527,7 @@
           // 固定表:先加载固定表配置(表头),参考 CostSurveyTab
           const surveyTemplateId =
             (row && (row.surveyTemplateId || row.templateId)) || ''
-          await this.initFixedTableData(surveyTemplateId)
+          await this.initFixedTableData(surveyTemplateId, row)
           this.fixedDialogVisible = true
         } else if (t === '3') {
           await this.initDynamicTableData()
@@ -547,7 +568,7 @@
           this.tableItems = []
         }
       },
-      async initFixedTableData(surveyTemplateId) {
+      async initFixedTableData(surveyTemplateId, row = {}) {
         try {
           this.fixedFields = ''
           this.fixedFieldids = ''
@@ -581,6 +602,52 @@
                 ...item,
               }))
             }
+            // 透传固定表头(与 DataRequirementsTab 对齐)
+            if (res.value && res.value.fixedFields && res.value.fixedFieldids) {
+              this.fixedFields = res.value.fixedFields
+              this.fixedFieldids = res.value.fixedFieldids
+            } else {
+              this.fixedFields = ''
+              this.fixedFieldids = ''
+            }
+            // 尝试从当前行或配置中解析监审期间
+            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) {
           console.error('加载固定表配置失败:', e)

+ 2 - 2
src/views/EntDeclaration/auditTaskManagement/components/DataRequirementsTab.vue

@@ -38,7 +38,7 @@
       :columns-meta="columnsMeta"
       :table-items="tableItems"
       :audit-periods="auditPeriods"
-      :project-audit-periods="auditPeriods"
+      :project-audit-periods="auditPeriod"
       :project-audit-period="auditPeriod"
       :project-id="projectId"
       :is-view-mode="viewModeForDialog"
@@ -326,7 +326,7 @@
       :project-id="projectId"
       :audited-unit-id="auditedUnitId"
       :audit-periods="auditPeriods"
-      :project-audit-periods="auditPeriods"
+      :project-audit-periods="auditPeriod"
       :project-audit-period="auditPeriod"
       :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
       :survey-template-id="getSurveyTemplateId(currentTemplateRow)"

+ 39 - 11
src/views/EntDeclaration/auditTaskManagement/taskFillIn.vue

@@ -240,17 +240,25 @@
               :on-exceed="handleMaterialExceed"
               :accept="uploadAccept"
             >
-              <el-button
-                v-show="
-                  !isTemplateFormat &&
-                  (!materialForm.fileList || materialForm.fileList.length === 0)
-                "
-                size="small"
-                type="primary"
-                :disabled="isViewMode"
-              >
-                选择文件
-              </el-button>
+              <el-tooltip effect="dark" placement="top">
+                <el-button
+                  v-show="
+                    !isTemplateFormat &&
+                    (!materialForm.fileList ||
+                      materialForm.fileList.length === 0)
+                  "
+                  size="small"
+                  type="primary"
+                  :disabled="isViewMode"
+                >
+                  选择文件
+                </el-button>
+                <div slot="content">
+                  请上传(大小不超过{{ formatFileSize(maxSize) }},格式:{{
+                    allowedTypes.join('/')
+                  }})
+                </div>
+              </el-tooltip>
               <el-button
                 v-if="isTemplateFormat"
                 size="small"
@@ -410,6 +418,18 @@
         unitList: [],
         OrgList: [],
         userList: [],
+        // 文件上传相关
+        allowedTypes: [
+          'xlsx',
+          'xls',
+          'doc',
+          'docx',
+          'pdf',
+          'jpg',
+          'jpeg',
+          'png',
+        ], // 允许上传的文件类型
+        maxSize: 50 * 1024 * 1024, // 50MB 文件大小限制
         dictData: {
           attributionYear: [], // 归属年度
           projectProposal: [], // 立项来源
@@ -975,6 +995,14 @@
       this.costSurveyPagination.total = this.formData.costSurveyData.length
     },
     methods: {
+      // 格式化文件大小
+      formatFileSize(bytes) {
+        if (bytes === 0) return '0 Bytes'
+        const k = 1024
+        const sizes = ['Bytes', 'KB', 'MB', 'GB']
+        const i = Math.floor(Math.log(bytes) / Math.log(k))
+        return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
+      },
       // 初始化数据
       initData() {
         // 优先使用props传入的taskInfo,其次使用localTaskInfo