|
@@ -52,7 +52,7 @@
|
52
|
52
|
<el-form-item label="检查人员:" prop="warnTargetArr">
|
53
|
53
|
<div style="border:1px solid #ccc;padding:15px;width:800px ">
|
54
|
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="formData.warnTargetArr" :disabled="isDetail" v-if="personList && personList.length>0" @change="handleCheckedCitiesChange">
|
|
55
|
+ <el-checkbox-group v-model="warnTargetArr" :disabled="isDetail" v-if="personList && personList.length>0" >
|
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>
|
|
@@ -235,7 +235,8 @@ export default {
|
235
|
235
|
loading:false,
|
236
|
236
|
checkAll: false,
|
237
|
237
|
isIndeterminate: true,
|
238
|
|
- personListIds: []
|
|
238
|
+ personListIds: [],
|
|
239
|
+ warnTargetArr: []
|
239
|
240
|
}
|
240
|
241
|
},
|
241
|
242
|
mounted() {
|
|
@@ -311,16 +312,15 @@ export default {
|
311
|
312
|
warnTargetArr.forEach(item => {
|
312
|
313
|
warnTargetIdArr.push(Number(item.substring(0, item.indexOf("|"))))
|
313
|
314
|
})
|
314
|
|
- this.formData.warnTargetArr = JSON.parse(JSON.stringify(warnTargetIdArr))
|
315
|
|
- this.checkAll = this.formData.warnTargetArr.length === this.personList.length;
|
316
|
|
- this.isIndeterminate = this.formData.warnTargetArr.length > 0 && this.formData.warnTargetArr.length < this.personList.length;
|
|
315
|
+ this.warnTargetArr = JSON.parse(JSON.stringify(warnTargetIdArr))
|
|
316
|
+ // this.checkAll = this.warnTargetArr.length === this.personList.length;
|
|
317
|
+ // this.isIndeterminate = this.warnTargetArr.length > 0 && this.warnTargetArr.length < this.personList.length;
|
317
|
318
|
}
|
318
|
319
|
}).catch((err) => {
|
319
|
320
|
console.log(err)
|
320
|
321
|
})
|
321
|
322
|
},
|
322
|
323
|
btnSave(formName) {
|
323
|
|
- console.log(this.formData.warnTargetArr)
|
324
|
324
|
this.loading = true
|
325
|
325
|
this.$refs[formName].validate((valid) => {
|
326
|
326
|
if (valid) {
|
|
@@ -331,7 +331,7 @@ export default {
|
331
|
331
|
})
|
332
|
332
|
let warnTargetNames = []
|
333
|
333
|
let warnTargetUserNames = []
|
334
|
|
- this.formData.warnTargetArr.forEach(item => {
|
|
334
|
+ this.warnTargetArr.forEach(item => {
|
335
|
335
|
this.personList.forEach(itemPer => {
|
336
|
336
|
if(item == itemPer.uId){
|
337
|
337
|
warnTargetNames.push(itemPer.personnelName)
|
|
@@ -342,8 +342,8 @@ export default {
|
342
|
342
|
this.formData.warnTargetNames = warnTargetNames.join(',')
|
343
|
343
|
|
344
|
344
|
let warnTarget = []
|
345
|
|
- for(var i = 0;i< this.formData.warnTargetArr.length;i++){
|
346
|
|
- warnTarget.push(`${this.formData.warnTargetArr[i]}|${warnTargetUserNames[i]}`)
|
|
345
|
+ for(var i = 0;i< this.warnTargetArr.length;i++){
|
|
346
|
+ warnTarget.push(`${this.warnTargetArr[i]}|${warnTargetUserNames[i]}`)
|
347
|
347
|
}
|
348
|
348
|
this.formData.warnTarget = warnTarget.join(',')
|
349
|
349
|
if (this.$route.query.state == 'add') {
|
|
@@ -363,9 +363,9 @@ export default {
|
363
|
363
|
window.history.go(-1)
|
364
|
364
|
},
|
365
|
365
|
warnTargetTypeSelect() {
|
366
|
|
- this.formData.warnTargetArr = []
|
367
|
|
- this.checkAll = false
|
368
|
|
- this.isIndeterminate = true
|
|
366
|
+ this.warnTargetArr = []
|
|
367
|
+ // this.checkAll = false
|
|
368
|
+ // this.isIndeterminate = true
|
369
|
369
|
gerPersonByRole(this.formData.warnTargetType).then(res => {
|
370
|
370
|
console.log(res)
|
371
|
371
|
this.personList = []
|
|
@@ -379,25 +379,25 @@ export default {
|
379
|
379
|
// this.personList.push(JSON.parse(JSON.stringify(person)))
|
380
|
380
|
// }
|
381
|
381
|
this.personList = res.data
|
382
|
|
- this.personList.forEach(item => {
|
383
|
|
- this.personListIds.push(item.uId)
|
384
|
|
- })
|
|
382
|
+ // this.personList.forEach(item => {
|
|
383
|
+ // this.personListIds.push(item.uId)
|
|
384
|
+ // })
|
385
|
385
|
|
386
|
386
|
})
|
387
|
387
|
},
|
388
|
|
- handleCheckAllChange(val) {
|
389
|
|
- if(val){
|
390
|
|
- this.formData.warnTargetArr = this.personListIds
|
391
|
|
- }else{
|
392
|
|
- this.formData.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
|
|
- }
|
|
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
|
+ // }
|
401
|
401
|
}
|
402
|
402
|
}
|
403
|
403
|
</script>
|