Bläddra i källkod

指派根据组查询人员

seimin 3 år sedan
förälder
incheckning
8eb9430adc
1 ändrade filer med 46 tillägg och 8 borttagningar
  1. 46 8
      src/components/showModel/showModel.vue

+ 46 - 8
src/components/showModel/showModel.vue

@@ -20,9 +20,14 @@
20 20
         <div v-if="info" class="showModel__info">{{ info }}</div>
21 21
         <div class="select-wrap" v-if="selectName === 'user'">
22 22
           <cube-select
23
+            v-model="selectGroupId"
24
+            :options="selectDataGroup"
25
+            placeholder="请选择工作组" @change="changeGroup($event)"
26
+          ></cube-select>
27
+          <cube-select
23 28
             v-model="selectUserId"
24
-            :options="selectData"
25
-            placeholder="请选择指派对象"
29
+            :options="selectDataUser"
30
+            placeholder="请选择指派对象" style="margin-top:0.5rem;"
26 31
           ></cube-select>
27 32
         </div>
28 33
         <div v-if="textName === 'textarea'">
@@ -58,14 +63,17 @@ export default {
58 63
       time: 5, //5秒后自动关闭
59 64
       timer: null, //5秒后自动关闭,定时器
60 65
       timerFlag: true, //是否显示取消自动关闭按钮
61
-      selectData: [], //select数据
62
-      selectUserId: 0, //select选中的数据
66
+      selectDataUser: [], //select数据-用户
67
+      selectUserId: 0, //select选中的数据-用户
68
+      selectDataGroup: [], //select数据-工作组
69
+      selectGroupId: 0, //select选中的数据-工作组
63 70
       textareaData: '', //textarea的数据
64 71
     };
65 72
   },
66 73
   watch: {
67 74
     disjunctor(newValue) {
68 75
       if (newValue && this.selectName === "user") {
76
+        this.selectGroupId = 0;
69 77
         this.selectUserId = 0;
70 78
       }
71 79
       if (newValue && this.textName === "textarea") {
@@ -130,8 +138,13 @@ export default {
130 138
     }
131 139
   },
132 140
   methods: {
141
+    //选择组
142
+    changeGroup(groupId){
143
+      this.getZpUser(groupId);
144
+    },
133 145
     // 获取指派对象
134
-    getZpUser() {
146
+    getZpUser(groupId) {
147
+      this.selectDataUser = [];
135 148
       var postData = {
136 149
         idx: 0,
137 150
         sum: 1000,
@@ -141,14 +154,38 @@ export default {
141 154
           selectType: "1"
142 155
         }
143 156
       };
157
+      if(groupId){
158
+        postData.user.groupdata = {id:groupId}
159
+      }
144 160
       this.$http
145 161
         .post("service/user/data/fetchDataList/user", postData)
146 162
         .then(res => {
147
-          res.data.list.forEach((v, i) => {
148
-            this.selectData.push({
163
+          res.data.list = res.data.list || [];
164
+          this.selectDataUser = res.data.list.map((v) => {
165
+            return {
149 166
               text: v.name,
150 167
               value: v.id
151
-            });
168
+            };
169
+          });
170
+        });
171
+    },
172
+    // 获取工作组
173
+    getZpGroup() {
174
+      this.selectDataGroup = [];
175
+      var postData = {
176
+        idx: 0,
177
+        sum: 1000,
178
+        group: {}
179
+      };
180
+      this.$http
181
+        .post("service/user/data/fetchDataList/group", postData)
182
+        .then(res => {
183
+          res.data.list = res.data.list||[];
184
+          this.selectDataGroup = res.data.list.map((v) => {
185
+            return {
186
+              text: v.groupName,
187
+              value: v.id
188
+            };
152 189
           });
153 190
         });
154 191
     },
@@ -183,6 +220,7 @@ export default {
183 220
   },
184 221
   created() {
185 222
     if (this.selectName === "user") {
223
+      this.getZpGroup();
186 224
       this.getZpUser();
187 225
     }
188 226
   }