|
@@ -32,62 +32,54 @@
|
|
|
<!-- 固定表填报弹窗(可编辑/只读由 isViewMode/viewModeForDialog 控制) -->
|
|
<!-- 固定表填报弹窗(可编辑/只读由 isViewMode/viewModeForDialog 控制) -->
|
|
|
<fixed-table-dialog
|
|
<fixed-table-dialog
|
|
|
:visible.sync="fixedTableDialogVisible"
|
|
:visible.sync="fixedTableDialogVisible"
|
|
|
- :survey-data="{ ...(currentTemplateRow || {}), fixedHeaders }"
|
|
|
|
|
|
|
+ :survey-data="{ ...currentSurveyRow, fixedHeaders }"
|
|
|
|
|
+ :fixed-fields="fixedFields || ''"
|
|
|
|
|
+ :fixed-fieldids="fixedFieldids || ''"
|
|
|
|
|
+ :columns-meta="columnsMeta"
|
|
|
:table-items="tableItems"
|
|
:table-items="tableItems"
|
|
|
:audit-periods="auditPeriods"
|
|
:audit-periods="auditPeriods"
|
|
|
- :is-view-mode="viewModeForDialog"
|
|
|
|
|
|
|
+ :project-audit-periods="auditPeriods"
|
|
|
|
|
+ :project-audit-period="auditPeriod"
|
|
|
|
|
+ :is-view-mode="isViewMode"
|
|
|
:request-type="2"
|
|
:request-type="2"
|
|
|
:audited-unit-id="auditedUnitId"
|
|
:audited-unit-id="auditedUnitId"
|
|
|
:upload-id="
|
|
:upload-id="
|
|
|
- (currentTemplateRow &&
|
|
|
|
|
- (currentTemplateRow.uploadId || currentTemplateRow.id)) ||
|
|
|
|
|
- ''
|
|
|
|
|
|
|
+ currentSurveyRow && currentSurveyRow.id ? currentSurveyRow.id : uploadId
|
|
|
"
|
|
"
|
|
|
- :survey-template-id="getSurveyTemplateId(currentTemplateRow)"
|
|
|
|
|
- :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
|
|
|
|
|
- @save="
|
|
|
|
|
- $emit('handle-fixed-table-save', {
|
|
|
|
|
- row: currentTemplateRow,
|
|
|
|
|
- tableData: $event,
|
|
|
|
|
- })
|
|
|
|
|
- "
|
|
|
|
|
- @refresh="
|
|
|
|
|
- $emit('handle-fixed-table-save', {
|
|
|
|
|
- row: currentTemplateRow,
|
|
|
|
|
- tableData: {},
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ :survey-template-id="
|
|
|
|
|
+ currentSurveyRow && currentSurveyRow.surveyTemplateId
|
|
|
|
|
+ ? currentSurveyRow.surveyTemplateId
|
|
|
|
|
+ : surveyTemplateId
|
|
|
"
|
|
"
|
|
|
|
|
+ :catalog-id="catalogId"
|
|
|
|
|
+ :task-id="taskId"
|
|
|
|
|
+ @save="handleFixedTableSave"
|
|
|
|
|
+ @refresh="handleRefresh"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<!-- 动态表填报弹窗(可编辑/只读由 isViewMode/viewModeForDialog 控制) -->
|
|
<!-- 动态表填报弹窗(可编辑/只读由 isViewMode/viewModeForDialog 控制) -->
|
|
|
<dynamic-table-dialog
|
|
<dynamic-table-dialog
|
|
|
:key="dynamicDialogKey"
|
|
:key="dynamicDialogKey"
|
|
|
:visible.sync="dynamicTableDialogVisible"
|
|
:visible.sync="dynamicTableDialogVisible"
|
|
|
- :survey-data="currentTemplateRow || {}"
|
|
|
|
|
|
|
+ :survey-data="currentSurveyRow"
|
|
|
:table-data="dynamicTableData"
|
|
:table-data="dynamicTableData"
|
|
|
:table-items="tableItems"
|
|
:table-items="tableItems"
|
|
|
- :is-view-mode="viewModeForDialog"
|
|
|
|
|
- :request-type="2"
|
|
|
|
|
|
|
+ :is-view-mode="isViewMode"
|
|
|
|
|
+ :request-type="1"
|
|
|
:audited-unit-id="auditedUnitId"
|
|
:audited-unit-id="auditedUnitId"
|
|
|
:upload-id="
|
|
:upload-id="
|
|
|
- (currentTemplateRow &&
|
|
|
|
|
- (currentTemplateRow.uploadId || currentTemplateRow.id)) ||
|
|
|
|
|
- ''
|
|
|
|
|
- "
|
|
|
|
|
- :survey-template-id="getSurveyTemplateId(currentTemplateRow)"
|
|
|
|
|
- :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
|
|
|
|
|
- @save="
|
|
|
|
|
- $emit('handle-dynamic-table-save', {
|
|
|
|
|
- row: currentTemplateRow,
|
|
|
|
|
- tableData: $event,
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ currentSurveyRow && (currentSurveyRow.uploadId || currentSurveyRow.id)
|
|
|
|
|
+ ? currentSurveyRow.uploadId || currentSurveyRow.id
|
|
|
|
|
+ : uploadId
|
|
|
"
|
|
"
|
|
|
- @refresh="
|
|
|
|
|
- $emit('handle-dynamic-table-save', {
|
|
|
|
|
- row: currentTemplateRow,
|
|
|
|
|
- tableData: {},
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ :catalog-id="catalogId"
|
|
|
|
|
+ :survey-template-id="
|
|
|
|
|
+ currentSurveyRow && currentSurveyRow.surveyTemplateId
|
|
|
|
|
+ ? currentSurveyRow.surveyTemplateId
|
|
|
|
|
+ : surveyTemplateId
|
|
|
"
|
|
"
|
|
|
|
|
+ @save="handleDynamicTableSave"
|
|
|
|
|
+ @refresh="handleRefresh"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<el-button
|
|
<el-button
|
|
@@ -314,6 +306,9 @@
|
|
|
:is-view-mode="true"
|
|
:is-view-mode="true"
|
|
|
:request-type="2"
|
|
:request-type="2"
|
|
|
:audited-unit-id="auditedUnitId"
|
|
:audited-unit-id="auditedUnitId"
|
|
|
|
|
+ :audit-periods="auditPeriods"
|
|
|
|
|
+ :project-audit-periods="auditPeriods"
|
|
|
|
|
+ :project-audit-period="auditPeriod"
|
|
|
:upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
|
|
:upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
|
|
|
:survey-template-id="getSurveyTemplateId(currentTemplateRow)"
|
|
:survey-template-id="getSurveyTemplateId(currentTemplateRow)"
|
|
|
:catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
|
|
:catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
|
|
@@ -341,7 +336,7 @@
|
|
|
downloadTemplate,
|
|
downloadTemplate,
|
|
|
importData,
|
|
importData,
|
|
|
} from '@/api/audit/survey'
|
|
} from '@/api/audit/survey'
|
|
|
- import { getListBySurveyFdTemplateIdAndVersion } from '@/api/costSurveyTemplateHeaders'
|
|
|
|
|
|
|
+ import { getListBySurveyTemplateIdAndVersion } from '@/api/costSurveyTemplateHeaders'
|
|
|
import SurveyFormDialog from '@/views/EntDeclaration/auditTaskManagement/components/SurveyFormDialog.vue'
|
|
import SurveyFormDialog from '@/views/EntDeclaration/auditTaskManagement/components/SurveyFormDialog.vue'
|
|
|
import FixedTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/FixedTableDialog.vue'
|
|
import FixedTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/FixedTableDialog.vue'
|
|
|
import DynamicTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/DynamicTableDialog.vue'
|
|
import DynamicTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/DynamicTableDialog.vue'
|
|
@@ -373,10 +368,16 @@
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
default: '',
|
|
default: '',
|
|
|
},
|
|
},
|
|
|
|
|
+ // 任务ID(用于上传等场景)
|
|
|
taskId: {
|
|
taskId: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
default: '',
|
|
default: '',
|
|
|
},
|
|
},
|
|
|
|
|
+ // 监审期间(与 CostSurveyTab 对齐,便于统一传递给子组件)
|
|
|
|
|
+ auditPeriod: {
|
|
|
|
|
+ type: [String, Array],
|
|
|
|
|
+ default: null,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -399,14 +400,49 @@
|
|
|
auditPeriods: [],
|
|
auditPeriods: [],
|
|
|
dynamicTableData: [],
|
|
dynamicTableData: [],
|
|
|
dynamicDialogKey: 0,
|
|
dynamicDialogKey: 0,
|
|
|
|
|
+ fixedDialogKey: 0,
|
|
|
fixedHeaders: null,
|
|
fixedHeaders: null,
|
|
|
|
|
+ // 与 CostSurveyTab 对齐的固定表头派生字段
|
|
|
|
|
+ fixedFields: '',
|
|
|
|
|
+ fixedFieldids: '',
|
|
|
|
|
+ columnsMeta: [],
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- computed: {},
|
|
|
|
|
- mounted() {
|
|
|
|
|
- // 直接使用this.currentNode访问props值,无需在data中重复定义
|
|
|
|
|
|
|
+ // ...
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ auditPeriod: {
|
|
|
|
|
+ immediate: true,
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ handler(val) {
|
|
|
|
|
+ if (!val) return
|
|
|
|
|
+ if (Array.isArray(val)) {
|
|
|
|
|
+ this.auditPeriods = val.map((p) => String(p))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const str = String(val).trim()
|
|
|
|
|
+ if (!str) return
|
|
|
|
|
+ if (str.includes(',')) {
|
|
|
|
|
+ this.auditPeriods = str
|
|
|
|
|
+ .split(',')
|
|
|
|
|
+ .map((s) => s.trim())
|
|
|
|
|
+ .filter(Boolean)
|
|
|
|
|
+ } else if (str.includes('-')) {
|
|
|
|
|
+ const parts = str.split('-')
|
|
|
|
|
+ if (parts.length === 2) {
|
|
|
|
|
+ const start = parseInt(parts[0].trim())
|
|
|
|
|
+ const end = parseInt(parts[1].trim())
|
|
|
|
|
+ const years = []
|
|
|
|
|
+ if (!isNaN(start) && !isNaN(end) && end >= start) {
|
|
|
|
|
+ for (let y = start; y <= end; y++) years.push(String(y))
|
|
|
|
|
+ }
|
|
|
|
|
+ this.auditPeriods = years
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.auditPeriods = [str]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
// 在线填报入口:与 CostSurveyTab 一致
|
|
// 在线填报入口:与 CostSurveyTab 一致
|
|
|
async handleOnlineSubmission(row) {
|
|
async handleOnlineSubmission(row) {
|
|
@@ -918,14 +954,18 @@
|
|
|
}
|
|
}
|
|
|
const res = await getSingleRecordSurveyList(params)
|
|
const res = await getSingleRecordSurveyList(params)
|
|
|
if (res && res.code === 200 && res.value) {
|
|
if (res && res.code === 200 && res.value) {
|
|
|
|
|
+ // 将接口返回的数据转换为固定表配置格式
|
|
|
|
|
+ // 固定表使用 itemlist,不使用 fixedFields 和 fixedFieldids
|
|
|
const { itemlist } = res.value
|
|
const { itemlist } = res.value
|
|
|
|
|
+ console.log('itemlist', itemlist)
|
|
|
|
|
+ // 如果有 itemlist,使用 itemlist 作为表格项配置
|
|
|
if (itemlist && Array.isArray(itemlist) && itemlist.length > 0) {
|
|
if (itemlist && Array.isArray(itemlist) && itemlist.length > 0) {
|
|
|
- this.tableItems = itemlist.map((item) => ({
|
|
|
|
|
|
|
+ this.tableItems = itemlist.map((item, index) => ({
|
|
|
id: item.id || item.itemId || '',
|
|
id: item.id || item.itemId || '',
|
|
|
- rowid: item.rowid || item.id || item.itemId || '',
|
|
|
|
|
- seq: item.序号,
|
|
|
|
|
- itemName: item.项目 || '',
|
|
|
|
|
- unit: item.unit || '',
|
|
|
|
|
|
|
+ rowid: item.rowid || item.id || item.itemId || '', // rowid 用于父子关系
|
|
|
|
|
+ seq: item.序号, // 序号就是序号
|
|
|
|
|
+ itemName: item.项目 || '', // 项目就是项目
|
|
|
|
|
+ unit: item.unit || '', // 单位是 unit
|
|
|
isCategory: item.isCategory || false,
|
|
isCategory: item.isCategory || false,
|
|
|
categorySeq: item.categorySeq || '',
|
|
categorySeq: item.categorySeq || '',
|
|
|
categoryId: item.categoryId || '',
|
|
categoryId: item.categoryId || '',
|
|
@@ -934,13 +974,20 @@
|
|
|
? item.parentid
|
|
? item.parentid
|
|
|
: item.parentId !== undefined
|
|
: item.parentId !== undefined
|
|
|
? item.parentId
|
|
? item.parentId
|
|
|
- : '-1',
|
|
|
|
|
|
|
+ : '-1', // 父项ID,默认为 '-1'(父项)
|
|
|
validateRules: item.validateRules || {},
|
|
validateRules: item.validateRules || {},
|
|
|
linkageRules: item.linkageRules || {},
|
|
linkageRules: item.linkageRules || {},
|
|
|
children: item.children || [],
|
|
children: item.children || [],
|
|
|
- ...item,
|
|
|
|
|
|
|
+ ...item, // 保留其他字段
|
|
|
}))
|
|
}))
|
|
|
|
|
+ // 若该接口同时提供 fixedFields/fixedFieldids,则同步到弹窗表头
|
|
|
|
|
+ if (res.value.fixedFields && res.value.fixedFieldids) {
|
|
|
|
|
+ this.fixedFields = res.value.fixedFields
|
|
|
|
|
+ console.log(this.fixedFields, 'biaogeshuju')
|
|
|
|
|
+ this.fixedFieldids = res.value.fixedFieldids
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // 如果没有 itemlist,使用假数据
|
|
|
this.tableItems = this.getMockTableItems()
|
|
this.tableItems = this.getMockTableItems()
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -959,28 +1006,116 @@
|
|
|
this.tableItems = this.getMockTableItems()
|
|
this.tableItems = this.getMockTableItems()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 监审期间
|
|
|
|
|
- const currentYear = new Date().getFullYear()
|
|
|
|
|
- this.auditPeriods = [
|
|
|
|
|
- String(currentYear - 2),
|
|
|
|
|
- String(currentYear - 1),
|
|
|
|
|
- String(currentYear),
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ // 监审期间:优先使用 props.auditPeriod,其次使用行上的 auditPeriod,否则默认最近三年
|
|
|
|
|
+ if (this.auditPeriod) {
|
|
|
|
|
+ if (Array.isArray(this.auditPeriod)) {
|
|
|
|
|
+ this.auditPeriods = this.auditPeriod.map((p) => String(p))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.auditPeriods = this.parseAuditPeriod(this.auditPeriod)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (
|
|
|
|
|
+ this.currentTemplateRow &&
|
|
|
|
|
+ this.currentTemplateRow.auditPeriod
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.auditPeriods = this.parseAuditPeriod(
|
|
|
|
|
+ this.currentTemplateRow.auditPeriod
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const currentYear = new Date().getFullYear()
|
|
|
|
|
+ this.auditPeriods = [
|
|
|
|
|
+ String(currentYear - 2),
|
|
|
|
|
+ String(currentYear - 1),
|
|
|
|
|
+ String(currentYear),
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const headerRes = await getListBySurveyFdTemplateIdAndVersion({
|
|
|
|
|
|
|
+ const headerRes = await getListBySurveyTemplateIdAndVersion({
|
|
|
surveyTemplateId: this.getSurveyTemplateId(this.currentTemplateRow),
|
|
surveyTemplateId: this.getSurveyTemplateId(this.currentTemplateRow),
|
|
|
- type: 2,
|
|
|
|
|
|
|
+ type: 1,
|
|
|
})
|
|
})
|
|
|
if (headerRes && headerRes.code === 200) {
|
|
if (headerRes && headerRes.code === 200) {
|
|
|
- this.fixedHeaders = headerRes.value || null
|
|
|
|
|
|
|
+ const hdrVal = headerRes.value
|
|
|
|
|
+ // 统一规范:columnsMeta + fixedFields + fixedFieldids
|
|
|
|
|
+ let columnsMeta = []
|
|
|
|
|
+ let fixedFieldsStr = this.fixedFields || ''
|
|
|
|
|
+ let fixedFieldidsStr = this.fixedFieldids || ''
|
|
|
|
|
+
|
|
|
|
|
+ if (Array.isArray(hdrVal)) {
|
|
|
|
|
+ columnsMeta = hdrVal
|
|
|
|
|
+ } else if (hdrVal && typeof hdrVal === 'object') {
|
|
|
|
|
+ const {
|
|
|
|
|
+ fixedFields,
|
|
|
|
|
+ fixedFieldids,
|
|
|
|
|
+ columnsMeta: metas,
|
|
|
|
|
+ headers,
|
|
|
|
|
+ items,
|
|
|
|
|
+ } = hdrVal
|
|
|
|
|
+ fixedFieldsStr = fixedFieldsStr || fixedFields || ''
|
|
|
|
|
+ fixedFieldidsStr = fixedFieldidsStr || fixedFieldids || ''
|
|
|
|
|
+ columnsMeta = Array.isArray(metas)
|
|
|
|
|
+ ? metas
|
|
|
|
|
+ : Array.isArray(headers)
|
|
|
|
|
+ ? headers
|
|
|
|
|
+ : Array.isArray(items)
|
|
|
|
|
+ ? items
|
|
|
|
|
+ : []
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如未提供 fixedFields/fixedFieldids,则从 columnsMeta 推导
|
|
|
|
|
+ if (
|
|
|
|
|
+ (!fixedFieldsStr || !fixedFieldidsStr) &&
|
|
|
|
|
+ Array.isArray(columnsMeta) &&
|
|
|
|
|
+ columnsMeta.length
|
|
|
|
|
+ ) {
|
|
|
|
|
+ const labels = columnsMeta
|
|
|
|
|
+ .map((m) => (m && (m.label || m.fieldName || m.name)) || '')
|
|
|
|
|
+ .map((s) => String(s || '').trim())
|
|
|
|
|
+ .filter(Boolean)
|
|
|
|
|
+ const ids = columnsMeta
|
|
|
|
|
+ .map(
|
|
|
|
|
+ (m) =>
|
|
|
|
|
+ (m && (m.fieldId || m.fieldName || m.prop || m.code)) || ''
|
|
|
|
|
+ )
|
|
|
|
|
+ .map((s) => String(s || '').trim())
|
|
|
|
|
+ .filter(Boolean)
|
|
|
|
|
+ if (labels.length) fixedFieldsStr = labels.join(',')
|
|
|
|
|
+ if (ids.length) fixedFieldidsStr = ids.join(',')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 回写到实例;优先保留服务端原始 fixedHeaders,以与成本调查表保持一致
|
|
|
|
|
+ this.columnsMeta = columnsMeta
|
|
|
|
|
+ this.fixedFields = fixedFieldsStr
|
|
|
|
|
+ this.fixedFieldids = fixedFieldidsStr
|
|
|
|
|
+ if (hdrVal) {
|
|
|
|
|
+ this.fixedHeaders = hdrVal
|
|
|
|
|
+ } else if (
|
|
|
|
|
+ (Array.isArray(this.columnsMeta) && this.columnsMeta.length) ||
|
|
|
|
|
+ (this.fixedFields && this.fixedFields.length) ||
|
|
|
|
|
+ (this.fixedFieldids && this.fixedFieldids.length)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.fixedHeaders = {
|
|
|
|
|
+ fixedFields: this.fixedFields,
|
|
|
|
|
+ fixedFieldids: this.fixedFieldids,
|
|
|
|
|
+ columnsMeta: this.columnsMeta,
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.fixedHeaders = null
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
this.fixedHeaders = null
|
|
this.fixedHeaders = null
|
|
|
|
|
+ this.fixedFields = ''
|
|
|
|
|
+ this.fixedFieldids = ''
|
|
|
|
|
+ this.columnsMeta = []
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
this.fixedHeaders = null
|
|
this.fixedHeaders = null
|
|
|
|
|
+ this.fixedFields = ''
|
|
|
|
|
+ this.fixedFieldids = ''
|
|
|
|
|
+ this.columnsMeta = []
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ this.fixedDialogKey++
|
|
|
this.fixedTableDialogVisible = true
|
|
this.fixedTableDialogVisible = true
|
|
|
},
|
|
},
|
|
|
extractLengthFromFormat(format) {
|
|
extractLengthFromFormat(format) {
|