diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 45e9c05..d4cc192 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -280,7 +280,11 @@ export default { columns.forEach((col, colIndex) => { const oldValue = oldRow[col.prop]; const newValue = row[col.prop]; - + // 空值不提交 + if(this.isValueEmpty(newValue) && this.isValueEmpty(oldValue)){ + return + } + if (!isEqual(oldValue, newValue)) { const fieldLabelCn = this.$i18n.t(col.label, "zh_CN"); const fieldLabelEn = this.$i18n.t(col.label, "en_US"); @@ -303,7 +307,9 @@ export default { if (col.bodySubKey) { const oldSubValue = oldRow[col.bodySubKey]; const newSubValue = row[col.bodySubKey]; - + if(this.isValueEmpty(newSubValue) && this.isValueEmpty(oldSubValue)){ + return + } if (!isEqual(oldSubValue, newSubValue)) { const fieldLabelCn = this.$i18n.t(col.label, "zh_CN"); const fieldLabelEn = this.$i18n.t(col.label, "en_US"); @@ -417,10 +423,10 @@ export default { onCopy(rowIndex, col) { if (col.copyFrom) { - if (!this.localDataSource[rowIndex][col.copyFrom]) {//没有值就不用复制了 + if (this.isValueEmpty(this.localDataSource[rowIndex][col.copyFrom])) {//没有值就不用复制了 return } - this.$set(this.localDataSource[rowIndex], col.prop, this.localDataSource[rowIndex][col.copyFrom]) + this.updateDataSourceByRowIndex(rowIndex,{[col.prop]:this.localDataSource[rowIndex][col.copyFrom]},"clickable") this.onBlur(rowIndex, col.prop, this.localDataSource[rowIndex][col.prop]); } }, @@ -724,6 +730,7 @@ export default { this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); // 深拷贝数据以避免直接修改原始数据 this.localDataSource = JSON.parse(JSON.stringify(dataSource || [])); + this.checkCompareToOnDataLoad(); }, // 根据行索引更新数据 autoUpdateRecord 是否自动更新记录 updateDataSourceByRowIndex(rowIndex, data, type) { @@ -735,6 +742,7 @@ export default { } this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource = [...this.localDataSource]; + this.checkCompareToOnDataLoad(); }, showEditSignDialog: _.debounce(function (rowIndex, data) { const oldData = this.oldLocalDataSource[rowIndex]; @@ -742,7 +750,7 @@ export default { const isSame = this.compareOldAndCurrentFormFields(data, oldData); // 遍历data对象,和oldData比较,判断data的key值在对应oldData里面是否有值 for (const key in data) { - if (!oldData[key] && oldData[key] != 0) { + if (this.isValueEmpty(oldData[key])) { isFirst = true; break; } diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 210adb5..d9e5065 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -430,7 +430,7 @@ export default { if(isSame){ return; } - if (this.oldValue && !isSame && this.templateFillType === "actFill") { + if (!this.isValueEmpty(this.oldValue) && !isSame && this.templateFillType === "actFill") { // 通过EventBus触发电子签名弹窗 EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); }else{//如果是第一次填写,不需要密码验证 diff --git a/src/components/Template/Step.vue b/src/components/Template/Step.vue index 0951317..4e57bd5 100644 --- a/src/components/Template/Step.vue +++ b/src/components/Template/Step.vue @@ -31,6 +31,7 @@