From 9006d49ae90c6fc8e97693fa9aaafb88be7bde88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZHANGTENG=5C=E5=BC=A0=E8=85=BE?= <894697943@qq.com> Date: Wed, 11 Mar 2026 20:08:05 +0800 Subject: [PATCH] =?UTF-8?q?fix[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]DL006?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang/en/template/dl.js | 3 + src/lang/zh/template/dl.js | 5 + .../business/comps/template/comps/dl/DL006.vue | 271 +++++++++++++++------ 3 files changed, 202 insertions(+), 77 deletions(-) diff --git a/src/lang/en/template/dl.js b/src/lang/en/template/dl.js index 5fcd221..180993c 100644 --- a/src/lang/en/template/dl.js +++ b/src/lang/en/template/dl.js @@ -68,6 +68,9 @@ export default { jymc: '加液名称', jybh: '加液编号', ysjytj: '预设加液体积', + jlzb: '剂量组别', + jzbh: '菌种编号', + gspcdqk: '供试品沉淀情况' }, dl007: { ...common, diff --git a/src/lang/zh/template/dl.js b/src/lang/zh/template/dl.js index 2b6e2fc..7e49c41 100644 --- a/src/lang/zh/template/dl.js +++ b/src/lang/zh/template/dl.js @@ -69,6 +69,11 @@ export default { jymc: '加液名称', jybh: '加液编号', ysjytj: '预设加液体积', + jlzb: '剂量组别', + jzbh: '菌种编号', + gspcdqk: '供试品沉淀情况', + czxx: '操作信息', + pyxbh:"培养箱编号" }, dl007: { ...common, diff --git a/src/views/business/comps/template/comps/dl/DL006.vue b/src/views/business/comps/template/comps/dl/DL006.vue index ace8e5b..b3271ac 100644 --- a/src/views/business/comps/template/comps/dl/DL006.vue +++ b/src/views/business/comps/template/comps/dl/DL006.vue @@ -42,27 +42,36 @@ @onRegentSubmit="(e) => onRegentSubmit(e)" :showOperation="false" :showAddRow="false" - :formData="{stepTableFormData:formData.stepTableFormData_1,headerSelectFields:{}}" + :formData="formData" :showHeaderSelect="fillType === 'preFill'" :prefixKey="`jlzpzxxTable`" > - + {{ $t('template.dl.dl006.wcButton') }} - - - + + +
+ + +
0){ + this.clickFinish() + } + }, computed: { - czxxColumns() { - return [ - { - prop: 'jlzb', - label: '剂量组别', - bodyType: 'input', - bodyTypeFillType: 'preFill', - placeholder: '请输入剂量组别' - }, - { - prop: 'czrxm', - label: '菌种编号', - bodyType: 'checkbox', - width: 300, - headerColumns:[ - { - label: '菌种编号', - type:"span", - }, - { - type:"sj", - fillType: 'preFill', - key:"bh", - }, - { - type: 'input', - fillType:"preFill", - key:"srbh" - }, - { - type:"select", - fillType:"preFill", - key:"dw", - options: [ - {label:"mg/皿",value:"mg/皿"}, - ], - }, - ] - } - ] + czxxColumns: { + get() { + return this.rawCzxxColumns.map(col => ({ + ...col, + })); + }, + set(newColumns) { + // 赋值时:把新值同步到原始数据(关键!否则计算属性不会更新) + this.rawCzxxColumns = newColumns; + } }, // 备注表单配置 remarkConig() { @@ -213,7 +209,9 @@ export default { type: 'select', options: this.getDictOptions('business_pytj'), fillType: 'actFill', - otherCode: 'syddOther' + otherCode: 'syddOther', + compareTo:"pytjyt", + copyFrom:"pytjyt", } } }, @@ -250,7 +248,7 @@ export default { ] }, - // 操作信息表信息 + // 剂量组表信息 czInfoFormConfig() { return [ { @@ -290,7 +288,7 @@ export default { subType: 'button', isClearForm: true, subKey: 'jlzsl', - buttonName: 'template.dl.dl006.wcButton', + buttonName: 'form.saveConfirm', maxlength: 2, }, // pykssj: { @@ -306,6 +304,34 @@ export default { } ] }, + // 操作信息表信息 + czFormConfig() { + return [ + { + type: 'step', + config: { + pyxbh: { + label: 'template.dl.dl006.pyxbh', + type: 'yq', + fillType: 'actFill', + maxlength: 2, + }, + pytjcz: { + label: 'template.dl.dl003.pytj', + type: 'input', + disabled:true, + maxlength: 2, + }, + pykssjcz: { + label: 'template.dl.dl007.pykssj', + type: 'dateTime', + fillType: 'actFill', + maxlength: 4, + }, + } + } + ] + }, // 操作信息表菌种列表 jlzpzxxColumns() { return [ @@ -358,7 +384,8 @@ export default { data() { return { formData: {}, - refConf + refConf, + rawCzxxColumns:[], } }, methods: { @@ -374,7 +401,8 @@ export default { return; } const { jlzsl } = formFields; - if (!Number.isInteger(jlzsl) || jlzsl < 0) { + console.log(jlzsl,11) + if (!Number.isInteger(Number(jlzsl)) || Number(jlzsl) < 0) { console.warn('记录总数 jlzsl 必须是大于等于0的整数,当前值:', jlzsl); return; } @@ -451,6 +479,7 @@ export default { // return this.resourceTmp }, onRegentSubmit(e) { + console.log(e,909090) const { selectInfo, key, rowIndex } = e const { row } = selectInfo @@ -544,21 +573,109 @@ export default { }); } }, - //选择table header下拉框也要更新体积 - // onHeaderSelectChange(data){ - // const {key, headerSelectFields,dataSource=[]} = data; - // const keys = [ - // 'targetDiluentVolumeUnit', - // ] - // if(keys.includes(key)){ - // const {targetStartSolution,subTargetStartSolution} = this.$refs.stepFormPackageRef?.getFilledFormData(); - // const params = { - // subTargetStartSolution, - // headerSelectFields - // } - // this.batchUpdateTargetStartSolutionVolume(dataSource,targetStartSolution,params) - // } - // }, + //完成 + clickFinish() { + // 获取表单数据 + const { jzs, jlzsl, pxms, qsbh, stepTableFormData = [] } = this.getFilledFormData(); + // 初始化列配置数组 + let columns = []; + + // 1. 添加固定列:剂量组别 + columns.push({ + prop: 'jlzb', + label: 'template.dl.dl006.jlzb', + bodyType: 'input', + bodyFillType: 'preFill', // 修复:原bodyTypeFillType拼写错误 + }); + + // 2. 根据jzs的值动态生成指定数量的列 + if (jzs && !isNaN(Number(jzs)) && Number(jzs) > 0) { + for (let i = 0; i < Number(jzs); i++) { + columns.push({ + prop: `czrxm_${i}`, + label: 'template.dl.dl006.jzbh', + bodyType: 'checkbox', + bodyFillType: 'actFill', // 修复:actFill改为preFill,与数据填充类型匹配 + width: 300, + checkboxLabel:'', + headerColumns: [ + { + label: '菌种编号', + type: "span", + disabled: true, + editable: false + }, + { + type: "xj", + fillType: 'actFill', + key: `bh_${i}`, + required: true, + validator: (value) => { + if (!/^\d+$/.test(value)) { + return '请输入数字'; + } + if (value.length > 10) { + return '最多只能输入10个字符'; + } + return true; + } + }, + { + type: 'input', + fillType: "preFill", + key: `srbh_${i}` + }, + { + type: "select", + fillType: "preFill", + key: `dw_${i}`, + required: true, + options: this.getDictOptions('business_tjdw'), + placeholder: '请选择单位' + }, + ] + }); + } + } + + // 3. 添加固定列:供试品沉淀情况 + columns.push({ + prop: 'gspcdqk', + label: 'template.dl.dl006.gspcdqk', + bodyType: 'input', + bodyFillType: 'actFill', // 修复:原bodyTypeFillType拼写错误 + }); + + // 关键修复1:先更新列配置,确保表格能识别字段 + this.rawCzxxColumns = [...columns]; // 解构赋值触发响应式更新 + this.$nextTick(() => { // 等待列配置更新完成后再赋值数据 + const doseGroupCount = Number(stepTableFormData.length) || 0; + const parallelDishCount = Number(pxms) || 0; + if (doseGroupCount <= 0 || parallelDishCount <= 0) { + this.$message.warning('剂量组数量或平行皿数需为大于0的数字'); + return; + } + + // 关键修复2:先构建完整的数据源数组,再一次性更新 + const newDataSource = []; + let rowIndexNew = 0; + for (let doseIndex = 0; doseIndex < doseGroupCount; doseIndex++) { + for (let dishIndex = 0; dishIndex < parallelDishCount; dishIndex++) { + const rowData = { + jlzb: stepTableFormData[doseIndex]?.jlzmc || '', + gspcdqk: '', + // 初始化动态列字段,避免undefined + }; + newDataSource.push(rowData); + rowIndexNew++; + } + } + // 在构建 newDataSource 之后,补充编号生成逻辑 + console.log(this.getFilledFormData()) + // 关键修复3:一次性更新数据源,覆盖原空数据 + this.$refs.czxxTableRef.updateDataSource(newDataSource); + }); + }, } }