onRegentSubmit(e)"
- :showOperation="false"
- :showAddRow="false"
- :formData="{stepTableFormData:formData.stepTableFormData_1,headerSelectFields:{},headerFields:formData.headerFields}"
- :showHeaderSelect="fillType === 'preFill'"
- :prefixKey="`czxxTable`"
- >
-
+
+
+
+ onRegentSubmit(e)"
+ :showOperation="false"
+ :showAddRow="false"
+ :formData="{stepTableFormData:formData.stepTableFormData_1,headerSelectFields:{},headerFields:formData.headerFields}"
+ :showHeaderSelect="fillType === 'preFill'"
+ :prefixKey="`czxxTable`"
+ >
+
+
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);
+ });
+ },
}
}