|
@ -35,14 +35,18 @@ |
|
|
controls-position="right" |
|
|
controls-position="right" |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item v-if="form.isTop === '0'" label="上级节点" prop="dicPid"> |
|
|
|
|
|
<treeselect |
|
|
|
|
|
v-model="form.dicPid" |
|
|
|
|
|
:load-options="loadDicts" |
|
|
|
|
|
:options="dicts" |
|
|
|
|
|
placeholder="选择上级节点" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
<el-row> |
|
|
|
|
|
<el-form-item v-if="form.isTop === '0'" label="上级节点" prop="dicPid"> |
|
|
|
|
|
<treeselect |
|
|
|
|
|
v-model="form.dicPid" |
|
|
|
|
|
style="width: 584px;" |
|
|
|
|
|
:load-options="loadDicts" |
|
|
|
|
|
:options="dicts" |
|
|
|
|
|
:normalizer="normalizer" |
|
|
|
|
|
placeholder="选择上级节点" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-row> |
|
|
<el-form-item label="内容说明" prop="dicExplain"> |
|
|
<el-form-item label="内容说明" prop="dicExplain"> |
|
|
<el-input v-model="form.dicExplain" type="textarea" :rows="4" style="width: 584px;" /> |
|
|
<el-input v-model="form.dicExplain" type="textarea" :rows="4" style="width: 584px;" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -53,7 +57,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
<el-dialog title="删除字典内容" :visible.sync="deleteVisible" :before-close="handleClose"> |
|
|
|
|
|
|
|
|
<!-- <el-dialog title="删除字典内容" :visible.sync="deleteVisible" :before-close="handleClose"> |
|
|
<span class="dialog-right-top" /> |
|
|
<span class="dialog-right-top" /> |
|
|
<span class="dialog-left-bottom" /> |
|
|
<span class="dialog-left-bottom" /> |
|
|
<div class="setting-dialog"> |
|
|
<div class="setting-dialog"> |
|
@ -64,7 +68,7 @@ |
|
|
<el-button type="primary" @click.native="handleConfirm">确定</el-button> |
|
|
<el-button type="primary" @click.native="handleConfirm">确定</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
</el-dialog> --> |
|
|
<div class="container-wrap"> |
|
|
<div class="container-wrap"> |
|
|
<span class="right-top-line" /> |
|
|
<span class="right-top-line" /> |
|
|
<span class="left-bottom-line" /> |
|
|
<span class="left-bottom-line" /> |
|
@ -75,7 +79,7 @@ |
|
|
ref="table" |
|
|
ref="table" |
|
|
v-loading="crud.loading" |
|
|
v-loading="crud.loading" |
|
|
lazy |
|
|
lazy |
|
|
:load="getDicts" |
|
|
|
|
|
|
|
|
:load="getDictsDatas" |
|
|
:data="crud.data" |
|
|
:data="crud.data" |
|
|
:tree-props="{children: 'childMenus', hasChildren: 'hasChildren'}" |
|
|
:tree-props="{children: 'childMenus', hasChildren: 'hasChildren'}" |
|
|
highlight-current-row |
|
|
highlight-current-row |
|
@ -174,6 +178,15 @@ export default { |
|
|
[CRUD.HOOK.afterDelete]() { |
|
|
[CRUD.HOOK.afterDelete]() { |
|
|
this.needRefreshTree = true |
|
|
this.needRefreshTree = true |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 新增与编辑前做的操作 |
|
|
|
|
|
[CRUD.HOOK.afterToCU](crud, form) { |
|
|
|
|
|
if (form.dicPid !== null) { |
|
|
|
|
|
form.isTop = '0' |
|
|
|
|
|
} else if (form.id !== null) { |
|
|
|
|
|
form.isTop = '1' |
|
|
|
|
|
} |
|
|
|
|
|
this.getDicts() |
|
|
|
|
|
}, |
|
|
// 获取数据前设置默认参数 |
|
|
// 获取数据前设置默认参数 |
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
this.crud.query.id = this.dicPid |
|
|
this.crud.query.id = this.dicPid |
|
@ -184,7 +197,7 @@ export default { |
|
|
this.$emit('treeRefresh', crud.data) |
|
|
this.$emit('treeRefresh', crud.data) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getDicts(tree, treeNode, resolve) { |
|
|
|
|
|
|
|
|
getDictsDatas(tree, treeNode, resolve) { |
|
|
const params = { pid: tree.id } |
|
|
const params = { pid: tree.id } |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
crudDict.getDicts(params).then(res => { |
|
|
crudDict.getDicts(params).then(res => { |
|
@ -192,13 +205,23 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, 100) |
|
|
}, 100) |
|
|
}, |
|
|
}, |
|
|
// 获取弹窗内部门数据 |
|
|
|
|
|
|
|
|
getDicts() { |
|
|
|
|
|
crudDict.getDicts().then(res => { |
|
|
|
|
|
this.dicts = res.map(function(obj) { |
|
|
|
|
|
if (!obj.childMenus) { |
|
|
|
|
|
obj.childMenus = null |
|
|
|
|
|
} |
|
|
|
|
|
return obj |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 获取弹窗内字典数据 |
|
|
loadDicts({ action, parentNode, callback }) { |
|
|
loadDicts({ action, parentNode, callback }) { |
|
|
if (action === LOAD_CHILDREN_OPTIONS) { |
|
|
if (action === LOAD_CHILDREN_OPTIONS) { |
|
|
crudDict.getDicts({ enabled: true, pid: parentNode.id }).then(res => { |
|
|
|
|
|
parentNode.childMenus = res.content.map(function(obj) { |
|
|
|
|
|
if (obj.hasChildren) { |
|
|
|
|
|
obj.children = null |
|
|
|
|
|
|
|
|
crudDict.getDicts().then(res => { |
|
|
|
|
|
parentNode.children = res.map(function(obj) { |
|
|
|
|
|
if (obj.children) { |
|
|
|
|
|
obj.childMenus = null |
|
|
} |
|
|
} |
|
|
return obj |
|
|
return obj |
|
|
}) |
|
|
}) |
|
@ -208,35 +231,45 @@ export default { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
clickRowHandler(row) { |
|
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
|
this.$refs.table.toggleRowSelection(row) |
|
|
|
|
|
}, |
|
|
|
|
|
selectionChangeHandler(val) { |
|
|
|
|
|
if (val.length > 1) { |
|
|
|
|
|
// 取出最后val的最后一个返回出来 |
|
|
|
|
|
const finalVal = val.pop() |
|
|
|
|
|
// 清除所有选中 |
|
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
|
// 给最后一个加上选中 |
|
|
|
|
|
this.$refs.table.toggleRowSelection(finalVal) |
|
|
|
|
|
this.crud.selectionChangeHandler([finalVal]) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.crud.selectionChangeHandler(val) |
|
|
|
|
|
|
|
|
// clickRowHandler(row) { |
|
|
|
|
|
// this.$refs.table.clearSelection() |
|
|
|
|
|
// this.$refs.table.toggleRowSelection(row) |
|
|
|
|
|
// }, |
|
|
|
|
|
// selectionChangeHandler(val) { |
|
|
|
|
|
// if (val.length > 1) { |
|
|
|
|
|
// // 取出最后val的最后一个返回出来 |
|
|
|
|
|
// const finalVal = val.pop() |
|
|
|
|
|
// // 清除所有选中 |
|
|
|
|
|
// this.$refs.table.clearSelection() |
|
|
|
|
|
// // 给最后一个加上选中 |
|
|
|
|
|
// this.$refs.table.toggleRowSelection(finalVal) |
|
|
|
|
|
// this.crud.selectionChangeHandler([finalVal]) |
|
|
|
|
|
// } else { |
|
|
|
|
|
// this.crud.selectionChangeHandler(val) |
|
|
|
|
|
// } |
|
|
|
|
|
// }, |
|
|
|
|
|
// toDelete(data) { |
|
|
|
|
|
// this.deleteData = data |
|
|
|
|
|
// this.deleteVisible = true |
|
|
|
|
|
// }, |
|
|
|
|
|
// handleConfirm() { |
|
|
|
|
|
// this.deleteVisible = false |
|
|
|
|
|
// this.crud.delAllLoading = true |
|
|
|
|
|
// this.crud.doDelete(this.deleteData) |
|
|
|
|
|
// }, |
|
|
|
|
|
// handleClose(done) { |
|
|
|
|
|
// this.deleteData = {} |
|
|
|
|
|
// done() |
|
|
|
|
|
// }, |
|
|
|
|
|
normalizer(node) { |
|
|
|
|
|
if (node.childMenus == null || node.childMenus === 'null') { |
|
|
|
|
|
delete node.childMenus |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
id: node.id, |
|
|
|
|
|
label: node.dicName, |
|
|
|
|
|
children: node.childMenus |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
toDelete(data) { |
|
|
|
|
|
this.deleteData = data |
|
|
|
|
|
this.deleteVisible = true |
|
|
|
|
|
}, |
|
|
|
|
|
handleConfirm() { |
|
|
|
|
|
this.deleteVisible = false |
|
|
|
|
|
this.crud.delAllLoading = true |
|
|
|
|
|
this.crud.doDelete(this.deleteData) |
|
|
|
|
|
}, |
|
|
|
|
|
handleClose(done) { |
|
|
|
|
|
this.deleteData = {} |
|
|
|
|
|
done() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|