From 085fa2fb257e9f11f8f6d34bf12e2dc281c36b4d Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期四, 09 二月 2023 11:28:21 +0800
Subject: [PATCH] 2023/2/9 肖辉 修改部门管理

---
 src/views/systemSetting/baseSetting/department/createUser/index.vue |   91 ++++++++++++++++++++++++++++++---------------
 1 files changed, 61 insertions(+), 30 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/department/createUser/index.vue b/src/views/systemSetting/baseSetting/department/createUser/index.vue
index 9756121..bd9769c 100644
--- a/src/views/systemSetting/baseSetting/department/createUser/index.vue
+++ b/src/views/systemSetting/baseSetting/department/createUser/index.vue
@@ -19,14 +19,14 @@
           </el-form-item>
           <!-- 涓婄骇閮ㄩ棬 -->
           <el-form-item class="optionItems" label="涓婄骇閮ㄩ棬:" prop="parentId">
-            <el-select v-model="depart.parentId" placeholder="璇疯緭鍏ヤ笂绾ч儴闂�">
-              <el-option :value="mylabel">
+            <el-select ref="projectApplicant" v-model="depart.parentId" placeholder="璇疯緭鍏ヤ笂绾ч儴闂�">
+              <el-option  :value="mylabel">
                 <el-tree
                   ref="tree"
                   :check-strictly="true"
                   :data="departList"
                   :props="defaultProps"
-                  show-checkbox
+                  @node-click="handleCheck"
                   @check-change="handleCheck"
                   default-expand-all
                   node-key="id"
@@ -74,12 +74,18 @@
               <li class="li-btn">
                 <i class="el-icon-plus" @click="openUser = true"></i>
               </li>
+              <li class="li-btn">
+                <el-tooltip class="item" effect="light" content="娓呴櫎閫変腑浜哄憳" placement="top" :enterable="false">
+                  <i class="el-icon-minus" @click="clrarUser"></i>
+                </el-tooltip>
+
+              </li>
             </ul>
             <div class="card" v-if="openUser">
               <el-card class="box-card">
                 <div slot="header" class="myclear">
                   <span>宸ヤ綔浜哄憳</span>
-                  <div @click="addUser">纭</div>
+                  <div class="box-card-sub" @click="addUser">纭</div>
                 </div>
                 <div class="scrollWrap">
                   <el-checkbox-group v-model="checkedUser">
@@ -270,6 +276,10 @@
       if (this.checkedList.length > 0) this.checkedList[0].leader = true;
       this.openUser = false;
     },
+    // 娓呴櫎閫変腑鐢ㄦ埛
+    clrarUser(){
+      this.checkedUser=[]
+    },
     handleClose() {
       this.$emit("changMyDialog", { flag: false });
     },
@@ -278,32 +288,42 @@
       this.departTypeList = await getTypeList(1, "08");
     },
     handleCheck(data, checked) {
-      this.depart.parentId = data.departName;
-      // 鑾峰彇褰撳墠閫夋嫨鐨刬d鍦ㄦ暟缁勪腑鐨勭储寮�
-      const indexs = this.selectOrg.orgsid.indexOf(data.id);
-      // 濡傛灉涓嶅瓨鍦ㄦ暟缁勪腑锛屽苟涓旀暟缁勪腑宸茬粡鏈変竴涓猧d骞朵笖checked涓簍rue鐨勬椂鍊欙紝浠h〃涓嶈兘鍐嶆閫夋嫨銆�
-      if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) {
-        this.$message({
-          message: "鍙兘閫夋嫨涓�涓儴闂紒",
-          type: "warning",
-          showClose: true,
-        });
-        // 璁剧疆宸查�夋嫨鐨勮妭鐐逛负false 寰堥噸瑕�
-        this.$refs.tree.setChecked(data, false);
-      } else if (this.selectOrg.orgsid.length === 0 && checked) {
-        // 鍙戠幇鏁扮粍涓虹┖ 骞朵笖鏄凡閫夋嫨
-        // 闃叉鏁扮粍鏈夊�硷紝棣栧厛娓呯┖锛屽啀push
-        this.selectOrg.orgsid = [];
-        this.selectOrg.orgsid.push(data.id);
-      } else if (
-        indexs >= 0 &&
-        this.selectOrg.orgsid.length === 1 &&
-        !checked
-      ) {
-        // 鍐嶆鐩存帴杩涜璧嬪�间负绌烘搷浣�
-        this.selectOrg.orgsid = [];
-        this.depart.parentId = "";
+      if(checked.childNodes.length == 0){
+        this.depart.parentId = data.departName;
+        let _this = this;
+        _this.$refs.projectApplicant.blur();
+        this.selectOrg.orgsid = []
+        this.selectOrg.orgsid.push(data.id)
+      }else {
+        return
       }
+
+      // this.depart.parentId = data.departName;
+      // // 鑾峰彇褰撳墠閫夋嫨鐨刬d鍦ㄦ暟缁勪腑鐨勭储寮�
+      // const indexs = this.selectOrg.orgsid.indexOf(data.id);
+      // // 濡傛灉涓嶅瓨鍦ㄦ暟缁勪腑锛屽苟涓旀暟缁勪腑宸茬粡鏈変竴涓猧d骞朵笖checked涓簍rue鐨勬椂鍊欙紝浠h〃涓嶈兘鍐嶆閫夋嫨銆�
+      // if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) {
+      //   this.$message({
+      //     message: "鍙兘閫夋嫨涓�涓儴闂紒",
+      //     type: "warning",
+      //     showClose: true,
+      //   });
+      //   // 璁剧疆宸查�夋嫨鐨勮妭鐐逛负false 寰堥噸瑕�
+      //   this.$refs.tree.setChecked(data, false);
+      // } else if (this.selectOrg.orgsid.length === 0 && checked) {
+      //   // 鍙戠幇鏁扮粍涓虹┖ 骞朵笖鏄凡閫夋嫨
+      //   // 闃叉鏁扮粍鏈夊�硷紝棣栧厛娓呯┖锛屽啀push
+      //   this.selectOrg.orgsid = [];
+      //   this.selectOrg.orgsid.push(data.id);
+      // } else if (
+      //   indexs >= 0 &&
+      //   this.selectOrg.orgsid.length === 1 &&
+      //   !checked
+      // ) {
+      //   // 鍐嶆鐩存帴杩涜璧嬪�间负绌烘搷浣�
+      //   this.selectOrg.orgsid = [];
+      //   this.depart.parentId = "";
+      // }
     },
     // 璁剧疆棰嗗
     setLeader(idx) {
@@ -370,6 +390,12 @@
         width: 36px;
         height: 36px;
         border-radius: 50%;
+       .el-icon-plus{
+         cursor: pointer;
+       }
+        .el-icon-minus{
+          cursor: pointer;
+        }
       }
       .el-form-item__content {
         width: 400px;
@@ -431,6 +457,11 @@
             // color: #4b9bb7;
             display: flex;
             justify-content: space-between;
+            .box-card-sub{
+              color: #2f54eb;
+              margin-left: 5px;
+              cursor: pointer;
+            }
           }
 
           .hidebar {
@@ -470,4 +501,4 @@
     padding-right: 20px;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0