| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="上级权限"> |
| | | <el-select v-model="addDictForm.parentId" placeholder="请选择上级权限" style="width: 100%" @change="parentIdChange" :disabled="mode=='add'"> |
| | | <el-option v-for="item in parentIdList" :key="item.parentId" :label="item.title" :value="item.parentId"/> |
| | | </el-select> |
| | | <el-tree-select |
| | | @change = "parentIdChange" |
| | | v-model="addDictForm.parentId" |
| | | clearable |
| | | node-key="id" |
| | | placeholder="上级权限" |
| | | ref="parentTree" |
| | | :data="parentIdList" |
| | | check-strictly |
| | | :props="{ label: 'title' }" |
| | | style="width:100%;" |
| | | :render-after-expand="false" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | }, |
| | | methods: { |
| | | parentIdChange(value) { |
| | | this.parentIdList.forEach(item=> { |
| | | if(item.parentId == value) { |
| | | this.addDictForm.$parentId = item.title; |
| | | } |
| | | }) |
| | | var $parentId = this.$refs.parentTree.getCurrentNode().title; |
| | | this.addDictForm.$parentId = $parentId; |
| | | }, |
| | | deptCategoryChange(value) { |
| | | this.deptCategoryList.forEach(item=> { |
| | |
| | | }) |
| | | }, |
| | | //显示 |
| | | open(mode='add'){ |
| | | open(parentIdList,deptCategoryList,mode='add'){ |
| | | this.mode = mode; |
| | | this.parentIdList = parentIdList; |
| | | this.deptCategoryList = deptCategoryList; |
| | | this.visible = true; |
| | | return this |
| | | }, |
| | |
| | | var res = await this.$API.system.dept.list.get(); |
| | | this.depts = res.data; |
| | | }, |
| | | getDetail(id) { |
| | | console.log(this.deptCategoryList) |
| | | getDetail(id,fixed) { |
| | | this.$HTTP.get(`/api/blade-system/data-scope-manager/detail?id=${id}`).then(res=> { |
| | | if(res.code == 200) { |
| | | //可以和上面一样单个注入,也可以像下面一样直接合并进去 |
| | | Object.assign(this.addDictForm, res.data); |
| | | res.data.parentId == 0?res.data.parentId = "":res.data.parentId; |
| | | res.data.$parentId = res.data.parentName; |
| | | res.data.$deptCategory = res.data.deptCategoryName; |
| | | res.data.deptCategory = String(res.data.deptCategory); |
| | | if(fixed) { //新增子项 |
| | | this.addDictForm.parentId = id; |
| | | }else { |
| | | Object.assign(this.addDictForm, res.data); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | //表单注入数据 |
| | | setData(data){ |
| | | this.getDetail(data.id); |
| | | this.getDetail(data.id,data.fixed); |
| | | } |
| | | } |
| | | } |