修改上级部门(选择项排除本身和下级)

This commit is contained in:
RuoYi
2020-05-16 18:39:30 +08:00
parent 8c7aca2527
commit 9f4918cc14
3 changed files with 38 additions and 9 deletions

View File

@ -9,6 +9,14 @@ export function listDept(query) {
})
}
// 查询部门列表(排除节点)
export function listDeptExcludeChild(deptId) {
return request({
url: '/system/dept/list/exclude/' + deptId,
method: 'get'
})
}
// 查询部门详细
export function getDept(deptId) {
return request({

View File

@ -138,7 +138,7 @@
</template>
<script>
import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept";
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -220,12 +220,6 @@ export default {
children: node.children
};
},
/** 查询部门下拉树结构 */
getTreeselect() {
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
});
},
// 字典状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
@ -256,22 +250,26 @@ export default {
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != undefined) {
this.form.parentId = row.deptId;
}
this.open = true;
this.title = "添加部门";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
getDept(row.deptId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改部门";
});
listDeptExcludeChild(row.deptId).then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
});
},
/** 提交按钮 */
submitForm: function() {