|
|
@ -124,7 +124,7 @@ export default { |
|
|
|
total: 0, |
|
|
|
total: 0, |
|
|
|
multipleSelection: [], |
|
|
|
multipleSelection: [], |
|
|
|
importTypeList: [], |
|
|
|
importTypeList: [], |
|
|
|
importTypeIndex: 10000, |
|
|
|
importTypeIndex: 100000, |
|
|
|
fieldData: [], |
|
|
|
fieldData: [], |
|
|
|
fieldHead: [], |
|
|
|
fieldHead: [], |
|
|
|
tableName: '', |
|
|
|
tableName: '', |
|
|
@ -138,6 +138,8 @@ export default { |
|
|
|
previewHead: [], |
|
|
|
previewHead: [], |
|
|
|
previewData: [], |
|
|
|
previewData: [], |
|
|
|
submited: false, |
|
|
|
submited: false, |
|
|
|
|
|
|
|
names: [], |
|
|
|
|
|
|
|
showNames: [] |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -216,6 +218,8 @@ export default { |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
confirmType(){ |
|
|
|
confirmType(){ |
|
|
|
|
|
|
|
if(this.submited) return false |
|
|
|
|
|
|
|
this.submited = true |
|
|
|
if(this.id){ |
|
|
|
if(this.id){ |
|
|
|
this.$post(this.api.updateCategory,{ |
|
|
|
this.$post(this.api.updateCategory,{ |
|
|
|
id: this.id, |
|
|
|
id: this.id, |
|
|
@ -224,7 +228,12 @@ export default { |
|
|
|
this.$message.success('编辑成功') |
|
|
|
this.$message.success('编辑成功') |
|
|
|
this.getType() |
|
|
|
this.getType() |
|
|
|
this.typeVisible = false |
|
|
|
this.typeVisible = false |
|
|
|
}).catch(res => {}) |
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
},1500) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
}) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.$post(this.api.saveCategory,{ |
|
|
|
this.$post(this.api.saveCategory,{ |
|
|
|
levelId: this.levelId, |
|
|
|
levelId: this.levelId, |
|
|
@ -233,7 +242,12 @@ export default { |
|
|
|
this.$message.success('添加成功') |
|
|
|
this.$message.success('添加成功') |
|
|
|
this.getType() |
|
|
|
this.getType() |
|
|
|
this.typeVisible = false |
|
|
|
this.typeVisible = false |
|
|
|
}).catch(res => {}) |
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
},1500) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
closeType(){ |
|
|
|
closeType(){ |
|
|
@ -321,7 +335,7 @@ export default { |
|
|
|
},50) |
|
|
|
},50) |
|
|
|
}, |
|
|
|
}, |
|
|
|
getTable(n,isConcat){ |
|
|
|
getTable(n,isConcat){ |
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage}&pageSize=${this.typeTreeUnit}`).then(res => { |
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage ? n.typeTreePage : 1}&pageSize=${this.typeTreeUnit}`).then(res => { |
|
|
|
let list = res.list.records |
|
|
|
let list = res.list.records |
|
|
|
list.map(n => { |
|
|
|
list.map(n => { |
|
|
|
n.label = n.showName |
|
|
|
n.label = n.showName |
|
|
@ -331,11 +345,12 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
if(isConcat){ |
|
|
|
if(isConcat){ |
|
|
|
n.typeTreePage++ |
|
|
|
|
|
|
|
n.children = n.children.concat(list) |
|
|
|
n.children = n.children.concat(list) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
n.children = list |
|
|
|
n.children = list |
|
|
|
|
|
|
|
n.tableLen = res.list.total |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
n.typeTreePage++ |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
batchImport(){ |
|
|
|
batchImport(){ |
|
|
@ -420,39 +435,65 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
closeImport(){ |
|
|
|
closeImport(){ |
|
|
|
this.$refs.typeTree.setCheckedKeys([]) |
|
|
|
this.$refs.typeTree.setCheckedKeys([]) |
|
|
|
|
|
|
|
this.names = [] |
|
|
|
|
|
|
|
this.showNames = [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
confirmImport(){ |
|
|
|
getNames(){ |
|
|
|
if(this.submited) return false |
|
|
|
|
|
|
|
let list = this.$refs.typeTree.getCheckedNodes() |
|
|
|
let list = this.$refs.typeTree.getCheckedNodes() |
|
|
|
let names = [] |
|
|
|
return new Promise((resolve,reject) => { |
|
|
|
let showNames = [] |
|
|
|
let getLen = 0 |
|
|
|
list.map(n => { |
|
|
|
list.map(n => { |
|
|
|
if(n.name && !n.disabled){ |
|
|
|
if(n.tableLen && n.tableLen > n.children.length) getLen++ |
|
|
|
names.push(n.name) |
|
|
|
}) |
|
|
|
showNames.push(n.showName) |
|
|
|
list.map((n,i) => { |
|
|
|
} |
|
|
|
if(n.tableLen && n.tableLen > n.children.length){ |
|
|
|
|
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=1&pageSize=10000`).then(res => { |
|
|
|
|
|
|
|
let tableList = res.list.records |
|
|
|
|
|
|
|
getLen-- |
|
|
|
|
|
|
|
tableList.map(n => { |
|
|
|
|
|
|
|
if(!this.defaultTypeChecked.includes(String(n.id))){ |
|
|
|
|
|
|
|
this.names.push(n.name) |
|
|
|
|
|
|
|
this.showNames.push(n.showName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if(!getLen) resolve() |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
}else if(n.name && !n.disabled && !this.names.includes(n.name)){ |
|
|
|
|
|
|
|
this.names.push(n.name) |
|
|
|
|
|
|
|
this.showNames.push(n.showName) |
|
|
|
|
|
|
|
if(!getLen) resolve() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
if(!names.length) return this.$message.warning('请选择数据') |
|
|
|
}, |
|
|
|
|
|
|
|
confirmImport(){ |
|
|
|
|
|
|
|
if(this.submited) return false |
|
|
|
|
|
|
|
if(!this.$refs.typeTree.getCheckedNodes().length) return this.$message.warning('请选择数据') |
|
|
|
|
|
|
|
this.getNames().then(() => { |
|
|
|
|
|
|
|
let names = Array.from(new Set(this.names)) |
|
|
|
|
|
|
|
let showNames = Array.from(new Set(this.showNames)) |
|
|
|
|
|
|
|
if(!names.length) return this.$message.warning('请选择数据') |
|
|
|
|
|
|
|
|
|
|
|
this.submited = true |
|
|
|
this.submited = true |
|
|
|
let data = [] |
|
|
|
let data = [] |
|
|
|
let categoryId = Number(this.categoryId) |
|
|
|
let categoryId = Number(this.categoryId) |
|
|
|
names.map((n,i) => { |
|
|
|
names.map((n,i) => { |
|
|
|
data.push({ |
|
|
|
data.push({ |
|
|
|
categoryId, |
|
|
|
categoryId, |
|
|
|
name: n, |
|
|
|
name: n, |
|
|
|
showName: showNames[i], |
|
|
|
showName: showNames[i], |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.$post(this.api.saveTable,data).then(res => { |
|
|
|
this.$post(this.api.saveTable,data).then(res => { |
|
|
|
this.$message.success('导入成功') |
|
|
|
this.$message.success('导入成功') |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
this.importVisible = false |
|
|
|
this.importVisible = false |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submited = false |
|
|
|
|
|
|
|
},1000) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
this.submited = false |
|
|
|
this.submited = false |
|
|
|
},1000) |
|
|
|
}) |
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|