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 @@
-
+