|
|
|
@ -13,7 +13,7 @@ |
|
|
|
<div class="template-form-item"> |
|
|
|
<BaseInfoFormPackage fieldItemLabel="template.common.baseInfo" |
|
|
|
ref="operateStepRef" :formConfig="operateConfig" :formData="formData" /> |
|
|
|
<BaseInfoFormPackage fieldItemLabel="template.dj.dj001.fhfw" |
|
|
|
<BaseInfoFormPackage v-if="fillType !== 'preFill'" fieldItemLabel="template.dj.dj001.fhfw" |
|
|
|
ref="fhfwCheckBoxRef" :formConfig="fhfwCheckBoxConfig" :formData="formData" /> |
|
|
|
<div class="template-form-item" > |
|
|
|
<span>{{ $t('template.dj.dj001.fhfw') }}</span> |
|
|
|
@ -159,13 +159,14 @@ export default { |
|
|
|
label: 'template.dj.dj001.fhfw', |
|
|
|
type: "checkboxTree", |
|
|
|
fillType: 'actFill', |
|
|
|
options: this.fhfwCheckOptions |
|
|
|
options: Array.isArray(this.fhfwCheckOptions) ? this.fhfwCheckOptions : [] |
|
|
|
}, |
|
|
|
fhlrCheck: { |
|
|
|
label: 'template.dj.dj001.fhlr', |
|
|
|
type: "checkboxTree", |
|
|
|
fillType: 'actFill', |
|
|
|
options: this.fhlrCheckOptions |
|
|
|
options: Array.isArray(this.fhlrCheckOptions) ? this.fhlrCheckOptions : [] |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -199,16 +200,17 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
formData: {}, |
|
|
|
formData: { |
|
|
|
fhfwCheck: { checkedValues: [], otherValues: {} }, |
|
|
|
fhlrCheck: { checkedValues: [], otherValues: {} }, |
|
|
|
}, |
|
|
|
fhfwCheckOptions:[], |
|
|
|
fhlrCheckOptions:[], |
|
|
|
isFirstTableDataRecorded: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
setTimeout(()=>{ |
|
|
|
this.getTableData() |
|
|
|
},200) |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//获取已填写的表单数据 |
|
|
|
@ -251,23 +253,47 @@ export default { |
|
|
|
}, |
|
|
|
// 获取范围和内容表格数据(核心优化) |
|
|
|
getTableData() { |
|
|
|
const formData = this.getFilledFormData() || {}; |
|
|
|
const stepTableFormData = formData.stepTableFormData || []; |
|
|
|
const stepTableFormData_1 = formData.stepTableFormData_1 || []; |
|
|
|
// 处理数据为复选框options格式(去重+空值过滤) |
|
|
|
const firstList = stepTableFormData |
|
|
|
.filter(item => item.fhfw) // 过滤空值 |
|
|
|
.map(item => ({ label: item.fhfw, value: item.fhfw })) |
|
|
|
.filter((item, index, arr) => arr.findIndex(i => i.value === item.value) === index); // 去重 |
|
|
|
try { |
|
|
|
const formData = this.getFilledFormData() || {}; |
|
|
|
// 修复:增加空值保护 |
|
|
|
const stepTableFormData = formData.stepTableFormData || this.formData.stepTableFormData || []; |
|
|
|
const stepTableFormData_1 = formData.stepTableFormData_1 || this.formData.stepTableFormData_1 || []; |
|
|
|
|
|
|
|
// 处理数据为checkboxTree期望的格式(包含children结构) |
|
|
|
const firstList = stepTableFormData |
|
|
|
.filter(item => item && item.fhfw && item.fhfw.trim()) // 严格过滤空值 |
|
|
|
.map(item => ({ |
|
|
|
label: item.fhfw, |
|
|
|
value: item.fhfw, |
|
|
|
children: [] // 必须包含children字段,否则checkboxTree会报错 |
|
|
|
})) |
|
|
|
// 去重优化 |
|
|
|
.filter((item, index, arr) => { |
|
|
|
return arr.findIndex(i => i.value === item.value) === index; |
|
|
|
}); |
|
|
|
|
|
|
|
const secondList = stepTableFormData_1 |
|
|
|
.filter(item => item.fhlr) // 过滤空值 |
|
|
|
.map(item => ({ label: item.fhlr, value: item.fhlr })) |
|
|
|
.filter((item, index, arr) => arr.findIndex(i => i.value === item.value) === index); // 去重 |
|
|
|
const secondList = stepTableFormData_1 |
|
|
|
.filter(item => item && item.fhlr && item.fhlr.trim()) // 严格过滤空值 |
|
|
|
.map(item => ({ |
|
|
|
label: item.fhlr, |
|
|
|
value: item.fhlr, |
|
|
|
children: [] // 必须包含children字段 |
|
|
|
})) |
|
|
|
.filter((item, index, arr) => { |
|
|
|
return arr.findIndex(i => i.value === item.value) === index; |
|
|
|
}); |
|
|
|
|
|
|
|
// 更新响应式变量(触发computed更新) |
|
|
|
this.fhfwCheckOptions = firstList; |
|
|
|
this.fhlrCheckOptions = secondList; |
|
|
|
// 响应式更新 |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.fhfwCheckOptions = firstList; |
|
|
|
this.fhlrCheckOptions = secondList; |
|
|
|
}) |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
// 异常时重置为空数组,避免页面崩溃 |
|
|
|
this.fhfwCheckOptions = []; |
|
|
|
this.fhlrCheckOptions = []; |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
|