马宇豪
2025-03-12 de5e674a5655cd5c8d5457d1be8182519625d265
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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
<template>
  <div class="system-menu-dialog-container">
    <el-dialog :title="identifyDialogState.title" v-model="identifyDialogState.identifyDialogVisible" width="600px">
      <el-form ref="identifyFormRef" :rules="identifyDialogState.identifyFormRules"
               :model="identifyDialogState.identifyForm" size="default" label-width="160px">
        <el-row :gutter="35">
          <!--                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
          <!--                        <el-form-item label="辨识方法" prop="identificationMethod">-->
          <!--                            <el-select class="input-length" :disabled="true" v-model="identifyDialogState.identifyForm.identificationMethod" style="width:100%" placeholder="辨识方法" clearable>-->
          <!--                                <el-option v-for="item in identifyDialogState.identificationMethodList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
          <!--                            </el-select>-->
          <!--                        </el-form-item>-->
          <!--                    </el-col>-->
 
          <div style="width: 100%" v-if="identifyDialogState.method === 1">
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="PHA_检查项目" prop="phaCheckItem">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.phaCheckItem" placeholder="检查项目"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="PHA_存在风险因素" prop="phaRiskFactor">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.phaRiskFactor" placeholder="存在风险因素"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="PHA_可能产生的后果" prop="phaResult">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.phaResult" placeholder="可能产生的后果"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="分配评价方法">
                <el-select disabled class="input-length" v-model="identifyDialogState.evaluateMethod" style="width:100%"
                           placeholder="" clearable>
                  <el-option v-for="item in identifyDialogState.evaluateMethodList" :key="item.id" :label="item.name"
                             :value="item.id"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!--                      <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
            <!--                        <el-form-item label="评价专家" prop="phaEvaluateUser">-->
            <!--                          <el-select class="input-length" v-model="identifyDialogState.identifyForm.phaEvaluateUser" style="width:100%" placeholder="" clearable>-->
            <!--                            <el-option v-for="item in identifyDialogState.personList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
            <!--                          </el-select>-->
            <!--                        </el-form-item>-->
            <!--                      </el-col>-->
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="评价专家">
                <el-input class="input-length" disabled v-model="identifyDialogState.evaluateUser"
                          placeholder="暂无评价专家" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识结果" prop="result">
                <el-radio-group v-model="identifyDialogState.identifyForm.result"
                                :disabled="identifyDialogState.disabled">
                  <el-radio :label="1">有风险</el-radio>
                  <el-radio :label="2">无风险</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识专家建议" prop="identificationDesc">
                <el-input class="input-length" type="textarea" :autosize="{ minRows: 3}"
                          :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.identificationDesc" placeholder="辨识专家建议"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="附件">
                <el-upload accept="image/*" :action="identifyDialogState.uploadUrl"
                           :disabled="identifyDialogState.disabled"
                           :headers="identifyDialogState.header" method="post" :data="{module: 'identification'}"
                           :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview"
                           :limit='identifyDialogState.imgLimit' v-model:file-list="identifyDialogState.fileList"
                           list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove"
                           :before-remove="beforeRemove">
                  <el-icon>
                    <Plus/>
                  </el-icon>
                  <template #tip>
                    <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
                  </template>
                </el-upload>
              </el-form-item>
            </el-col>
          </div>
 
          <div style="width: 100%" v-if="identifyDialogState.method === 2">
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="JHA_作业步骤" prop="jhaCheckItem">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.jhaCheckItem" placeholder="作业步骤"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="JHA_危险源或潜在事件" prop="jhaRiskFactor">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.jhaRiskFactor" placeholder="危险源或潜在事件"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="JHA_可能产生的后果" prop="jhaResult">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.jhaResult" placeholder="可能产生的后果"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="分配评价方法">
                <el-select disabled class="input-length" v-model="identifyDialogState.evaluateMethod" style="width:100%"
                           placeholder="" clearable>
                  <el-option v-for="item in identifyDialogState.evaluateMethodList" :key="item.id" :label="item.name"
                             :value="item.id"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!--                      <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
            <!--                        <el-form-item label="评价专家" prop="jhaEvaluateUser">-->
            <!--                          <el-select class="input-length" v-model="identifyDialogState.identifyForm.jhaEvaluateUser" style="width:100%" placeholder="" clearable>-->
            <!--                            <el-option v-for="item in identifyDialogState.personList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
            <!--                          </el-select>-->
            <!--                        </el-form-item>-->
            <!--                      </el-col>-->
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="评价专家">
                <el-input class="input-length" disabled v-model="identifyDialogState.evaluateUser"
                          placeholder="暂无评价专家" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识结果" prop="result">
                <el-radio-group v-model="identifyDialogState.identifyForm.result"
                                :disabled="identifyDialogState.disabled">
                  <el-radio :label="1">有风险</el-radio>
                  <el-radio :label="2">无风险</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识专家建议" prop="identificationDesc">
                <el-input class="input-length" type="textarea" :autosize="{ minRows: 3}"
                          :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.identificationDesc" placeholder="辨识专家建议"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="附件">
                <el-upload accept="image/*" :action="identifyDialogState.uploadUrl"
                           :disabled="identifyDialogState.disabled"
                           :headers="identifyDialogState.header" method="post" :data="{module: 'identification'}"
                           :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview"
                           :limit='identifyDialogState.imgLimit' v-model:file-list="identifyDialogState.fileList"
                           list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove"
                           :before-remove="beforeRemove">
                  <el-icon>
                    <Plus/>
                  </el-icon>
                  <template #tip>
                    <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
                  </template>
                </el-upload>
              </el-form-item>
            </el-col>
          </div>
 
          <div style="width: 100%" v-if="identifyDialogState.method === 3">
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="SCL_检查项目" prop="sclCheckItem">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.sclCheckItem" placeholder="检查项目"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="SCL_检查标准" prop="sclCheckStandard">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.sclCheckStandard" placeholder="检查标准"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="SCL_不符合标准情况" prop="sclCheckUnstandard">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.sclCheckUnstandard" placeholder="不符合标准情况"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="SCL_主要后果" prop="sclCheckResult">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.sclCheckResult" placeholder="主要后果"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="分配评价方法">
                <el-select disabled class="input-length" v-model="identifyDialogState.evaluateMethod" style="width:100%"
                           placeholder="" clearable>
                  <el-option v-for="item in identifyDialogState.evaluateMethodList" :key="item.id" :label="item.name"
                             :value="item.id"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!--                      <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
            <!--                        <el-form-item label="评价专家" prop="sclEvaluateUser">-->
            <!--                          <el-select class="input-length" v-model="identifyDialogState.identifyForm.sclEvaluateUser" style="width:100%" placeholder="" clearable>-->
            <!--                            <el-option v-for="item in identifyDialogState.personList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
            <!--                          </el-select>-->
            <!--                        </el-form-item>-->
            <!--                      </el-col>-->
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="评价专家">
                <el-input class="input-length" disabled v-model="identifyDialogState.evaluateUser"
                          placeholder="暂无评价专家" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识结果" prop="result">
                <el-radio-group v-model="identifyDialogState.identifyForm.result"
                                :disabled="identifyDialogState.disabled">
                  <el-radio :label="1">有风险</el-radio>
                  <el-radio :label="2">无风险</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识专家建议" prop="identificationDesc">
                <el-input class="input-length" type="textarea" :autosize="{ minRows: 3}"
                          :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.identificationDesc" placeholder="辨识专家建议"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="附件">
                <el-upload accept="image/*" :action="identifyDialogState.uploadUrl"
                           :disabled="identifyDialogState.disabled"
                           :headers="identifyDialogState.header" method="post" :data="{module: 'identification'}"
                           :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview"
                           :limit='identifyDialogState.imgLimit' v-model:file-list="identifyDialogState.fileList"
                           list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove"
                           :before-remove="beforeRemove">
                  <el-icon>
                    <Plus/>
                  </el-icon>
                  <template #tip>
                    <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
                  </template>
                </el-upload>
              </el-form-item>
            </el-col>
          </div>
 
          <div style="width: 100%" v-if="identifyDialogState.method === 4">
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_节点" prop="hazopNode">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopNode" placeholder="HAZOP_节点"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_参数" prop="hazopParam">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopParam" placeholder="HAZOP_参数"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_参数描述" prop="hazopParamDesc">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopParamDesc" placeholder="HAZOP_参数描述"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_引导词" prop="hazopGuide">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopGuide" placeholder="HAZOP_引导词"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_偏差" prop="hazopDeviation">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopDeviation" placeholder="HAZOP_偏差"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_可能原因" prop="hazopPossibleCauses">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopPossibleCauses" placeholder="HAZOP_可能原因"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="HAZOP_主要后果" prop="hazopResult">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.hazopResult" placeholder="HAZOP_主要后果"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="分配评价方法">
                <el-select disabled class="input-length" v-model="identifyDialogState.evaluateMethod" style="width:100%"
                           placeholder="" clearable>
                  <el-option v-for="item in identifyDialogState.evaluateMethodList" :key="item.id" :label="item.name"
                             :value="item.id"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!--                      <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
            <!--                        <el-form-item label="评价专家" prop="hazopEvaluateUser">-->
            <!--                          <el-select class="input-length" v-model="identifyDialogState.identifyForm.hazopEvaluateUser" style="width:100%" placeholder="" clearable>-->
            <!--                            <el-option v-for="item in identifyDialogState.personList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
            <!--                          </el-select>-->
            <!--                        </el-form-item>-->
            <!--                      </el-col>-->
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="评价专家">
                <el-input class="input-length" disabled v-model="identifyDialogState.evaluateUser"
                          placeholder="暂无评价专家" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识结果" prop="result">
                <el-radio-group v-model="identifyDialogState.identifyForm.result"
                                :disabled="identifyDialogState.disabled">
                  <el-radio :label="1">有风险</el-radio>
                  <el-radio :label="2">无风险</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识专家建议" prop="identificationDesc">
                <el-input class="input-length" type="textarea" :autosize="{ minRows: 3}"
                          :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.identificationDesc" placeholder="辨识专家建议"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="附件">
                <el-upload accept="image/*" :action="identifyDialogState.uploadUrl"
                           :disabled="identifyDialogState.disabled"
                           :headers="identifyDialogState.header" method="post" :data="{module: 'identification'}"
                           :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview"
                           :limit='identifyDialogState.imgLimit' v-model:file-list="identifyDialogState.fileList"
                           list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove"
                           :before-remove="beforeRemove">
                  <el-icon>
                    <Plus/>
                  </el-icon>
                  <template #tip>
                    <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
                  </template>
                </el-upload>
              </el-form-item>
            </el-col>
          </div>
 
          <div style="width: 100%" v-if="identifyDialogState.method === 5">
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="类比法_检查项目" prop="analogyCheckItem">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.analogyCheckItem" placeholder="检查项目"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="类比法_类比参照" prop="analogyReference">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.analogyReference" placeholder="类比参照"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="类比法_存在风险因素" prop="analogyRiskFactor">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.analogyRiskFactor" placeholder="存在风险因素"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="类比法_可能产生的后果" prop="analogyResult">
                <el-input class="input-length" :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.analogyResult" placeholder="可能产生的后果"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="分配评价方法">
                <el-select disabled class="input-length" v-model="identifyDialogState.evaluateMethod" style="width:100%"
                           placeholder="" clearable>
                  <el-option v-for="item in identifyDialogState.evaluateMethodList" :key="item.id" :label="item.name"
                             :value="item.id"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!--                      <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">-->
            <!--                        <el-form-item label="评价专家" prop="analogyEvaluateUser">-->
            <!--                          <el-select class="input-length" v-model="identifyDialogState.identifyForm.analogyEvaluateUser" style="width:100%" placeholder="" clearable>-->
            <!--                            <el-option v-for="item in identifyDialogState.personList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
            <!--                          </el-select>-->
            <!--                        </el-form-item>-->
            <!--                      </el-col>-->
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="评价专家">
                <el-input class="input-length" disabled v-model="identifyDialogState.evaluateUser"
                          placeholder="暂无评价专家" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识结果" prop="result">
                <el-radio-group v-model="identifyDialogState.identifyForm.result"
                                :disabled="identifyDialogState.disabled">
                  <el-radio :label="1">有风险</el-radio>
                  <el-radio :label="2">无风险</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="辨识专家建议" prop="identificationDesc">
                <el-input class="input-length" type="textarea" :autosize="{ minRows: 3}"
                          :disabled="identifyDialogState.disabled"
                          v-model="identifyDialogState.identifyForm.identificationDesc" placeholder="辨识专家建议"
                          clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
              <el-form-item label="附件">
                <el-upload accept="image/*" :action="identifyDialogState.uploadUrl"
                           :disabled="identifyDialogState.disabled"
                           :headers="identifyDialogState.header" method="post" :data="{module: 'identification'}"
                           :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview"
                           :limit='identifyDialogState.imgLimit' v-model:file-list="identifyDialogState.fileList"
                           list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove"
                           :before-remove="beforeRemove">
                  <el-icon>
                    <Plus/>
                  </el-icon>
                  <template #tip>
                    <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
                  </template>
                </el-upload>
              </el-form-item>
            </el-col>
          </div>
        </el-row>
      </el-form>
      <template #footer>
                <span class="dialog-footer">
                    <el-button @click="identifyDialogState.identifyDialogVisible = !identifyDialogState.identifyDialogVisible"
                     size="default">取 消</el-button>
                    <el-button v-if="!identifyDialogState.disabled" type="primary" @click="onSubmitIdentify"
                     size="default">确定</el-button>
                </span>
      </template>
    </el-dialog>
    <el-dialog v-model="identifyDialogState.dialogVisible">
      <el-image style="width: 100%; height: 100%" :src="identifyDialogState.dialogImageUrl"/>
    </el-dialog>
  </div>
</template>
 
<script setup lang="ts">
import {reactive, ref} from "vue";
import {ElMessage, UploadProps} from "element-plus";
import {identifyApi} from "/@/api/analyse/identify";
import {isValidKey} from "/@/utils/methods";
import Cookies from "js-cookie";
import {useUserInfo} from "/@/stores/userInfo";
import {storeToRefs} from "pinia";
import axios from "axios";
 
const userInfo = useUserInfo();
const {userInfos} = storeToRefs(userInfo);
const identifyFormRef = ref()
 
const identifyDialogState = reactive<IdentifyDialogType>({
  title: '',
  method: null,
  time: [],
  disabled: false,
  evaluateMethod: null,
  evaluateUser: '',
  identifyDialogVisible: false,
  identifyForm: {
    id: null,
    identificationMethod: null,
    result: null,
    identificationDesc: '',
    analogyCheckItem: '',
    analogyRiskFactor: '',
    analogyResult: '',
    analogyReference: '',
    hazopNode: '',
    hazopParam: '',
    hazopParamDesc: '',
    hazopGuide: '',
    hazopDeviation: '',
    hazopPossibleCauses: '',
    hazopResult: '',
    jhaCheckItem: '',
    jhaRiskFactor: '',
    jhaResult: '',
    phaCheckItem: '',
    phaRiskFactor: '',
    phaResult: '',
    sclCheckItem: '',
    sclCheckStandard: '',
    sclCheckUnstandard: '',
    sclCheckResult: '',
    hazopId: null,
    jhaId: null,
    phaId: null,
    sclId: null,
    analogyId: null,
    fileData: ''
  },
  fileList: [],
  imgLimit: 1,
  uploadUrl: import.meta.env.VITE_API_URL + '/attachment/upload/url',
  isOverSize: false,
  header: {
    uid: Number(userInfos.value.uid),
    tk: Cookies.get('token')
  },
  dialogVisible: false,
  dialogImageUrl: '',
  identifyFormRules: {
    result: [{required: true, message: '请选择辨识结果', trigger: 'blur'}],
    identificationDesc: [{required: true, message: '请输入辨识专家建议', trigger: 'blur'}],
    analogyCheckItem: [{required: true, message: '请输入检查项目', trigger: 'blur'}],
    analogyRiskFactor: [{required: true, message: '请输入存在风险因素', trigger: 'blur'}],
    analogyResult: [{required: true, message: '请输入可能产生的后果', trigger: 'blur'}],
    analogyReference: [{required: true, message: '请输入类比参照', trigger: 'blur'}],
    hazopNode: [{required: true, message: '请输入节点', trigger: 'blur'}],
    hazopParam: [{required: true, message: '请输入参数', trigger: 'blur'}],
    hazopParamDesc: [{required: true, message: '请输入参数描述', trigger: 'blur'}],
    hazopGuide: [{required: true, message: '请输入引导词', trigger: 'blur'}],
    hazopDeviation: [{required: true, message: '请输入偏差', trigger: 'blur'}],
    hazopPossibleCauses: [{required: true, message: '请输入可能原因', trigger: 'blur'}],
    hazopResult: [{required: true, message: '请输入主要后果', trigger: 'blur'}],
    jhaCheckItem: [{required: true, message: '请输入作业步骤', trigger: 'blur'}],
    jhaRiskFactor: [{required: true, message: '请输入危险源或潜在事件', trigger: 'blur'}],
    jhaResult: [{required: true, message: '请输入可能产生的后果', trigger: 'blur'}],
    phaCheckItem: [{required: true, message: '请输入检查项目', trigger: 'blur'}],
    phaRiskFactor: [{required: true, message: '请输入存在风险因素', trigger: 'blur'}],
    phaResult: [{required: true, message: '请输入可能产生的后果', trigger: 'blur'}],
    sclCheckItem: [{required: true, message: '请输入检查项目', trigger: 'blur'}],
    sclCheckStandard: [{required: true, message: '请输入检查标准', trigger: 'blur'}],
    sclCheckUnstandard: [{required: true, message: '请输入不符合标准情况', trigger: 'blur'}],
    sclCheckResult: [{required: true, message: '请输入主要后果', trigger: 'blur'}]
  },
  planList: [],
  personList: [],
  identificationMethodList: [
    {id: 1, name: 'PHA'},
    {id: 2, name: 'JHA'},
    {id: 3, name: 'SCL'},
    {id: 4, name: 'HAZOP'},
    {id: 5, name: '类比法'},
  ],
  evaluateMethodList: [
    {id: 1, name: 'LEC'},
    {id: 2, name: 'LS'},
    {id: 3, name: 'MES'},
    {id: 4, name: 'RS'},
  ]
})
 
const showIdentifyDialog = (title: string, value: IdentifyType, identifyQueryForm: identifyQueryFormType, idenForm: IdentifyType, personList: Array<NewPersonListType>) => {
  identifyDialogState.fileList = []
  identifyDialogState.method = identifyQueryForm.identificationMethod
  identifyDialogState.identifyDialogVisible = true;
  identifyDialogState.disabled = false
  identifyDialogState.evaluateMethod = idenForm.evaluateMethod
  identifyDialogState.evaluateUser = idenForm.evaluateUser
  identifyDialogState.personList = personList
  setTimeout(() => {
    identifyFormRef.value.clearValidate();
  });
  if (title === '新增') {
    identifyDialogState.title = '新增';
    identifyDialogState.identifyForm = {
      id: identifyQueryForm.id,
      identificationMethod: identifyQueryForm.identificationMethod,
      result: null,
      identificationDesc: '',
      analogyCheckItem: '',
      analogyRiskFactor: '',
      analogyResult: '',
      analogyReference: '',
      hazopNode: '',
      hazopParam: '',
      hazopParamDesc: '',
      hazopGuide: '',
      hazopDeviation: '',
      hazopPossibleCauses: '',
      hazopResult: '',
      jhaCheckItem: '',
      jhaRiskFactor: '',
      jhaResult: '',
      phaCheckItem: '',
      phaRiskFactor: '',
      phaResult: '',
      sclCheckItem: '',
      sclCheckStandard: '',
      sclCheckUnstandard: '',
      sclCheckResult: '',
      hazopId: null,
      jhaId: null,
      phaId: null,
      sclId: null,
      analogyId: null,
      fileData: ''
    };
  } else if (title === '查看') {
    identifyDialogState.title = '查看';
    identifyDialogState.disabled = true
    for (let i in identifyDialogState.identifyForm) {
      if (isValidKey(i, identifyDialogState.identifyForm)) {
        identifyDialogState.identifyForm[i] = value[i];
      }
    }
    if(identifyDialogState.identifyForm.fileData && identifyDialogState.identifyForm.fileData !== ''){
      const picList = identifyDialogState.identifyForm.fileData.split(',')
      identifyDialogState.fileList = picList.map((item,index)=>{
        return {
          name: index,
          url: import.meta.env.VITE_API_URL + item
        }
      })
    }
  } else {
    identifyDialogState.title = '编辑';
    for (let i in identifyDialogState.identifyForm) {
      if (isValidKey(i, identifyDialogState.identifyForm)) {
        identifyDialogState.identifyForm[i] = value[i];
      }
    }
    identifyDialogState.identifyForm.identificationMethod = identifyQueryForm.identificationMethod
    if(identifyDialogState.identifyForm.fileData && identifyDialogState.identifyForm.fileData !== ''){
      const picList = identifyDialogState.identifyForm.fileData.split(',')
      identifyDialogState.fileList = picList.map((item,index)=>{
        return {
          name: index,
          url: import.meta.env.VITE_API_URL + item
        }
      })
    }
  }
};
 
// 图片上传
const showTip = () => {
  ElMessage({
    type: 'warning',
    message: '超出文件上传数量'
  });
}
 
const picSize = async (rawFile: any) => {
  if (rawFile.size / 1024 / 1024 > 5) {
    ElMessage({
      type: 'warning',
      message: '文件大小不能超过5M。'
    });
    return false
  }
};
 
const handlePictureCardPreview = (uploadFile: { url: string }) => {
  identifyDialogState.dialogImageUrl = uploadFile.url!;
  identifyDialogState.dialogVisible = true;
};
 
const upload = async (params: any) => {
  // const formData = new FormData();
  // formData.append('file', state.fileList[0].raw);
  let reader = new FileReader();
  reader.readAsArrayBuffer(params.file);
 
  reader.onload = async () => {
    axios.post(identifyDialogState.uploadUrl, reader.result, {
      headers: {uid: Number(userInfos.value.uid), tk: Cookies.get('token')}
    }).then(res => {
      if (res.data.code === 100) {
        console.log(res.data.data)
      }
    });
  };
};
 
const handleAvatarSuccess: UploadProps['onSuccess'] = (
    res,
    uploadFile
) => {
  if (res.code == 100) {
    identifyDialogState.identifyForm.fileData = res.data
  }else{
    ElMessage({
      type: 'warning',
      message: res.msg
    })
  }
}
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
  console.log(uploadFile, uploadFiles)
}
 
const onSubmitIdentify = () => {
  identifyFormRef.value.validate(async (valid: boolean) => {
    if (valid) {
      if (identifyDialogState.title === '新增') {
        let {hazopId, jhaId, phaId, sclId, analogyId, ...data} = identifyDialogState.identifyForm
        let res = await identifyApi().addIdentify(data);
        if (res.data.code === 100) {
          emit('refresh', 1, res.data.data)
          identifyDialogState.identifyDialogVisible = false;
          ElMessage({
            type: 'success',
            message: '新增成功'
          })
          identifyDialogState.fileList = []
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg,
          });
        }
      } else {
        if(identifyDialogState.fileList.length == 0){
          identifyDialogState.identifyForm.fileData = ''
        }
        let res = await identifyApi().modIdentify(identifyDialogState.identifyForm)
        if (res.data.code === 100) {
          emit('refresh', 2, identifyDialogState.identifyForm)
          identifyDialogState.identifyDialogVisible = false;
          ElMessage({
            type: 'success',
            message: '编辑成功'
          })
          identifyDialogState.fileList = []
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg,
          });
        }
      }
    } else {
      ElMessage({
        type: 'warning',
        message: '请完善基本信息',
      });
    }
  })
}
 
const emit = defineEmits(['refresh'])
 
defineExpose({
  showIdentifyDialog
})
</script>
 
<style scoped>
 
</style>