From eb1b391c80db36891756c453d125d5c0b1a585ae Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Fri, 30 Jan 2026 23:28:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86][upd?= =?UTF-8?q?ate]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/CustomTable.vue | 47 +++++++++++++++++----- src/components/Template/StepComponents/ry/bdtj.vue | 2 +- src/components/Template/StepComponents/ry/bdzl.vue | 2 +- src/components/Template/StepComponents/ry/clcz.vue | 2 +- .../Template/StepComponents/ry/clfcz.vue | 2 +- src/components/Template/StepComponents/ry/cs.vue | 2 +- src/components/Template/StepComponents/ry/czdd.vue | 2 +- src/components/Template/StepComponents/ry/czhj.vue | 2 +- src/components/Template/StepComponents/ry/dc.vue | 2 +- src/components/Template/StepComponents/ry/ddhy.vue | 2 +- src/components/Template/StepComponents/ry/fb.vue | 2 +- src/components/Template/StepComponents/ry/fr.vue | 2 +- .../Template/StepComponents/ry/frdrq.vue | 2 +- src/components/Template/StepComponents/ry/fs.vue | 2 +- src/components/Template/StepComponents/ry/fy.vue | 2 +- src/components/Template/StepComponents/ry/glsd.vue | 2 +- src/components/Template/StepComponents/ry/glzd.vue | 2 +- src/components/Template/StepComponents/ry/hb.vue | 2 +- src/components/Template/StepComponents/ry/hwhy.vue | 2 +- src/components/Template/StepComponents/ry/jb.vue | 2 +- src/components/Template/StepComponents/ry/jd.vue | 2 +- src/components/Template/StepComponents/ry/jrjb.vue | 2 +- src/components/Template/StepComponents/ry/jrry.vue | 2 +- src/components/Template/StepComponents/ry/js.vue | 2 +- src/components/Template/StepComponents/ry/jz.vue | 2 +- src/components/Template/StepComponents/ry/lx.vue | 2 +- src/components/Template/StepComponents/ry/mj.vue | 2 +- src/components/Template/StepComponents/ry/qcyy.vue | 2 +- src/components/Template/StepComponents/ry/qywz.vue | 2 +- src/components/Template/StepComponents/ry/rs.vue | 2 +- src/components/Template/StepComponents/ry/sy.vue | 2 +- .../Template/StepComponents/ry/tjphcz.vue | 2 +- .../Template/StepComponents/ry/tjphfcz.vue | 2 +- .../Template/StepComponents/ry/tpjydd.vue | 2 +- .../Template/StepComponents/ry/tpjysd.vue | 2 +- src/components/Template/StepComponents/ry/wxhy.vue | 2 +- src/components/Template/StepComponents/ry/xzrq.vue | 2 +- src/components/Template/StepComponents/ry/ym.vue | 2 +- src/components/Template/StepComponents/ry/zy.vue | 2 +- src/components/Template/StepComponents/ry/zyhy.vue | 2 +- .../Template/mixins/formPackageMixins.js | 2 +- .../comps/template/comps/sp/SWYPBQGZYZBB.vue | 10 +++-- .../comps/template/comps/sp/SWYPNBGZYZBB.vue | 9 +++-- 43 files changed, 90 insertions(+), 56 deletions(-) diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 0b99cef..ea8040c 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -713,27 +713,56 @@ export default { this.$emit('row-delete', rowIndex); }, // 更新数据方法,可在formData变更时调用,也可由父组件调用 - updateDataSource(dataSource = [],autoUpdateRecord = true) { + updateDataSource(dataSource = []) { this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); - if(autoUpdateRecord){ - this.showEditSignDialog(); - } - console.log(this.oldLocalDataSource, "oldLocalDataSource") // 深拷贝数据以避免直接修改原始数据 this.localDataSource = JSON.parse(JSON.stringify(dataSource || [])); }, // 根据行索引更新数据 autoUpdateRecord 是否自动更新记录 updateDataSourceByRowIndex(rowIndex, data,autoUpdateRecord = true) { this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); - if(autoUpdateRecord){ - this.showEditSignDialog(); - } + if(autoUpdateRecord){//如果formpackage联动table的情况,不需要自动更新,不然会出现多个弹窗的问题。 + this.showEditSignDialog(rowIndex,data); + } this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource = [...this.localDataSource]; }, - showEditSignDialog: _.debounce(()=>{ + showEditSignDialog: _.debounce(function(rowIndex,data){ + const oldData = this.oldLocalDataSource[rowIndex]; + let isFirst = false;//是否是第一次添加,是否和旧数据相同 + const isSame = this.compareOldAndCurrentFormFields(data,oldData); + // 遍历data对象,和oldData比较,判断data的key值在对应oldData里面是否有值 + for(const key in data) { + if(!oldData[key]&&oldData[key]!=0){ + isFirst = true; + break; + } + } + if(!isFirst &&!isSame && this.templateFillType === "actFill"){ + console.log("showww") + setTimeout(() => { + EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); + }, 100); + }else{ + this.updateRecord(rowIndex,data); + } + }, 100), + // 比较newData和oldData的值是否相等,只要有一对不相等就返回false + compareOldAndCurrentFormFields(newData,oldData) { + for (const key in newData) { + const oldValue = newData[key]; + const currentValue = oldData[key]; + if (JSON.stringify(oldValue) !== JSON.stringify(currentValue)) { + return false; + } else { + return false; + } + } + + return true; + }, onAddRow() { this.addRow({ actSolutionVolumePrecision: 3,//小数点精度默认为3 diff --git a/src/components/Template/StepComponents/ry/bdtj.vue b/src/components/Template/StepComponents/ry/bdtj.vue index 2c53c56..c13bd72 100644 --- a/src/components/Template/StepComponents/ry/bdtj.vue +++ b/src/components/Template/StepComponents/ry/bdtj.vue @@ -1,6 +1,6 @@