Your Name
2022-07-19 a0da13fa9d90a7b3f8091d5759ba630f95c35528
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
<template>
    <div class="app-container">
        <div class="filter-container">
            <div class="basic_search">
                <span>巡检开始时间:</span>
                <el-date-picker v-model="listQuery.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="巡检开始时间"></el-date-picker>
            </div>
            <div class="basic_search">
                <span>巡检结束时间:</span>
                <el-date-picker v-model="listQuery.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="巡检结束时间"></el-date-picker>
            </div>
            <div class="basic_search">
                <span>巡检任务类型:</span>
                <el-select v-model="listQuery.type">
                   <el-option
                        v-for="item in typeList"
                        :key="item.id"
                        :value="item.id"
                        :label="item.name"
                    ></el-option>
                </el-select>
            </div>
            <div class="basic_search">
                <span>巡检任务状态:</span>
                <el-select v-model="listQuery.status" clearable>
                    <el-option
                        v-for="item in statusList"
                        :key="item.id"
                        :value="item.id"
                        :label="item.name"
                    ></el-option>
                </el-select>
            </div>
            <div class="basic_search">
                <span>巡检任务创建人员:</span>
                <el-select v-model="listQuery.createUid" filterable clearable>
                    <el-option
                        v-for="item in userList"
                        :key="item.id"
                        :value="item.id"
                        :label="item.realname"
                    ></el-option>
                </el-select>
            </div>
<!--            <div class="basic_search">-->
<!--                <span>异常通知人员:</span>-->
<!--                <el-select v-model="listQuery.noticeUid" filterable clearable>-->
<!--                   <el-option-->
<!--                        v-for="item in userList"-->
<!--                        :key="item.id"-->
<!--                        :value="item.id"-->
<!--                        :label="item.realname"-->
<!--                    ></el-option>-->
<!--                </el-select>-->
<!--            </div>-->
            <div class="basic_search">
                <span>执行巡检人员:</span>
                <el-select v-model="listQuery.execUid" filterable clearable>
                    <el-option
                        v-for="item in userList"
                        :key="item.id"
                        :value="item.id"
                        :label="item.realname"
                    ></el-option>
                </el-select>
            </div>
            <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" icon="el-icon-refresh" @click="refreshHandle">搜索</el-button>
            <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" icon="el-icon-plus" @click="showAnalyseUnitForm('','新增')">新增</el-button>
        </div>
 
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :key="tableKey"
                :data="inspectionTaskData"
                border
                fit
                highlight-current-row
                style="width: 100%;"
            >
                <el-table-column label="任务名称" prop="title" align="center">
                </el-table-column>
                <el-table-column label="检查类型" prop="type" align="center">
                    <template slot-scope="scope">
                        <div v-for="item in typeList">
                            <div v-show="item.id === scope.row.type">
                                {{ item.name }}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="检查频次(小时)" prop="intervalSeconds" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.intervalSeconds | parseHours}}
                    </template>
                </el-table-column>
                <el-table-column label="任务开始时间" prop="startTime" align="center">
                </el-table-column>
<!--                <el-table-column label="异常通知人" prop="noticeUname" align="center">-->
<!--                </el-table-column>-->
                <el-table-column label="巡检人" prop="execUname" align="center">
                </el-table-column>
                <el-table-column label="创建人" prop="createUname" align="center">
                </el-table-column>
                <el-table-column label="创建时间" prop="createTime" align="center">
                </el-table-column>
                <el-table-column label="状态" prop="createTime" align="center">
                    <template slot-scope="scope">
                        <div v-for="item in statusList">
                            <div v-show="scope.row.status === item.id">
                                <el-tag :type="scope.row.status === 1 ? 'primary' : (scope.row.status === 2 ? 'warning' : (scope.row.status === 3 ? 'danger' : 'info'))">{{item.name}}</el-tag>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                        <el-button type="text" @click="showAnalyseUnitForm(scope.row,'编辑')">编辑</el-button>
                        <el-button type="text" style="color: red" @click="deleteById(scope.row)">删除</el-button>
                        <el-button type="text" @click="openTask(scope.row,'编辑')">开启</el-button>
                        <el-button type="text" style="color: red" @click="closeTask(scope.row)">关闭</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br>
            <el-pagination
                v-show="recordTotal>0"
                :current-page="listQuery.page"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="listQuery.pageSize"
                :total="recordTotal"
                layout="total, sizes, prev, pager, next, jumper"
                background
                style="float:right;"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
            />
            <br>
        </div>
 
        <el-dialog :title="title" :visible.sync="inspectionTaskVisible" append-to-body :close-on-click-modal="false" width="55%">
 
 
            <el-divider></el-divider>
 
            <div class="inspectionTask_form">
                <el-form ref="inspectionTaskForm" :rules="inspectionTaskFormRules" :model="inspectionTaskForm" label-position="right" label-width="120px">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="任务名称" prop="title">
                                <el-input v-model="inspectionTaskForm.title" class="analyseUnit_input">
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="巡检任务类型" prop="type">
                                <el-select v-model="inspectionTaskForm.type" class="analyseUnit_input" :disabled="ifShow">
                                    <el-option
                                        v-for="item in typeList"
                                        :key="item.id"
                                        :value="item.id"
                                        :label="item.name"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="周期开始时间" prop="startTime">
                                <el-date-picker v-model="inspectionTaskForm.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="周期开始时间" class="analyseUnit_input"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="检查频次" prop="intervalSeconds">
                                <el-select v-model="inspectionTaskForm.intervalSeconds" class="analyseUnit_input">
                                    <el-option
                                    v-for="item in intervalSecondsList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="提前通知时间" prop="noticeSeconds">
                                <el-select v-model="inspectionTaskForm.noticeSeconds" class="analyseUnit_input">
                                    <el-option
                                        v-for="item in noticeSecondsList"
                                        :key="item.id"
                                        :label="item.name"
                                        :value="item.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="任务有效时间" prop="effectSeconds">
                                <el-select v-model="inspectionTaskForm.effectSeconds" class="analyseUnit_input">
                                    <el-option
                                        v-for="item in effectSecondsList"
                                        :key="item.id"
                                        :label="item.name"
                                        :value="item.id"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
<!--                    <el-row>-->
<!--                        <el-col :span="12">-->
<!--                            <el-form-item label="异常通知部门" prop="noticeDepartment">-->
<!--                                <el-select v-model="noticeDepartment" class="analyseUnit_input" filterable clearable @change="changeNotice">-->
<!--                                    <el-option-->
<!--                                        v-for="item in departmentList"-->
<!--                                        :key="item.id"-->
<!--                                        :value="item.department"-->
<!--                                        :label="item.department"-->
<!--                                    ></el-option>-->
<!--                                </el-select>-->
<!--                            </el-form-item>-->
<!--                        </el-col>-->
<!--                        <el-col :span="12">-->
<!--                        <el-form-item label="异常通知人员" prop="noticeUid">-->
<!--                            <el-select v-model="inspectionTaskForm.noticeUid" filterable clearable class="analyseUnit_input">-->
<!--                                <el-option-->
<!--                                    v-for="item in noticeUidList"-->
<!--                                    :key="item.id"-->
<!--                                    :value="item.id"-->
<!--                                    :label="item.realname"-->
<!--                                ></el-option>-->
<!--                            </el-select>-->
<!--                        </el-form-item>-->
<!--                    </el-col>-->
<!--                    </el-row>-->
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="执行巡检部门" prop="execDepartment">
                                <el-select v-model="execDepartment" filterable clearable class="analyseUnit_input" @change="changeExec">
                                    <el-option
                                        v-for="item in departmentList"
                                        :key="item.id"
                                        :value="item.department"
                                        :label="item.department"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="执行巡检人员" prop="execUid">
                                <el-select v-model="inspectionTaskForm.execUid" filterable clearable class="analyseUnit_input">
                                    <el-option
                                        v-for="item in execUidList"
                                        :key="item.id"
                                        :value="item.id"
                                        :label="item.realname"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </div>
 
 
            <el-divider></el-divider>
 
            <div class="inspectionTask_point">
                <el-tabs class="active" v-model="activeName">
                    <el-tab-pane label="检查项信息" name="inspectionPoint">
                        <inspection-point @giveToForm="receiveToForm" ref="inspectionPoint" :title="title" :inspectionTaskForm="inspectionTaskForm"></inspection-point>
                    </el-tab-pane>
                </el-tabs>
            </div>
 
            <div  align="right">
                <el-button @click="inspectionTaskVisible = false">取消</el-button>
                <el-button type="primary" @click="submitAnalyseUnit()">确认</el-button>
            </div>
        </el-dialog>
    </div>
</template>
 
<script>
    import Cookies from "js-cookie";
    import { mapGetters } from 'vuex'
    import { computePageCount } from '@/utils'
    import inspectionPoint from './components/inpectionPoint'
    import {
        getInspectionTask,
        addInspectionTask,
        updateInspectionTask,
        deleteInspectionTask, closeInspectionTask
    } from "../../../../api/inspectionTask";
    import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage";
    import {safetyInspectionItemName} from "../../../../api/safetySelfInspection";
    export default {
        name: 'index',
        filters: {
            parseHours(seconds){
                let arg1 = parseFloat(seconds)
                let arg2 = parseFloat(3600)
                let t1 = 0
                let t2 = 0
                let r1
                let r2
                try {
                    t1 = arg1.toString().split(".")[1].length;
                }catch (e){
 
                }
                try {
                    t2 = arg2.toString().split(".")[1].length;
                }catch (e){
                }
                r1 = Number(arg1.toString().replace(".",""))
                r2 = Number(arg2.toString().replace(".",""))
                return r1/r2*Math.pow(10,t2-t1)
            },
        },
        computed: {
            ...mapGetters([
                'userType'
            ])
        },
        components: {
            inspectionPoint
        },
        data() {
            return {
                tableKey: 0,
                ifShow:true,
                activeName:'inspectionPoint',
                inspectionTaskData: [],
                departmentList:[],
                userList:[],
                // noticeUidList:[],
                execUidList:[],
                statusList:[{name:'任务开启',id:1},{id:2,name:'任务关闭'},{id:3,name:'删除'},{id:4,name:'过期'}],
                intervalSecondsList:[{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:28800,name:'8小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'},{id:17280,name:'2天'},{id:604800,name:'每周'},{id:2592000,name:'每月'},{id:7862400,name:'每季度'}],
                noticeSecondsList:[{id:600,name:'10分'},{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'}],
                effectSecondsList:[{id:1800,name:'30分'},{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'}],
                typeList:[{id:1,name:'日常检查'},{id:2,name:'周期检查'}],
                listLoading: false,
                pageSize: 10,
                recordTotal: 0,
                currentPage: 1,
                pageTotal: 0,
                title:'',
                company:'',
                code:'',
                // noticeDepartment:'',
                execDepartment:'',
                inspectionTaskVisible:false,
                inspectionTaskFormRules:{
                    title: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
                    type: [{ required: true, message: '检查类型不能为空', trigger: 'change' }],
                    intervalSeconds: [{ required: true, message: '检查频次不能为空', trigger: 'change' }],
                    noticeSeconds: [{ required: true, message: '提前通知时间不能为空', trigger: 'change' }],
                    startTime: [{ required: true, message: '周期开始时间不能为空', trigger: 'change' }],
                    effectSeconds: [{ required: true, message: '任务有效时间不能为空', trigger: 'change' }],
                    noticeUid: [{ required: true, message: '异常通知人员不能为空', trigger: 'change' }],
                    execUid: [{ required: true, message: '执行巡检人员不能为空', trigger: 'change' }],
                },
                inspectionTaskForm:{
                    type:null,
                    createUid: null,
                    effectSeconds: null,
                    execUid: null,
                    intervalSeconds: null,
                    noticeSeconds: null,
                    // noticeUid: null,
                    title:'',
                    riskControlMeasureIdList: [
                    ],
                    startTime: "",
                },
                listQuery:{
                    createUid: "",
                    endTime: "",
                    execUid: "",
                    startTime: "",
                    status:"",
                    type: "",
                    page: 1,
                    pageSize: 10,
 
                },
            }
        },
        created() {
            this.getInspectionTaskData()
            this.getDepartment()
            this.getUser()
        },
        methods: {
            async getInspectionTaskData(){
                this.listLoading = true
                let res = await getInspectionTask(this.listQuery)
                if(res.data.code === '200'){
                    this.recordTotal = JSON.parse(res.data.message).total
                    this.inspectionTaskData = res.data.result
                }else if(res.data.code === '300'){
                    this.inspectionTaskData = []
                }
                else{
                    this.$message({
                        message:res.data.message,
                        type:'warning'
                    })
                }
                this.listLoading = false
            },
            async getDepartment(){
                let res = await getDepartmentList({pageSize:1000,pageIndex:1})
                if(res.data.code === '200'){
                    this.departmentList = res.data.result.result
                }else{
                    this.$message({
                        message:res.data.message,
                        type:'warning'
                    })
                }
            },
            // changeNotice(){
            //     if(this.noticeDepartment === '') {
            //         this.noticeUidList = []
            //         this.inspectionTaskForm.noticeUid = ''
            //     }
            //     this.noticeUidList = this.userList.filter( item => item.department === this.noticeDepartment)
            // },
            changeExec(){
                if(this.execDepartment === '') {
                    this.execUidList = []
                    this.inspectionTaskForm.execUid = ''
                }
                this.execUidList = this.userList.filter ( item => item.departmentname === this.execDepartment)
            },
            async getUser(){
                let res = await safetyInspectionItemName()
                if(res.data.code === '200'){
                    this.userList = res.data.result
                }else{
                    this.$message({
                        message:res.data.message,
                        type:'warning'
                    })
                }
            },
            showAnalyseUnitForm(value,type){
                this.inspectionTaskVisible = true
                this.$nextTick(() =>{
                    this.$refs["inspectionTaskForm"].clearValidate()
                })
                if(type === '新增'){
                    this.ifShow = false
                    this.title = '新建巡检计划设定'
                    // this.noticeDepartment = ''
                    this.execDepartment = ''
                    this.inspectionTaskForm = {
                        type:null,
                        createUid: parseInt(Cookies.get('userId')),
                        effectSeconds: null,
                        execUid: null,
                        intervalSeconds: null,
                        noticeSeconds: null,
                        // noticeUid: null,
                        title:'',
                        riskControlMeasureIdList: [
                        ],
                        startTime: "",
                    }
                    setTimeout(() => {
                        this.$refs.inspectionPoint.inspectionPointData = []
                        this.$refs.inspectionPoint.ifEdit = false
                    });
                }else{
                    this.ifShow = true
                    this.title = '编辑巡检计划设定'
                    // this.noticeDepartment = this.handleDepartment(JSON.parse(JSON.stringify(value)).noticeUid)
                    // this.changeNotice()
                    this.execDepartment = this.handleDepartment(JSON.parse(JSON.stringify(value)).execUid)
                    this.changeExec()
                    this.inspectionTaskForm = JSON.parse(JSON.stringify(value))
                    this.inspectionTaskForm.execUid = value.execUid
                    // this.inspectionTaskForm.noticeUid = value.noticeUname
                     setTimeout(() => {
                        this.$refs.inspectionPoint.inspectionPointData =  this.inspectionTaskForm.checkContents
                        this.$refs.inspectionPoint.ifEdit = true
                    });
                }
            },
            handleDepartment(value){
                let department = ''
                for(let i in this.userList){
                    if(this.userList[i].id === value){
                        department = this.userList[i].departmentname
                    }
                }
                department = this.departmentList.find(item => item.department === department)
                return department.department
            },
            submitAnalyseUnit(){
                this.$refs["inspectionTaskForm"].validate((valid) =>{
                    if(valid){
                        if(this.inspectionTaskForm.noticeSeconds >= this.inspectionTaskForm.intervalSeconds){
                            this.$message({
                                type:'warning',
                                 message:'提前通知时间不能大于检查频次'
                            })
                        }else if(this.inspectionTaskForm.intervalSeconds <= this.inspectionTaskForm.effectSeconds){
                                this.$message({
                                type:'warning',
                                 message:'任务持续时间不能大于检查频次'
                            })
                        }else if(this.justifyTime(this.inspectionTaskForm.startTime,this.inspectionTaskForm.noticeSeconds)){
                                this.$message({
                                type:'warning',
                                message:'周期开始时间减去当前时间和提前通知时间要大于等于半小时'
                            })
                        }else{
                            if(this.title === '新建巡检计划设定'){
                                addInspectionTask(this.inspectionTaskForm).then((res)=>{
                                    if(res.data.code === '200'){
                                        this.inspectionTaskVisible = false
                                        this.getInspectionTaskData()
                                        this.$notify({
                                            type:'success',
                                            duration:2000,
                                            message:'新增成功',
                                            title:'成功'
                                        })
                                    }else{
                                        this.$message({
                                            type:'warning',
                                            message:res.data.message
                                        })
                                    }
                                })
                            }else{
                                updateInspectionTask({
                                    effectSeconds: this.inspectionTaskForm.effectSeconds,
                                    execUid: this.inspectionTaskForm.execUid,
                                    intervalSeconds: this.inspectionTaskForm.intervalSeconds,
                                    noticeSeconds: this.inspectionTaskForm.noticeSeconds,
                                    // noticeUid: this.inspectionTaskForm.noticeUid,
                                    startTime: this.inspectionTaskForm.startTime,
                                    status: this.inspectionTaskForm.status,
                                    workId: this.inspectionTaskForm.workId,
                                    title: this.inspectionTaskForm.title
                                    }).then((res)=>{
                                    if(res.data.code === '200'){
                                        this.inspectionTaskVisible = false
                                        this.getInspectionTaskData()
                                        this.$notify({
                                            type:'success',
                                            duration:2000,
                                            title:'成功',
                                            message:'编辑成功'
                                        })
                                    }else{
                                        this.$message({
                                            type:'warning',
                                            message:res.data.message
                                        })
                                    }
                                })
                            }
                        }
 
                    }else{
                        this.$message({
                            type:'warning',
                            message:'请完善基本信息'
                        })
                    }
                })
 
            },
            justifyTime(time,interval) {
                let timeStr = new Date(time.replace(/-/g,'/'))
                let date = parseInt(timeStr.getTime()/1000)
                let newTimeStr = new Date()
                let newDate = parseInt(newTimeStr.getTime()/1000)
                if(date - newDate - interval - 1800 >= 0){
                    return false
                }else{
                    return true
                }
            },
 
            openTask(val,type){
                if(val.status !== 2){
                    this.$message({
                        type:'warning',
                        message:'当前状态不可开启'
                    })
                    return
                }
                this.showAnalyseUnitForm(val,type)
                this.inspectionTaskForm.status = 1
            },
 
            closeTask(val){
                if(val.status !== 1){
                    this.$message({
                        type:'warning',
                        message:'当前状态不可关闭'
                    })
                    return
                }
                this.$confirm('关闭此条任务,是否继续','提示',{
                    confirmButtonText:'确定',
                    cancelButtonText:'取消',
                    type:'warning',
                }).then(()=> {
                    closeInspectionTask(val.workId).then( (res)=>{
                        if(res.data.code === '200'){
                            this.getInspectionTaskData()
                            this.$notify({
                                title:'成功',
                                message:'关闭成功',
                                type:'success',
                                duration:2000,
                            })
                        }else{
                            this.$message({
                                type:'warning',
                                message:res.data.message
                            })
                        }
                    })
                })
            },
 
            deleteById(val){
                if(val.status !== 2){
                    this.$message({
                        type:'warning',
                        message:'当前状态不可删除'
                    })
                    return
                }
                this.$confirm('删除此条信息,是否继续','提示',{
                    confirmButtonText:'确定',
                    cancelButtonText:'取消',
                    type:'warning',
                }).then(()=> {
                    deleteInspectionTask(val.workId).then( (res)=>{
                        if(res.data.code === '200'){
                            this.getInspectionTaskData()
                            this.$notify({
                                title:'成功',
                                message:'删除成功',
                                type:'success',
                                duration:2000,
                            })
                        }else{
                            this.$message({
                                type:'warning',
                                message:res.data.message
                            })
                        }
                    })
                })
            },
            receiveToForm(value) {
                this.inspectionTaskForm.riskControlMeasureIdList = []
                this.inspectionTaskForm.riskControlMeasureIdList = value.map( item => {
                    return item.id
                })
                // this.inspectionTaskForm.riskControlMeasureIdList.push({id:value.id})
            },
            refreshHandle(){
                this.getInspectionTaskData()
            },
            handleSizeChange(val){
                this.listQuery.pageSize = val
                this.getInspectionTaskData()
            },
            handleCurrentChange(val){
                this.listQuery.page = val
                this.getInspectionTaskData()
            },
        }
    }
</script>
<style scoped>
    .basic_search{
        display:inline-block;
        padding-bottom: 10px;
        padding-left: 10px;
    }
    .analyseUnit_input{
        width:320px;
    }
    /deep/.el-divider--horizontal {
     margin-top: 0px !important;
    }
 
    /deep/.el-dialog__body {
      padding-top: 10px !important;
    }
</style>