소스 검색

Merge branch 'master' of http://116.204.116.5:3000/zzw/cbjsxt-front-master

suhp 1 개월 전
부모
커밋
a5c044e5c5

+ 8 - 0
src/api/auditReviewDocManage.js

@@ -76,3 +76,11 @@ export function queryByDocumentIdandWhereValue(params) {
     params,
   })
 }
+// 文书
+export function getCostProjectDocumentFile(params) {
+  return request({
+    url: url + `/costProjectDocumentFile/v1/getInfo`,
+    method: 'get',
+    params,
+  })
+}

+ 101 - 24
src/components/task/components/submitData.vue

@@ -25,13 +25,18 @@
           min-width="200"
         />
 
-        <el-table-column label="资料类型" width="120" align="center">
+        <el-table-column label="资料类型" width="200" align="center">
           <template slot-scope="scope">
             <span
-              :class="{
-                'template-tag': scope.row.templateId,
-              }"
+              v-if="
+                Number(scope.row.formatRequired) === 3 && scope.row.templateId
+              "
+              :title="'点击查看模板'"
+              style="cursor: pointer"
             >
+              {{ `预置模板(${getTemplateTypeName(scope.row.templateType)})` }}
+            </span>
+            <span v-else>
               {{ getFormatType(scope.row.formatRequired) }}
             </span>
           </template>
@@ -138,22 +143,57 @@
         <el-button type="primary" @click="handleAuditSubmit">提交</el-button>
       </div>
     </el-dialog>
-  </div>
-</template>
 
-<style scoped>
-  .result-pending {
-    color: #909399;
-  }
+    <survey-form-dialog
+      :visible.sync="singleDialogVisible"
+      :survey-data="{}"
+      :is-view-mode="true"
+      :audited-unit-id="
+        (currentTemplateRow && currentTemplateRow.auditedUnitId) || ''
+      "
+      :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
+      :survey-template-id="
+        (currentTemplateRow &&
+          (currentTemplateRow.templateId ||
+            currentTemplateRow.surveyTemplateId)) ||
+        ''
+      "
+      :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
+    />
 
-  .result-pass {
-    color: #67c23a;
-  }
+    <fixed-table-dialog
+      :visible.sync="fixedDialogVisible"
+      :is-view-mode="true"
+      :audited-unit-id="
+        (currentTemplateRow && currentTemplateRow.auditedUnitId) || ''
+      "
+      :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
+      :survey-template-id="
+        (currentTemplateRow &&
+          (currentTemplateRow.templateId ||
+            currentTemplateRow.surveyTemplateId)) ||
+        ''
+      "
+      :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
+    />
 
-  .result-fail {
-    color: #f56c6c;
-  }
-</style>
+    <dynamic-table-dialog
+      :visible.sync="dynamicDialogVisible"
+      :is-view-mode="true"
+      :audited-unit-id="
+        (currentTemplateRow && currentTemplateRow.auditedUnitId) || ''
+      "
+      :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
+      :survey-template-id="
+        (currentTemplateRow &&
+          (currentTemplateRow.templateId ||
+            currentTemplateRow.surveyTemplateId)) ||
+        ''
+      "
+      :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
+    />
+  </div>
+</template>
 
 <script>
   import {
@@ -164,9 +204,17 @@
     getDataPreliminaryReviewButton,
     doProcessBtn,
   } from '@/api/dataPreliminaryReview'
+  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'
 
   export default {
     name: 'AuditReview',
+    components: {
+      SurveyFormDialog,
+      FixedTableDialog,
+      DynamicTableDialog,
+    },
     props: {
       id: {
         type: [String, Number],
@@ -208,6 +256,10 @@
         materialData: [],
         // 按类型分组的材料数据
         materialCategories: [],
+        currentTemplateRow: null,
+        singleDialogVisible: false,
+        fixedDialogVisible: false,
+        dynamicDialogVisible: false,
       }
     },
     watch: {
@@ -282,12 +334,22 @@
       },
       // 获取格式类型
       getFormatType(formatRequired) {
-        const formatMap = {
+        const map = {
           1: '文档文件',
-          2: '预置模板',
-          3: 'Excel文件',
+          2: 'excel',
+          3: '预置模板',
+        }
+        const k = Number(formatRequired)
+        return map[k] || '文档文件'
+      },
+      getTemplateTypeName(t) {
+        const map = {
+          1: '单记录',
+          2: '固定表',
+          3: '动态表',
         }
-        return formatMap[formatRequired] || '文档文件'
+        const k = String(t || '').trim()
+        return map[k] || map[Number(k)] || ''
       },
       // 资料初审按钮点击事件
       handleAuditPass(row) {
@@ -330,9 +392,7 @@
             row?.path ||
             ''
           if (!filePath) {
-            this.$message &&
-              this.$message.warning &&
-              this.$message.warning('未找到可预览的文件路径')
+            this.handleViewTemplate(row)
             return
           }
           const encodedUrl = encodeURIComponent(
@@ -346,6 +406,23 @@
           //   this.$message.error('文件预览失败')
         }
       },
+      handleViewTemplate(row) {
+        this.currentTemplateRow = row || null
+        const t = String(
+          (row && (row.templateType || row.templatetype)) || ''
+        ).trim()
+        if (t === '1') {
+          this.singleDialogVisible = true
+        } else if (t === '2') {
+          this.fixedDialogVisible = true
+        } else if (t === '3') {
+          this.dynamicDialogVisible = true
+        } else {
+          this.$message &&
+            this.$message.warning &&
+            this.$message.warning('未知的模板类型,无法打开预置模板')
+        }
+      },
       // 查看报表
       handleViewReport(row) {
         this.$message.info(`查看报表:${row.name}`)

+ 91 - 8
src/views/costAudit/auditInfo/auditManage/costAudit.vue

@@ -109,7 +109,7 @@
       <el-button type="primary" size="small" @click="handleImportData">
         导入数据
       </el-button>
-      <el-button type="primary" size="small" @click="handleSaveTemplate">
+      <el-button type="primary" size="small" @click="handleSaveData">
         保存核定数据
       </el-button>
     </div>
@@ -178,7 +178,8 @@
   } from '@/api/costVerifyManage'
   import { getDetail } from '@/api/auditInitiation'
   import { catalogMixin } from '@/mixins/useDict'
-  import { saveAs } from 'file-saver'
+  import { saveSingleRecordSurvey } from '@/api/audit/survey'
+
   export default {
     name: 'CostAudit',
     mixins: [catalogMixin],
@@ -201,6 +202,7 @@
         type: String,
         default: '',
       },
+      auditedUnitId: { type: String, default: '' },
     },
     data() {
       return {
@@ -631,8 +633,44 @@
             this.costAuditData.push(rowData)
           })
 
-          // 表格排序,子项排在父项的后面
-          this.sortItemsByHierarchy()
+          // 平铺顺序:父项在前、子项紧随其后
+          const sortFn = (a, b) =>
+            Number(a.orderNum || 0) - Number(b.orderNum || 0)
+          const byRowId = new Map()
+          const parents = []
+          const childGroups = new Map()
+          this.costAuditData.forEach((row) => {
+            if (row && row.children) delete row.children
+            const key = row.rowid != null ? String(row.rowid) : ''
+            if (key) byRowId.set(key, row)
+            const pid = row.parentid
+            const isParent =
+              pid === -1 || pid === '-1' || pid === null || pid === undefined
+            if (isParent) {
+              parents.push(row)
+            } else {
+              const pKey = pid != null ? String(pid) : ''
+              if (!childGroups.has(pKey)) childGroups.set(pKey, [])
+              childGroups.get(pKey).push(row)
+            }
+          })
+          parents.sort(sortFn)
+          const flat = []
+          const seen = new Set()
+          parents.forEach((p) => {
+            flat.push(p)
+            seen.add(p)
+            const group = childGroups.get(String(p.rowid)) || []
+            group.sort(sortFn).forEach((c) => {
+              flat.push(c)
+              seen.add(c)
+            })
+          })
+          // 处理找不到父项的子项:放在末尾
+          this.costAuditData.forEach((row) => {
+            if (!seen.has(row)) flat.push(row)
+          })
+          this.costAuditData = flat
         }
       },
       handleSaveTemplate(type) {
@@ -669,7 +707,52 @@
             this.$loading().close()
             console.log(err)
           })
-        // this.$message({ type: 'success', message: '保存成功' })
+      },
+      async handleSaveData() {
+        const loading = this.$loading({
+          lock: true,
+          text: '保存数据中...',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)',
+        })
+        try {
+          // 1) 基于当前表格数据生成保存明细
+          const rawItems =
+            this.splitFixedTableDataForSave(this.costAuditData) || []
+          const auditedUnitId =
+            this.auditedUnitId || this.auditForm.auditedUnitId || ''
+          const surveyTemplateId =
+            this.auditForm.surveyTemplateId || this.auditForm.dataTable || ''
+          const catalogId = this.auditForm.catalogId || ''
+          const hasData = !!(this.auditForm && this.auditForm.uploadId)
+
+          const finalSaveData = rawItems.map((it) => {
+            const base = {
+              rowid: it.rowid,
+              rkey: it.rkey,
+              rvalue: it.rvalue != null ? String(it.rvalue) : '',
+              auditedUnitId,
+              surveyTemplateId,
+              catalogId,
+            }
+            if (hasData) base.uploadId = this.auditForm.uploadId
+            return base
+          })
+
+          // 2) 调用保存接口
+          const res = await saveSingleRecordSurvey(finalSaveData)
+          if (res && res.code === 200) {
+            this.$message.success('保存成功')
+            this.loadTemplateData && this.loadTemplateData()
+          } else {
+            this.$message.error((res && res.message) || '保存失败')
+          }
+        } catch (err) {
+          console.error(err)
+          // this.$message.error('保存失败')
+        } finally {
+          loading.close()
+        }
       },
       //分割字符串
       stringToObjects(str) {
@@ -946,9 +1029,9 @@
         this.$message({ type: 'info', message: '导出数据' })
       },
 
-      handleSaveData() {
-        this.$message({ type: 'success', message: '成本审核数据已保存' })
-      },
+      // handleSaveData() {
+      //   this.$message({ type: 'success', message: '成本审核数据已保存' })
+      // },
 
       handleRemark(row, field) {
         this.$prompt('请输入说明', '提示', {

+ 1 - 0
src/views/costAudit/auditInfo/auditManage/details.vue

@@ -57,6 +57,7 @@
             :selected-project="selectedProject"
             :current-node="currentNode"
             :current-status="currentStatus"
+            :audited-unit-id="auditedUnitId"
           />
         </el-tab-pane>
         <el-tab-pane

+ 18 - 10
src/views/costAudit/auditInfo/auditManage/submitData.vue

@@ -25,18 +25,16 @@
           min-width="200"
         />
 
-        <el-table-column label="资料类型" width="150" align="center">
+        <el-table-column label="资料类型" width="200" align="center">
           <template slot-scope="scope">
             <span
               v-if="
-                Number(scope.row.formatRequired) === 2 && scope.row.templateId
+                Number(scope.row.formatRequired) === 3 && scope.row.templateId
               "
-              class="template-tag"
               style="cursor: pointer"
-              title="点击查看模板"
-              @click="handleViewTemplate(scope.row)"
+              :title="'点击查看模板'"
             >
-              预置模板
+              {{ `预置模板(${getTemplateTypeName(scope.row.templateType)})` }}
             </span>
             <span v-else>
               {{ getFormatType(scope.row.formatRequired) }}
@@ -376,12 +374,22 @@
       },
       // 获取格式类型
       getFormatType(formatRequired) {
-        const formatMap = {
+        const map = {
           1: '文档文件',
-          2: '预置模板',
-          3: 'Excel文件',
+          2: 'excel',
+          3: '预置模板',
         }
-        return formatMap[formatRequired] || '文档文件'
+        const k = Number(formatRequired)
+        return map[k] || '文档文件'
+      },
+      getTemplateTypeName(t) {
+        const map = {
+          1: '单记录',
+          2: '固定表',
+          3: '动态表',
+        }
+        const k = String(t || '').trim()
+        return map[k] || map[Number(k)] || ''
       },
       // 资料初审按钮点击事件
       handleAuditPass(row) {

+ 6 - 4
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/auditNoticeTab.vue

@@ -319,7 +319,7 @@
   import CostAuditDialog from '@/components/costAudit/CostAuditDialog.vue'
   import TemplatePreviewEdit from '@/components/costAudit/TemplatePreviewEdit.vue'
   import { getAllUnitList } from '@/api/auditEntityManage'
-  import { queryByDocumentIdandWhereValue } from '@/api/auditReviewDocManage.js'
+  import { getCostProjectDocumentFile } from '@/api/auditReviewDocManage.js'
   import { getData } from '@/api/auditDocNoManage.js'
   import { updateScan, downDocument } from '@/api/taskCustomizedRelease.js'
   import {
@@ -641,15 +641,17 @@
         let data = this.documentData.documentTypes.find(
           (item) => item.id === this.document.documentId
         )
+        console.log(data, 'data')
         this.fileUrl = data.fileUrl
         this.document.documentName = data.documentName
         this.getDocumentData()
       },
       getDocumentData() {
         if (this.document.documentId) {
-          queryByDocumentIdandWhereValue({
-            documentId: this.document.documentId,
-            whereValue: this.project.projectId,
+          getCostProjectDocumentFile({
+            // documentId: this.document.documentId,
+            // whereValue: this.project.projectId,
+            id: this.document.id,
           }).then((res) => {
             this.costDocumentTemplateFiles = res.value || []
           })