diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 79b7ef8..9b23c64 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -122,6 +122,19 @@ @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" /> +
@@ -342,6 +355,18 @@ export default { this.onErrorUpdate(rowIndex, colIndex, col.prop, !isValid); this.$emit("onCheckboxTagChange", rowIndex, col, value) }, + // checkbox变化 + onCheckboxChange(rowIndex, colIndex, col, value) { + this.localDataSource[rowIndex][col.prop] = value; + // 输入时清除对应表单项的错误状态 + this.formErrors = this.formErrors.filter(error => + !(error.rowIndex === rowIndex && + error.colIndex === colIndex && + error.field === col.prop) + ); + this.$emit("onCheckboxChange", rowIndex, col, value); + this.justUpdateFilledFormData(); + }, handleClickButton(e, data, key, rowIndex, colIndex) { this.$emit("clickButton", key, rowIndex, colIndex, e, data,) }, @@ -524,6 +549,23 @@ export default { this.formErrors.push(errorItem); } } + } else if (col.bodyType === "checkbox") { + // checkbox类型的校验逻辑 - 通常checkbox不需要必填校验,除非明确指定 + // 如果需要必填,可以检查是否至少选中一个 + if (col.required && !col.bodyDisabled) { + const hasChecked = Array.isArray(mainValue) ? mainValue.length > 0 : mainValue; + if (!hasChecked) { + const errorItem = { + rowIndex, + colIndex, + field: col.prop, + label: this.$t(col.label), + error: `请选择${this.$t(col.label)}` + }; + errors.push(errorItem); + this.formErrors.push(errorItem); + } + } } else { if (isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') { const errorItem = { @@ -735,6 +777,15 @@ export default { if (col.bodyDisabled) { item.disabled = col.bodyDisabled; } + // 支持动态checkboxLabel - 从行数据中获取 + const dynamicLabelKey = col.prop + 'Label'; + if (currentItem && currentItem[dynamicLabelKey]) { + // 优先从行数据中获取动态label(如jzbh1Label) + item.checkboxLabel = currentItem[dynamicLabelKey]; + } else if (col.checkboxLabel !== undefined && col.checkboxLabel !== '') { + // 否则使用列配置的checkboxLabel + item.checkboxLabel = this.$t(col.checkboxLabel); + } return item }, getBodyButtonItem(col,) { diff --git a/src/lang/en/template/dl.js b/src/lang/en/template/dl.js index 09c5663..af3860f 100644 --- a/src/lang/en/template/dl.js +++ b/src/lang/en/template/dl.js @@ -40,7 +40,12 @@ export default { dl008: { ...common, cxqk: 'Imaging Status', - wrqk: 'Contamination Status' + wrqk: 'Contamination Status', + jlzb: 'Dose Group', + jzbh1: 'Strain Number', + jzbh2: 'Strain Number', + jzbh3: 'Strain Number', + jzbh4: 'Strain Number' }, dl009: { ...common, diff --git a/src/lang/zh/template/dl.js b/src/lang/zh/template/dl.js index 4c6e507..05dd295 100644 --- a/src/lang/zh/template/dl.js +++ b/src/lang/zh/template/dl.js @@ -40,7 +40,12 @@ export default { dl008: { ...common, cxqk: '成像情况', - wrqk: '污染情况' + wrqk: '污染情况', + jlzb: '剂量组别', + jzbh1: '菌种编号', + jzbh2: '菌种编号', + jzbh3: '菌种编号', + jzbh4: '菌种编号' }, dl009: { ...common, diff --git a/src/views/business/comps/template/comps/dl/DL008.vue b/src/views/business/comps/template/comps/dl/DL008.vue index 2711f06..0dadc2e 100644 --- a/src/views/business/comps/template/comps/dl/DL008.vue +++ b/src/views/business/comps/template/comps/dl/DL008.vue @@ -52,9 +52,12 @@ :columns="cxqkColumns" :ref="refConf.cxqk" @onRegentSubmit="(e) => onRegentSubmit(e)" - :showOperation="fillType === 'actFill'" - :formData="formData" + :showOperation="false" + :showAddRow="false" + :formData="cxqkFormData" :prefixKey="`cxqkTable`" + :isBorder="true" + :showSort="false" >