From 9f4918cc14064ea625f75dc616c7a1dc07815b42 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期六, 16 五月 2020 18:39:30 +0800 Subject: [PATCH] 修改上级部门(选择项排除本身和下级) --- ruoyi-ui/src/views/system/dept/index.vue | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index ad6b971..ac6d663 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -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 @@ 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 @@ /** 新增按钮操作 */ 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() { -- Gitblit v1.9.2