From fd7586c8d91473d2850af1e48b12f1a289e6b8d1 Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期四, 13 六月 2024 00:10:43 +0800 Subject: [PATCH] 新增文件 --- src/views/console/system/add-scope-manager.vue | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/views/console/system/add-scope-manager.vue b/src/views/console/system/add-scope-manager.vue index ebc31e4..c7b49ff 100644 --- a/src/views/console/system/add-scope-manager.vue +++ b/src/views/console/system/add-scope-manager.vue @@ -14,9 +14,18 @@ </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"> @@ -100,11 +109,8 @@ }, 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=> { @@ -114,8 +120,10 @@ }) }, //鏄剧ず - open(mode='add'){ + open(parentIdList,deptCategoryList,mode='add'){ this.mode = mode; + this.parentIdList = parentIdList; + this.deptCategoryList = deptCategoryList; this.visible = true; return this }, @@ -128,12 +136,20 @@ 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); + } + console.log(res.data.parentId,res.data.$parentId) } }) }, @@ -160,7 +176,7 @@ }, //琛ㄥ崟娉ㄥ叆鏁版嵁 setData(data){ - this.getDetail(data.id); + this.getDetail(data.id,data.fixed); } } } -- Gitblit v1.9.3