diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index a984f0f..657d30d 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -194,7 +194,7 @@ export default { previewData: [], curComment: [], submited: false, - names: [], + categorys: [], nameVisible: false, curRow: {}, headVisible: false, @@ -563,7 +563,7 @@ export default { }, closeImport(){ this.$refs.typeTree.setCheckedKeys([]) - this.names = [] + this.categorys = [] }, // 获取names和showNames,提交的时候需要 getNames(list){ @@ -576,7 +576,7 @@ export default { delete e.id e.categoryId = categoryId }) - this.names = list + this.categorys = list resolve() }).catch(res => {}) }) @@ -594,9 +594,14 @@ export default { delete e.id e.categoryId = categoryId }) + function uniq (arr, val) { + const res = new Map() + return arr.filter(e => !res.has(e[val]) && res.set(e[val], 1)) + } if (typeIds.length) { this.getNames(typeIds).then(() => { - const data = this.names + const allIds = [...this.categorys, ...tableIds] + const data = uniq(allIds, 'name') const dataList = [] for (let i = 0, len = data.length; i < len; i += 2000) { dataList.push(data.slice(i, i + 2000))