|
|
@@ -496,7 +496,7 @@
|
|
|
<div v-loading="loading" element-loading-text="加载中...">
|
|
|
<el-table
|
|
|
style="width: 100%"
|
|
|
- :data="paginatedCostSurveyData"
|
|
|
+ :data="formData.costSurveyData"
|
|
|
border
|
|
|
size="small"
|
|
|
>
|
|
|
@@ -717,6 +717,7 @@
|
|
|
getTaskRequirementList,
|
|
|
sendMessage,
|
|
|
} from '@/api/auditTaskProcessing'
|
|
|
+ import { getSurveyList } from '@/api/audit/survey'
|
|
|
|
|
|
export default {
|
|
|
name: 'TaskInfo',
|
|
|
@@ -820,6 +821,25 @@
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 从传入 taskData/formData 中派生 catalogId/auditedUnitId,供成本调查表接口使用
|
|
|
+ catalogId() {
|
|
|
+ return (
|
|
|
+ (this.taskData &&
|
|
|
+ (this.taskData.catalogId || this.taskData.catalogid)) ||
|
|
|
+ (this.formData &&
|
|
|
+ this.formData.basicInfo &&
|
|
|
+ (this.formData.basicInfo.catalogId ||
|
|
|
+ this.formData.basicInfo.catalogid)) ||
|
|
|
+ ''
|
|
|
+ )
|
|
|
+ },
|
|
|
+ auditedUnitId() {
|
|
|
+ return (
|
|
|
+ (this.taskData &&
|
|
|
+ (this.taskData.auditedUnitId || this.taskData.auditedunitid)) ||
|
|
|
+ ''
|
|
|
+ )
|
|
|
+ },
|
|
|
groupedDataRequirements() {
|
|
|
if (
|
|
|
!this.formData.dataRequirements ||
|
|
|
@@ -883,6 +903,13 @@
|
|
|
this.dialogVisible = val
|
|
|
if (val) {
|
|
|
this.loadData()
|
|
|
+ // 若默认即在成本调查表页且尚未加载,则加载
|
|
|
+ if (
|
|
|
+ this.activeTab === 'costSurvey' &&
|
|
|
+ !this.tabLoadedStatus.costSurvey
|
|
|
+ ) {
|
|
|
+ this.loadCostSurvey()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
immediate: true,
|
|
|
@@ -1151,24 +1178,86 @@
|
|
|
},
|
|
|
// 加载成本调查表
|
|
|
async loadCostSurvey() {
|
|
|
+ console.log(1111111)
|
|
|
+ // if (!this.catalogId) {
|
|
|
+ // this.formData.costSurveyData = []
|
|
|
+ // this.costSurveyPagination.total = 0
|
|
|
+ // this.tabLoadedStatus.costSurvey = true
|
|
|
+ // return
|
|
|
+ // }
|
|
|
try {
|
|
|
this.loading = true
|
|
|
- // TODO: 调用成本调查表接口
|
|
|
- // const res = await getCostSurveyList(this.currentTaskInfo.taskId)
|
|
|
- // if (res && res.code === 200) {
|
|
|
- // this.formData.costSurveyData = res.value || []
|
|
|
- // this.costSurveyPagination.total = this.formData.costSurveyData.length
|
|
|
- // }
|
|
|
-
|
|
|
- // 暂时使用mock数据
|
|
|
- this.formData.costSurveyData = []
|
|
|
- this.costSurveyPagination.total = this.formData.costSurveyData.length
|
|
|
+ const params = {
|
|
|
+ catalogId: this.catalogId,
|
|
|
+ pageNum: this.costSurveyPagination.currentPage,
|
|
|
+ pageSize: this.costSurveyPagination.pageSize,
|
|
|
+ }
|
|
|
+ if (this.auditedUnitId) params.auditedUnitId = this.auditedUnitId
|
|
|
+ const res = await getSurveyList(params)
|
|
|
+ console.log(res, 'res')
|
|
|
+ // 兼容不同返回结构
|
|
|
+ const raw =
|
|
|
+ (res &&
|
|
|
+ ((res.value && (res.value.records || res.value)) ||
|
|
|
+ res.data ||
|
|
|
+ res)) ||
|
|
|
+ []
|
|
|
+ const list = Array.isArray(raw)
|
|
|
+ ? raw
|
|
|
+ : Array.isArray(raw.records)
|
|
|
+ ? raw.records
|
|
|
+ : []
|
|
|
+ const rows = list.map((it, idx) => {
|
|
|
+ const t = String(it.templateType || it.templatetype || '')
|
|
|
+ const tableType =
|
|
|
+ t === '1'
|
|
|
+ ? '单记录'
|
|
|
+ : t === '2'
|
|
|
+ ? '固定表'
|
|
|
+ : t === '3'
|
|
|
+ ? '动态表'
|
|
|
+ : ''
|
|
|
+ return {
|
|
|
+ index:
|
|
|
+ (this.costSurveyPagination.currentPage - 1) *
|
|
|
+ this.costSurveyPagination.pageSize +
|
|
|
+ idx +
|
|
|
+ 1,
|
|
|
+ id: it.uploadId || it.id || '',
|
|
|
+ name:
|
|
|
+ it.surveyTemplateName || it.informationName || it.name || '',
|
|
|
+ dataType: it.dataType || '预置模板',
|
|
|
+ tableType,
|
|
|
+ isRequired: String(it.isRequired) === '1' ? '是' : '否',
|
|
|
+ isUpload: String(it.isUpload) === '1' || it.isUpload === true,
|
|
|
+ uploadId: it.uploadId || it.id || '',
|
|
|
+ surveyTemplateId: it.templateId || it.surveyTemplateId || '',
|
|
|
+ catalogId: it.catalogId || this.catalogId || '',
|
|
|
+ auditedUnitId: it.auditedUnitId || this.auditedUnitId || '',
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.formData.costSurveyData = rows
|
|
|
+ // 设置总数
|
|
|
+ const total =
|
|
|
+ (res &&
|
|
|
+ res.value &&
|
|
|
+ (res.value.total ||
|
|
|
+ (Array.isArray(res.value.records)
|
|
|
+ ? res.value.records.length
|
|
|
+ : Array.isArray(res.value)
|
|
|
+ ? res.value.length
|
|
|
+ : 0))) ||
|
|
|
+ (Array.isArray(raw) ? raw.length : raw.total || 0)
|
|
|
+ this.costSurveyPagination.total = total
|
|
|
this.tabLoadedStatus.costSurvey = true
|
|
|
- } catch (error) {
|
|
|
- console.error('加载成本调查表失败:', error)
|
|
|
- this.$message.error('加载成本调查表失败')
|
|
|
+ } catch (err) {
|
|
|
+ console.error('加载成本调查表失败:', err)
|
|
|
+ this.$message &&
|
|
|
+ this.$message.error &&
|
|
|
+ this.$message.error('加载成本调查表失败')
|
|
|
this.formData.costSurveyData = []
|
|
|
this.costSurveyPagination.total = 0
|
|
|
+ this.tabLoadedStatus.costSurvey = true
|
|
|
} finally {
|
|
|
this.loading = false
|
|
|
}
|
|
|
@@ -1277,16 +1366,14 @@
|
|
|
// 成本调查表分页 - 页码改变
|
|
|
handleCostSurveyPageChange(page) {
|
|
|
this.costSurveyPagination.currentPage = page
|
|
|
- // 如果成本调查表数据来自API,可以在这里调用API
|
|
|
- // this.loadCostSurvey()
|
|
|
+ this.loadCostSurvey()
|
|
|
},
|
|
|
|
|
|
// 成本调查表分页 - 每页条数改变
|
|
|
handleCostSurveySizeChange(size) {
|
|
|
this.costSurveyPagination.pageSize = size
|
|
|
this.costSurveyPagination.currentPage = 1
|
|
|
- // 如果成本调查表数据来自API,可以在这里调用API
|
|
|
- // this.loadCostSurvey()
|
|
|
+ this.loadCostSurvey()
|
|
|
},
|
|
|
|
|
|
// 消息通知分页 - 页码改变
|