|
|
@ -77,7 +77,7 @@ |
|
|
|
:default-checked-keys="defaultTypeChecked" |
|
|
|
:default-checked-keys="defaultTypeChecked" |
|
|
|
:current-node-key="curId" |
|
|
|
:current-node-key="curId" |
|
|
|
show-checkbox |
|
|
|
show-checkbox |
|
|
|
:props="defaultProps" |
|
|
|
:props="defaultPropsImport" |
|
|
|
highlight-current |
|
|
|
highlight-current |
|
|
|
@node-click="importTypeClick" |
|
|
|
@node-click="importTypeClick" |
|
|
|
@node-expand="importTypeExpand" |
|
|
|
@node-expand="importTypeExpand" |
|
|
@ -160,6 +160,10 @@ export default { |
|
|
|
children: 'children', |
|
|
|
children: 'children', |
|
|
|
label: 'categoryName' |
|
|
|
label: 'categoryName' |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
defaultPropsImport: { |
|
|
|
|
|
|
|
children: 'children', |
|
|
|
|
|
|
|
label: 'label' |
|
|
|
|
|
|
|
}, |
|
|
|
defaultActive: [], |
|
|
|
defaultActive: [], |
|
|
|
added: false, |
|
|
|
added: false, |
|
|
|
typeVisible: false, |
|
|
|
typeVisible: false, |
|
|
@ -258,10 +262,13 @@ export default { |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
addType(row){ |
|
|
|
addType(row){ |
|
|
|
|
|
|
|
if (row) { |
|
|
|
this.categoryId = row.data.id |
|
|
|
this.categoryId = row.data.id |
|
|
|
if (row) this.defaultActive = [row.data.id] |
|
|
|
this.defaultActive = [row.data.id] |
|
|
|
|
|
|
|
} |
|
|
|
this.typeVisible = true |
|
|
|
this.typeVisible = true |
|
|
|
this.levelId = row ? row.data.id : 0 |
|
|
|
this.levelId = row ? row.data.id : 0 |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
editType(row){ |
|
|
|
editType(row){ |
|
|
|
this.typeVisible = true |
|
|
|
this.typeVisible = true |
|
|
@ -309,9 +316,17 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
this.$message.success('添加成功') |
|
|
|
this.$message.success('添加成功') |
|
|
|
this.getType(this.node, this.resolve) |
|
|
|
this.getType(this.node, this.resolve) |
|
|
|
|
|
|
|
if (this.levelId) { |
|
|
|
let node = this.$refs.type.getNode(this.categoryId) |
|
|
|
let node = this.$refs.type.getNode(this.categoryId) |
|
|
|
node.loaded = false |
|
|
|
node.loaded = false |
|
|
|
node.expand() |
|
|
|
node.expand() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// this.categoryId = '' |
|
|
|
|
|
|
|
// this.defaultProps = [] |
|
|
|
|
|
|
|
// this.$refs.type.setCurrentNode(0) |
|
|
|
|
|
|
|
// this.getType(0, this.resolve) |
|
|
|
|
|
|
|
location.reload() |
|
|
|
|
|
|
|
} |
|
|
|
this.typeVisible = false |
|
|
|
this.typeVisible = false |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submited = false |
|
|
|
this.submited = false |
|
|
@ -578,6 +593,13 @@ export default { |
|
|
|
if(!checked.length) return this.$message.warning('请选择数据') |
|
|
|
if(!checked.length) return this.$message.warning('请选择数据') |
|
|
|
this.submited = true |
|
|
|
this.submited = true |
|
|
|
const typeIds = checked.filter(e => !e.name).map(e => e.realId) // 先筛选出分类id,再获取分类真正的id |
|
|
|
const typeIds = checked.filter(e => !e.name).map(e => e.realId) // 先筛选出分类id,再获取分类真正的id |
|
|
|
|
|
|
|
const tableIds = checked.filter(e => e.name) |
|
|
|
|
|
|
|
const categoryId = Number(this.categoryId) |
|
|
|
|
|
|
|
tableIds.map(e => { |
|
|
|
|
|
|
|
delete e.id |
|
|
|
|
|
|
|
e.categoryId = categoryId |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (typeIds.length) { |
|
|
|
this.getNames(typeIds).then(() => { |
|
|
|
this.getNames(typeIds).then(() => { |
|
|
|
const data = this.names |
|
|
|
const data = this.names |
|
|
|
const dataList = [] |
|
|
|
const dataList = [] |
|
|
@ -605,6 +627,18 @@ export default { |
|
|
|
this.submited = false |
|
|
|
this.submited = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$post(this.api.saveTable, tableIds).then(res => { |
|
|
|
|
|
|
|
this.$message.success('导入成功') |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
this.importVisible = false |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
},1000) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.submited = false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|