Procházet zdrojové kódy

Merge branch 'master' of http://1.71.9.215:3000/feiyi/cbjsxt-front-master

luzhixia před 1 měsícem
rodič
revize
c4c63c7541

+ 47 - 5
src/views/EntDeclaration/auditTaskManagement/components/DataRequirementsTab.vue

@@ -5,7 +5,7 @@
       :visible.sync="surveyFormDialogVisible"
       :survey-data="{ ...(currentTemplateRow || {}), ...surveyDetailData }"
       :form-fields="formFields"
-      :is-view-mode="isViewMode || viewModeForDialog"
+      :is-view-mode="viewModeForDialog"
       :audited-unit-id="auditedUnitId"
       :request-type="2"
       :upload-id="
@@ -35,7 +35,7 @@
       :survey-data="{ ...(currentTemplateRow || {}), fixedHeaders }"
       :table-items="tableItems"
       :audit-periods="auditPeriods"
-      :is-view-mode="isViewMode || viewModeForDialog"
+      :is-view-mode="viewModeForDialog"
       :request-type="2"
       :audited-unit-id="auditedUnitId"
       :upload-id="
@@ -66,7 +66,7 @@
       :survey-data="currentTemplateRow || {}"
       :table-data="dynamicTableData"
       :table-items="tableItems"
-      :is-view-mode="isViewMode || viewModeForDialog"
+      :is-view-mode="viewModeForDialog"
       :request-type="2"
       :audited-unit-id="auditedUnitId"
       :upload-id="
@@ -482,7 +482,7 @@
         }
       },
       // 模版查看:与 submitData.vue 的 handleViewTemplate 保持一致
-      handleViewTemplate(row) {
+      async handleViewTemplate(row) {
         this.currentTemplateRow = row || null
         const t = String(
           (row && (row.templateType || row.templatetype)) || ''
@@ -490,7 +490,49 @@
         // 点击“查看”时,复用在线填报的弹窗和数据加载逻辑,但强制只读
         this.viewModeForDialog = true
         if (t === '1' || t === '2' || t === '3') {
-          this.handleOnlineSubmission(row)
+          if (!row) return
+          this.currentTemplateRow = row
+          this.surveyDetailData = {}
+          // 在线填报时使用页面传入的 isViewMode,不强制只读
+          this.viewModeForDialog = true
+
+          const t = String(row.templateType || row.templatetype || '').trim()
+          // 1=单记录,2=固定表,3=动态表
+          if (t === '1') {
+            // 只要有 uploadId/id 就尝试回显数据
+            if (row.uploadId || row.id) {
+              try {
+                const params = {
+                  uploadId: row.uploadId || row.id,
+                  auditedUnitId: this.auditedUnitId,
+                  type: 2,
+                }
+                const res = await getSurveyDetail(params)
+                if (res && res.code === 200 && res.value) {
+                  console.log(res, 'getUploadData')
+                  const detailData = {}
+                  if (Array.isArray(res.value)) {
+                    res.value.forEach((item) => {
+                      if (item.rowid && item.rvalue !== undefined) {
+                        detailData[item.rowid] = item.rvalue
+                      }
+                    })
+                  } else if (res.value && typeof res.value === 'object') {
+                    Object.assign(detailData, res.value)
+                  }
+                  this.surveyDetailData = detailData
+                }
+              } catch (err) {
+                console.error('获取单记录详情失败', err)
+              }
+            }
+            await this.initFormFields()
+          } else if (t === '2') {
+            await this.initFixedTableData()
+          } else if (t === '3') {
+            this.resetDynamicDialogState()
+            await this.initDynamicTableData()
+          }
         } else {
           this.$message &&
             this.$message.warning &&

+ 4 - 1
src/views/EntDeclaration/auditTaskManagement/components/FixedTableDialog.vue

@@ -79,7 +79,9 @@
     </el-table>
 
     <div slot="footer" class="dialog-footer">
-      <el-button type="primary" @click="handleSave">保存</el-button>
+      <el-button v-if="isViewMode" type="primary" @click="handleSave">
+        保存
+      </el-button>
       <el-button @click="handleCancel">取消</el-button>
     </div>
   </el-dialog>
@@ -311,6 +313,7 @@
       },
       // 初始化表格数据
       initTableData() {
+        console.log(this.isViewMode, '只读')
         if (!this.tableItems || this.tableItems.length === 0) {
           // 如果没有传入数据,使用假数据
           this.tableData = this.getMockTableData()