SideMenu.vue 14.1 KB
Newer Older
1
<template id="SideMenu">
zhengxiaokui committed
2
  <c-row>
3
    <div class="eContainer-menu-search">
4
      <el-button
zhengxiaokui committed
5 6 7
        icon="el-icon-s-fold"
        v-if="menuOpen"
        @click="closeMenu"
8 9
      ></el-button>
      <el-button icon="el-icon-s-unfold" v-else @click="openMenu"></el-button>
10
      <c-search-input v-show="menuOpen"></c-search-input>
11
    </div>
潘际乾 committed
12
    <c-content :height="menusHeight">
zhengxiaokui committed
13 14 15 16 17 18 19 20
      <el-menu
        :default-active="activeMenu"
        class="el-menu-vertical-demo"
        v-bind:router="true"
        @open="handleOpen"
        @close="handleClose"
        :collapse="!menuOpen"
      >
liushikai committed
21
        <SubMenu :subMenuList="menus" :openFlgArr="openFlgArr"></SubMenu>
zhengxiaokui committed
22
      </el-menu>
23
    </c-content>
zhengxiaokui committed
24
  </c-row>
fukai committed
25 26
</template>
<script>
zhengxiaokui committed
27 28
import Button from "../../components/Button.vue";
import SubMenu from "~/components/SubMenu.vue";
29

zhengxiaokui committed
30 31
export default {
  components: { Button, SubMenu },
32
  data: function () {
zhengxiaokui committed
33
    return {
liushikai committed
34
      openFlgArr: [],
zhengxiaokui committed
35 36
      menuOpen: true,
      menuList: [
jianglong committed
37 38 39 40
        
        
        
         { inifrm: "2", ininam: "买方信用证", pntmiu: "" },
41 42 43
        // { inifrm: "ditopn", ininam: "信用证开立", pntmiu: "2" },
        // { inifrm: "ditame", ininam: "信用证修改", pntmiu: "2" },
        // { inifrm: "ditcan", ininam: "信用证注销", pntmiu: "2" },
潘际乾 committed
44 45
        { inifrm: "infdid", ininam: "买方信用证交易查询", pntmiu: "2" },
        { inifrm: "infbdd", ininam: "买方信用证单据查询", pntmiu: "2" },
zhoubaojian committed
46
        //{ inifrm: "bdtset", ininam: "买方信用证收款", pntmiu: "2" },
jianglong committed
47

潘际乾 committed
48
        { inifrm: "22", ininam: "卖方信用证", pntmiu: "" },
49 50 51 52
        { inifrm: "infdet", ininam: "卖方信用证交易查询", pntmiu: "22" },
        { inifrm: "infbfd", ininam: "卖方信用证单据查询", pntmiu: "22" },
        //{ inifrm: "bftsnd", ininam: "卖方信用证寄单", pntmiu: "2" },
        //{ inifrm: "bftset", ininam: "卖方信用证收款", pntmiu: "2" },
53 54
        // { inifrm: "bdtudp", ininam: "信用证承兑", pntmiu: "2" },
        // { inifrm: "bdtdcr", ininam: "信用证不符点/拒付", pntmiu: "2" },
55 56
        // { inifrm: "ditdck", ininam: "信用证到单", pntmiu: "2" },
        // { inifrm: "bdtset", ininam: "信用证付款", pntmiu: "2" },
jianglong committed
57 58 59 60 61 62 63 64 65 66 67
        
         { inifrm: "4", ininam: "进口信用证", pntmiu: "" },
        { inifrm: "inflid", ininam: "进口信用证交易查询", pntmiu: "4" },
        { inifrm: "infbrd", ininam: "进口信用证单据查询", pntmiu: "4" },
        // { inifrm: "litopn", ininam: "进口信用证开立", pntmiu: "4" },
        // { inifrm: "litdav", ininam: "进口信用证通知到单", pntmiu: "4" },
        // { inifrm: "litdck", ininam: "进口信用证到单", pntmiu: "4" },
        // { inifrm: "brtlat", ininam: "进口信用证单据偿还垫款", pntmiu: "4" },



liushikai committed
68
        { inifrm: "3", ininam: "出口信用证", pntmiu: "" },
Eivi committed
69
        { inifrm: "infled", ininam: "出口信用证交易查询", pntmiu: "3" },
cyy committed
70
        { inifrm: "infbed", ininam: "出口信用证单据查询", pntmiu: "3" },
Eivi committed
71 72 73 74 75 76 77 78 79 80 81 82
        // { inifrm: "letsel", ininam: "出口信用证查询", pntmiu: "3" },
        // { inifrm: "letopn", ininam: "出口信用证通知", pntmiu: "3" },
        // { inifrm: "letnot", ininam: "出口信用证预通知", pntmiu: "3" },
        // { inifrm: "letame", ininam: "出口信用证修改", pntmiu: "3" },
        // { inifrm: "letrsv", ininam: "出口信用证补通知", pntmiu: "3" },
        // { inifrm: "bptcan", ininam: "出口融资注销", pntmiu: "3" },
        // { inifrm: "letcan", ininam: "出口信用证注销", pntmiu: "3" },
        // { inifrm: "betacc", ininam: "出口信用证单据承兑", pntmiu: "3" },
        // { inifrm: "betrcl", ininam: "出口信用证单据索汇", pntmiu: "3" },
        // { inifrm: "betdcr", ininam: "出口信用证不符点/拒付", pntmiu: "3" },
        // { inifrm: "betdrv", ininam: "出口信用证单据修改", pntmiu: "3" },
        // { inifrm: "infbpd", ininam: "出口押汇查询", pntmiu: "3" },
jianglong committed
83
       
84 85 86 87
        // { inifrm: "litcan", ininam: "进口信用证注销", pntmiu: "4" },
        // { inifrm: "inftrd", ininam: "进口押汇查询", pntmiu: "4" },
        // { inifrm: "trtame", ininam: "进口融资修改", pntmiu: "4" },
        // { inifrm: "inftxm", ininam: "条式语句查询", pntmiu: "4" },
88

jianglong committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106


{ inifrm: "7", ininam: "转让信用证", pntmiu: "" },
        { inifrm: "infltd", ininam: "转让信用证查询", pntmiu: "7" },
        { inifrm: "infbtd", ininam: "转让信用证单据查询", pntmiu: "7" },


{ inifrm: "17",ininam: "进口融资", pntmiu: "" },
        { inifrm: "inftrd", ininam: "进口融资查询", pntmiu: "17" },
         
        { inifrm: "16",ininam: "出口融资", pntmiu: "" },
        { inifrm: "infbpd", ininam: "出口融资查询", pntmiu: "16" },


       
        

 { inifrm: "5", ininam: "进口代收", pntmiu: "" },
107 108 109 110 111 112 113
        // { inifrm: "bctdav", ininam: "进口代收到单通知", pntmiu: "5" },
        // { inifrm: "bctame", ininam: "进口代收修改", pntmiu: "5" },
        // { inifrm: "bctacc", ininam: "进口代收承兑", pntmiu: "5" },
        // { inifrm: "bctrad", ininam: "进口代收二次收单", pntmiu: "5" },
        // { inifrm: "bctdor", ininam: "进口代收拒付", pntmiu: "5" },
        // { inifrm: "bctset", ininam: "进口代收付款", pntmiu: "5" },
        // { inifrm: "bctcan", ininam: "进口代收注销", pntmiu: "5" },
wjj committed
114
        { inifrm: "infbcd", ininam: "进口代收查询", pntmiu: "5" },
nanrui committed
115

116
        { inifrm: "6", ininam: "出口托收", pntmiu: "" },
nanrui committed
117 118 119 120 121 122
        { inifrm: "infbod", ininam: "出口托收查询", pntmiu: "6" },
        // { inifrm: "botdav", ininam: "出口托收寄单", pntmiu: "6" },
        // { inifrm: "botame", ininam: "出口托收修改", pntmiu: "6" },
        // { inifrm: "botdcr", ininam: "出口托收拒付/不符点", pntmiu: "6" },
        // { inifrm: "botset", ininam: "出口托收收汇", pntmiu: "6" },
        // { inifrm: "botcan", ininam: "出口托收闭卷", pntmiu: "6" },
jianglong committed
123
        
liushikai committed
124
        { inifrm: "8", ininam: "打包托收", pntmiu: "" },
125
        { inifrm: "infcld", ininam: "打包托收查询", pntmiu: "8" },
126 127 128
        // { inifrm: "cltdav", ininam: "打包托收开立", pntmiu: "8" },
        // { inifrm: "clttra", ininam: "打包托收催收", pntmiu: "8" },
        // { inifrm: "cltset", ininam: "打包托收解包", pntmiu: "8" },
129
        { inifrm: "9", ininam: "光票托收", pntmiu: "" },
wangna committed
130 131 132 133
        { inifrm: "infccd", ininam: "光票托收查询", pntmiu: "9" },
        // { inifrm: "ccttra", ininam: "光票托收催收", pntmiu: "9" },
        // { inifrm: "cctdcr", ininam: "光票托收退票", pntmiu: "9" },
        // { inifrm: "cctset", ininam: "光票托收收汇", pntmiu: "9" },
wangbinfei committed
134 135
        //{ inifrm: "cltdav", ininam: "光票托收开立", pntmiu: "10" },
        //{ inifrm: "clttra", ininam: "光票托收", pntmiu: "10" },
jianglong committed
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

 { inifrm: "13", ininam: "保函", pntmiu: "" },
        { inifrm: "infgid", ininam: "保函入口交易", pntmiu: "13" },
        { inifrm: "infgcd", ininam: "保函赔付查询", pntmiu: "13" },
        // { inifrm: "gitsel", ininam: "进口保函查询", pntmiu: "13" },



 

        
        // { inifrm: "0", ininam: "公共夹", pntmiu: "" },
        // { inifrm: "sptsel", ininam: "待办任务", pntmiu: "0" },
        // { inifrm: "trnrel", ininam: "复核任务", pntmiu: "0" },
        // { inifrm: "diasel", ininam: "备忘录选择交易", pntmiu: "0" },
        { inifrm: "1", ininam: "汇款业务", pntmiu: "" },
        { inifrm: "infcpd", ininam: "汇款查询", pntmiu: "1" },
        // { inifrm: "cptopn", ininam: "汇出汇款", pntmiu: "1" },
        // { inifrm: "cptadv", ininam: "汇入汇款", pntmiu: "1" },
        // { inifrm: "cptato", ininam: "境内外币汇出汇款", pntmiu: "1" },
        // { inifrm: "cptati", ininam: "境内外币汇入汇款", pntmiu: "1" },
        { inifrm: "cnysel", ininam: "跨境人民币查询", pntmiu: "1" },
        // { inifrm: "cptrel", ininam: "汇款复核与查询", pntmiu: "1" },
        // { inifrm: "cptcan", ininam: "汇款注销", pntmiu: "1" },
        // { inifrm: "cptrep", ininam: "汇入汇款挂账解付", pntmiu: "1" },


       { inifrm: "15",ininam: "福费廷管理", pntmiu: "" },
        { inifrm: "assetInfo", ininam: "资产信息管理", pntmiu: "15" },
        { inifrm: "assetPub", ininam: "资产发布信息管理", pntmiu: "15" },
        { inifrm: "fund", ininam: "资金信息管理", pntmiu: "15" },
       
        
        
       
liushikai committed
171
        { inifrm: "10", ininam: "参数管理", pntmiu: "" },
172
        { inifrm: "dbiusr", ininam: "Dbiusr", pntmiu: "10" },
173
        { inifrm: "dbibch", ininam: "Dbibch", pntmiu: "10" },
liushikai committed
174
        { inifrm: "infusr", ininam: "用户信息", pntmiu: "10" },
zhujiazhan committed
175 176 177 178
        //{ inifrm: "11", ininam: "卖方信用证", pntmiu: "" },
        //{ inifrm: "detopn", ininam: "卖方信用证开立", pntmiu: "11" },
        //{ inifrm: "detame", ininam: "卖方信用证修改", pntmiu: "11" },
        //{ inifrm: "detsel", ininam: "卖方信用证查询", pntmiu: "11" },
179 180

        { inifrm: "12", ininam: "智能审单", pntmiu: "" },
181
        { inifrm: "examRule", ininam: "智能审单规则配置", pntmiu: "12" },
182
        //保函
jianglong committed
183
       
wangna committed
184 185
        // { inifrm: "gitset", ininam: "进口保函赔付", pntmiu: "13" },
        // { inifrm: "gitcrq", ininam: "进口保函索赔登记", pntmiu: "13" },
186
        { inifrm: "14", ininam: "服务管理", pntmiu: "" },
吴佳 committed
187
        { inifrm: "switsk", ininam: "Switsk", pntmiu: "14" },
liuxin committed
188
        { inifrm: "mgrtsk", ininam: "Mgrtsk", pntmiu: "14" },
吴佳 committed
189
        { inifrm: "sptrel", ininam: "sptrel", pntmiu: "14" },
zhujiazhan committed
190 191
         { inifrm: "sptneg", ininam: "sptneg", pntmiu: "14" },

192

jianglong committed
193
       
194

jianglong committed
195
       
196
        
zhengxiaokui committed
197 198
      ],
      menus: [],
199
      menusHeight: 0,
zhengxiaokui committed
200 201 202 203 204
    };
  },
  computed: {
    activeMenu() {
      return this.$route.path;
205
    },
zhengxiaokui committed
206
  },
潘际乾 committed
207 208 209
  watch: {
    $route: function () {
      this.$nextTick(() => {
210 211 212 213 214
        const arr = [];
        this.getOpenMenusIndex(this.menus, arr);
        this.openFlgArr = [...new Set([...this.openFlgArr, ...arr])];
      });
    },
潘际乾 committed
215
  },
潘际乾 committed
216 217 218
  created() {
    this.menusHeight = 60 + 46 + 8;
  },
zhengxiaokui committed
219 220 221
  mounted() {
    const arr = [];
    this.generateMenuTree(arr);
222
    this.menus = arr;
223
    this.$store.commit("UserContext/setMenu", arr);
224
    this.initOpenFlgIndex();
zhengxiaokui committed
225 226 227
  },
  methods: {
    generateMenuTree(list, item) {
228 229 230
      const cc = [],
        c = [];
      let n = 0;
zhengxiaokui committed
231 232 233 234 235 236 237
      for (let i = 0; i < this.menuList.length; i++) {
        const menuItem = this.menuList[i];
        if (!item) {
          if (menuItem.pntmiu === undefined || menuItem.pntmiu === "") {
            const children = [];
            menuItem.path = "/business";
            this.generateMenuTree(children, menuItem);
238
            const child = {
zhengxiaokui committed
239 240 241
              name: menuItem.ininam,
              path: menuItem.path,
              children,
242 243 244 245 246 247 248
            };
            if (children.length > 0) {
              child["index"] = child.path + "_" + n++;
              cc.push(child);
            } else {
              c.push(child);
            }
249
          }
zhengxiaokui committed
250 251 252 253 254
        } else {
          if (menuItem.pntmiu === item.inifrm) {
            const children = [];
            menuItem.path = item.path + "/" + menuItem.inifrm;
            this.generateMenuTree(children, menuItem);
255
            const child = {
zhengxiaokui committed
256 257 258 259
              name: menuItem.ininam,
              path: menuItem.path,
              icon: "el-icon-document",
              children,
260 261 262 263 264 265 266
            };
            if (children.length > 0) {
              child["index"] = child.path + "_" + n++;
              cc.push(child);
            } else {
              c.push(child);
            }
267 268
          }
        }
zhengxiaokui committed
269
      }
270
      list.push(...cc, ...c);
zhengxiaokui committed
271
    },
liushikai committed
272 273
    handleOpen(index, indexPath) {
      // console.log(index, indexPath);
274 275 276
      const arr = Object.assign([], this.openFlgArr);
      arr.push(index);
      this.openFlgArr = arr;
zhengxiaokui committed
277
    },
liushikai committed
278 279
    handleClose(index, indexPath) {
      // console.log(index, indexPath);
280 281
      const arr = Object.assign([], this.openFlgArr);
      this.openFlgArr = arr.filter((idx) => idx !== index);
zhengxiaokui committed
282 283 284 285 286
    },
    openMenu() {
      this.menuOpen = true;
      const aside = document.querySelector("aside");
      aside.className = aside.className.split(" ")[0];
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
      this.initOpenFlgIndex();
    },
    initOpenFlgIndex() {
      const r = [];
      this.getOpenMenusIndex(this.menus, r);
      this.openFlgArr = r;
    },
    getOpenMenusIndex(menus, arr) {
      for (let i = 0; i < menus.length; i++) {
        const menu = menus[i];
        if (menu.path === this.activeMenu) {
          return true;
        }
        if (menu.children.length > 0) {
          if (this.getOpenMenusIndex(menu.children, arr)) {
            arr.push(menu.index);
            return true;
          }
        }
      }
      return false;
zhengxiaokui committed
308 309 310 311 312
    },
    closeMenu() {
      this.menuOpen = false;
      const aside = document.querySelector("aside");
      aside.className = aside.className + " fold";
313
      this.openFlgArr = [];
zhengxiaokui committed
314
    },
zhengxiaokui committed
315 316
  },
};
fukai committed
317
</script>
潘际乾 committed
318
<style scoped>
zhengxiaokui committed
319 320 321 322 323
.eContainer-menu-search .el-button {
  border: none;
  font-size: 20px;
  padding: 12px 20px;
}
324

zhengxiaokui committed
325 326 327 328 329 330 331
.eContainer-menu-search .el-input {
  width: auto;
  position: absolute;
  right: 20px;
  top: 10px;
  left: 60px;
}
332

zhengxiaokui committed
333 334 335 336
.eContainer-scroller .el-scrollbar__wrap {
  overflow: auto;
  margin-right: 0px !important;
}
337

zhengxiaokui committed
338 339 340 341
.eContainer-menu-search {
  width: 100%;
  position: relative;
}
342

zhengxiaokui committed
343 344 345 346 347 348 349 350
.eContainer-menu-search .el-input,
.eContainer-menu-search .search-wrapper {
  width: auto;
  position: absolute;
  right: 20px;
  top: 10px;
  left: 60px;
}
351

zhengxiaokui committed
352 353 354
.eContainer-menu-search .el-input .el-input__inner {
  height: 30px;
}
355

zhengxiaokui committed
356 357 358
.eContainer-menu-search .el-icon-search {
  line-height: 30px;
}
359

zhengxiaokui committed
360 361 362
.eContainer-scroller {
  height: calc(100% - 44px);
}
363

zhengxiaokui committed
364 365 366
.eContainer-scroller .el-scrollbar__bar {
  display: none;
}
367

zhengxiaokui committed
368 369 370 371
.el-icon-s-fold {
  float: left;
  font-size: 20px;
}
372

zhengxiaokui committed
373 374 375 376
.el-icon-s-unfold {
  float: left;
  font-size: 20px;
}
377

zhengxiaokui committed
378 379 380
.el-menu {
  border-right: none;
}
381

zhengxiaokui committed
382 383 384 385 386
.eContainer-refresh {
  width: auto;
  overflow: auto;
  height: calc(100% - 44px);
}
387

zhengxiaokui committed
388 389 390 391
.el-button-refresh {
  width: 100%;
  height: 40px;
}
392 393 394
</style>

<style>
zhengxiaokui committed
395 396 397
.el-menu-vertical-demo.el-menu--collapse {
  width: 60px;
}
398

zhengxiaokui committed
399 400 401 402 403 404 405
.el-submenu__title,
.el-menu-item,
.el-submenu .el-menu-item {
  font-size: 12px;
  height: 35px;
  line-height: 35px;
}
406
.el-menu-vertical-demo [class^="el-icon-caret-"] {
407 408
  color: #606266;
}
409
</style>