|
|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div class="custom-table-wrapper"> |
|
|
|
<div class="custom-table-header"> |
|
|
|
<div class="custom-table-wrapper" :class="{'no-border': !isBorder}"> |
|
|
|
<div class="custom-table-header" v-if="isBorder"> |
|
|
|
<div class="custom-table-row"> |
|
|
|
<div v-for="(col, index) in columns" :key="index" class="custom-table-cell header-cell" |
|
|
|
:style="getCellWidth(col)"> |
|
|
|
@ -222,7 +222,11 @@ export default { |
|
|
|
prefixKey: { |
|
|
|
type: String, |
|
|
|
default: "", |
|
|
|
} |
|
|
|
}, |
|
|
|
isBorder: {//是否无边框,无边框的没有表头和border |
|
|
|
type: Boolean, |
|
|
|
default: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -638,39 +642,10 @@ export default { |
|
|
|
// 根据行索引更新数据 autoUpdateRecord 是否自动更新记录 |
|
|
|
updateDataSourceByRowIndex(rowIndex, data) { |
|
|
|
this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); |
|
|
|
// if (type === "clickable") {//如果是custom内部的clickable需要判断是否弹窗 |
|
|
|
// this.showEditSignDialog(rowIndex,data); |
|
|
|
// }else if(type === "blur"){ |
|
|
|
// this.updateRecords(); |
|
|
|
// } |
|
|
|
this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; |
|
|
|
this.localDataSource = [...this.localDataSource]; |
|
|
|
this.checkCompareToOnDataLoad(); |
|
|
|
}, |
|
|
|
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 (this.isValueEmpty(oldData[key])) { |
|
|
|
isFirst = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isFirst && !isSame && this.templateFillType === "actFill") { |
|
|
|
console.log("showww") |
|
|
|
setTimeout(() => { |
|
|
|
EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); |
|
|
|
}, 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
console.log("not show") |
|
|
|
this.updateRecords(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, 100), |
|
|
|
// 比较newData和oldData的值是否相等,只要有一对不相等就返回false |
|
|
|
compareOldAndCurrentFormFields(newData, oldData) { |
|
|
|
for (const key in newData) { |
|
|
|
@ -719,9 +694,9 @@ export default { |
|
|
|
); |
|
|
|
} |
|
|
|
}, |
|
|
|
onSubBlur(rowIndex, colKey, value) { |
|
|
|
this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] }); |
|
|
|
}, |
|
|
|
// onSubBlur(rowIndex, colKey, value) { |
|
|
|
// this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] }); |
|
|
|
// }, |
|
|
|
// 检查是否需要橙色背景 |
|
|
|
hasOrangeBg(rowIndex, colIndex, field) { |
|
|
|
const key = `${rowIndex}-${colIndex}-${field}`; |
|
|
|
@ -780,6 +755,15 @@ export default { |
|
|
|
font-size: 14px; |
|
|
|
color: #606266; |
|
|
|
margin-top: 20px; |
|
|
|
&.no-border { |
|
|
|
border: none; |
|
|
|
.custom-table-cell { |
|
|
|
border-right: none; |
|
|
|
} |
|
|
|
.custometable-row { |
|
|
|
border-bottom: none; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.inner-table-cell { |
|
|
|
|