BusNavbar.vue 4.55 KB
Newer Older
1
<template>
潘际乾 committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
  <el-dialog
    :visible.sync="initdialog"
    :title="'交易列表'"
    append-to-body
    :before-close="beforeClose"
    @opened="opened"
  >
    <div class="m-list-btns">
      <div class="busnavbar">
        <div class="busnavbar-items">
          <c-button
            style="margin-left: 7px"
            size="medium"
            type="primary"
            class="medium_bcs"
            v-for="(item, index) in navcode"
            v-bind:key="index"
            @click.native="onNarBtnClick(item.code, item.index)"
            :title="item.title"
            :disabled="item.isDis === 'N'"
            >{{ item.label }}</c-button
          >
LiRui committed
24 25 26 27 28
          <div style="margin-top: 15px;margin-left: 10px;">
          <div v-for="(str,idx) in tState" :key="idx" style="margin-bottom: 5px;font-weight: bold;">
            {{str}}
          </div>
        </div>
潘际乾 committed
29 30
        </div>
      </div>
31
    </div>
潘际乾 committed
32
  </el-dialog>
33 34 35 36 37
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";

38 39
import _ from "~/utils/Lodash"

40
export default {
liuxin committed
41
  props: {
潘际乾 committed
42 43
    ownref: {
      required: true,
44
    },
潘际乾 committed
45 46 47 48 49 50 51 52 53 54 55 56 57
    trnCode: {
      required: true,
    },
    model: {
      required: true,
    },
    ownrefPath: {
      required: false,
      default: "didgrp",
    },
    tabIndex: {
      required: false,
      default: 1,
58
    },
liuxin committed
59
  },
60 61 62 63
  components: {},
  mixins: [commonProcess], // 里面包含了Default、Check等的公共处理
  data() {
    return {
潘际乾 committed
64
      initdialog: false,
65 66 67
      navcode: [
        // {code:"",label:"",isDis:"",title:""},
      ],
LiRui committed
68
      tState: []
69 70 71 72 73 74 75 76 77
    };
  },
  methods: {
    //各入口按钮请求
    async onNarBtnClick(code, i) {
      this.model.cfgfil[`subtrn${i}`] = code;
      let rtnmsg = await this.executeRule(`cfgfil.hotsub${i}`);
      if (rtnmsg.respCode == SUCCESS) {
        this.navcode = [];
78
        this.$emit("onChoose", code.toLowerCase(), this.model.pageId);
79 80 81 82 83 84 85 86 87 88 89
      } else {
        this.$notify.error({ title: "错误", message: "服务请求失败!" });
      }
    },
    getIndex(module) {
      for (let i = 1; i <= 12; i++) {
        var temp = this.model.cfgfil[`subtxt${i}`];
        if (module == temp) {
          return i;
        }
      }
90
      return 1;
91
    },
潘际乾 committed
92
    opened() {
wangna committed
93
      this.tState = []
潘际乾 committed
94 95 96 97 98 99
      this.$emit("childmethods");
    },
    beforeClose() {
      this.navcode = [];
      this.initdialog = false;
    },
100 101
  },
  mounted() {
潘际乾 committed
102
    this.trnName = this.trnCode;
103 104
    this.$nextTick(function () {
      this.$on("childmethods", async function () {
105 106
        let res = await this.executeRule(`cfgfil.hotreg${this.tabIndex}`);
        if (res.respCode == SUCCESS) {
潘际乾 committed
107
          this.updateModel(res.data);
108
        } else {
潘际乾 committed
109 110 111 112
          this.$notify.error({
            title: "错误",
            message: "服务请求失败!",
          });
113 114
        }

115 116
        this.navcode = [];
        //请求按钮数据
117 118 119 120 121 122 123 124 125
        let rulePath
        if (this.ownrefPath.endsWith(".ownref")) {
          _.set(this.model, this.ownrefPath, this.ownref);
          rulePath = this.ownrefPath
        } else {
          this.model[this.ownrefPath].rec.ownref = this.ownref;
          rulePath = this.ownrefPath + ".rec.ownref"
        }
        let rtnmsg = await this.executeRule(rulePath); //didgrp_rec_ownref
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
        if (rtnmsg.respCode == SUCCESS) {
          //重置数组
          this.navcode = [];
          this.updateModel(rtnmsg.data);
          //this.model.cfgfil.btnstm = rtnmsg.data.cfgfil_btnstm.rows
          //给inr赋值,后面弹窗里面的按钮请求会用到
          //this.model.didgrp.rec.inr = rtnmsg.data.didgrp_rec_inr
          const length = this.model.cfgfil.btnstm.rows.length;
          let btnStr = this.model.cfgfil.btnstm.rows;
          for (let i = 0; i < length; i++) {
            let arr = btnStr[i].split("\t");
            var index = this.getIndex(arr[1]);
            let newList = {
              code: arr[0],
              label: arr[1],
141
              isDis: arr[2],
142 143 144 145 146
              title: arr[3],
              index: index,
            };
            this.navcode.push(newList);
          }
LiRui committed
147
          // 交易状态信息
148 149 150 151 152 153
          const selbut = this.model.selbut ?? {}
          const arr = Object.keys(selbut)
                            .filter(key => key.startsWith("dsp"))
                            .map(key => selbut[key] || "")
                            .filter(s => s.trim()!== "")
          this.tState = arr
154 155 156 157 158 159 160 161 162 163 164
        } else {
          this.navcode = [];
          this.$notify.error({ title: "错误", message: "服务请求失败!" });
        }
      });
    });
  },
};
</script>
<style>
</style>