mengy лет назад: 5
Родитель
Сommit
46e9a668ed

+ 30 - 24
shanXiPlatform/src/views/systemManagement/earlyWarningManagement/addEarlyWarningManagement.vue

@@ -51,8 +51,8 @@
51 51
         </el-form-item>
52 52
         <el-form-item label="检查人员:"  prop="warnTargetArr">
53 53
             <div style="border:1px solid #ccc;padding:15px;width:800px ">
54
-              <!-- <el-checkbox :indeterminate="isIndeterminate" :disabled="isDetail" v-model="checkAll" v-if="personList && personList.length>0" @change="handleCheckAllChange">全选</el-checkbox> -->
55
-              <el-checkbox-group v-model="warnTargetArr"  :disabled="isDetail" v-if="personList && personList.length>0" >
54
+              <el-checkbox :indeterminate="isIndeterminate" :disabled="isDetail" v-model="checkAll" v-if="personList && personList.length>0" @change="handleCheckAllChange">全选</el-checkbox>
55
+              <el-checkbox-group v-model="warnTargetArr"  :disabled="isDetail" v-if="personList && personList.length>0"  @change="handleCheckedCitiesChange">
56 56
                 <el-checkbox v-for="item in personList" :key="item.uId" :label="item.uId">{{item.personnelName}}</el-checkbox>
57 57
               </el-checkbox-group>
58 58
               <span v-if="!personList || personList.length == 0" style="color:#cccccc">暂无数据</span>
@@ -236,7 +236,7 @@ export default {
236 236
       checkAll: false,
237 237
       isIndeterminate: true,
238 238
       personListIds: [],
239
-      warnTargetArr: []
239
+      warnTargetArr:[]
240 240
     }
241 241
   },
242 242
   mounted() {
@@ -305,8 +305,15 @@ export default {
305 305
     detailInfo() {
306 306
       detailFun(this.$route.query.id).then(res => {
307 307
         if (res.code == 200) {
308
+          gerPersonByRole(res.data.warnTargetType).then(response => {
309
+            this.personList = []
310
+            this.personList = response.data
311
+            this.personList.forEach(item => {
312
+              this.personListIds.push(item.uId)
313
+            })
314
+          })
308 315
           this.formData = res.data
309
-          this.warnTargetTypeSelect()
316
+          // this.warnTargetTypeSelect()
310 317
           let warnTargetArr = this.formData.warnTarget.split(',')
311 318
           let warnTargetIdArr = []
312 319
           warnTargetArr.forEach(item => {
@@ -363,9 +370,6 @@ export default {
363 370
       window.history.go(-1)
364 371
     },
365 372
     warnTargetTypeSelect() {
366
-      this.warnTargetArr = []
367
-        // this.checkAll = false
368
-        // this.isIndeterminate = true
369 373
       gerPersonByRole(this.formData.warnTargetType).then(res => {
370 374
         console.log(res)
371 375
         this.personList = []
@@ -379,25 +383,27 @@ export default {
379 383
         //   this.personList.push(JSON.parse(JSON.stringify(person)))
380 384
         // }
381 385
         this.personList = res.data
382
-        // this.personList.forEach(item => {
383
-        //   this.personListIds.push(item.uId)
384
-        // })
385
-        
386
+        this.personList.forEach(item => {
387
+          this.personListIds.push(item.uId)
388
+        })
389
+        this.warnTargetArr = []
390
+        this.checkAll = false
391
+        this.isIndeterminate = true
386 392
       })
387 393
     },
388
-    // handleCheckAllChange(val) {
389
-    //   if(val){
390
-    //     this.warnTargetArr = this.personListIds
391
-    //   }else{
392
-    //     this.warnTargetArr = []
393
-    //   }
394
-    //   this.isIndeterminate = false;
395
-    // },
396
-    // handleCheckedCitiesChange(value) {
397
-    //   let checkedCount = value.length;
398
-    //   this.checkAll = checkedCount === this.personList.length;
399
-    //   this.isIndeterminate = checkedCount > 0 && checkedCount < this.personList.length;
400
-    // }
394
+    handleCheckAllChange(val) {
395
+      if(val){
396
+        this.warnTargetArr = this.personListIds
397
+      }else{
398
+        this.warnTargetArr = []
399
+      }
400
+      this.isIndeterminate = false;
401
+    },
402
+    handleCheckedCitiesChange(value) {
403
+      let checkedCount = value.length;
404
+      this.checkAll = checkedCount === this.personList.length;
405
+      this.isIndeterminate = checkedCount > 0 && checkedCount < this.personList.length;
406
+    }
401 407
   }
402 408
 }
403 409
 </script>