管道基础大数据平台系统开发-【前端】-新系統界面
liupengpeng
2023-02-14 b671529a86644b7496279c469fa683f58be222e1
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
<template>
  <div class="menuSettings_box">
    <div class="menuSettings_tree">
      <My-bread :list="[
          `${$t('operatManage.operatManage')}`,
          `${$t('operatManage.menuSettings')}`,
        ]"></My-bread>
      <el-divider />
    </div>
    <div class="cataLogContent">
      <div class="left_Tree subpage_Div">
        <div style="width:auto">
          <el-tree
            ref="tree"
            :props="defaultProps"
            node-key="id"
            highlight-current
            :data="menuList"
            :expand-on-click-node="false"
            :default-expand-all="true"
            @node-click="handleNodeClick"
          >
          </el-tree>
        </div>
 
      </div>
      <div class="right_menu subpage_Div">
 
        <div style="display:flex;justify-content:space-between">
          <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/' }">{{
            $t('dataManage.dictionaryManageObj.particulars')
          }}</el-breadcrumb-item>
          </el-breadcrumb>
 
          <div>
            <el-button
              v-if="menuStatus.insert"
              :disabled="itemdetail.pid == null ? true : false"
              @click="setNewNode(1)"
              type="success"
              icon="el-icon-plus"
              size="small"
            >新增同级</el-button>
            <el-button
              v-if="menuStatus.insert"
              :disabled="itemdetail.pid == null ? true : false"
              @click="setNewNode(2)"
              type="success"
              icon="el-icon-plus"
              size="small"
            >新增子级</el-button>
            <el-button
              v-if="menuStatus.delete"
              @click="setDelNode()"
              :disabled="itemdetail.pid == null ? true : false"
              type="danger"
              icon="el-icon-delete"
              size="small"
            >删除</el-button>
            <el-button
              v-if="menuStatus.update"
              :disabled="itemdetail.pid == null ? true : false"
              @click="setEditNode(1)"
              type="info"
              icon="el-icon-top"
              size="small"
            >向上移动</el-button>
            <el-button
              v-if="menuStatus.update"
              :disabled="itemdetail.pid == null ? true : false"
              @click="setEditNode(2)"
              type="info"
              icon="el-icon-bottom"
              size="small"
            >向下移动</el-button>
          </div>
 
        </div>
        <el-divider />
        <div class="form_box">
          <el-form
            :model="itemdetail"
            ref="itemdetail"
            :rules="rules"
          >
            <el-form-item
              prop="enName"
              :label="$t('operatManage.menuSetObj.enName')"
              :label-width="formLabelWidth"
            >
              <el-input
                clear="el_input"
                v-model="itemdetail.enName"
                autocomplete="off"
              ></el-input>
            </el-form-item>
            <el-form-item
              prop="cnName"
              :label="$t('operatManage.menuSetObj.cnName')"
              :label-width="formLabelWidth"
            >
              <el-input
                v-model="itemdetail.cnName"
                autocomplete="off"
              ></el-input>
            </el-form-item>
            <el-form-item
              :label="$t('operatManage.menuSetObj.icon')"
              :label-width="formLabelWidth"
            >
              <el-input
                v-model="itemdetail.icon"
                autocomplete="off"
              ></el-input>
            </el-form-item>
            <el-form-item
              prop="isShow"
              :label="$t('operatManage.menuSetObj.isShow')"
              :label-width="formLabelWidth"
            >
              <el-select
                style="width: 400px"
                :popper-append-to-body="false"
                v-model="itemdetail.isShow"
                placeholder=""
              >
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              :label="$t('operatManage.menuSetObj.menuUrl')"
              :label-width="formLabelWidth"
            >
              <el-input
                v-model="itemdetail.url"
                autocomplete="off"
              ></el-input>
            </el-form-item>
            <el-form-item
              :label="$t('operatManage.menuSetObj.authorize')"
              :label-width="formLabelWidth"
            >
              <el-input
                v-model="itemdetail.perms"
                autocomplete="off"
              ></el-input>
            </el-form-item>
            <el-form-item
              :label="$t('operatManage.menuSetObj.type')"
              prop="type"
              :label-width="formLabelWidth"
            >
              <el-select
                style="width: 400px"
                :popper-append-to-body="false"
                v-model="itemdetail.type"
                :placeholder="$t('common.choose')"
              >
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              :label="$t('operatManage.menuSetObj.bak')"
              :label-width="formLabelWidth"
            >
              <el-input
                v-model="itemdetail.bak"
                autocomplete="off"
              ></el-input>
            </el-form-item>
            <div
              class="btnBox"
              v-if="menuStatus.update"
            >
              <el-button
                size="small"
                type="info"
                @click="updMenu('itemdetail')"
              >{{ $t('common.confirm') }}</el-button>
              <el-button
                size="small"
                type="primary"
                @click="reset('itemdetail')"
              >{{
                $t('common.cancel')
              }}</el-button>
            </div>
          </el-form>
        </div>
 
      </div>
    </div>
 
    <el-dialog
      :title="$t('common.append')"
      :visible.sync="dialogFormVisible"
    >
      <el-form
        :model="ruleForm"
        ref="ruleForm"
        :rules="rules"
      >
        <el-form-item
          prop="enName"
          :label="$t('operatManage.menuSetObj.enName')"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="ruleForm.enName"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          prop="cnName"
          :label="$t('operatManage.menuSetObj.cnName')"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="ruleForm.cnName"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('operatManage.menuSetObj.icon')"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="ruleForm.icon"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          prop="isShow"
          :label="$t('operatManage.menuSetObj.isShow')"
          :label-width="formLabelWidth"
        >
          <el-select
            :popper-append-to-body="false"
            style="width:100%"
            v-model="ruleForm.isShow"
            placeholder=""
          >
            <el-option
              v-for="item in options1"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          :label="$t('operatManage.menuSetObj.menuUrl')"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="ruleForm.url"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('operatManage.menuSetObj.authorize')"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="ruleForm.perms"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('operatManage.menuSetObj.type')"
          prop="type"
          :label-width="formLabelWidth"
        >
          <el-select
            :popper-append-to-body="false"
            style="width:100%"
            v-model="ruleForm.type"
            :placeholder="$t('common.choose')"
          >
            <el-option
              v-for="item in options2"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          :label="$t('operatManage.menuSetObj.bak')"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="ruleForm.bak"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="resetForm('ruleForm')">{{
          $t('common.cancel')
        }}</el-button>
        <el-button
          style="background: #409eff; color: white; border: 1px solid #409eff"
          @click="submitForm('ruleForm')"
          v-loading.fullscreen.lock="fullscreenLoading"
        >{{ $t('common.confirm') }}</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import MyBread from '../../components/MyBread.vue';
import {
  queryMenuAll,
  updateMenuTree,
  updateMenuTrees,
  queryMaxId,
  insertMenu,
  deleteMenu,
  getPerms,
} from '../../api/api';
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
    MyBread,
  },
  data() {
    return {
      menuStatus: {
        delete: false,
        insert: false,
        update: false,
      },
      defaultProps: {
        children: 'children',
        label: 'cnName',
      },
      fullscreenLoading: false,
      oriData: [], //原始树数据
      menuList: [], //el树数据
      old_dirDat: [], //el树数据(拖动前)
      newData: [], //拖动后原始数据
      itemdetail: {
        cnName: '',
        enName: '',
        icon: null,
        isShow: null,
        perms: null,
        url: '',
        type: null,
        bak: '',
      },
      backUpData: '',
      formLabelWidth: '130px',
      delChildID: '',
      delChildIDs: [],
      dialogFormVisible: false,
      ruleForm: {
        level: null,
        orderNum: null,
        pid: null,
        enName: '',
        cnName: '',
        icon: '',
        isShow: null,
        url: '',
        perms: null,
        type: null,
        bak: '',
      },
      rules: {
        enName: [
          { required: true, message: '请输入英文名称', trigger: 'blur' },
        ],
        cnName: [
          { required: true, message: '请输入中文名称', trigger: 'blur' },
        ],
 
        isShow: [
          {
            required: true,
            message: '请选择是否显示',
            trigger: 'change',
          },
        ],
        type: [
          {
            required: true,
            message: '请选择节点类型',
            trigger: 'change',
          },
        ],
      },
      // 下拉的option里面的value定义成0,1,不能定义成’0’,'1’字符串,
      // 如果要定义成字符串,后台需要返回的也是字符串
      options1: [
        {
          value: 0,
          label: '隐藏',
        },
        {
          value: 1,
          label: '显示',
        },
      ],
      options2: [
        {
          value: 0,
          label: '根目录',
        },
        {
          value: 1,
          label: '菜单',
        },
        {
          value: 2,
          label: '按钮',
        },
      ],
      newNode: null,
    };
  },
  methods: {
    getMenuTree() {
      //获取目录树最大ID,新建节点使用
      // queryMaxId().then((res) => {
      //   this.id = res.data;
      // });
      queryMenuAll().then((res) => {
        if (res.code == 200) {
          this.menuList = this.treeData(res.result);
          this.oriData = res.result;
          this.newData = res.result;
          if (this.itemdetail.id != null) {
            this.$nextTick(() => {
              this.$refs.tree.setCurrentKey(this.itemdetail.id);
            });
          }
 
 
 
        } else {
          console.log('接口报错');
        }
      });
    },
    treeData(source) {
      let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆
      return cloneData.filter((father) => {
        // 循环所有项
        let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
        branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值
        return father.pid == 0; // 返回一级菜单
      });
    },
 
    setEditNode(res) {
      let node = this.$refs.tree.getCurrentNode();
      let pchildNodes = this.$refs.tree.getNode(node.id).parent.childNodes;
      let currentId = {};
      for (let i = 0; i < pchildNodes.length; i++) {
        if (pchildNodes[i].data.id == node.id) {
          currentId = i;
        }
      }
      switch (res) {
        case 1://向上移动
          if (currentId != 0) {
            const tempChildrenNodex1 = pchildNodes[currentId - 1];
            const tempChildrenNodex2 = pchildNodes[currentId];
            tempChildrenNodex2.orderNum = pchildNodes[currentId - 1].data.orderNum;
            tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum
            var arr = [];
            this.oriData.filter(res => {
              if (res.id == tempChildrenNodex2.data.id) {
                res.orderNum = tempChildrenNodex2.orderNum;
                arr.push(res)
              } else if (res.id == tempChildrenNodex1.data.id) {
                res.orderNum = tempChildrenNodex1.orderNum;
                arr.push(res)
              }
 
            })
            this.newData = arr;
            this.sendChange();
          } else {
            this.$message({
              message: '处于顶端,不能继续上移',
              type: 'warning'
            });
          }
          break;
        case 2://向下移动
          if (currentId < (pchildNodes.length - 1)) {
            const tempChildrenNodex1 = pchildNodes[currentId + 1];
            const tempChildrenNodex2 = pchildNodes[currentId];
            tempChildrenNodex2.orderNum = pchildNodes[currentId + 1].data.orderNum;
            tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
            var arr = [];
            this.oriData.filter(res => {
              if (res.id == tempChildrenNodex2.data.id) {
                res.orderNum = tempChildrenNodex2.orderNum;
                arr.push(res)
              } else if (res.id == tempChildrenNodex1.data.id) {
                res.orderNum = tempChildrenNodex1.orderNum;
                arr.push(res)
              }
            })
            this.newData = arr;
            this.sendChange();
          } else {
            this.$message({
              message: '处于底端,不能继续下移',
              type: 'warning'
            });
 
          }
          break;
 
      }
    },
    setDelNode() {
      this.remove(this.newNode, this.itemdetail)
    },
    setNewNode(res) {
      var id, lever, orderNum;
      if (res == 1) {//新增同级
        id = this.itemdetail.pid;
        orderNum = this.getMaxOrderNum(this.newNode.parent.childNodes)
 
        lever = this.itemdetail.level;
      } else if (res == 2) {//新增子级
        id = this.itemdetail.id;
        orderNum = this.getMaxOrderNum(this.newNode.childNodes)
 
        lever = this.itemdetail.level + 1;
      }
 
      this.ruleForm.pid = id;
      this.ruleForm.level = lever;
      this.ruleForm.orderNum = orderNum
      this.dialogFormVisible = true;
    },
    getMaxOrderNum(res) {
      var val = -100;
      for (var i in res) {
        if (res[i].data.orderNum > val) {
          val = res[i].data.orderNum
        }
      }
      val = val + 1;
      return val;
    },
 
 
 
 
 
 
    append(node, data) {
      this.dialogFormVisible = true;
      this.ruleForm.pid = data.id;
      this.ruleForm.orderNum = node.childNodes.length + 1;
      this.ruleForm.level = data.level + 1;
    },
    resetForm(formName) {
      this.dialogFormVisible = false;
      this.$nextTick(() => {
        this.$refs[formName].resetFields();
        this.ruleForm = {};
      });
    },
    submitForm(formName) {
      this.$nextTick(() => {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.fullscreenLoading = true;
            insertMenu(this.ruleForm)
              .then((res) => {
                setTimeout(() => {
                  this.fullscreenLoading = false;
                  if (res.code == 200) {
                    this.$message({
                      message: '添加成功',
                      type: 'success',
                    });
                    this.getMenuTree();
                    this.itemdetail = {};
                    this.ruleForm = {};
                    this.dialogFormVisible = false;
                    this.$refs[formName].resetFields();
                  }
                }, 500);
              })
              .catch((res) => {
                this.itemdetail = {};
                this.$message.error('添加失败');
                this.fullscreenLoading = false;
                console.log(res);
              });
          } else {
            // alert("目录名称不能为空");
            return false;
          }
        });
      });
    },
    remove(node, data) {
      this.$confirm('此操作将删除该节点, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          //兄弟重新排序
          const parent = node.parent;
          const children = parent.data.children || parent.data;
          children.splice(data.orderNum - 1, 1);
          children.forEach((item, index) => {
            item.orderNum = index + 1;
          });
 
          this.traverseArr(data); //获取删除的子ID
          this.delChildIDs.push(data.id); //要删除的全部ID
          let delIDs = this.delChildIDs;
          Promise.all([
            deleteMenu({ ids: delIDs.toString() }),
            updateMenuTrees(children),
          ])
            .then((res) => {
              if (res[0].code == 200 && res[1].code == 200) {
                this.$message({
                  type: 'success',
                  message: '删除成功!',
                });
                this.getMenuTree();
                this.itemdetail = {};
              } else if (res[0].code == 200) {
                this.getMenuTree();
                this.$message.error('删除成功,位置调整失败');
              } else if (res[1].code == 200) {
                this.getMenuTree();
                this.$message.error('删除失败,位置调整成功');
              } else {
                this.$message.error('删除失败');
              }
            })
            .catch(() => {
              this.$message({
                type: 'error',
                message: '删除失败',
              });
            });
 
          //重置要删除的子ID
          this.delChildIDs = [];
        })
        .catch(() => {
          this.$message('已取消删除');
        });
    },
    traverseArr(obj) {
      if (obj.children) {
        return obj.children.forEach((item) => {
          // console.log(item.id + "---" + item.name);
          // this.delChildID += "id=" + item.id + "&";
          this.delChildIDs.push(item.id);
          this.traverseArr(item);
        });
      }
      return;
    },
    flaten(arr) {
      return arr.reduce((p, v, i) => {
        for (let i = 0; i < p.length; i++) {
          if (p[i].children) {
            delete p[i].children;
          }
        }
        return p.concat(v.children ? this.flaten(v.children).concat(v) : v);
      }, []);
    },
    handleDragStart(node, ev) {
      this.old_dirDat = JSON.parse(JSON.stringify(this.menuList)); //将备份的dir重新赋值
    },
    handleDrop(draggingNode, dropNode, dropType, ev) {
      this.$confirm('此操作将保存目录更改, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          //父节点
          let data = dropType != 'inner' ? dropNode.parent.data : dropNode.data;
          // 父节点中全部子节点
          let nodeData =
            dropNode.level == 1 && dropType != 'inner' ? data : data.children;
          //变更节点
          // console.log(nodeData);
          nodeData.forEach((item, i) => {
            if (dropType != 'inner') {
              if (draggingNode.data.pid === dropNode.data.pid) {
                item.pid = item.pid;
              } else {
                item.pid = dropNode.data.pid;
              }
            } else {
              item.pid = data.id;
            }
            item.orderNum = i + 1;
          });
          // console.log(nodeData);
          //更新原始整体数据
          let arr = [];
          this.oriData.forEach((e) => {
            nodeData.forEach((item) => {
              if (item.id === e.id) e = item;
            });
            arr.push(e);
          });
          this.newData = arr;
          this.sendChange();
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消更改',
          });
          this.menuList = this.old_dirDat; //将备份的dir重新赋值
        });
    },
    sendChange() {
      this.newData.forEach((item) => {
        if (item.pid == 0) {
          item.type = 0;
        }
      });
      updateMenuTrees(this.newData)
        .then((res) => {
          if (res.code == 200) {
            this.getMenuTree();
            return;
          } else {
            this.$message.error('调整失败,请重试!');
          }
        })
        .catch(() => {
          this.$message.error('调整失败,请重试!');
        });
    },
    handleNodeClick(data, node) {
      this.newNode = node;
      this.backUpData = JSON.stringify(data);
      this.itemdetail = JSON.parse(JSON.stringify(data));
    },
    updMenu(formName) {
      this.$nextTick(() => {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.fullscreenLoading = true;
            updateMenuTree(this.itemdetail)
              .then((res) => {
                setTimeout(() => {
                  this.fullscreenLoading = false;
                  if (res.code == 200) {
                    this.getMenuTree();
                    this.itemdetail = {};
                    this.dialogFormVisible = false;
                    this.$refs[formName].resetFields();
                  }
                }, 500);
              })
              .catch((res) => {
                this.$message.error('调整失败,请重试!');
                this.fullscreenLoading = false;
              });
          } else {
            return false;
          }
        });
      });
    },
    reset(formName) {
      this.$refs[formName].resetFields();
      if (this.backUpData != '') {
        this.itemdetail = JSON.parse(this.backUpData);
      }
    },
    showPermsMenu(res) {
 
      switch (res.tag) {
        case '/delete':
          this.menuStatus.delete = true;
          break;
        case '/insert':
          this.menuStatus.insert = true;
          break;
        case '/update':
          this.menuStatus.update = true;
          break;
      }
    },
    getPerms() {
      var val = this.$store.state.currentPerms;
      var permsEntity = this.$store.state.permsEntity;
 
      if (permsEntity.length == 0) {
        getPerms().then((res) => {
          if (res.code == 200) {
            permsEntity = res.result;
          }
        });
      }
      for (var i = 0; i < permsEntity.length; i++) {
        if (permsEntity[i].perms == val) {
          this.showPermsMenu(permsEntity[i]);
        }
      }
    },
  },
  mounted() {
    this.getMenuTree();
    this.getPerms();
  },
  created() { },
};
</script>
<style lang="less" scoped>
.menuSettings_box {
  height: 98%;
  width: 98%;
  padding: 1%;
 
  .cataLogContent {
    width: 100%;
    height: 92%;
    display: flex;
    justify-content: space-between;
    .left_Tree {
      width: 15%;
      height: 91%;
      border-radius: 5px;
      padding: 1%;
      overflow-y: auto;
    }
    .right_menu {
      width: 80%;
      height: 91%;
      border-radius: 5px;
      padding: 1%;
      overflow: auto;
      .form_box {
        box-sizing: border-box;
        width: 100%;
        .el-input {
          width: 400px;
        }
      }
    }
  }
}
</style>