|
|
@@ -202,6 +202,8 @@
|
|
|
:fixed-fields="fixedFields || ''"
|
|
|
:fixed-fieldids="fixedFieldids || ''"
|
|
|
:table-items="tableItems"
|
|
|
+ :project-audit-periods="projectAuditPeriods"
|
|
|
+ :project-audit-period="projectAuditPeriod"
|
|
|
/>
|
|
|
|
|
|
<dynamic-table-dialog
|
|
|
@@ -250,6 +252,7 @@
|
|
|
getSurveyDetail,
|
|
|
getDynamicTableData,
|
|
|
} from '@/api/audit/survey'
|
|
|
+ import { getProjectInformationInfo } from '@/api/auditTaskProcessing'
|
|
|
|
|
|
export default {
|
|
|
name: 'AuditReview',
|
|
|
@@ -279,6 +282,8 @@
|
|
|
type: [String, Number],
|
|
|
default: '',
|
|
|
},
|
|
|
+ // 立项项目ID(用于拉取立项信息中的监审期间)
|
|
|
+ projectId: { type: String, default: '' },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -336,6 +341,22 @@
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ // 解析监审期间字符串(如 "2022,2023,2024" 或 "2022-2024")
|
|
|
+ parseAuditPeriod(periodStr) {
|
|
|
+ if (!periodStr) return []
|
|
|
+ const str = String(periodStr)
|
|
|
+ if (str.includes(',')) {
|
|
|
+ return str.split(',').map((p) => p.trim())
|
|
|
+ } else if (str.includes('-')) {
|
|
|
+ const [start, end] = str.split('-').map(Number)
|
|
|
+ if (!isNaN(start) && !isNaN(end) && start <= end) {
|
|
|
+ return Array.from({ length: end - start + 1 }, (_, i) =>
|
|
|
+ String(start + i)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return [str].filter(Boolean)
|
|
|
+ },
|
|
|
// 加载报送资料数据
|
|
|
async loadMaterialData() {
|
|
|
try {
|
|
|
@@ -506,7 +527,7 @@
|
|
|
// 固定表:先加载固定表配置(表头),参考 CostSurveyTab
|
|
|
const surveyTemplateId =
|
|
|
(row && (row.surveyTemplateId || row.templateId)) || ''
|
|
|
- await this.initFixedTableData(surveyTemplateId)
|
|
|
+ await this.initFixedTableData(surveyTemplateId, row)
|
|
|
this.fixedDialogVisible = true
|
|
|
} else if (t === '3') {
|
|
|
await this.initDynamicTableData()
|
|
|
@@ -547,7 +568,7 @@
|
|
|
this.tableItems = []
|
|
|
}
|
|
|
},
|
|
|
- async initFixedTableData(surveyTemplateId) {
|
|
|
+ async initFixedTableData(surveyTemplateId, row = {}) {
|
|
|
try {
|
|
|
this.fixedFields = ''
|
|
|
this.fixedFieldids = ''
|
|
|
@@ -581,6 +602,52 @@
|
|
|
...item,
|
|
|
}))
|
|
|
}
|
|
|
+ // 透传固定表头(与 DataRequirementsTab 对齐)
|
|
|
+ if (res.value && res.value.fixedFields && res.value.fixedFieldids) {
|
|
|
+ this.fixedFields = res.value.fixedFields
|
|
|
+ this.fixedFieldids = res.value.fixedFieldids
|
|
|
+ } else {
|
|
|
+ this.fixedFields = ''
|
|
|
+ this.fixedFieldids = ''
|
|
|
+ }
|
|
|
+ // 尝试从当前行或配置中解析监审期间
|
|
|
+ const periodStr =
|
|
|
+ row.auditPeriod || (res.value && res.value.auditPeriod) || ''
|
|
|
+ this.auditPeriods = this.parseAuditPeriod(periodStr)
|
|
|
+ // 优先从立项信息中获取监审期间并覆盖(按需求回显年份)
|
|
|
+ try {
|
|
|
+ if (this.projectId) {
|
|
|
+ const projRes = await getProjectInformationInfo(this.projectId)
|
|
|
+ const projVal = projRes && projRes.value
|
|
|
+ if (projVal) {
|
|
|
+ // 记录原始与数组两种形式,供弹窗优先使用
|
|
|
+ if (projVal.auditPeriod) {
|
|
|
+ this.projectAuditPeriod = projVal.auditPeriod
|
|
|
+ this.projectAuditPeriods = Array.isArray(
|
|
|
+ projVal.auditPeriod
|
|
|
+ )
|
|
|
+ ? projVal.auditPeriod.map((p) => String(p))
|
|
|
+ : this.parseAuditPeriod(projVal.auditPeriod)
|
|
|
+ } else if (
|
|
|
+ Array.isArray(projVal.auditPeriodArray) &&
|
|
|
+ projVal.auditPeriodArray.length
|
|
|
+ ) {
|
|
|
+ this.projectAuditPeriods = projVal.auditPeriodArray
|
|
|
+ .map((it) => it && (it.value || it))
|
|
|
+ .map((p) => String(p))
|
|
|
+ .filter((s) => s && s.trim())
|
|
|
+ this.projectAuditPeriod = this.projectAuditPeriods.join(',')
|
|
|
+ }
|
|
|
+ // 同步覆盖父级传入/配置解析的 auditPeriods
|
|
|
+ if (this.projectAuditPeriods.length > 0) {
|
|
|
+ this.projectAuditPeriod = this.projectAuditPeriods.slice()
|
|
|
+ console.log(this.projectAuditPeriod, '监审期间')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ // 忽略立项信息拉取失败,保留已有解析结果
|
|
|
+ }
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.error('加载固定表配置失败:', e)
|