|
@@ -158,13 +158,30 @@
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<span v-if="!scope.row.isCategoryHeader">
|
|
<span v-if="!scope.row.isCategoryHeader">
|
|
|
- <span
|
|
|
|
|
- v-if="scope.row.isUpload === 1 || scope.row.isUpload === '1'"
|
|
|
|
|
- style="color: #67c23a"
|
|
|
|
|
- >
|
|
|
|
|
- 已上传
|
|
|
|
|
|
|
+ <span v-if="scope.row.informationName == '动态表'">
|
|
|
|
|
+ <span
|
|
|
|
|
+ v-if="uploadStatusMap[scope.row.id] === '已上传'"
|
|
|
|
|
+ style="color: #67c23a"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ uploadStatusMap[scope.row.id] || '-' }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span
|
|
|
|
|
+ v-else-if="uploadStatusMap[scope.row.id] === '未上传'"
|
|
|
|
|
+ class="text-danger"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ uploadStatusMap[scope.row.id] }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-else>-</span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-else>
|
|
|
|
|
+ <span
|
|
|
|
|
+ v-if="scope.row.isUpload === 1 || scope.row.isUpload === '1'"
|
|
|
|
|
+ style="color: #67c23a"
|
|
|
|
|
+ >
|
|
|
|
|
+ 已上传
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-else class="text-danger">未上传</span>
|
|
|
</span>
|
|
</span>
|
|
|
- <span v-else class="text-danger">未上传</span>
|
|
|
|
|
</span>
|
|
</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -418,6 +435,7 @@
|
|
|
fixedFields: '',
|
|
fixedFields: '',
|
|
|
fixedFieldids: '',
|
|
fixedFieldids: '',
|
|
|
columnsMeta: [],
|
|
columnsMeta: [],
|
|
|
|
|
+ uploadStatusMap: {},
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// ...
|
|
// ...
|
|
@@ -454,8 +472,86 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ // 监听dataRequirements变化,预加载所有动态表上传状态
|
|
|
|
|
+ dataRequirements: {
|
|
|
|
|
+ immediate: true,
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ handler(newVal, oldVal) {
|
|
|
|
|
+ if (newVal && newVal.length > 0) {
|
|
|
|
|
+ this.preloadAllDynamicTableStatus()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 异步获取上传状态并直接更新row属性
|
|
|
|
|
+ async fetchUploadStatus(row) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const uploadId = row.uploadId || row.id || ''
|
|
|
|
|
+ const auditedUnitId = this.auditedUnitId || row.auditedUnitId || ''
|
|
|
|
|
+ const catalogId = row.catalogId || ''
|
|
|
|
|
+ const surveyTemplateId = this.getSurveyTemplateId(row)
|
|
|
|
|
+
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ uploadId,
|
|
|
|
|
+ auditedUnitId,
|
|
|
|
|
+ catalogId,
|
|
|
|
|
+ surveyTemplateId,
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const res = await getDynamicTableData(params)
|
|
|
|
|
+
|
|
|
|
|
+ // 直接更新row的uploadStatus属性
|
|
|
|
|
+ if (res && res.code === 200) {
|
|
|
|
|
+ const records = res.value?.records || res.value || []
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.uploadStatusMap,
|
|
|
|
|
+ uploadId,
|
|
|
|
|
+ records.length > 0 ? '已上传' : '未上传'
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.uploadStatusMap[uploadId] = ''
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 触发表格更新
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ })
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取上传状态失败:', error)
|
|
|
|
|
+ // 错误情况下更新为未上传状态
|
|
|
|
|
+ row.uploadStatus = '未上传'
|
|
|
|
|
+ // 确保表格更新
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 预加载所有动态表上传状态
|
|
|
|
|
+ async preloadAllDynamicTableStatus() {
|
|
|
|
|
+ if (!this.dataRequirements || this.dataRequirements.length === 0) return
|
|
|
|
|
+
|
|
|
|
|
+ const dynamicTableRows = this.dataRequirements.filter(
|
|
|
|
|
+ (row) => !row.isCategoryHeader && row.informationName === '动态表'
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ // 并行请求所有动态表的上传状态,不设置初始加载状态
|
|
|
|
|
+ const promises = dynamicTableRows.map((row) => {
|
|
|
|
|
+ return this.fetchUploadStatus(row)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await Promise.all(promises)
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('预加载上传状态失败:', error)
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ // 确保表格更新
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 在线填报入口:与 CostSurveyTab 一致
|
|
// 在线填报入口:与 CostSurveyTab 一致
|
|
|
async handleOnlineSubmission(row) {
|
|
async handleOnlineSubmission(row) {
|
|
|
if (!row) return
|
|
if (!row) return
|