lyh
6 天以前 c60e141e9b43be2eb5122eaa7da13bc0cf3848cd
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
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
<template>
  <div>
    <el-row class="container" id="deviceCon">
      <p-head  ref="pHead"></p-head>
      <el-col :span="24" class="main" id="deviceDrag">
        <el-aside id="deviceTreeDiv" :class="'menu-expanded'"  @contextmenu.prevent.native="rightClick($event)">
          <div class="search_box">
            <el-input placeholder="输入关键字进行搜索" v-model="filterText" ></el-input>
          </div>
          <el-tree
            id="deviceTree"
            class="filter-tree"
            :filter-node-method="filterNode"
            :data="treeList"
            :props="defaultProps"
            :default-expanded-keys="expandedKeys"
            highlight-current
            node-key="id"
            ref="tree"
            @node-contextmenu="rightClick"
            :current-node-key="currentNodekey"
            :expand-on-click-node="false"
            @node-click="handleNodeClick"
            :style="treeHeight">
               <span class="custom-tree-node" slot-scope="{ node, data }">
                  <span>
                      <!-- <img v-if="node.level==1" src="@assets/tree/icon_1.png" alt="">
                      <img   v-if="node.level==2" src="@assets/tree/icon_2.png" alt="">
                      <img  v-if="node.level==3" src="@assets/tree/icon_3.png" alt="">  -->
                     <i v-if="data.type==1" class="el-icon-files"></i>
                    <!-- <i v-if="node.level==2" class="el-icon-news"></i> -->
                      <i v-if="data.type==2" class="el-icon-reading"></i>
                      {{ node.label }}
                  </span>
           </span>
          </el-tree>
        </el-aside>
        <div id="deviceResize" class="drag-two-resize"></div>
        <section id="deviceDoc" class="content-container">
          <doc-tab
            id="filesTab"
            @showDocImportDialog="showDocImportDialog"
            @setDocClassCode="setDocClassCode"
            ref="DocTab"
            v-if="nodeType == 2" v-on:indexChange="setIndex($event)" :baseNode="baseNode"></doc-tab>
          <div v-if="nodeType == 2" id="tabResize" class="r-resize"></div>
          <div>
            <el-col :span="24" id="attributeTab" class="content-wrapper" :style="conheight">
              <keep-alive>
                <group-detail-tab v-if="tabType === 1" :baseNode="groupNode"></group-detail-tab>
                <device-detail-tab v-else-if="tabType === 2" :baseNode="deviceNode"></device-detail-tab>
                <doc-detail-tab v-else-if="tabType === 3" :baseNode="docNode"></doc-detail-tab>
              </keep-alive>
            </el-col>
          </div>
        </section>
        <div class="treeRightMenu">
          <device-context-menu
            ref="DeviceContextMenu"
            @loadTree="loadTree"
            @showGroupAddDialog="showGroupAddDialog"
            @showGroupEditDialog="showGroupEditDialog"
            @showDeviceAddDialog="showDeviceAddDialog"
            @showDeviceEditDialog="showDeviceEditDialog"
            @showDeviceAssignDialog="showDeviceAssignDialog"
            @showDocImportDialog="showDocImportDialog"
            @showGroupAssignDialog="showGroupAssignDialog"
            @showGroupAddChildDialog="showGroupAddChildDialog"
            @deleteDeviceGroup="deleteDeviceGroup"
            @deleteDevice="deleteDevice"
            :baseNode="baseNode"
          />
        </div>
      </el-col>
      <p-foot></p-foot>
    </el-row>
    <!--导入文档-->
    <el-dialog :visible.sync="docAddVisible" :close-on-click-modal="false" @close="closeUploadDialog" title="导入NC文档"  width="680px">
      <el-row>
        <table>
          <tr>
            <td>{{nodeDetail.nodeNameLabel}} :</td>
            <td>{{nodeDetail.nodeName}}</td>
          </tr>
        </table>
        <el-upload
          class="upload-demo"
          ref="DocUpload"
          :action="actionUrl"
          multiple
          show-file-list
          :on-change="handleUploadChange"
          :on-exceed="handleExceed"
          :limit="50"
          :file-list="fileList"
          :http-request="httpRequest"
          :auto-upload="false">
          <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
          <el-button style="margin-left: 10px;" size="small" :loading="buttonLoading" type="success" @click="submitUpload">上传到服务器</el-button>
          <div slot="tip" class="el-upload__tip">已选择{{fileList.length}}个文件</div>
        </el-upload>
      </el-row>
 
      </el-dialog>
      <!--添加分组-->
      <el-dialog :visible.sync="groupAddVisible" :close-on-click-modal="false" @close="closeDialog('groupAddForm')" title="添加分组"  width="480px">
        <el-form :model="groupAddData" :rules="groupRules" ref="groupAddForm" label-width="80px">
          <el-form-item label="分组名称"  prop="groupName">
            <el-input placeholder="请输入分组名称" v-model.trim="groupAddData.groupName"></el-input>
          </el-form-item>
          <el-form-item label="描述"  prop="description">
            <el-input type="textarea" row="4" resize="none" placeholder="请输入描述信息,最多50字" v-model.trim="groupAddData.description"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click.native="groupAddCommit" :loading="buttonLoading" type="primary" class="btn-custom">
            <span>保 存</span>
          </el-button>
          <el-button @click="closeDialog('groupAddForm')" class="btn-custom">
            <span>取 消</span>
          </el-button>
 
        </div>
      </el-dialog>
      <!--添加子分组-->
      <el-dialog :visible.sync="groupAddChildVisible" :close-on-click-modal="false" @close="closeDialog('groupAddChildForm')" title="添加子分组"  width="480px">
        <el-form :model="groupAddData" :rules="groupRules" ref="groupAddChildForm" label-width="80px">
          <el-form-item :label="parentNodeTitle">
            <el-input v-model.trim="parentNodeName" readOnly></el-input>
          </el-form-item>
          <el-form-item label="分组名称"  prop="groupName">
            <el-input placeholder="请输入分组名称" v-model.trim="groupAddData.groupName"></el-input>
          </el-form-item>
          <el-form-item label="描述"  prop="description">
            <el-input type="textarea" row="5" resize="none" placeholder="请输入描述信息,最多50字" v-model.trim="groupAddData.description"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
           <el-button @click.native="groupAddCommit" :loading="buttonLoading" type="primary" class="btn-custom">
            <span>保 存</span>
          </el-button>
          <el-button @click="closeDialog('groupAddChildForm')" class="btn-custom">
            <span>取 消</span>
          </el-button>
 
        </div>
      </el-dialog>
      <!--编辑分组-->
      <el-dialog :visible.sync="groupEditVisible" :close-on-click-modal="false" @close="closeDialog('groupEditForm')" title="编辑分组"  width="480px">
        <el-form :model="groupAddData" :rules="groupRules" ref="groupEditForm" label-width="80px">
          <el-form-item label="分组名称"  prop="groupName">
            <el-input placeholder="请输入分组名称" v-model.trim="groupAddData.groupName"></el-input>
          </el-form-item>
          <el-form-item label="描述"  prop="description">
            <el-input type="textarea" row="5" resize="none" placeholder="请输入描述信息,最多50字" v-model.trim="groupAddData.description"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click.native="groupEditCommit" :loading="buttonLoading" type="primary" class="btn-custom">
            <span>保 存</span>
          </el-button>
          <el-button @click="closeDialog('groupEditForm')" class="btn-custom">
            <span>取 消</span>
          </el-button>
 
        </div>
      </el-dialog>
      <!--添加设备-->
      <el-dialog :visible.sync="deviceAddVisible" :close-on-click-modal="false" title="添加设备"  @close="closeDialog(`deviceAddForm`)" width="880px">
        <el-form :model="deviceAddData" :rules="deviceRules" ref="deviceAddForm" label-width="80px">
          <el-row>
            <el-form-item :label="parentNodeTitle">
              <el-input v-model.trim="parentNodeName" readOnly></el-input>
            </el-form-item>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="设备名称"  prop="deviceName">
                <el-input placeholder="请输入设备名称" v-model.trim="deviceAddData.deviceName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="设备编号"  prop="deviceNo">
                <el-input placeholder="请输入设备名称" v-model.trim="deviceAddData.deviceNo"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="数控系统"  prop="controlSystem">
                <el-input placeholder="请输入数控系统" v-model.trim="deviceAddData.controlSystem"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="设备型号"  prop="deviceModel">
                <el-input placeholder="请输入设备型号" v-model.trim="deviceAddData.deviceModel"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="链接IP"  prop="linkIp">
                <el-input placeholder="请输入链接IP" v-model.trim="deviceAddData.linkIp"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="连接端口"  prop="linkPort">
                <el-input-number v-model="deviceAddData.linkPort" :min="1" :max="65533" controls-position="right"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-form-item label="所属部门"  prop="departId">
              <el-select v-model="deviceAddData.departId" clearable filterable placeholder="请选择所属部门">
                <el-option
                  v-for="item in departList"
                  :key="item.departId"
                  :label="`【` +item.departCode + `】` + item.departName"
                  :value="item.departId">
                </el-option>
              </el-select>
            </el-form-item>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
           <el-button @click.native="deviceAddCommit" :loading="buttonLoading" type="primary" class="btn-custom">
            <span>保 存</span>
          </el-button>
          <el-button @click="closeDialog(`deviceAddForm`)" class="btn-custom">
            <span>取 消</span>
          </el-button>
 
        </div>
      </el-dialog>
      <!--编辑设备-->
      <el-dialog :visible.sync="deviceEditVisible" :close-on-click-modal="false" title="添加设备"  @close="closeDialog(`deviceEditForm`)" width="880px">
        <el-form :model="deviceAddData" :rules="deviceRules" ref="deviceEditForm" label-width="80px">
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="设备名称"  prop="deviceName">
                <el-input placeholder="请输入设备名称" v-model.trim="deviceAddData.deviceName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="设备编号"  prop="deviceNo">
                <el-input placeholder="请输入设备编号" v-model.trim="deviceAddData.deviceNo"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="数控系统"  prop="controlSystem">
                <el-input placeholder="请输入数控系统" v-model.trim="deviceAddData.controlSystem"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="设备型号"  prop="deviceModel">
                <el-input placeholder="请输入设备型号" v-model.trim="deviceAddData.deviceModel"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="链接IP"  prop="linkIp">
                <el-input placeholder="请输入链接IP" v-model.trim="deviceAddData.linkIp"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="连接端口"  prop="linkPort">
                <el-input-number v-model="deviceAddData.linkPort" :min="1" :max="65533" controls-position="right"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-form-item label="所属部门"  prop="departId">
              <el-select v-model="deviceAddData.departId" clearable filterable placeholder="请选择所属部门">
                <el-option
                  v-for="item in departList"
                  :key="item.departId"
                  :label="`【` +item.departCode + `】` + item.departName"
                  :value="item.departId">
                </el-option>
              </el-select>
            </el-form-item>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
           <el-button @click.native="deviceEditCommit" :loading="buttonLoading" type="primary" class="btn-custom">
            <span>保 存</span>
          </el-button>
          <el-button @click="closeDialog(`deviceEditForm`)" class="btn-custom">
            <span>取 消</span>
          </el-button>
 
        </div>
 
      </el-dialog>
      <!--分组权限配置-->
      <el-dialog :visible.sync="groupAssignVisible" class="transfer_dialog" :close-on-click-modal="false" title="分组权限配置" @close="closeAssignDialog" width="50%">
        <template>
 
          <el-form :inline="true" class="demo-form-inline">
             <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="parentNodeTitle">
              <el-input v-model.trim="parentNodeName" readOnly></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="链接IP"  prop="linkIp">
              <el-input placeholder="请输入链接IP" v-model.trim="deviceAddData.linkIp"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="连接端口"  prop="linkPort">
              <el-input-number v-model="deviceAddData.linkPort" :min="1" :max="65533" controls-position="right"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="所属部门"  prop="departId">
            <el-select v-model="deviceAddData.departId" clearable filterable placeholder="请选择所属部门">
              <el-option
                v-for="item in departList"
                :key="item.departId"
                :label="`【` +item.departCode + `】` + item.departName"
                :value="item.departId">
              </el-option>
            </el-select>
          </el-form-item>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeDialog(`deviceEditForm`)" type="primary" class="btn-custom">
          <span>取 消</span>
        </el-button>
        <el-button @click.native="deviceEditCommit" :loading="buttonLoading" type="primary" class="btn-custom">
          <span>保 存</span>
        </el-button>
      </div>
      </template>
    </el-dialog>
    <!--分组权限配置-->
    <el-dialog :visible.sync="groupAssignVisible" class="transfer_dialog" :close-on-click-modal="false" title="分组权限配置" @close="closeAssignDialog" width="50%">
      <template>
        <el-form :inline="true" class="demo-form-inline">
          <el-form-item :label="parentNodeTitle">
            <el-input v-model.trim="parentNodeName" readOnly></el-input>
          </el-form-item>
          <el-form-item label="是否分配子节点">
            <el-switch
              height="40px"
              line-height="40px"
              style="display: block"
              active-color="#13ce66"
              v-model="relativeFlag"
             >
            </el-switch>
          </el-form-item>
        </el-form>
        <el-tabs v-model="activeName">
          <el-tab-pane label="分配用户" name="users">
            <template>
              <div  style="text-align: center">
                <el-transfer
                  style="text-align: left; display: inline-block"
                  v-model="userListKey"
                  :props="{
                      key: 'userId',
                       label: 'label'
                     }"
                  :data="userList"
                  @change="handlerUserListChange"
                  :titles="['未分配用户', '已分配用户']"
                  :button-texts="['移出用户','分配用户']"
                >
                </el-transfer>
              </div>
            </template>
          </el-tab-pane>
          <el-tab-pane label="分配部门" name="departs">
            <template>
              <div style="text-align: center">
                <el-transfer
                  style="text-align: left; display: inline-block"
                  v-model="departListKey"
                  :props="{
                      key: 'departId',
                      label: 'departName'
                    }"
                  :data="departList"
                  @change="handlerDepartListChange"
                  :titles="['未分配部门', '已分配部门']"
                  :button-texts="['移出部门','分配部门']"
                >
                </el-transfer>
              </div>
            </template>
          </el-tab-pane>
 
        </el-tabs>
      </template>
    </el-dialog>
    <!--设备权限配置-->
    <el-dialog :visible.sync="deviceAssignVisible" class="transfer_dialog" :close-on-click-modal="false" title="设备权限配置" @close="closeAssignDialog" width="50%">
      <template>
        <div style="text-align: center">
          <el-form :inline="true" class="demo-form-inline">
            <el-form-item :label="parentNodeTitle">
              <el-input v-model.trim="parentNodeName" readOnly></el-input>
            </el-form-item>
          </el-form>
          <el-transfer
            style="text-align: left; display: inline-block"
            v-model="userListKey"
            :props="{
                key: 'userId',
                label: 'nickname'
               }"
            :data="userList"
            @change="handlerUserListChange"
            :titles="['未分配用户', '已分配用户']"
            :button-texts="['移出角色','分配角色']"
          >
            <span slot-scope="{ option }">{{setLabel(option)}}</span>
          </el-transfer>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
 
<script>
  import PHead from '@/base/components/head.vue';
  import PFoot from '@/base/components/foot.vue';
  import * as deviceApi from '../api/device';
  import Bus from '@/module/deviceManager/components/bus.js'
  import { dragTwoColDiv, dragThreeColDiv, dragTwoRowDiv } from "@/common/drag";
  import DocTab from '@/module/deviceManager/components/doc_tab.vue';
  import DeviceContextMenu from '@/module/deviceManager/components/device_context_menu.vue';
  import GroupDetailTab from '@/module/deviceManager/components/group_attribute_info.vue';
  import DeviceDetailTab from '@/module/deviceManager/components/device_attribute_info.vue';
  import DocDetailTab from '@/module/deviceManager/components/doc_attribute_info.vue';
  let _this = {};
  export default {
    name: "device_manager",
    components:{
      PHead,
      PFoot,
      DeviceContextMenu,
      DocTab,
      GroupDetailTab,
      DeviceDetailTab,
      DocDetailTab,
      Bus
    },
    data() {
      return {
        contextQueryParams:{
          flag:2, //查询按钮的范围 1 菜单 2 对象
          param:null, //flag 为2时需要传递该参数 该参数与param对应数据id
          objectId:null, //查询参数,按类型而不同 1 菜单路径 2 对象权限码
          relativeParam:null,
          relativeObjectId:null
        },
        deleteParam:{
          id:''
        },
        buttonLoading:false,
        groupAddVisible:false,
        groupAddChildVisible:false,
        groupEditVisible:false,
        groupAssignVisible:false,
        deviceAddVisible:false,
        deviceEditVisible:false,
        deviceAssignVisible:false,
        docAddVisible : false,
        docUploadParams : {
          attributionId:'',
          attributionType:0,
          docClassCode:''
        },
        nodeDetail: {
          nodeNameLabel:'设备名称',
          nodeName:'机加设备'
        },
        actionUrl : 'bbbb',
        activeName:'users',
        fileList :[],
        filterText: '',
        treeList: [],
        expandedKeys:[],
        currentNodekey:'',
        defaultProps: {
          children: 'children',
          label: 'label'
        },
        treeHeight:{
          height:''
        },
        conheight:{
          height:''
        },
        nodeEntity:{},
        nodeType:0,
        currentNodeType:0,
        rightcCurrentNodeId:'',
        currentNodeId:'',
        tabType:0,
        baseNode : {
          index:1,
          list :''
        },
        groupNode:{
          index:1,
          list:''
        },
        deviceNode:{
          index:2,
          list:''
        },
        docNode:{
          index:3,
          list:''
        },
        parentNodeTitle:'',
        parentNodeName:'',
        groupAddData:{
          groupName:'',
          description:'',
          parentId:''
        },
        defaultGroupAddData:null,
        groupRules:{
          groupName:[
            {required: true, message: '请输入分组名称', trigger: 'blur'}
          ]
        },
        deviceAddData:{
          groupId:'',
          deviceName:'',
          deviceNo:'',
          controlSystem:'',
          deviceModel:'',
          linkIp:'',
          linkPort:'',
          departId:''
        },
        defaultDeviceAddData:null,
        deviceRules:{
          deviceName:[
            {required: true, message: '请输入设备名称', trigger: 'blur'}
          ],
          deviceNo:[
            {required: true, message: '请输入设备编号', trigger: 'blur'}
          ],
          departId:[
            {required: true, message: '请选择所属部门', trigger: 'change'}
          ],
        },
        departList:[],
        userList:[],
        departListKey:[],
        userListKey:[],
        relativeFlag:false,
      }
    },
    beforeCreate(){
      _this = this;
    },
    methods: {
      loadTree(){
        deviceApi.load_tree().then((res) =>{
          if (res.success) {
            this.treeList = res.list;
            this.$nextTick(function () {
              if (res.list && res.list.length > 0){
                this.expandedKeys=[res.list[0].id];
                if (this.rightcCurrentNodeId != null || this.rightcCurrentNodeId != '') {
                  this.expandedKeys.push(this.rightcCurrentNodeId);
                }
                this.checkNode(res.list[0].type, res.list[0].id).then((s) =>{
                  if(s.success) {
                    this.baseNode.index = res.list[0].type;
                    this.baseNode.list = res.list[0].entity;
                    if(res.list[0].type === 1) {
                      this.groupNode.list = res.list[0].entity;
                    }else if(res.list[0].type === 2) {
                      this.deviceNode.list = res.list[0].entity;
                    }
                    this.contextQueryParams.objectId = res.list[0].id;
                    this.nodeType = res.list[0].type;
                    this.tabType = res.list[0].type;
                  }else {
                    this.nodeType = 0;
                    this.tabType = 0;
                    //this.$message.error(s.message);
                  }
                });
              }
            })
          }
        })
      },
      rightClick(MouseEvent, object, Node, element) { // 鼠标右击触发事件
        if (object == undefined) {
          this.contextQueryParams.param = 'device_group';
          this.contextQueryParams.objectId = null;
          this.rightcCurrentNodeId = null;
          this.contextQueryParams.relativeParam = null;
          this.contextQueryParams.relativeObjectId = null;
          this.contextQueryParams.objectId = null;
          this.$refs.DeviceContextMenu.blankRightClick(MouseEvent, this.contextQueryParams);
        }else {
          this.relativeFlag = true;
          this.rightcCurrentNodeId = object.id;
          this.nodeEntity = object.entity;
          this.currentNodeType = object.type;
          this.currentNodeId = object.id;
          if (object.type == 1) {
            this.contextQueryParams.param = 'device_group';
          }else if (object.type == 2) {
            this.contextQueryParams.param = 'device';
          }
          this.contextQueryParams.objectId = object.id;
          this.baseNode.index = object.type;
          this.baseNode.list = object.entity;
          this.$refs.DeviceContextMenu.treeRightClick(MouseEvent, object, Node, element, this.contextQueryParams);
        }
      },
      filterNode(value, data) {
        if (!value)
          return true;
        return data.label.indexOf(value) !== -1;
      },
      setLabel(info){
        let departs = JSON.parse(JSON.stringify(info.departs));
        let label = info.nickname;
        if (departs.length > 0) {
          label += '/';
          label += departs.reduce((pre ,cur) => pre+ '[' + cur.departName + ']','')
        }
        return label;
      },
      getHeight(){
        console.log(window.innerHeight);
        if (this.nodeType == 2) {
          this.conheight.height=window.innerHeight-500+'px';
        }else {
          this.conheight.height=window.innerHeight-500+'px';
        }
        this.treeHeight.height=window.innerHeight-150+'px';
      },
      handleNodeClick(data, node, tree) {
        this.currentNodekey=node.id;
 
        this.checkNode(data.type, data.id).then((res) => {
          if(res.success) {
            this.baseNode.index = data.type;
            this.baseNode.list = data.entity;
            if(data.type === 1) {
              this.groupNode.list = data.entity;
            }else if(data.type === 2) {
              this.deviceNode.list = data.entity;
            }
            if (data.entity.createUser != '') {
              this.userList.forEach((v, k) => {
                if (v.userId == data.entity.createUser) {
                  return data.entity.createUser = v.nickname;
                }
              });
            }
            if (data.entity.updateUser != '') {
              this.userList.forEach((v, k) => {
                if (v.userId == data.entity.updateUser) {
                  return data.entity.updateUser = v.nickname;
                }
              });
            }
            this.contextQueryParams.objectId = data.id;
            this.nodeType = data.type;
            this.tabType = data.type;
          }else {
            this.nodeType = 0;
            this.tabType = 0;
            //this.$message.error(res.message);
          }
        });
      },
      showGroupAddDialog() {
        this.groupAddVisible = true;
      },
      showGroupAddChildDialog() {
        this.groupAddChildVisible = true;
        this.parentNodeTitle='父分组';
        this.parentNodeName=this.nodeEntity.groupName;
        this.groupAddData.parentId=this.nodeEntity.groupId;
      },
      showGroupEditDialog() {
        this.groupEditVisible = true;
        this.groupAddData = Object.assign({}, this.nodeEntity);
      },
      showDeviceAddDialog() {
        this.deviceAddVisible=true;
        this.deviceAddData.groupId=this.nodeEntity.groupId;
        this.parentNodeTitle='所属分组';
        this.parentNodeName=this.nodeEntity.groupName;
      },
      showDeviceEditDialog() {
        this.deviceEditVisible = true;
        this.deviceAddData = Object.assign({}, this.nodeEntity);
      },
      showGroupAssignDialog() {
        this.groupAssignVisible = true;
        this.parentNodeTitle='当前分组';
        this.parentNodeName=this.nodeEntity.groupName;
        this.getDepartPermList();
        this.getUserPermList();
      },
      showDeviceAssignDialog() {
        this.deviceAssignVisible = true;
        this.parentNodeTitle='当前设备';
        this.parentNodeName=this.nodeEntity.deviceName;
        this.departListKey = [];
        this.getUserPermList();
      },
      showDocImportDialog(params) {
        //console.info('打开设备导入文档弹框');
        params = JSON.parse(JSON.stringify(params));
        this.docAddVisible = true;
        this.docUploadParams.attributionType = params.attributionType;
        this.docUploadParams.attributionId = params.attributionId;
        this.fileList = [];
      },
      setDocClassCode(code) {
        this.docUploadParams.docClassCode = code;
      },
      deleteDeviceGroup(){
        this.$confirm('删除后不可取消,确认删除吗?', '提示', {}).then(() => {
          this.deleteParam.id = this.currentNodeId;
          deviceApi.device_group_delete(this.deleteParam).then((res) => {
            if (res.success) {
              this.loadTree();
              this.$message({
                message: res.message,
                type: 'success'
              });
            } else if (res.message) {
              this.$message({
                message: res.message,
                type: 'error'
              });
            }
          });
        });
      },
      deleteDevice(){
        this.$confirm('删除后不可取消,确认删除吗?', '提示', {}).then(() => {
          this.deleteParam.id = this.currentNodeId;
          deviceApi.device_delete(this.deleteParam).then((res) => {
            if (res.success) {
              this.loadTree();
              this.$message({
                message: res.message,
                type: 'success'
              });
            } else if (res.message) {
              this.$message({
                message: res.message,
                type: 'error'
              });
            }
          });
        });
      },
      setIndex(msg){
        msg = JSON.parse(JSON.stringify(msg));
        if (msg.list != null) {
          this.tabType = msg.index;
          if(msg.index == 1){
            this.groupNode.list = msg.list;
          }else if (msg.index == 2) {
            this.deviceNode.list = msg.list;
          }else if (msg.index == 3) {
            this.docNode.list = msg.list;
          }
        }
      },
      handleUploadChange(file, fileList) {
        this.fileList = fileList;
      },
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择 50 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
      },
      submitUpload() {
        this.$refs.DocUpload.submit();
      },
      httpRequest(uploadfile) {
        let formData = new FormData();
        formData.append('file', uploadfile.file);
        formData.append('attributionId', this.docUploadParams.attributionId);
        formData.append('attributionType', this.docUploadParams.attributionType);
        formData.append('docClassCode', this.docUploadParams.docClassCode);
        deviceApi.doc_upload(formData, uploadfile).then((res) => {
          if(res.success) {
            uploadfile.onSuccess();
          }else {
            //uploadfile.onError();
          }
        });
      },
      async checkNode(nodeType, paramId) {
        return await deviceApi.check_node_invlid(nodeType, paramId);
      },
      groupAddCommit() {
        if(this.groupAddData.parentId && this.groupAddData.parentId !== '') {
          this.$refs.groupAddChildForm.validate((valid) => {
            if (valid) {
              this.$confirm('确认提交吗?', '提示', {}).then(() => {
                this.buttonLoading = true;
                deviceApi.add_group(this.groupAddData).then((res) => {
                  if(res.success){
                    this.buttonLoading = false;
                    this.$message({
                      message: res.message,
                      type: 'success'
                    });
                    this.closeDialog('groupAddChildForm');
                    this.loadTree();
                  }else if(res.message){
                    this.buttonLoading = false;
                    this.$message({
                      message: res.message,
                      type: 'error'
                    });
                  }
                });
              });
            }
          });
        }else {
          this.$refs.groupAddForm.validate((valid) => {
            if (valid) {
              this.$confirm('确认提交吗?', '提示', {}).then(() => {
                this.buttonLoading = true;
                deviceApi.add_group(this.groupAddData).then((res) => {
                  if(res.success){
                    this.buttonLoading = false;
                    this.$message({
                      message: res.message,
                      type: 'success'
                    });
                    this.closeDialog('groupAddForm');
                    this.loadTree();
                  }else if(res.message){
                    this.buttonLoading = false;
                    this.$message({
                      message: res.message,
                      type: 'error'
                    });
                  }
                });
              });
            }
          });
        }
      },
      groupEditCommit() {
        this.$refs.groupEditForm.validate((valid) => {
          if (valid) {
            this.$confirm('确认提交吗?', '提示', {}).then(() => {
              this.buttonLoading = true;
              deviceApi.edit_group(this.nodeEntity.groupId, this.groupAddData).then((res) => {
                if(res.success){
                  this.buttonLoading = false;
                  this.$message({
                    message: res.message,
                    type: 'success'
                  });
                  this.closeDialog('groupEditForm');
                  this.loadTree();
                }else if(res.message){
                  this.buttonLoading = false;
                  this.$message({
                    message: res.message,
                    type: 'error'
                  });
                }
              });
            });
          }
        });
      },
      deviceAddCommit() {
        this.$refs.deviceAddForm.validate((valid) => {
          if (valid) {
            this.$confirm('确认提交吗?', '提示', {}).then(() => {
              this.buttonLoading = true;
              deviceApi.add_device(this.deviceAddData).then((res) => {
                if(res.success){
                  this.buttonLoading = false;
                  this.$message({
                    message: res.message,
                    type: 'success'
                  });
                  this.closeDialog('deviceAddForm');
                  this.loadTree();
                }else if(res.message){
                  this.buttonLoading = false;
                  this.$message({
                    message: res.message,
                    type: 'error'
                  });
                }
              });
            });
          }
        });
      },
      deviceEditCommit() {
        this.$refs.deviceEditForm.validate((valid) => {
          if (valid) {
            this.$confirm('确认提交吗?', '提示', {}).then(() => {
              this.buttonLoading = true;
              deviceApi.edit_device(this.nodeEntity.deviceId, this.deviceAddData).then((res) => {
                if(res.success){
                  this.buttonLoading = false;
                  this.$message({
                    message: res.message,
                    type: 'success'
                  });
                  this.closeDialog('deviceEditForm');
                  this.loadTree();
                }else if(res.message){
                  this.buttonLoading = false;
                  this.$message({
                    message: res.message,
                    type: 'error'
                  });
                }
              });
            });
          }
        });
      },
      closeDialog(formName) {
        this.buttonLoading = false;
        //重置form表单,初始化数据
        this.groupAddVisible = false;
        this.groupAddChildVisible=false;
        this.groupEditVisible = false;
        this.deviceAddVisible = false;
        this.deviceEditVisible = false;
 
        this.docAddVisible = false;
        if(this.$refs[formName]!==undefined){
          this.$refs[formName].resetFields();
        }
        this.groupAddData = JSON.parse(JSON.stringify(this.defaultGroupAddData));
        this.deviceAddData = JSON.parse(JSON.stringify(this.defaultDeviceAddData));
      },
      closeAssignDialog() {
        this.groupAssignVisible = false;
        this.deviceAssignVisible=false;
        this.userListKey = [];
        this.departListKey = [];
      },
      closeUploadDialog() {
        this.$refs.DocTab.reloadDocData();
      },
      getDepartList() {
        deviceApi.depart_list().then((res)=>{
          if(res.success && res.list && res.list.length > 0) {
            this.departList = res.list;
          }else {
            this.departList = [];
          }
        }).catch((error) => {
          this.departList = [];
        })
      },
      getUserList() {
        deviceApi.user_list().then((res)=>{
          if(res.success && res.list && res.list.length > 0) {
            res.list.forEach( v =>{
              let label = v.nickname;
              if (v.departs.length > 0) {
                label += '/';
                label += v.departs.reduce((pre ,cur) => pre+ '[' + cur.departName + ']','')
              }
              v.label = label
            });
            this.userList = res.list;
 
          }else {
            this.userList = [];
          }
        }).catch((error) => {
          this.userList = [];
        })
      },
      getDepartPermList() {
        let nodeType = this.nodeType;
        let paramId = '';
        if(nodeType == 1) {
          paramId = this.nodeEntity.groupId;
        }else if(nodeType == 2){
          paramId = null;
        }
        if(paramId && paramId !== '') {
          deviceApi.group_depart_list(paramId).then((res) => {
            if(res.success && res.list && res.list.length > 0) {
              this.departListKey = [];
              res.list.forEach((v,k) => {
                this.departListKey.push(v.departId);
              })
            }else {
              this.departListKey = [];
            }
          }).catch((error) => {
            this.departListKey = [];
          });
        }
      },
      getUserPermList() {
        let nodeType = this.nodeType;
        let paramId = '';
        if(nodeType == 1) {
          paramId = this.nodeEntity.groupId;
        }else if(nodeType == 2){
          paramId = this.nodeEntity.deviceId;
        }
        if(paramId && paramId !== '') {
          deviceApi.user_perm_list(nodeType, paramId).then((res) => {
            if(res.success && res.list && res.list.length > 0) {
              this.userListKey = [];
              res.list.forEach((v,k) => {
                this.userListKey.push(v.userId);
              })
            }else {
              this.userListKey = [];
            }
          }).catch((error) => {
            this.userListKey = [];
          });
        }
 
      },
      handlerUserListChange(value, direction, movedKeys) {
        let nodeType = this.nodeType;
        let paramId = '';
        let flag = 0;
        if(this.relativeFlag) {
          flag = 1;
        }else {
          flag = 2;
        }
        if(nodeType == 1) {
          paramId = this.nodeEntity.groupId;
        }else if(nodeType == 2){
          paramId = this.nodeEntity.deviceId;
          flag = 2;
        }
        if(paramId && paramId !== '') {
          if(direction == 'right') {
            //添加
            deviceApi.assign_add_user(nodeType, paramId, flag, movedKeys).then((res) => {
              if(res.success) {
                this.$message({
                  type:'success',
                  message:res.message
                })
              }else {
                this.$message({
                  type:'error',
                  message:res.message
                })
              }
            }).catch((error) => {
              this.$message({
                type:'error',
                message:'权限分配异常!'
              })
            })
          }else {
            //移除
            deviceApi.assign_remove_user(nodeType, paramId, flag, movedKeys).then((res) => {
              if(res.success) {
                this.$message({
                  type:'success',
                  message:res.message
                })
              }else {
                this.$message({
                  type:'error',
                  message:res.message
                })
              }
            }).catch((error) => {
              this.$message({
                type:'error',
                message:'权限分配异常!'
              })
            })
          }
        }else {
          this.$message({
            type:'error',
            message:'参数错误!'
          })
        }
      },
      handlerDepartListChange(value, direction, movedKeys) {
        let nodeType = this.nodeType;
        let paramId = '';
        if(nodeType == 1) {
          paramId = this.nodeEntity.groupId;
        }else if(nodeType == 2){
          paramId = null;
        }
        let flag = 0;
        if(this.relativeFlag) {
          flag = 1;
        }else {
          flag = 2;
        }
        if(paramId && paramId !== '') {
          if(direction == 'right') {
            //添加
            deviceApi.assign_add_depart(paramId, flag, movedKeys).then((res) => {
              if(res.success) {
                this.$message({
                  type:'success',
                  message:res.message
                })
              }else {
                this.$message({
                  type:'error',
                  message:res.message
                })
              }
            }).catch((error) => {
              this.$message({
                type:'error',
                message:'权限分配异常!'
              })
            })
          }else {
            //移除
            deviceApi.assign_remove_depart(paramId, flag, movedKeys).then((res) => {
              if(res.success) {
                this.$message({
                  type:'success',
                  message:res.message
                })
              }else {
                this.$message({
                  type:'error',
                  message:res.message
                })
              }
            }).catch((error) => {
              this.$message({
                type:'error',
                message:'权限分配异常!'
              })
            })
          }
        }else {
          this.$message({
            type:'error',
            message:'参数错误!'
          })
        }
      },
      /*handleGroupTabClick(tab, e) {
       /!* console.info(tab);
        console.info(e);
        debugger;*!/
        this.activeName = tab.name;
      }*/
    },
    created() {
      this.defaultGroupAddData = JSON.parse(JSON.stringify(this.groupAddData));
      this.defaultDeviceAddData = JSON.parse(JSON.stringify(this.deviceAddData));
      window.addEventListener('resize', this.getHeight);
      this.getHeight();
    },
    mounted() {
      //树结构
      this.loadTree();
      this.getDepartList();
      this.getUserList();
      this.$refs.pHead.activeIndex = '/home/device';
      Bus.$off('setIndex');
      Bus.$on('setIndex',val =>{//监听first组件的txt事件
        let msg = JSON.parse(JSON.stringify(val));
        _this.setIndex(msg);
      });
      dragTwoColDiv("deviceDrag", "deviceTreeDiv", "deviceResize", "deviceDoc");
    },
    watch: {
      //结构树搜索框内容
      filterText(val) {
        this.$refs.tree.filter(val);
      },
      deviceNode:{
        deep: true,  // 深度监听
        handler(newValue, oldValue) {
          if (newValue.index != 0) {
            this.$nextTick(function () {
              document.getElementById('filesTab').style.height = 452+'px';
              document.getElementById('deviceDocTable').style.height = 360+'px';
              dragTwoRowDiv("deviceDoc", "filesTab", "tabResize", "attributeTab");
            })
          }
        }
      },
      nodeType(val){
        if(val !==2){
          this.conheight.height=window.innerHeight-85+'px';
        }else{
          this.conheight.height=window.innerHeight-510+'px';
        }
      },
    }
  }
</script>
 
<style scoped lang="scss">
  .container {
    position: absolute;
    top: 0px;
    bottom: 0px;
    width: 100%;
  }
  .main {
    display: flex;
    position: absolute;
    top: 60px;
    bottom: 0px;
    overflow: hidden;
    aside {
      width: 230px;
      .el-tree{
        overflow: auto;
      }
    }
    .drag-two-resize {
      width: 5px;
      cursor: w-resize;
      background: #104AB7;
    }
    .r-resize{
      height: 5px;
      cursor: s-resize;
      background: #104AB7;
    }
  }
  .tree-title{
    background: #ffffff;
    text-align: center;
    line-height:4
  }
  .search_box{
    padding: 5%;
    background-color: #fff;
  }
  .menu-expanded {
    width: 230px;
    padding: 10px;
    background-color: #f0f8ff;
  }
  .content-container {
    background: #fff;
    flex: 1;
     overflow-x: hidden;
    overflow-y: auto;
    padding: 20px;
    .content-wrapper {
      background-color: #fff;
      box-sizing: border-box;
      padding: 10px 0;
    }
    .grid-content {
      height: 455px;
    }
  }
  .grid-table-height{
    height: 450px;
    overflow: auto;
  }
  .el-aside {
    border: 1px solid #ccc;
    border-right: none;
    overflow: hidden;
  }
 
  .el-main {
    border: 1px solid #ccc;
  }
 
  .menu_item {
    line-height: 20px;
    text-align: left;
    margin-top: 10px;
  }
 
  .menu {
    height: 100px;
    width: 80px;
    position: absolute;
    /* border-radius: 10px;*/
    border: 1px solid #999999;
    background-color: #f4f4f4;
  }
  .contextmenu {
    margin: 0;
    background: #fff;
    z-index: 3000;
    position: absolute;
    list-style-type: none;
    padding: 5px 0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 400;
    color: #333;
    box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
    li {
      margin: 0;
      padding: 7px 16px;
      cursor: pointer;
      list-style-type:none;
      font-size:15px
    }
 
    li:hover {
      background-color: #1790ff;
      color: white;
    }
  }
  .treeRightMenu{
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
  }
</style>
<style>
  .el-switch{
    height: 40px;
    line-height: 40px;
  }
  .el-upload-list{
    max-height: 500px;
    overflow: auto;
  }
  @media screen and (max-height: 760px) {
    .el-upload-list{
      max-height: 330px;
      overflow: auto;
    }
  }
</style>