新增数据修复

dev
Jo 3 years ago
parent 0d8e6c5ca9
commit 13b26d6c13
  1. 13
      src/views/data/Framework.vue

@ -194,7 +194,7 @@ export default {
previewData: [], previewData: [],
curComment: [], curComment: [],
submited: false, submited: false,
names: [], categorys: [],
nameVisible: false, nameVisible: false,
curRow: {}, curRow: {},
headVisible: false, headVisible: false,
@ -563,7 +563,7 @@ export default {
}, },
closeImport(){ closeImport(){
this.$refs.typeTree.setCheckedKeys([]) this.$refs.typeTree.setCheckedKeys([])
this.names = [] this.categorys = []
}, },
// namesshowNames, // namesshowNames,
getNames(list){ getNames(list){
@ -576,7 +576,7 @@ export default {
delete e.id delete e.id
e.categoryId = categoryId e.categoryId = categoryId
}) })
this.names = list this.categorys = list
resolve() resolve()
}).catch(res => {}) }).catch(res => {})
}) })
@ -594,9 +594,14 @@ export default {
delete e.id delete e.id
e.categoryId = categoryId 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) { if (typeIds.length) {
this.getNames(typeIds).then(() => { this.getNames(typeIds).then(() => {
const data = this.names const allIds = [...this.categorys, ...tableIds]
const data = uniq(allIds, 'name')
const dataList = [] const dataList = []
for (let i = 0, len = data.length; i < len; i += 2000) { for (let i = 0, len = data.length; i < len; i += 2000) {
dataList.push(data.slice(i, i + 2000)) dataList.push(data.slice(i, i + 2000))

Loading…
Cancel
Save