SideMenu.vue 13.6 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: [
wangguangchao committed
37 38 39 40
        // { inifrm: "0", ininam: "公共夹", pntmiu: "" },
        // { inifrm: "sptsel", ininam: "待办任务", pntmiu: "0" },
        // { inifrm: "trnrel", ininam: "复核任务", pntmiu: "0" },
        // { inifrm: "diasel", ininam: "备忘录选择交易", pntmiu: "0" },
liushikai committed
41
        { inifrm: "1", ininam: "汇款业务", pntmiu: "" },
42
        // { inifrm: "cptato", ininam: "汇款业务", pntmiu: "" }
zhengxiaokui committed
43 44 45
        { inifrm: "infcpd", ininam: "汇款查询", pntmiu: "1" },
        { inifrm: "cptopn", ininam: "汇出汇款", pntmiu: "1" },
        { inifrm: "cptadv", ininam: "汇入汇款", pntmiu: "1" },
46

liushikai committed
47
        { inifrm: "2", ininam: "买方信用证", pntmiu: "" },
48 49 50
        // { inifrm: "ditopn", ininam: "信用证开立", pntmiu: "2" },
        // { inifrm: "ditame", ininam: "信用证修改", pntmiu: "2" },
        // { inifrm: "ditcan", ininam: "信用证注销", pntmiu: "2" },
潘际乾 committed
51 52
        { inifrm: "infdid", ininam: "买方信用证交易查询", pntmiu: "2" },
        { inifrm: "infbdd", ininam: "买方信用证单据查询", pntmiu: "2" },
zhoubaojian committed
53
        //{ inifrm: "bdtset", ininam: "买方信用证收款", pntmiu: "2" },
潘际乾 committed
54
        { inifrm: "22", ininam: "卖方信用证", pntmiu: "" },
55 56 57 58
        { inifrm: "infdet", ininam: "卖方信用证交易查询", pntmiu: "22" },
        { inifrm: "infbfd", ininam: "卖方信用证单据查询", pntmiu: "22" },
        //{ inifrm: "bftsnd", ininam: "卖方信用证寄单", pntmiu: "2" },
        //{ inifrm: "bftset", ininam: "卖方信用证收款", pntmiu: "2" },
59 60
        // { inifrm: "bdtudp", ininam: "信用证承兑", pntmiu: "2" },
        // { inifrm: "bdtdcr", ininam: "信用证不符点/拒付", pntmiu: "2" },
61 62
        // { inifrm: "ditdck", ininam: "信用证到单", pntmiu: "2" },
        // { inifrm: "bdtset", ininam: "信用证付款", pntmiu: "2" },
liushikai committed
63
        { inifrm: "3", ininam: "出口信用证", pntmiu: "" },
64
        { inifrm: "infled", ininam: "出口信用证交易查询", pntmiu: "3" },
cyy committed
65
        { inifrm: "infbed", ininam: "出口信用证单据查询", pntmiu: "3" },
66 67 68 69 70 71 72 73 74 75 76 77
        // { 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" },
liushikai committed
78
        { inifrm: "4", ininam: "进口信用证", pntmiu: "" },
79
        { inifrm: "inflid", ininam: "进口信用证交易查询", pntmiu: "4" },
80
        { inifrm: "infbrd", ininam: "进口信用证单据查询", pntmiu: "4" },
81 82 83 84 85 86 87 88
        // { inifrm: "litopn", ininam: "进口信用证开立", pntmiu: "4" },
        // { inifrm: "litdav", ininam: "进口信用证通知到单", pntmiu: "4" },
        // { inifrm: "litdck", ininam: "进口信用证到单", pntmiu: "4" },
        // { inifrm: "brtlat", ininam: "进口信用证单据偿还垫款", pntmiu: "4" },
        // { inifrm: "litcan", ininam: "进口信用证注销", pntmiu: "4" },
        // { inifrm: "inftrd", ininam: "进口押汇查询", pntmiu: "4" },
        // { inifrm: "trtame", ininam: "进口融资修改", pntmiu: "4" },
        // { inifrm: "inftxm", ininam: "条式语句查询", pntmiu: "4" },
89

liushikai committed
90
        { inifrm: "5", ininam: "进口代收", pntmiu: "" },
91 92 93 94 95 96 97
        // { 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
98
        { inifrm: "infbcd", ininam: "进口代收查询", pntmiu: "5" },
99
        { inifrm: "6", ininam: "出口托收", pntmiu: "" },
nanrui committed
100 101
        
        { inifrm: "infbod", ininam: "出口托收入口交易", pntmiu: "6" },
jxl committed
102 103 104 105
        { inifrm: "botdav", ininam: "出口托收寄单", pntmiu: "6" },
        { inifrm: "botame", ininam: "出口托收修改", pntmiu: "6" },
        { inifrm: "botdcr", ininam: "出口托收拒付/不符点", pntmiu: "6" },
        { inifrm: "botset", ininam: "出口托收收汇", pntmiu: "6" },
xsh committed
106
        { inifrm: "botcan", ininam: "出口托收闭卷", pntmiu: "6" },
liushikai committed
107
        { inifrm: "7", ininam: "转让信用证", pntmiu: "" },
wjj committed
108 109
        { inifrm: "lttopn", ininam: "转让证开立", pntmiu: "7" },
        { inifrm: "lttame", ininam: "转让证修改", pntmiu: "7" },
110
        { inifrm: "lttcan", ininam: "转让证注销", pntmiu: "7" },
111 112 113 114 115 116 117 118
        { inifrm: "bttsnd", ininam: "转让证单据寄单", pntmiu: "7" },
        { inifrm: "bttdrv", ininam: "转让证修改单据金额", pntmiu: "7" },
        { inifrm: "bttdcr", ininam: "转让证单据拒单", pntmiu: "7" },
        {
          inifrm: "lttdav",
          ininam: "转让信用证单据第一受益人换单",
          pntmiu: "7",
        },
liushikai committed
119
        { inifrm: "bttdck", ininam: "转让信用证通知到单", pntmiu: "7" },
liushikai committed
120
        { inifrm: "8", ininam: "打包托收", pntmiu: "" },
wjj committed
121 122 123
        { inifrm: "cltdav", ininam: "打包托收开立", pntmiu: "8" },
        { inifrm: "clttra", ininam: "打包托收催收", pntmiu: "8" },
        { inifrm: "cltset", ininam: "打包托收解包", pntmiu: "8" },
124
        { inifrm: "9", ininam: "光票托收", pntmiu: "" },
125 126
        { inifrm: "ccttra", ininam: "光票托收催收", pntmiu: "9" },
        { inifrm: "cctdcr", ininam: "光票托收退票", pntmiu: "9" },
liushikai committed
127
        { inifrm: "cctset", ininam: "光票托收收汇", pntmiu: "9" },
wangbinfei committed
128 129
        //{ inifrm: "cltdav", ininam: "光票托收开立", pntmiu: "10" },
        //{ inifrm: "clttra", ininam: "光票托收", pntmiu: "10" },
liushikai committed
130 131
        { inifrm: "10", ininam: "参数管理", pntmiu: "" },
        { inifrm: "infusr", ininam: "用户信息", pntmiu: "10" },
132 133 134 135 136 137
        { inifrm: "11", ininam: "卖方信用证", pntmiu: "" },
        { inifrm: "detopn", ininam: "卖方信用证开立", pntmiu: "11" },
        { inifrm: "detame", ininam: "卖方信用证修改", pntmiu: "11" },
        { inifrm: "detsel", ininam: "卖方信用证查询", pntmiu: "11" },

        { inifrm: "12", ininam: "智能审单", pntmiu: "" },
138
        { inifrm: "examRule", ininam: "智能审单规则配置", pntmiu: "12" },
139
        //进口保函
140
        { inifrm: "13", ininam: "进口保函", pntmiu: "" },
wangna committed
141 142 143 144
        { inifrm: "infgid", ininam: "进口保函入口交易", pntmiu: "13" },
        // { inifrm: "gitsel", ininam: "进口保函查询", pntmiu: "13" },
        // { inifrm: "gitset", ininam: "进口保函赔付", pntmiu: "13" },
        // { inifrm: "gitcrq", ininam: "进口保函索赔登记", pntmiu: "13" },
145
        { inifrm: "14", ininam: "服务管理", pntmiu: "" },
吴佳 committed
146
        { inifrm: "switsk", ininam: "Switsk", pntmiu: "14" },
liuxin committed
147
        { inifrm: "mgrtsk", ininam: "Mgrtsk", pntmiu: "14" },
吴佳 committed
148
        { inifrm: "sptrel", ininam: "sptrel", pntmiu: "14" },
149 150 151 152 153

        { inifrm: "15",ininam: "福费廷管理", pntmiu: "" },
        { inifrm: "assetInfo", ininam: "资产信息管理", pntmiu: "15" },
        { inifrm: "assetPub", ininam: "资产发布信息管理", pntmiu: "15" },
        { inifrm: "fund", ininam: "资金信息管理", pntmiu: "15" },
154 155 156 157 158

        
        { inifrm: "16",ininam: "出口融资", pntmiu: "" },
        { inifrm: "infbpd", ininam: "出口融资查询", pntmiu: "16" },
        
zhengxiaokui committed
159 160
      ],
      menus: [],
161
      menusHeight: 0,
zhengxiaokui committed
162 163 164 165 166
    };
  },
  computed: {
    activeMenu() {
      return this.$route.path;
167
    },
zhengxiaokui committed
168
  },
潘际乾 committed
169 170 171
  watch: {
    $route: function () {
      this.$nextTick(() => {
172 173 174 175 176
        const arr = [];
        this.getOpenMenusIndex(this.menus, arr);
        this.openFlgArr = [...new Set([...this.openFlgArr, ...arr])];
      });
    },
潘际乾 committed
177
  },
潘际乾 committed
178 179 180
  created() {
    this.menusHeight = 60 + 46 + 8;
  },
zhengxiaokui committed
181 182 183
  mounted() {
    const arr = [];
    this.generateMenuTree(arr);
184
    this.menus = arr;
185
    this.$store.commit("UserContext/setMenu", arr);
186
    this.initOpenFlgIndex();
zhengxiaokui committed
187 188 189
  },
  methods: {
    generateMenuTree(list, item) {
190 191 192
      const cc = [],
        c = [];
      let n = 0;
zhengxiaokui committed
193 194 195 196 197 198 199
      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);
200
            const child = {
zhengxiaokui committed
201 202 203
              name: menuItem.ininam,
              path: menuItem.path,
              children,
204 205 206 207 208 209 210
            };
            if (children.length > 0) {
              child["index"] = child.path + "_" + n++;
              cc.push(child);
            } else {
              c.push(child);
            }
211
          }
zhengxiaokui committed
212 213 214 215 216
        } else {
          if (menuItem.pntmiu === item.inifrm) {
            const children = [];
            menuItem.path = item.path + "/" + menuItem.inifrm;
            this.generateMenuTree(children, menuItem);
217
            const child = {
zhengxiaokui committed
218 219 220 221
              name: menuItem.ininam,
              path: menuItem.path,
              icon: "el-icon-document",
              children,
222 223 224 225 226 227 228
            };
            if (children.length > 0) {
              child["index"] = child.path + "_" + n++;
              cc.push(child);
            } else {
              c.push(child);
            }
229 230
          }
        }
zhengxiaokui committed
231
      }
232
      list.push(...cc, ...c);
zhengxiaokui committed
233
    },
liushikai committed
234 235
    handleOpen(index, indexPath) {
      // console.log(index, indexPath);
236 237 238
      const arr = Object.assign([], this.openFlgArr);
      arr.push(index);
      this.openFlgArr = arr;
zhengxiaokui committed
239
    },
liushikai committed
240 241
    handleClose(index, indexPath) {
      // console.log(index, indexPath);
242 243
      const arr = Object.assign([], this.openFlgArr);
      this.openFlgArr = arr.filter((idx) => idx !== index);
zhengxiaokui committed
244 245 246 247 248
    },
    openMenu() {
      this.menuOpen = true;
      const aside = document.querySelector("aside");
      aside.className = aside.className.split(" ")[0];
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
      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
270 271 272 273 274
    },
    closeMenu() {
      this.menuOpen = false;
      const aside = document.querySelector("aside");
      aside.className = aside.className + " fold";
275
      this.openFlgArr = [];
zhengxiaokui committed
276
    },
zhengxiaokui committed
277 278
  },
};
fukai committed
279
</script>
潘际乾 committed
280
<style scoped>
zhengxiaokui committed
281 282 283 284 285
.eContainer-menu-search .el-button {
  border: none;
  font-size: 20px;
  padding: 12px 20px;
}
286

zhengxiaokui committed
287 288 289 290 291 292 293
.eContainer-menu-search .el-input {
  width: auto;
  position: absolute;
  right: 20px;
  top: 10px;
  left: 60px;
}
294

zhengxiaokui committed
295 296 297 298
.eContainer-scroller .el-scrollbar__wrap {
  overflow: auto;
  margin-right: 0px !important;
}
299

zhengxiaokui committed
300 301 302 303
.eContainer-menu-search {
  width: 100%;
  position: relative;
}
304

zhengxiaokui committed
305 306 307 308 309 310 311 312
.eContainer-menu-search .el-input,
.eContainer-menu-search .search-wrapper {
  width: auto;
  position: absolute;
  right: 20px;
  top: 10px;
  left: 60px;
}
313

zhengxiaokui committed
314 315 316
.eContainer-menu-search .el-input .el-input__inner {
  height: 30px;
}
317

zhengxiaokui committed
318 319 320
.eContainer-menu-search .el-icon-search {
  line-height: 30px;
}
321

zhengxiaokui committed
322 323 324
.eContainer-scroller {
  height: calc(100% - 44px);
}
325

zhengxiaokui committed
326 327 328
.eContainer-scroller .el-scrollbar__bar {
  display: none;
}
329

zhengxiaokui committed
330 331 332 333
.el-icon-s-fold {
  float: left;
  font-size: 20px;
}
334

zhengxiaokui committed
335 336 337 338
.el-icon-s-unfold {
  float: left;
  font-size: 20px;
}
339

zhengxiaokui committed
340 341 342
.el-menu {
  border-right: none;
}
343

zhengxiaokui committed
344 345 346 347 348
.eContainer-refresh {
  width: auto;
  overflow: auto;
  height: calc(100% - 44px);
}
349

zhengxiaokui committed
350 351 352 353
.el-button-refresh {
  width: 100%;
  height: 40px;
}
354 355 356
</style>

<style>
zhengxiaokui committed
357 358 359
.el-menu-vertical-demo.el-menu--collapse {
  width: 60px;
}
360

zhengxiaokui committed
361 362 363 364 365 366 367
.el-submenu__title,
.el-menu-item,
.el-submenu .el-menu-item {
  font-size: 12px;
  height: 35px;
  line-height: 35px;
}
368
.el-menu-vertical-demo [class^="el-icon-caret-"] {
369 370
  color: #606266;
}
371
</style>