0 ? headerValues.join(' ') : `菌种${colIndex}`
+ // 将多个值拼接为 "值1(值2值3)" 格式
+ const headerLabel = headerValues.length > 1
+ ? `${headerValues[0]}(${headerValues.slice(1).join('')})`
+ : headerValues[0] || `菌种${colIndex}`
dynamicColumns.push({
label: headerLabel,
@@ -538,7 +540,9 @@ export default {
bodyFillType: 'actFill',
bodyDisabled: true,
disabled: true,
- width: 100
+ width: 180,
+ showWidth: 90,
+
}
]
@@ -554,8 +558,10 @@ export default {
rowIndex++
}
- // 将多个值用空格拼接
- const headerLabel = headerValues.join(' ')
+ // 将多个值拼接为 "值1(值2值3)" 格式
+ const headerLabel = headerValues.length > 1
+ ? `${headerValues[0]}(${headerValues.slice(1).join('')})`
+ : headerValues[0] || `菌种${colIndex}`
columns.push({
label: headerLabel,
@@ -563,7 +569,6 @@ export default {
bodyType: 'checkbox',
bodyFillType: 'actFill',
checkboxLabel: '',
- width: 150
})
})
diff --git a/src/views/business/comps/template/comps/dl/DL009.vue b/src/views/business/comps/template/comps/dl/DL009.vue
index b381fc8..86bd1b9 100644
--- a/src/views/business/comps/template/comps/dl/DL009.vue
+++ b/src/views/business/comps/template/comps/dl/DL009.vue
@@ -57,6 +57,7 @@
{{ $t('template.dl.dl009.jlsDesc') }}
{
- this.handleJgxxQxbdSelect(row)
+ // 直接从表格ref获取当前仪器使用信息数据(而非formData)
+ const yqsyTableRef = this.$refs[refConf.yqsy]
+ const savedYqsyData = JSON.parse(JSON.stringify(yqsyTableRef?.getDataSource() || []))
+ console.log('[DL009] 选择前序表单前,保存仪器数据:', savedYqsyData.length, '条')
- // 再次使用 $nextTick 确保在 handleJgxxQxbdSelect 完成后恢复数据
- this.$nextTick(() => {
- if (
- currentYqsyData.length > 0 &&
- (!this.formData.stepTableFormData ||
- this.formData.stepTableFormData.length === 0)
- ) {
- this.$set(this.formData, 'stepTableFormData', currentYqsyData)
-
- // 同时更新表格显示
- const yqsyTableRef = this.$refs[refConf.yqsy]
- if (yqsyTableRef) {
- yqsyTableRef.updateDataSource(currentYqsyData)
- }
- }
+ // 先将仪器数据写入formData,防止watch触发时读到空数组
+ if (savedYqsyData.length > 0) {
+ this.$set(this.formData, 'stepTableFormData', savedYqsyData)
+ }
- // 如果当前表头数据为空,恢复之前的表头数据
- if (
- Object.keys(currentHeaderFields).length > 0 &&
- (!this.formData.headerSelectFields ||
- Object.keys(this.formData.headerSelectFields).length === 0)
- ) {
- this.$set(
- this.formData,
- 'headerSelectFields',
- currentHeaderFields
- )
- }
- })
- })
+ this.handleJgxxQxbdSelect(row, savedYqsyData)
}
},
// 处理结果信息前序表单选择
- handleJgxxQxbdSelect(row) {
+ handleJgxxQxbdSelect(row, savedYqsyData) {
// 重置加载标记,允许重新加载数据
this.isDataLoaded = false
@@ -664,7 +634,7 @@ export default {
}
// 3. 更新表格
- this.updateJgxxTable(dynamicColumns.columns, tableData, headerFields)
+ this.updateJgxxTable(dynamicColumns.columns, tableData, headerFields, savedYqsyData)
} catch (error) {
console.error('解析前序表单数据失败:', error)
this.clearJgxxTable()
@@ -775,7 +745,7 @@ export default {
},
// 更新结果信息表格
- updateJgxxTable(columns, tableData, headerFields) {
+ updateJgxxTable(columns, tableData, headerFields, savedYqsyData) {
// 更新动态列配置
this.dynamicJgxxColumns = columns
@@ -804,6 +774,22 @@ export default {
this.$set(this.formData, 'stepTableFormData_1', tableData)
this.isDataLoaded = true
+
+ // 恢复仪器使用信息数据
+ const yqsyTableRef = this.$refs[refConf.yqsy]
+ const currentData = yqsyTableRef?.getDataSource() || []
+ console.log('[DL009] updateJgxxTable $nextTick - 当前仪器数据:', currentData.length, '条')
+ console.log('[DL009] updateJgxxTable $nextTick - 保存的仪器数据:', savedYqsyData?.length, '条')
+
+ if (savedYqsyData && savedYqsyData.length > 0 && currentData.length === 0) {
+ console.log('[DL009] 恢复仪器数据')
+ // 先写入formData再更新表格
+ this.$set(this.formData, 'stepTableFormData', savedYqsyData)
+ this.$nextTick(() => {
+ yqsyTableRef?.updateDataSource(savedYqsyData)
+ console.log('[DL009] 恢复后仪器数据:', yqsyTableRef?.getDataSource()?.length, '条')
+ })
+ }
})
},
diff --git a/src/views/business/comps/template/comps/dl/DL010.vue b/src/views/business/comps/template/comps/dl/DL010.vue
index 8630aef..23553da 100644
--- a/src/views/business/comps/template/comps/dl/DL010.vue
+++ b/src/views/business/comps/template/comps/dl/DL010.vue
@@ -67,8 +67,8 @@
>
-
+
/^zbhxbbh_\d+$/.test(key))
+ .sort((a, b) => {
+ return parseInt(a.split('_')[1]) - parseInt(b.split('_')[1])
+ })
+ // 至少保留一个 zbhxbbh_1(preFill 时供用户输入编号)
+ if (zbhxbbhKeys.length === 0) {
+ zbhxbbhKeys.push('zbhxbbh_1')
+ }
+ zbhxbbhKeys.forEach(key => {
+ const index = key.split('_')[1]
+ config[key] = {
label: 'template.dl.dl012.zbhxbbh',
type: 'input',
subType: 'span',
@@ -232,20 +243,12 @@ export default {
subKey: 'zbhxbbhCodeSn_' + index,
fillType: 'preFill'
}
- }
+ })
return [
{
type: 'step',
config: {
...config,
- // zbhxbbh: {
- // label: 'template.dl.dl012.zbhxbbh',
- // type: 'input',
- // subType: 'span',
- // maxlength: 20,
- // subKey: 'zbhxbbhCodeSn',
- // fillType: 'preFill'
- // },
zbhxbyjtj: {
label: 'template.dl.dl012.zbhxbyjtj',
type: 'inputNumber',
@@ -254,7 +257,7 @@ export default {
fillType: 'preFill',
subOptions: this.getDictOptions('business_nddw'),
maxlength: 10,
- selectTo: 'zbhxbsjtjUnit' //下拉选择后,赋值到对应字段
+ selectTo: 'zbhxbsjtjUnit'
},
zbhxbsjtj: {
label: 'template.dl.dl012.zbhxbsjtj',
@@ -290,41 +293,49 @@ export default {
})
}
- // 只在实际填报模式下生成编号
- const data = this.getFilledFormDataByRefs([refConf.xbxx])
- const { zbxbs, zbhxbbh_1 } = data || {}
- if (!zbxbs) return
- try {
- this.zbxbs = Number(zbxbs)
- } catch (error) {
- this.zbxbs = 1
- }
- if (this.fillType !== 'actFill') return
- this.$nextTick(() => {
+ // 仅在 actFill 时,根据 zbxbs 生成 zbhxbbh_1/2/3... 写入 formData
+ if (this.fillType === 'actFill') {
+ const data = this.getFilledFormDataByRefs([refConf.xbxx])
+ const { zbxbs, zbhxbbh_1 } = data || {}
+ if (!zbxbs) return
+
+ let count = 1
+ try {
+ count = Number(zbxbs)
+ } catch (error) {
+ count = 1
+ }
+
+ // 先写入 this.formData,让 xbxxConfig computed 感知到新字段并生成对应表单项
const updateData = {}
- // 使用当前时间生成编号
const formattedDate = moment().format('YYMMDD')
- for (let index = 1; index <= this.zbxbs; index++) {
+ for (let index = 1; index <= count; index++) {
const zbhxbbhKey = 'zbhxbbh_' + index
const codeSnKey = 'zbhxbbhCodeSn_' + index
- // 分别判断每个字段,只有无值时才设置
if (!data[zbhxbbhKey]) {
+ this.$set(this.formData, zbhxbbhKey, zbhxbbh_1)
updateData[zbhxbbhKey] = zbhxbbh_1
}
if (!data[codeSnKey]) {
- updateData[codeSnKey] =
- formattedDate + '-' + `${index}`.padStart(4, '0')
+ const codeSnVal = formattedDate + '-' + `${index}`.padStart(4, '0')
+ this.$set(this.formData, codeSnKey, codeSnVal)
+ updateData[codeSnKey] = codeSnVal
}
}
- this.$refs[refConf.xbxx].batchUpdateFormData(updateData)
- })
+
+ // 等配置更新后,同步到子组件的 formFields
+ if (Object.keys(updateData).length > 0) {
+ this.$nextTick(() => {
+ this.$refs[refConf.xbxx].batchUpdateFormData(updateData)
+ })
+ }
+ }
},
data() {
return {
formData: {},
- refConf,
- zbxbs: 1
+ refConf
}
},
methods: {
diff --git a/src/views/business/comps/template/comps/dl/DL014.vue b/src/views/business/comps/template/comps/dl/DL014.vue
index 8bb3ecd..4956fb3 100644
--- a/src/views/business/comps/template/comps/dl/DL014.vue
+++ b/src/views/business/comps/template/comps/dl/DL014.vue
@@ -404,12 +404,14 @@ export default {
label: 'template.dl.dl014.jlzb',
prop: 'jlzb',
bodyType: 'input',
+ width: 180,
bodyFillType: 'preFill',
bodyMaxlength: 10
},
{
label: 'template.dl.dl014.xybh',
prop: 'xybh',
+ width: 180,
bodyType: 'sj',
bodyFillType: 'actFill'
},
@@ -417,6 +419,7 @@ export default {
label: 'template.dl.dl014.gysqgc',
prop: 'gysqgc',
bodyType: 'select',
+ width: 180,
bodyFillType: 'actFill',
bodyOptions: [
{ label: '良好', value: '良好' },
@@ -432,6 +435,7 @@ export default {
bodyMaxlength: 10,
headerSelectKey: 'ysplyjrlUnit',
headerOptions: this.getDictOptions('business_tjdw'),
+ width: 180,
fillType: 'preFill'
},
{
@@ -444,6 +448,7 @@ export default {
headerOptions: this.getDictOptions('business_tjdw'),
copyFrom: 'ysplyjrl',
compareTo: 'ysplyjrl',
+ width: 180,
fillType: 'preFill'
}
]
@@ -459,6 +464,7 @@ export default {
bodyMaxlength: 10,
headerSelectKey: 'yss9hhyjrlUnit',
headerOptions: this.getDictOptions('business_tjdw'),
+ width: 180,
fillType: 'preFill'
},
{
@@ -471,6 +477,7 @@ export default {
headerOptions: this.getDictOptions('business_tjdw'),
copyFrom: 'yss9hhyjrl',
compareTo: 'yss9hhyjrl',
+ width: 180,
fillType: 'preFill'
}
)
@@ -486,6 +493,7 @@ export default {
bodyMaxlength: 20,
bodySubType: 'gyzj',
bodySubKey: 'gyzjbh',
+ width: 240,
bodySubFillType: 'actFill'
},
{
@@ -496,6 +504,7 @@ export default {
bodyMaxlength: 10,
headerSelectKey: 'ysgspjrlUnit',
headerOptions: this.getDictOptions('business_tjdw'),
+ width: 180,
fillType: 'preFill'
},
{
@@ -507,6 +516,7 @@ export default {
headerSelectKey: 'ysgspjrlUnit',
headerOptions: this.getDictOptions('business_tjdw'),
copyFrom: 'ysgspjrl',
+ width: 180,
compareTo: 'ysgspjrl',
fillType: 'preFill'
},
@@ -515,6 +525,7 @@ export default {
prop: 'gyhzqk',
bodyType: 'select',
bodyFillType: 'actFill',
+ width: 180,
bodyOptions: [
{ label: '严重', value: '严重' },
{ label: '中等', value: '中等' },
diff --git a/src/views/business/comps/template/comps/dl/DL015.vue b/src/views/business/comps/template/comps/dl/DL015.vue
index d5d67f3..787c7ae 100644
--- a/src/views/business/comps/template/comps/dl/DL015.vue
+++ b/src/views/business/comps/template/comps/dl/DL015.vue
@@ -218,6 +218,7 @@ export default {
bodyType: 'input',
bodyFillType: 'actFill',
bodyDisabled: true,
+ width: 180,
disabled: true
},
{
@@ -226,12 +227,14 @@ export default {
bodyType: 'input',
bodyFillType: 'actFill',
bodyDisabled: true,
+ width: 180,
disabled: true
},
{
label: 'template.dl.dl015.hyqszqk',
prop: 'hyqszqk',
bodyType: 'select',
+ width: 180,
bodyFillType: 'actFill',
bodyOptions: [
{ label: '良好', value: '良好' },
@@ -243,6 +246,7 @@ export default {
label: 'template.dl.dl015.hyqcdjqk',
prop: 'hyqcdjqk',
bodyType: 'select',
+ width: 180,
bodyFillType: 'actFill',
bodyOptions: [
{ label: '严重', value: '严重' },
@@ -255,6 +259,7 @@ export default {
label: 'template.dl.dl015.hyqqtqk',
prop: 'hyqqtqk',
bodyType: 'select',
+ width: 180,
bodyFillType: 'actFill',
bodyOptions: [
{ label: '大量贴壁细胞变圆', value: '大量贴壁细胞变圆' },
@@ -264,6 +269,7 @@ export default {
{
label: 'template.dl.dl015.qqpyy',
prop: 'qqpyy',
+ width: 100,
bodyType: 'checkbox',
bodyFillType: 'actFill',
checkboxLabel: ''
@@ -271,12 +277,14 @@ export default {
{
label: 'template.dl.dl015.pbsxd',
prop: 'pbsxd',
+ width: 100,
bodyType: 'checkbox',
bodyFillType: 'actFill',
checkboxLabel: ''
},
{
label: 'template.dl.dl015.pyybrl',
+ width: 180,
prop: 'pyybrl',
bodyType: 'inputNumber',
bodyFillType: 'actFill',