fix: 测试计划-自定义表头,筛选功能会有问题

This commit is contained in:
wenyann 2021-04-27 15:22:45 +08:00 committed by 刘瑞斌
parent eac6d6491b
commit 38aa2cae2f
2 changed files with 18 additions and 2 deletions

View File

@ -293,7 +293,7 @@ import {
_handleSelect,
_handleSelectAll,
_sort,
buildBatchParam,
buildBatchParam, deepClone,
getLabel,
getSelectDataCounts,
initCondition,
@ -429,7 +429,8 @@ export default {
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
const list = deepClone(this.tableLabel);
this.$refs.headerCustom.open(list);
},
initTableData() {

View File

@ -176,4 +176,19 @@ export function buildBatchParam(vueObj) {
return param;
}
// 深拷贝
export function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone');
}
const targetObj = source.constructor === Array ? [] : {};
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys]);
} else {
targetObj[keys] = source[keys];
}
});
return targetObj;
}