From 5439618b08af4894d4e004c847f5840197fa39a8 Mon Sep 17 00:00:00 2001 From: lslaiwy <1209768238@qq.com> Date: Fri, 27 Feb 2026 22:47:05 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix[=E8=A1=A8=E5=8D=95=E6=A8=A1=E6=9D=BF]?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/comps/template/comps/dl/DL020.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/views/business/comps/template/comps/dl/DL020.vue b/src/views/business/comps/template/comps/dl/DL020.vue index ba36f9e..02205f1 100644 --- a/src/views/business/comps/template/comps/dl/DL020.vue +++ b/src/views/business/comps/template/comps/dl/DL020.vue @@ -140,16 +140,18 @@ export default { // this.$refs.ypjsInfoRef.updateFormData("jssj", moment().format("YYYY/MM/DD HH:mm"),{isUpdateRecord:true,signData}); // }, //获取已填写的表单数据 - getFilledFormData() { - const baseData = this.$refs.baseInfoRef.getFilledFormData(); - const swypyjData = this.$refs.swypyjInfoRef.getFilledFormData(); - const remarkData = this.$refs.remarkRef.getFilledFormData(); + async getFilledFormData() { + let content = await this.validFormFields(["baseInfoRef", "swypyjInfoRef", "stepRef", "remarkRef"]); + return content; + // const baseData = this.$refs.baseInfoRef.getFilledFormData(); + // const swypyjData = this.$refs.swypyjInfoRef.getFilledFormData(); + // const remarkData = this.$refs.remarkRef.getFilledFormData(); - return { - ...baseData, - ...swypyjData, - ...remarkData, - } + // return { + // ...baseData, + // ...swypyjData, + // ...remarkData, + // } }, //获取填写完成的表单数据 async getFormData() { @@ -168,7 +170,7 @@ export default { return await this.validFormFields(refsToValidate); }, getResource() { - let content = this.getFilledFormData(); + // let content = this.getFilledFormData(); //使用的试剂、仪器 const stepResource = this.$refs.stepRef.getStepResource() this.resourceTmp = stepResource.sjResource || [] From 15bf8051ee009e998e28f0c6e1fed93f24deaaea Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Sat, 28 Feb 2026 20:05:07 +0800 Subject: [PATCH 2/8] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]?= =?UTF-8?q?[=E6=9A=82=E5=AD=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/CustomTable.vue | 60 +++++++++++++++------- src/components/Template/HandleFormItem.vue | 55 ++++++++++---------- .../business/comps/template/comps/yp/YP003.vue | 7 +-- 3 files changed, 74 insertions(+), 48 deletions(-) diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 5f8df1f..d51aa3d 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -27,7 +27,7 @@ -
+
操作
@@ -110,17 +110,16 @@
@@ -190,7 +189,7 @@
-
@@ -227,6 +226,10 @@ export default { HandleFormItem }, props: { + operationWidth: { + type: String, + default: '245px', + }, // 是否显示表头选择器 showHeaderSelect: { type: Boolean, @@ -316,14 +319,26 @@ export default { unmounted() { this.oldLocalDataSource = []; }, - methods: { - onCheckboxTagChange(rowIndex, colIndex,tagIndex, e) { - console.log(e,"eee") - }, - handleClickButton(e, data, key, rowIndex, colIndex) { - this.$emit("clickButton", key, rowIndex, colIndex, e, data,) - }, - beforeSaveRecord(data, callback, rowIndex, col, row) { + methods: { + // 删除checkboxTag + onDeleteCheckboxTag(rowIndex, col, tagIndex) { + this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); + this.$emit("onDeleteTag", rowIndex, col,tagIndex); + const params = { + type: "fieldChanged", + newRecord:null, + resourceList: null, + } + EventBus.$emit('onModifyRecord', params,) + }, + onCheckboxTagChange(rowIndex, col,tagIndex, value) { + this.localDataSource[rowIndex][col.prop][tagIndex] = value; + this.$emit("onCheckboxTagChange", rowIndex, col,tagIndex, value) + }, + handleClickButton(e, data, key, rowIndex, colIndex) { + this.$emit("clickButton", key, rowIndex, colIndex, e, data,) + }, + beforeSaveRecord(data, callback, rowIndex, col, row) { this.$emit("beforeSaveRecord", { inputData: data, callback, rowIndex, key: col.prop, rowData: row, dataSource: this.localDataSource }) }, getCellWidth(col) { @@ -471,7 +486,8 @@ export default { if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) { // 检查主字段 const mainValue = row[col.prop]; - if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span') { + console.log(mainValue,"mainValue") + if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span'&& col.bodyType !== 'button') { const errorItem = { rowIndex, colIndex, @@ -484,7 +500,7 @@ export default { } // 检查子字段(如果有) - if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span') { + if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span'&&col.bodySubType!=="button") { const subValue = row[col.bodySubKey]; console.log(col, subValue, "subValue") if (this.isValueEmpty(subValue)) { @@ -884,7 +900,8 @@ export default { } .custom-table-body { - max-height: 300px; + max-height: 500px; + overflow-y: auto; /* 可根据需要调整或由父组件控制 */ } @@ -1030,4 +1047,11 @@ export default { .flex-wrap{ flex-wrap: wrap; } +.error-border{ + border-color: #ff5d5d ; + box-shadow: 0 0 6px #ffc3c3 ; + padding: 8px; + border-radius: 4px; + border: 1px solid; +} \ No newline at end of file diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 7ebe2d8..df49189 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -93,8 +93,9 @@ :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
-
- + - - {{ tagValue || '点击输入' }} + {{ tagValue}} + + + +
-
@@ -270,7 +276,6 @@ export default { checkboxValue: this.getChecked(),//是否选中 checkboxTagChecked: checkboxTagChecked, // checkboxTag类型的checkbox选中状态 tagValue: tagValue, // checkboxTag类型的tag值 - isEditingTag: false, // 是否正在编辑tag uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], //试剂/仪器/供试品等类型 selectRegentInfo: {},//选择的试剂/仪器/供试品等信息 @@ -654,7 +659,7 @@ export default { preFill: "blue-border",//预填写的边框颜色 } // 如果有错误状态,返回红色边框样式,覆盖原有的边框颜色 - if (this.error && this.type !== "attachment") { + if (this.error && this.type !== "attachment" && this.type !== "checkboxTag") { return "error-border"; } return typeObj[fillType] || "" @@ -816,16 +821,11 @@ export default { onCheckboxTagChange() { this.emitCheckboxTagValue(); }, - // 点击tag区域 - onTagClick() { - this.isEditingTag = true; - this.$nextTick(() => { - this.$refs.tagInput && this.$refs.tagInput.focus(); - }); - }, + // tag输入框失去焦点 - onTagBlur() { - this.isEditingTag = false; + onTagBlur(e) { + const value = e.target.value; + this.tagValue = value; this.emitCheckboxTagValue(); // 触发保存记录 if (this.tagValue) { @@ -834,9 +834,7 @@ export default { }, // 删除tag onDeleteTag() { - this.tagValue = ''; - this.emitCheckboxTagValue(); - this.onCommonHandleSaveRecord(''); + this.$emit("deleteTag"); }, // 发送checkboxTag的值 emitCheckboxTagValue() { @@ -844,7 +842,7 @@ export default { checked: this.checkboxTagChecked, tagValue: this.tagValue }; - this.$emit('change', value); + this.inputValue = value; }, // 统一处理失去焦点事件 onBlur(e) { @@ -1649,8 +1647,8 @@ export default { .checkbox-tag-container { border-radius: 4px; // transition: all 0.3s; - margin-bottom: 5px; - margin-right: 5px; + margin-bottom: 10px; + margin-right: 10px; &.error-border { border-color: #ff5d5d !important; @@ -1664,7 +1662,7 @@ export default { .tag-content { cursor: pointer; - + position: relative; .tag-input { width: 100px; } @@ -1678,15 +1676,18 @@ export default { .delete-icon { cursor: pointer; color: #909399; - font-size: 14px; + font-size: 12px; padding: 2px; border-radius: 50%; + position: absolute; + top:6px; + right:5px; // transition: all 0.3s; - &:hover { - color: #ff5d5d; + // &:hover { + color: red; background-color: #f5f5f5; - } + // } } } } diff --git a/src/views/business/comps/template/comps/yp/YP003.vue b/src/views/business/comps/template/comps/yp/YP003.vue index e40bb41..471c569 100644 --- a/src/views/business/comps/template/comps/yp/YP003.vue +++ b/src/views/business/comps/template/comps/yp/YP003.vue @@ -17,6 +17,7 @@ :ref="`tableRef`" :columns="tableColumns" :formData="formData" + operationWidth = "80px" :prefixKey = "`table`" fieldItemLabel = "template.common.operationSteps" @clickButton="handleClickButton" @@ -159,7 +160,7 @@ export default { prop: 'cyd', bodyType: 'input', bodyFillType: 'actFill', - width: 280, + width: 100, bodyMaxlength: 50, },{ label: 'template.yp.yp003.dwbh', @@ -177,7 +178,7 @@ export default { prop: 'ypsl', bodyType: 'input', bodyFillType: 'actFill', - width: 280, + width: 80, }] }, }, @@ -234,7 +235,7 @@ export default { const data = excelData.splice(1); const tagData = data.map((item)=>{ return { - checked:false, + checked:undefined, tagValue:item[0], } }) From 5a1cac9ad7c1902f37e090cdffc4b57eb0fd88f7 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Sat, 28 Feb 2026 20:14:54 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]?= =?UTF-8?q?[=E6=9A=82=E5=AD=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/CustomTable.vue | 114 +++++++++++++++++--------------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index d51aa3d..31b77e6 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -110,16 +110,16 @@
@@ -319,26 +319,26 @@ export default { unmounted() { this.oldLocalDataSource = []; }, - methods: { - // 删除checkboxTag - onDeleteCheckboxTag(rowIndex, col, tagIndex) { - this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); - this.$emit("onDeleteTag", rowIndex, col,tagIndex); - const params = { - type: "fieldChanged", - newRecord:null, - resourceList: null, - } - EventBus.$emit('onModifyRecord', params,) - }, - onCheckboxTagChange(rowIndex, col,tagIndex, value) { - this.localDataSource[rowIndex][col.prop][tagIndex] = value; - this.$emit("onCheckboxTagChange", rowIndex, col,tagIndex, value) - }, - handleClickButton(e, data, key, rowIndex, colIndex) { - this.$emit("clickButton", key, rowIndex, colIndex, e, data,) - }, - beforeSaveRecord(data, callback, rowIndex, col, row) { + methods: { + // 删除checkboxTag + onDeleteCheckboxTag(rowIndex, col, tagIndex) { + this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); + this.$emit("onDeleteTag", rowIndex, col, tagIndex); + const params = { + type: "fieldChanged", + newRecord: null, + resourceList: null, + } + EventBus.$emit('onModifyRecord', params,) + }, + onCheckboxTagChange(rowIndex, col, tagIndex, value) { + this.localDataSource[rowIndex][col.prop][tagIndex] = value; + this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value) + }, + handleClickButton(e, data, key, rowIndex, colIndex) { + this.$emit("clickButton", key, rowIndex, colIndex, e, data,) + }, + beforeSaveRecord(data, callback, rowIndex, col, row) { this.$emit("beforeSaveRecord", { inputData: data, callback, rowIndex, key: col.prop, rowData: row, dataSource: this.localDataSource }) }, getCellWidth(col) { @@ -486,35 +486,43 @@ export default { if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) { // 检查主字段 const mainValue = row[col.prop]; - console.log(mainValue,"mainValue") - if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span'&& col.bodyType !== 'button') { - const errorItem = { - rowIndex, - colIndex, - field: col.prop, - label: this.$t(col.label), - error: `请填写${this.$t(col.label)}` - }; - errors.push(errorItem); - this.formErrors.push(errorItem); - } + if (col.bodyType === "checkboxTag") { + if(this.templateFillType === "actFill"){ - // 检查子字段(如果有) - if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span'&&col.bodySubType!=="button") { - const subValue = row[col.bodySubKey]; - console.log(col, subValue, "subValue") - if (this.isValueEmpty(subValue)) { + }else if(this.templateFillType === "preFill"){ + + } + } else { + if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') { const errorItem = { rowIndex, colIndex, - field: col.bodySubKey, - label: `${this.$t(col.label)}单位`, - error: `请填写${this.$t(col.label)}单位` + field: col.prop, + label: this.$t(col.label), + error: `请填写${this.$t(col.label)}` }; errors.push(errorItem); this.formErrors.push(errorItem); } + + // 检查子字段(如果有) + if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span' && col.bodySubType !== "button") { + const subValue = row[col.bodySubKey]; + console.log(col, subValue, "subValue") + if (this.isValueEmpty(subValue)) { + const errorItem = { + rowIndex, + colIndex, + field: col.bodySubKey, + label: `${this.$t(col.label)}单位`, + error: `请填写${this.$t(col.label)}单位` + }; + errors.push(errorItem); + this.formErrors.push(errorItem); + } + } } + console.log(col.otherCode, "col.otherCode") // 检查其他输入框 @@ -1044,14 +1052,16 @@ export default { text-align: center; width: 100px; } -.flex-wrap{ + +.flex-wrap { flex-wrap: wrap; } -.error-border{ - border-color: #ff5d5d ; - box-shadow: 0 0 6px #ffc3c3 ; - padding: 8px; - border-radius: 4px; - border: 1px solid; + +.error-border { + border-color: #ff5d5d; + box-shadow: 0 0 6px #ffc3c3; + padding: 8px; + border-radius: 4px; + border: 1px solid; } \ No newline at end of file From b272a99172988b2bc700bc5f9af36ddb855717b8 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Sat, 28 Feb 2026 21:26:05 +0800 Subject: [PATCH 4/8] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]?= =?UTF-8?q?[=E6=9A=82=E5=AD=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/CustomTable.vue | 67 ++++++++++++++++------ src/components/Template/HandleFormItem.vue | 14 ++--- .../Template/operation/TableOpertaion.vue | 10 +++- .../Template/operation/TableOpertaionDelete.vue | 12 +++- .../business/comps/template/comps/yp/YP003.vue | 6 +- .../comps/template/mixins/templateMixin.js | 11 ++++ 6 files changed, 91 insertions(+), 29 deletions(-) diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 31b77e6..83026c2 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -111,15 +111,13 @@ @@ -324,15 +322,11 @@ export default { onDeleteCheckboxTag(rowIndex, col, tagIndex) { this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); this.$emit("onDeleteTag", rowIndex, col, tagIndex); - const params = { - type: "fieldChanged", - newRecord: null, - resourceList: null, - } - EventBus.$emit('onModifyRecord', params,) + this.justUpdateFilledFormData(); }, - onCheckboxTagChange(rowIndex, col, tagIndex, value) { + onCheckboxTagChange(rowIndex, colIndex, col, tagIndex, value) { this.localDataSource[rowIndex][col.prop][tagIndex] = value; + this.onErrorUpdate(rowIndex, colIndex, col.prop, value?false:true); this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value) }, handleClickButton(e, data, key, rowIndex, colIndex) { @@ -487,10 +481,35 @@ export default { // 检查主字段 const mainValue = row[col.prop]; if (col.bodyType === "checkboxTag") { - if(this.templateFillType === "actFill"){ - - }else if(this.templateFillType === "preFill"){ - + // checkboxTag类型的校验逻辑 + if (this.templateFillType === "actFill") { + // actFill时,检查是否有checked为true的项 + const hasChecked = mainValue && mainValue.some(tag => tag.checked === true); + if (!hasChecked && !col.bodyDisabled) { + 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 (this.templateFillType === "preFill") { + // preFill时,检查所有tagValue是否不为空 + const allTagValuesFilled = mainValue && mainValue.every(tag => tag.tagValue && tag.tagValue.trim() !== ''); + if (!allTagValuesFilled && !col.bodyDisabled) { + 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 (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') { @@ -761,6 +780,15 @@ export default { return true; }, + // 只是更新已填写的表单数据,不触发校验 + justUpdateFilledFormData(){ + const params = { + type: "fieldChanged", + newRecord: null, + resourceList: null, + } + EventBus.$emit('onModifyRecord', params,) + }, onAddRow() { if (this.$listeners && this.$listeners['onAddRow']) { this.$emit('onAddRow'); @@ -772,6 +800,7 @@ export default { targetDiluentVolumePrecision: 3,//小数点精度默认为3 targetStartSolutionVolumePrecision: 3,//小数点精度默认为3 }); + this.justUpdateFilledFormData() }, // 添加行 @@ -1055,13 +1084,13 @@ export default { .flex-wrap { flex-wrap: wrap; + gap:10px; } -.error-border { - border-color: #ff5d5d; +.row-error-border { box-shadow: 0 0 6px #ffc3c3; padding: 8px; border-radius: 4px; - border: 1px solid; + border: 1px solid #ff5d5d; } \ No newline at end of file diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index df49189..a42a2f4 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -820,6 +820,7 @@ export default { // checkboxTag的checkbox变化处理 onCheckboxTagChange() { this.emitCheckboxTagValue(); + this.onCommonHandleSaveRecord(); }, // tag输入框失去焦点 @@ -827,10 +828,7 @@ export default { const value = e.target.value; this.tagValue = value; this.emitCheckboxTagValue(); - // 触发保存记录 - if (this.tagValue) { - this.onCommonHandleSaveRecord(this.tagValue); - } + this.onCommonHandleSaveRecord(this.tagValue); }, // 删除tag onDeleteTag() { @@ -961,7 +959,9 @@ export default { //处理更新记录 handleUpdateRecord(data,recordData) { const baseInfo = this.getCommonRecordInfo(); - if (!this.oldValue && !this.inputValue) return; + if (!this.oldValue && !this.inputValue){ + return + } if(recordData){ this.oldValue = recordData.oldValue; this.inputValue = recordData.inputValue; @@ -1647,8 +1647,8 @@ export default { .checkbox-tag-container { border-radius: 4px; // transition: all 0.3s; - margin-bottom: 10px; - margin-right: 10px; + // margin-bottom: 10px; + // margin-right: 10px; &.error-border { border-color: #ff5d5d !important; diff --git a/src/components/Template/operation/TableOpertaion.vue b/src/components/Template/operation/TableOpertaion.vue index 1483bad..7cdc64b 100644 --- a/src/components/Template/operation/TableOpertaion.vue +++ b/src/components/Template/operation/TableOpertaion.vue @@ -162,7 +162,15 @@ export default { }, // 删除行 deleteRow(index) { - this.$emit("deleteRow", index) + this.$emit("deleteRow", index); + setTimeout(() => { + const params = { + type: "fieldChanged", + newRecord: null, + resourceList: null, + } + EventBus.$emit('onModifyRecord', params,) + }, 30); } } } diff --git a/src/components/Template/operation/TableOpertaionDelete.vue b/src/components/Template/operation/TableOpertaionDelete.vue index c9f6562..54b3401 100644 --- a/src/components/Template/operation/TableOpertaionDelete.vue +++ b/src/components/Template/operation/TableOpertaionDelete.vue @@ -10,6 +10,8 @@ + diff --git a/src/views/business/comps/template/comps/dl/DL018.vue b/src/views/business/comps/template/comps/dl/DL018.vue new file mode 100644 index 0000000..02205f1 --- /dev/null +++ b/src/views/business/comps/template/comps/dl/DL018.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/views/business/comps/template/comps/dl/DL019.vue b/src/views/business/comps/template/comps/dl/DL019.vue new file mode 100644 index 0000000..02205f1 --- /dev/null +++ b/src/views/business/comps/template/comps/dl/DL019.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/views/business/comps/template/comps/dl/DL021.vue b/src/views/business/comps/template/comps/dl/DL021.vue new file mode 100644 index 0000000..02205f1 --- /dev/null +++ b/src/views/business/comps/template/comps/dl/DL021.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/views/business/comps/template/comps/dl/DL022.vue b/src/views/business/comps/template/comps/dl/DL022.vue new file mode 100644 index 0000000..02205f1 --- /dev/null +++ b/src/views/business/comps/template/comps/dl/DL022.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/views/business/comps/template/comps/dl/DL023.vue b/src/views/business/comps/template/comps/dl/DL023.vue new file mode 100644 index 0000000..02205f1 --- /dev/null +++ b/src/views/business/comps/template/comps/dl/DL023.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/views/business/comps/template/comps/dl/DL024.vue b/src/views/business/comps/template/comps/dl/DL024.vue new file mode 100644 index 0000000..02205f1 --- /dev/null +++ b/src/views/business/comps/template/comps/dl/DL024.vue @@ -0,0 +1,205 @@ + + + + + From 36f18c146f7f1c1b7490f0c3bd6ff615915d433a Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Sat, 28 Feb 2026 22:46:18 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]?= =?UTF-8?q?[=E6=9A=82=E5=AD=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/CustomTable.vue | 3 +- src/components/Template/HandleFormItem.vue | 193 +++++++++++---------- .../Template/mixins/formPackageMixins.js | 1 - .../business/comps/template/comps/yp/YP003.vue | 8 +- 4 files changed, 115 insertions(+), 90 deletions(-) diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 83026c2..d5044ec 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -325,9 +325,10 @@ export default { this.justUpdateFilledFormData(); }, onCheckboxTagChange(rowIndex, colIndex, col, tagIndex, value) { + console.log(value,"vvv") this.localDataSource[rowIndex][col.prop][tagIndex] = value; this.onErrorUpdate(rowIndex, colIndex, col.prop, value?false:true); - this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value) + this.$emit("onCheckboxTagChange", rowIndex, col, this.localDataSource[rowIndex][col.prop]) }, handleClickButton(e, data, key, rowIndex, colIndex) { this.$emit("clickButton", key, rowIndex, colIndex, e, data,) diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index a42a2f4..5bec01e 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -24,12 +24,11 @@ :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue" :disabled="getDisabled()" :placeholder="getPlaceholder()" @change="onItemCheckboxChange"> - - + + {{ option.label }} @@ -41,11 +40,10 @@ {{ option.label }}
- +
@@ -63,7 +61,7 @@ {{ $t(item.buttonName) }} - +
- +
- - - {{ tagValue}} + + + {{ tagValue }} - - + +
@@ -248,23 +237,23 @@ export default { }, data() { let initialValue = this.value; - let initialOtherValues = {},checkboxTagChecked = false,tagValue = ''; - + let initialOtherValues = {}, checkboxTagChecked = false, tagValue = ''; + // 如果是checkboxList类型且value是对象格式 if (this.type === 'checkboxList' && this.value && typeof this.value === 'object') { initialValue = this.value.checkboxValues || []; initialOtherValues = this.value.otherValues || {}; } else if (this.type === 'checkboxList' && !Array.isArray(this.value)) { initialValue = []; - }else if (this.type === 'checkboxTag' && this.value && typeof this.value === 'object') { - checkboxTagChecked = this.value.checked || false; + } else if (this.type === 'checkboxTag' && this.value && typeof this.value === 'object') { + checkboxTagChecked = this.value.checked; tagValue = this.value.tagValue || ''; } return { inputValue: initialValue, oldValue: initialValue, // 记录上一次的值 otherValues: initialOtherValues, // 存储checkboxList中otherCode对应的输入值 - oldOtherValues: {...initialOtherValues}, // 记录上一次的otherValues + oldOtherValues: { ...initialOtherValues }, // 记录上一次的otherValues showModal: false, // 控制模态框显示 modificationRecords: [], // 存储修改记录 modalTimer: null, // 用于延迟隐藏模态框 @@ -275,6 +264,7 @@ export default { visible: false,//是否显示弹窗 checkboxValue: this.getChecked(),//是否选中 checkboxTagChecked: checkboxTagChecked, // checkboxTag类型的checkbox选中状态 + oldCheckboxTagChecked: checkboxTagChecked, // checkboxTag类型的checkbox选中状态 tagValue: tagValue, // checkboxTag类型的tag值 uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], //试剂/仪器/供试品等类型 @@ -290,7 +280,7 @@ export default { }, watch: { value(newVal) { - console.log(newVal,"newVal") + console.log(newVal, "newVal") if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') { this.inputValue = newVal.checkboxValues || []; this.otherValues = newVal.otherValues || {}; @@ -333,13 +323,13 @@ export default { EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit) }, methods: { - getFlexClass(){ - const noFlexArr = ["radio","checkboxTag"] + getFlexClass() { + const noFlexArr = ["radio", "checkboxTag"] return noFlexArr.includes(this.type) ? '' : 'flex1' }, - getDecimalDigits(){ - const {precision} = this.item; - if(!isNaN(precision)){ + getDecimalDigits() { + const { precision } = this.item; + if (!isNaN(precision)) { return precision } return 6 @@ -531,11 +521,11 @@ export default { // 执行试剂提交的共同逻辑 executeReagentSubmit(data) { this.inputValue = data.selectedId; - const {filledCodes=[]} = this.item; - console.log(filledCodes,"filledCodes") - const {selectInfo,row} = data; - if(filledCodes.length>0){ - this.inputValue = row[filledCodes[0]]+"("+row[filledCodes[1]]+")"; + const { filledCodes = [] } = this.item; + console.log(filledCodes, "filledCodes") + const { selectInfo, row } = data; + if (filledCodes.length > 0) { + this.inputValue = row[filledCodes[0]] + "(" + row[filledCodes[1]] + ")"; } this.selectRegentInfo = data; EventBus.$emit("hideSelectMixReagentDialog"); @@ -779,7 +769,7 @@ export default { // 检查是否有被取消选中的checkbox if (this.oldValue && Array.isArray(this.oldValue)) { const uncheckedValues = this.oldValue.filter(oldVal => !this.inputValue.includes(oldVal)); - + // 清除被取消选中的checkbox对应的otherValues if (uncheckedValues.length > 0) { this.item.options.forEach(option => { @@ -790,19 +780,19 @@ export default { } } value = { - checkboxValues: this.inputValue, - otherValues: this.otherValues - }; - if(val){ - + checkboxValues: this.inputValue, + otherValues: this.otherValues + }; + if (val) { + this.onCommonHandleSaveRecord(); } } - + this.$emit('input', value); this.$emit('change', value); - + // 根据输入值判断是否显示错误状态 const isEmpty = this.isValueEmpty(value); @@ -818,7 +808,8 @@ export default { this.onInputChange(); }, // checkboxTag的checkbox变化处理 - onCheckboxTagChange() { + onCheckboxTagChange(e) { + this.checkboxTagChecked = e; this.emitCheckboxTagValue(); this.onCommonHandleSaveRecord(); }, @@ -917,19 +908,24 @@ export default { this.$emit("change", this.inputValue); return; } - + // 值发生了变化,需要弹出密码输入框 - const isSame = this.isEqual(this.oldValue, this.inputValue); - let isOtherValuesSame = true; + let isSame = true, isOldValueEmpty = true; // 如果是checkboxList类型,需要同时比较otherValues if (this.type === 'checkboxList' && this.otherValues) { - isOtherValuesSame = this.isEqual(this.oldOtherValues, this.otherValues); - } - console.log(this.oldValue, this.inputValue, isSame, isOtherValuesSame,this.otherValues,this.oldOtherValues,"是否需要记录修改记录") - if (isSame && isOtherValuesSame) { + isSame = this.isEqual(this.oldOtherValues, this.otherValues); + isOldValueEmpty = this.isValueEmpty(this.oldOtherValues); + } else if (this.type === "checkboxTag") { + isSame = this.isEqual(this.oldCheckboxTagChecked, this.checkboxTagChecked); + isOldValueEmpty = this.isValueEmpty(this.oldCheckboxTagChecked); + }else{ + isSame = this.isEqual(this.oldValue, this.inputValue) + isOldValueEmpty = this.isValueEmpty(this.oldValue); + } + if (isSame) { return; } - if (!this.isValueEmpty(this.oldValue) && !(isSame && isOtherValuesSame) && this.templateFillType === "actFill") { + if (!isOldValueEmpty && !(isSame) && this.templateFillType === "actFill") { // 通过EventBus触发电子签名弹窗 EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); } else {//如果是第一次填写,不需要密码验证 @@ -942,11 +938,16 @@ export default { // 用户点击取消,还原数据 let oldValue = this.oldValue; if (this.type === 'checkboxList') { - oldValue = { + oldValue = { checkboxValues: oldValue.checkboxValues || oldValue, otherValues: this.oldOtherValues }; - } + }else if(this.type === "checkboxTag"){ + oldValue = { + checked: this.oldCheckboxTagChecked, + tagValue: this.tagValue, + }; + } this.inputValue = this.oldValue; this.$emit('input', oldValue); // 触发 v-model 更新 // this.$emit("blur", this.oldValue); @@ -957,20 +958,26 @@ export default { }, //处理更新记录 - handleUpdateRecord(data,recordData) { + handleUpdateRecord(data, recordData) { const baseInfo = this.getCommonRecordInfo(); - if (!this.oldValue && !this.inputValue){ + if (!this.oldValue && !this.inputValue) { return } - if(recordData){ + if (recordData) { this.oldValue = recordData.oldValue; this.inputValue = recordData.inputValue; } + let recordOldVlaue = this.oldValue,recordValue = this.inputValue,isModify = !!this.oldValue; + if(this.type === "checkboxTag"){ + recordOldVlaue =this.oldValue? `${this.oldValue.tagValue}:${this.oldValue.checked?'勾选':'未勾选'}`:''; + recordValue = `${this.inputValue?.tagValue}:${this.inputValue?.checked?'勾选':'未勾选'}`; + isModify = this.oldValue.checked !== undefined; + } const record = { ...baseInfo, - oldValue: this.oldValue, - value: this.inputValue, - title: this.oldValue ? "修改" : "提交", + oldValue: recordOldVlaue, + value: recordValue, + title: isModify ? "修改" : "提交", time: moment().format("YYYY-MM-DD HH:mm:ss"), } if (data) { @@ -982,11 +989,13 @@ export default { newRecord: [record], resourceList: this.getZdxgjl(), } - - // 更新oldValue和oldOtherValues + + // 更新oldValue和oldOtherValues if (this.type === 'checkboxList') { this.oldValue = [...this.inputValue]; this.oldOtherValues = { ...this.otherValues }; + }else if(this.type === "checkboxTag"){ + this.oldCheckboxTagChecked = this.checkboxTagChecked; } let value = this.inputValue; if (this.type === 'checkboxList') { @@ -994,10 +1003,15 @@ export default { checkboxValues: this.inputValue, otherValues: this.otherValues }; + }else if(this.type === "checkboxTag"){ + value = { + checked: this.checkboxTagChecked, + tagValue: this.tagValue, + }; } - if(this.type === "button"){ - this.$emit('clickButton', this.item,this.inputValue,data); - if(this.templateFillType === "preFill"){ + if (this.type === "button") { + this.$emit('clickButton', this.item, this.inputValue, data); + if (this.templateFillType === "preFill") { return; } } @@ -1015,7 +1029,7 @@ export default { } this.$nextTick(() => { EventBus.$emit('onModifyRecord', params,) - console.log(params,"onModifyRecord") + console.log(params, "onModifyRecord") if (this.regentType.includes(this.item.type)) { this.$emit("onRegentSubmit", this.selectRegentInfo, this.inputValue); } @@ -1104,7 +1118,7 @@ export default { isShowHandle() { const { fillType } = this.item; //只有当模板状态不是预填时,才显示操作按钮 - return this.templateFillType !== "preFill" && fillType === "actFill"&&this.type!=="button" + return this.templateFillType !== "preFill" && fillType === "actFill" && this.type !== "button" }, //判断是否禁用 getDisabled() { @@ -1580,15 +1594,17 @@ export default { margin-right: 16px; display: flex; align-items: center; + &:not(:last-child) { margin-bottom: 10px; } + // display: inline-block; - + .el-input { width: 200px; margin-left: 10px; - + &.error-border { .el-input__inner { border-color: #ff5d5d !important; @@ -1598,7 +1614,7 @@ export default { } } - + } .orange-border { @@ -1610,6 +1626,7 @@ export default { } } + .el-checkbox { &.is-checked { .el-checkbox__label { @@ -1622,6 +1639,7 @@ export default { } } } + .el-radio { &.is-checked { .el-radio__label { @@ -1663,6 +1681,7 @@ export default { .tag-content { cursor: pointer; position: relative; + .tag-input { width: 100px; } @@ -1680,13 +1699,13 @@ export default { padding: 2px; border-radius: 50%; position: absolute; - top:6px; - right:5px; + top: 6px; + right: 5px; // transition: all 0.3s; // &:hover { - color: red; - background-color: #f5f5f5; + color: red; + background-color: #f5f5f5; // } } } diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js index 1c6ab3a..4af3cb3 100644 --- a/src/components/Template/mixins/formPackageMixins.js +++ b/src/components/Template/mixins/formPackageMixins.js @@ -261,7 +261,6 @@ export default { selectInfoKeys.forEach(key => { result[key] = formData[key]; }) - console.log(config,"allConfig") // 更新表单字段 this.formFields = result; this.allFieldsConfig = config; diff --git a/src/views/business/comps/template/comps/yp/YP003.vue b/src/views/business/comps/template/comps/yp/YP003.vue index 41c0aca..87a7963 100644 --- a/src/views/business/comps/template/comps/yp/YP003.vue +++ b/src/views/business/comps/template/comps/yp/YP003.vue @@ -19,8 +19,9 @@ :formData="formData" operationWidth = "80px" :prefixKey = "`table`" - fieldItemLabel = "template.common.operationSteps" + fieldItemLabel = "template.yp.yp003.ybxx" @clickButton="handleClickButton" + @onCheckboxTagChange="onCheckboxTagChange" :showOperation="fillType === 'preFill'" > +
+ +
+
@@ -324,11 +325,21 @@ export default { this.$emit("onDeleteTag", rowIndex, col, tagIndex); this.justUpdateFilledFormData(); }, - onCheckboxTagChange(rowIndex, colIndex, col, tagIndex, value) { + onCheckboxTagChange(rowIndex, colIndex, col, value) { console.log(value,"vvv") - this.localDataSource[rowIndex][col.prop][tagIndex] = value; - this.onErrorUpdate(rowIndex, colIndex, col.prop, value?false:true); - this.$emit("onCheckboxTagChange", rowIndex, col, this.localDataSource[rowIndex][col.prop]) + // value 现在是整个数组 + this.localDataSource[rowIndex][col.prop] = value; + // 根据校验规则判断是否清除错误状态 + let isValid = false; + if (this.templateFillType === "actFill") { + // actFill时,检查是否有checked为true的项 + isValid = value && value.some(tag => tag.checked === true); + } else if (this.templateFillType === "preFill") { + // preFill时,检查所有tagValue是否不为空 + isValid = value && value.every(tag => tag.tagValue && tag.tagValue.trim() !== ''); + } + this.onErrorUpdate(rowIndex, colIndex, col.prop, !isValid); + this.$emit("onCheckboxTagChange", rowIndex, col, value) }, handleClickButton(e, data, key, rowIndex, colIndex) { this.$emit("clickButton", key, rowIndex, colIndex, e, data,) @@ -766,6 +777,7 @@ export default { this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource = [...this.localDataSource]; this.checkCompareToOnDataLoad(); + this.justUpdateFilledFormData(); }, // 比较newData和oldData的值是否相等,只要有一对不相等就返回false compareOldAndCurrentFormFields(newData, oldData) { diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 5bec01e..e4dc2cf 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -87,24 +87,25 @@
支持扩展名:.rar .zip .doc .docx .pdf .jpg,文件大小不超过2MB
-
-
- -
- - - {{ tagValue }} - - - - - +
+
+
+ +
+ + + {{ tag.tagValue }} + + + + +
@@ -237,7 +238,7 @@ export default { }, data() { let initialValue = this.value; - let initialOtherValues = {}, checkboxTagChecked = false, tagValue = ''; + let initialOtherValues = {}, checkboxTagList = []; // 如果是checkboxList类型且value是对象格式 if (this.type === 'checkboxList' && this.value && typeof this.value === 'object') { @@ -245,10 +246,13 @@ export default { initialOtherValues = this.value.otherValues || {}; } else if (this.type === 'checkboxList' && !Array.isArray(this.value)) { initialValue = []; - } else if (this.type === 'checkboxTag' && this.value && typeof this.value === 'object') { - checkboxTagChecked = this.value.checked; - tagValue = this.value.tagValue || ''; - } + } else if (this.type === 'checkboxTag' && Array.isArray(this.value)) { + // checkboxTag类型,value是数组格式 + checkboxTagList = this.value.map(tag => ({ + checked: tag.checked, + tagValue: tag.tagValue || '' + })); + } return { inputValue: initialValue, oldValue: initialValue, // 记录上一次的值 @@ -263,9 +267,8 @@ export default { replyContent: '', // 回复内容 visible: false,//是否显示弹窗 checkboxValue: this.getChecked(),//是否选中 - checkboxTagChecked: checkboxTagChecked, // checkboxTag类型的checkbox选中状态 - oldCheckboxTagChecked: checkboxTagChecked, // checkboxTag类型的checkbox选中状态 - tagValue: tagValue, // checkboxTag类型的tag值 + checkboxTagList: checkboxTagList, // checkboxTag类型的列表数据 + oldCheckboxTagList: JSON.parse(JSON.stringify(checkboxTagList)), // 记录上一次的checkboxTagList uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], //试剂/仪器/供试品等类型 selectRegentInfo: {},//选择的试剂/仪器/供试品等信息 @@ -276,6 +279,7 @@ export default { }, pendingUploadFile: null, // 用于存储待上传的文件 pendingRemoveFile: null, // 用于存储待删除的文件 + currentTagIndex:-1,//当前选中的checkboxTag索引 } }, watch: { @@ -284,10 +288,13 @@ export default { if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') { this.inputValue = newVal.checkboxValues || []; this.otherValues = newVal.otherValues || {}; - } else if (this.type === 'checkboxTag' && newVal && typeof newVal === 'object') { - this.checkboxTagChecked = newVal.checked || false; - this.tagValue = newVal.tagValue || ''; - } else { + } else if (this.type === 'checkboxTag' && Array.isArray(newVal)) { + // checkboxTag类型,value是数组格式 + this.checkboxTagList = newVal.map(tag => ({ + checked: tag.checked, + tagValue: tag.tagValue || '' + })); + } else { this.inputValue = this.type === 'checkboxList' && !Array.isArray(newVal) ? [] : newVal; } } @@ -808,30 +815,33 @@ export default { this.onInputChange(); }, // checkboxTag的checkbox变化处理 - onCheckboxTagChange(e) { - this.checkboxTagChecked = e; + onCheckboxTagChange(tagIndex, e) { + this.currentTagIndex = tagIndex; + this.checkboxTagList[tagIndex].checked = e; this.emitCheckboxTagValue(); this.onCommonHandleSaveRecord(); }, // tag输入框失去焦点 - onTagBlur(e) { - const value = e.target.value; - this.tagValue = value; + onTagBlur(tagIndex) { + this.currentTagIndex = tagIndex; + const value = this.checkboxTagList[tagIndex].tagValue; this.emitCheckboxTagValue(); - this.onCommonHandleSaveRecord(this.tagValue); + this.onCommonHandleSaveRecord(value); }, // 删除tag - onDeleteTag() { - this.$emit("deleteTag"); + onDeleteTag(tagIndex) { + this.currentTagIndex = tagIndex; + // 从列表中删除指定索引的tag + this.checkboxTagList.splice(tagIndex, 1); + this.emitCheckboxTagValue(); + this.$emit("deleteTag", tagIndex); }, // 发送checkboxTag的值 emitCheckboxTagValue() { - const value = { - checked: this.checkboxTagChecked, - tagValue: this.tagValue - }; - this.inputValue = value; + // 发送整个数组 + this.$emit('input', [...this.checkboxTagList]); + this.$emit('change', [...this.checkboxTagList]); }, // 统一处理失去焦点事件 onBlur(e) { @@ -916,8 +926,12 @@ export default { isSame = this.isEqual(this.oldOtherValues, this.otherValues); isOldValueEmpty = this.isValueEmpty(this.oldOtherValues); } else if (this.type === "checkboxTag") { - isSame = this.isEqual(this.oldCheckboxTagChecked, this.checkboxTagChecked); - isOldValueEmpty = this.isValueEmpty(this.oldCheckboxTagChecked); + // checkboxTag类型,只比较当前tagIndex的数据 + const currentTag = this.checkboxTagList[this.currentTagIndex]; + const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {}; + isSame = this.isEqual(oldTag.checked, currentTag.checked); + isOldValueEmpty = this.isValueEmpty(oldTag.checked); + }else{ isSame = this.isEqual(this.oldValue, this.inputValue) isOldValueEmpty = this.isValueEmpty(this.oldValue); @@ -942,11 +956,17 @@ export default { checkboxValues: oldValue.checkboxValues || oldValue, otherValues: this.oldOtherValues }; - }else if(this.type === "checkboxTag"){ - oldValue = { - checked: this.oldCheckboxTagChecked, - tagValue: this.tagValue, - }; + } else if (this.type === "checkboxTag") { + // checkboxTag类型,只回退当前tagIndex的数据 + if (this.currentTagIndex >= 0 && this.currentTagIndex < this.oldCheckboxTagList.length) { + const oldTag = this.oldCheckboxTagList[this.currentTagIndex]; + this.checkboxTagList[this.currentTagIndex] = { ...oldTag }; + oldValue = [...this.checkboxTagList]; + } else { + // 如果没有指定tagIndex,回退整个数组 + this.checkboxTagList = JSON.parse(JSON.stringify(this.oldCheckboxTagList)); + oldValue = [...this.checkboxTagList]; + } } this.inputValue = this.oldValue; this.$emit('input', oldValue); // 触发 v-model 更新 @@ -967,11 +987,15 @@ export default { this.oldValue = recordData.oldValue; this.inputValue = recordData.inputValue; } - let recordOldVlaue = this.oldValue,recordValue = this.inputValue,isModify = !!this.oldValue; - if(this.type === "checkboxTag"){ - recordOldVlaue =this.oldValue? `${this.oldValue.tagValue}:${this.oldValue.checked?'勾选':'未勾选'}`:''; - recordValue = `${this.inputValue?.tagValue}:${this.inputValue?.checked?'勾选':'未勾选'}`; - isModify = this.oldValue.checked !== undefined; + let recordOldVlaue = this.oldValue, recordValue = this.inputValue, isModify = !!this.oldValue; + if (this.type === "checkboxTag") { + // checkboxTag类型,只记录当前tagIndex的数据变化 + const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {}; + const currentTag = this.checkboxTagList[this.currentTagIndex] || {}; + recordOldVlaue = `${oldTag.tagValue || ''}:${oldTag.checked ? '勾选' : '未勾选'}`; + recordValue = `${currentTag.tagValue || ''}:${currentTag.checked ? '勾选' : '未勾选'}`; + isModify = oldTag.checked !== undefined + } const record = { ...baseInfo, @@ -994,8 +1018,14 @@ export default { if (this.type === 'checkboxList') { this.oldValue = [...this.inputValue]; this.oldOtherValues = { ...this.otherValues }; - }else if(this.type === "checkboxTag"){ - this.oldCheckboxTagChecked = this.checkboxTagChecked; + } else if (this.type === "checkboxTag") { + // checkboxTag类型,只更新当前tagIndex的数据 + if (this.currentTagIndex >= 0 && this.currentTagIndex < this.checkboxTagList.length) { + this.oldCheckboxTagList[this.currentTagIndex] = { ...this.checkboxTagList[this.currentTagIndex] }; + } else { + // 如果没有指定tagIndex,更新整个数组 + this.oldCheckboxTagList = JSON.parse(JSON.stringify(this.checkboxTagList)); + } } let value = this.inputValue; if (this.type === 'checkboxList') { @@ -1003,11 +1033,8 @@ export default { checkboxValues: this.inputValue, otherValues: this.otherValues }; - }else if(this.type === "checkboxTag"){ - value = { - checked: this.checkboxTagChecked, - tagValue: this.tagValue, - }; + } else if (this.type === "checkboxTag") { + value = [...this.checkboxTagList]; } if (this.type === "button") { this.$emit('clickButton', this.item, this.inputValue, data); @@ -1662,16 +1689,15 @@ export default { } // checkboxTag样式 +.checkbox-tag-wrapper { + display: flex; + flex-wrap: wrap; + gap: 10px; + padding: 8px; +} + .checkbox-tag-container { border-radius: 4px; - // transition: all 0.3s; - // margin-bottom: 10px; - // margin-right: 10px; - - &.error-border { - border-color: #ff5d5d !important; - box-shadow: 0 0 6px #ffc3c3 !important; - } .checkbox-tag-item { display: flex; @@ -1701,12 +1727,8 @@ export default { position: absolute; top: 6px; right: 5px; - // transition: all 0.3s; - - // &:hover { color: red; background-color: #f5f5f5; - // } } } } From c744588221a511b53d13ab5eb16a4c5b0f24c956 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Sun, 1 Mar 2026 11:11:39 +0800 Subject: [PATCH 8/8] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]?= =?UTF-8?q?[yp003]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/HandleFormItem.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index e4dc2cf..25be34a 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -833,7 +833,6 @@ export default { onDeleteTag(tagIndex) { this.currentTagIndex = tagIndex; // 从列表中删除指定索引的tag - this.checkboxTagList.splice(tagIndex, 1); this.emitCheckboxTagValue(); this.$emit("deleteTag", tagIndex); },