From c8e279927a36c755fd78769cfa8e489568192aa4 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 28 Aug 2021 16:31:05 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises

---
 src/views/dispatch/dispatchChildoperable.vue |   87 +++++++++++++++++++++++++++----------------
 1 files changed, 54 insertions(+), 33 deletions(-)

diff --git a/src/views/dispatch/dispatchChildoperable.vue b/src/views/dispatch/dispatchChildoperable.vue
index 702bb90..d858ed2 100644
--- a/src/views/dispatch/dispatchChildoperable.vue
+++ b/src/views/dispatch/dispatchChildoperable.vue
@@ -23,7 +23,13 @@
 </template> 
 
 <script>
-import { getdata1, adddata1, update1, remove1,getDispatcherUnitByDeptId} from "@/api/dispatch/dispatch";
+import {
+  getdata1,
+  adddata1,
+  update1,
+  remove1,
+  getDispatcherUnitByDeptId,
+} from "@/api/dispatch/dispatch";
 import { getListByDeptId } from "@/api/system/user";
 import { mapState } from "vuex";
 
@@ -269,15 +275,14 @@
       },
     };
   },
-  created () {
-
-
-     if(this.userInfo.role_name=="保安公司管理员"){
-        const deptColumn = this.findObject(this.option1.column, "deptId");
-        
-        deptColumn.search = false;
-        
-      }
+  created() {
+    if (this.userInfo.role_name == "保安公司管理员") {
+      const deptColumn = this.findObject(this.option1.column, "deptId");
+      deptColumn.search = false;
+    }else{
+      const deptColumn = this.findObject(this.option1.column, "dispatcherUnitId");
+      deptColumn.search = false;
+    }
   },
   computed: {
     // },
@@ -291,8 +296,11 @@
     ...mapState({
       userInfo: (state) => state.user.userInfo,
     }),
+    deps() {
+      return this.form.deptId;
+    },
   },
-  
+
   methods: {
     handleChangeTABS(column) {
       this.typeTABS = column;
@@ -422,12 +430,12 @@
 
     beforeOpen(done, type) {
       var that = this;
-      if (["add","edit", "view"].includes(type)) {  
-        if(this.userInfo.role_name=="保安公司管理员"){
-          getListByDeptId(that.userInfo.dept_id).then((res)=>{
+      if (["add", "edit", "view"].includes(type)) {
+        if (this.userInfo.role_name == "保安公司管理员") {
+          getListByDeptId(that.userInfo.dept_id).then((res) => {
             const userColumn = that.findObject(this.option1.column, "userIds");
             userColumn.dicData = res.data.data;
-          })
+          });
         }
       }
       this.initFlag = true;
@@ -475,13 +483,13 @@
         };
       }
 
-      if(this.userInfo.role_name=="保安公司管理员"){
+      if (this.userInfo.role_name == "保安公司管理员") {
         const deptColumn = this.findObject(this.option1.column, "deptId");
         deptColumn.disabled = true;
         // deptColumn.search = false; //会报错
         deptColumn.value = this.userInfo.dept_id;
         this.initData(2);
-      }else{
+      } else {
         this.initData(1);
       }
 
@@ -496,29 +504,42 @@
         this.data1 = data.records;
         this.loading1 = false;
         // this.$nextTick(() => this.$refs.crudrec1.dicInit("cascader"));
-        console.log(this.form,111111);
+        console.log(this.form, 111111);
       });
     },
-    initData(type){
+    initData(type) {
       var that = this;
-      if(type==1){
-          getDispatcherUnitByDeptId(null).then((res)=>{
-            const dispatcherUnitIdColumn = that.findObject(this.option1.column, "dispatcherUnitId");
-            dispatcherUnitIdColumn.dicData = res.data.data;
-           
-        })
+      if (type == 1) {
+        getDispatcherUnitByDeptId(null).then((res) => {
+          const dispatcherUnitIdColumn = that.findObject(
+            this.option1.column,
+            "dispatcherUnitId"
+          );
+          console.log(res.data.data,111);
+          dispatcherUnitIdColumn.dicData = res.data.data;
+        });
       }
-      if(type==2){
-          getDispatcherUnitByDeptId(that.userInfo.dept_id).then((res)=>{
-            const dispatcherUnitIdColumn = that.findObject(this.option1.column, "dispatcherUnitId");
-            dispatcherUnitIdColumn.dicData = res.data.data;
-        })
+      if (type == 2) {
+        getDispatcherUnitByDeptId(that.userInfo.dept_id).then((res) => {
+          const dispatcherUnitIdColumn = that.findObject(
+            this.option1.column,
+            "dispatcherUnitId"
+          );
+          dispatcherUnitIdColumn.dicData = res.data.data;
+        });
+        getListByDeptId(that.userInfo.dept_id).then((res) => {
+          const userIdsColumn = that.findObject(this.option1.column, "userIds");
+          userIdsColumn.dicData = res.data.data;
+        });
       }
-    }
+    },
   },
   //  watch: {
-  //   "form.deptId"() {
-  //     this.initData();
+  //   // "form.deptId"() {
+  //   //   this.initData();
+  //   // }
+  //   deps(){
+  //     console.log(this.deps,5646646)
   //   }
   // },
   mounted() {

--
Gitblit v1.9.3