From c256d19950748c4cc1fc17e5434cdb9f5846840c Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Tue, 3 Feb 2026 20:49:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E7=83=A6=E4=BA=BA=E7=9A=84=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/comps/template/comps/dl/SYWZPZJHB.vue | 16 ++++----- .../comps/template/dialog/SubPackageDialog.vue | 40 +++++++++++++++++----- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue b/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue index c85ef16..39d145d 100644 --- a/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue +++ b/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue @@ -147,7 +147,7 @@ export default { width: 280, bodyType: "input", bodyFillType: "actFill", - bodyMaxlength: 10, + bodyMaxlength: 50, }, { label: "配制浓度", @@ -155,11 +155,10 @@ export default { width: 280, headerSelectKey: "preparationConcentrationUnit", fillType: "actFill", - headerOptions: this.$store.state.template.volumeOptions, - defaultValue: "mg", - bodyType: "inputNumber", + headerOptions: this.getDictOptions('business_nddw'), + bodyType: "input", bodyFillType: "actFill", - bodyMaxlength: 10, + bodyMaxlength: 50, }, { label: "配制体积", @@ -167,10 +166,10 @@ export default { width: 280, headerSelectKey: "preparationVolumeUnit", fillType: "actFill", - headerOptions: this.$store.state.template.volumeOptions, - bodyType: "inputNumber", + headerOptions: this.getDictOptions('business_tjdw'), + bodyType: "input", bodyFillType: "actFill", - bodyMaxlength: 10, + bodyMaxlength: 50, }, ] }, @@ -186,7 +185,6 @@ export default { }; }, mounted() { -console.log("mounted") }, methods: { diff --git a/src/views/business/comps/template/dialog/SubPackageDialog.vue b/src/views/business/comps/template/dialog/SubPackageDialog.vue index 4278ef0..cc8007e 100644 --- a/src/views/business/comps/template/dialog/SubPackageDialog.vue +++ b/src/views/business/comps/template/dialog/SubPackageDialog.vue @@ -24,7 +24,7 @@ 每份包装量:
- +
平均分配 重置 @@ -51,6 +51,7 @@ import HandleFormItem from '@/components/Template/HandleFormItem.vue'; import { compareVolume } from '@/utils/volumeTools.js'; import { EventBus } from '@/utils/eventBus'; import { getLatestSn } from '@/api/template'; +import {isValueEmpty} from "@/utils/index"; export default { dicts: [ 'business_tjdw', @@ -92,6 +93,7 @@ export default { }, fzListErrors: [], // 分装列表错误状态 uuid:"",//事件id + originalData: {},//原始数据 } }, computed: { @@ -112,6 +114,7 @@ export default { }, show(data) { const cloneData = JSON.parse(JSON.stringify(data)); + console.log(cloneData,"cloneData") if(data && data.uuid) {//为了标识eventBus的事件id this.uuid = data.uuid } @@ -121,6 +124,13 @@ export default { this.fzListErrors = new Array(this.fzList.length).fill(false); delete cloneData.fzList; } + this.originalData = { + fzList: cloneData.fzList, + mybh: cloneData.mybh, + fzsl: cloneData.fzsl, + dw: cloneData.dw, + mfbzl: cloneData.mfbzl, + } this.formData = cloneData; // 重置错误状态 this.resetErrors(); @@ -157,36 +167,49 @@ export default { }, submitEmit(){ + const {originalData} = this; + const nowData = {...this.formData, fzList: this.fzList}; + if(!originalData.fzList){ + this.updateRecords(nowData); + }else if(JSON.stringify(nowData) !== JSON.stringify(originalData)){ + console.log("有修改") + } EventBus.$emit('dialogSubPackageSubmit', {...this.formData, fzList: this.fzList,uuid:this.uuid}); setTimeout(() => { this.close(); }, 500); }, + updateRecords(){ + console.log("更新记录") + }, validateFormData() { let isValid = true; - + const {mybh,fzsl,dw,mfbzl} = this.formData; // 验证母液编号 - if (!this.formData.mybh) { + if (isValueEmpty(mybh)) { this.formErrors.mybh = true; isValid = false; } - // 验证分装数量 - if (!this.formData.fzsl) { + if (isValueEmpty(fzsl)) { this.formErrors.fzsl = true; isValid = false; } // 验证单位 - if (!this.formData.dw) { + if (isValueEmpty(dw)) { this.formErrors.dw = true; isValid = false; } - + // 验证单位 + if (isValueEmpty(mfbzl)) { + this.formErrors.mfbzl = true; + isValid = false; + } // 验证分装列表中的数值 if (this.fzList && this.fzList.length > 0) { for (let i = 0; i < this.fzList.length; i++) { - if (!this.fzList[i].num) { + if (isValueEmpty(this.fzList[i].num)) { // 确保fzListErrors数组有足够的元素 if (this.fzListErrors.length <= i) { this.$set(this.fzListErrors, i, true); @@ -197,7 +220,6 @@ export default { } } } - return isValid; }, resetErrors() {