BusNavbar.vue 5.91 KB
Newer Older
1 2 3
<template>
  <div class="busnavbar">
     <div class="busnavbar-items">
liuxin committed
4
          <c-button style="margin-left:7px;" size="medium" type="primary" class="medium_bcs" v-for="(item,index)  in codeList" v-bind:key="index" @click.native="onNarBtnClick(item.code,item.index)"   :title="item.title" :disabled="item.isDis==='N'">{{item.label}}</c-button>
5 6 7 8 9 10 11
     </div>
  </div>
</template>
<script>
import Api from "~/service/Api"
import CodeTable from "~/config/CodeTable"
import Litsel from "~/model/Ditsel"
wangren committed
12
import commonProcess from "~/mixin/commonProcess"
13 14 15 16 17 18 19


export default { 
    props:["ownref"],
    components:{
        
    },
wangren committed
20
    mixins: [commonProcess],    // 里面包含了Default、Check等的公共处理
21 22 23 24 25
    data(){
        return {
            trnName:'ditsel',
            model:new Litsel().data,
            navcode:[
26
               // {code:"",label:"",isDis:"",title:""},            
27 28 29 30 31 32 33
            ],
        }
    },
    methods:{
         //各入口按钮请求
     async  onNarBtnClick(code,i){
            this.model.cfgfil.subtrn1= code  
liuxin committed
34 35
            let rtnmsg = await this.executeRule(`cfgfil.hotsub${i}`)
            // console.log("cfgfil.code:" +  this.model.cfgfil.subtrn1);
吴佳 committed
36
            if(rtnmsg.respCode == SUCCESS){
37 38
               this.navcode = []
               this.$emit("onChoose",code.toLowerCase());
39
            }else{
40
               this.$notify.error({ title: "错误", message: "服务请求失败!" });
41 42 43
            }
            
        },
liuxin committed
44 45 46 47 48 49 50 51 52
        getIndex(module){
            for(let i = 1; i <= 12; i++){
                var temp = this.model.cfgfil[`subtxt${i}`];
                if(module == temp){
                    return i;
                }
            }
            return 0;
        }
53 54 55 56 57 58 59
    
     },
    computed:{
         codeList(){
              //将model中的数据映射成数组
              return this.navcode.map(item=>{
                  let entireItem = {...item}
liuxin committed
60
                //   this.navcode = [];
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
                  //TODO 根据数据判断当前的code,是否可以继续
               //    entireItem.enable = item.isDis
                  return entireItem
              })
         }
     },
     watch:{
        "ownref":async function(n, o){
            if(!this.ownref){
                 console.log("11111")
               //   onTigger()
                 return;
            }
        }
    },
    
    mounted(){
         this.$nextTick(function(){
              this.$on('childmethods',async function(){
80
                   this.navcode = []
81 82 83
                  //请求按钮数据
                  this.model.didgrp.rec.ownref = this.ownref  
                  console.log("ownref:" + this.ownref  );
84
                  
85
                    let rtnmsg = await this.executeRule("didgrp.rec.ownref");//didgrp_rec_ownref
86
                    if(rtnmsg.respCode == SUCCESS){
87 88 89 90 91 92 93 94
                              //重置数组
                              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
liuxin committed
95 96
                            //   let j = 0;
                            //   let m = 0;
liuxin committed
97
                            //   const buttonIndex = ['保证金收取','保证金注销','保证金调整','开立信用证','信用证修改','减额修改接受','修改通知行','到单']
liuxin committed
98 99
                            //   const buttonIndex = ['信用证修改','减额修改接受','到单','修改通知行']
                            //   for(let i=0;  i < length; i++){
100
                              //获取数组中每行的数据
liuxin committed
101 102 103 104 105 106 107 108 109 110 111 112 113
                                //    if(!( btnStr[i].indexOf("保证金") >= 0) && !(btnStr[i].indexOf("开立信用证") >= 0)){
                                //         let arr = btnStr[i].split("\t");
                                //         let newList = {
                                //         code:arr[0],
                                //         label:arr[1],
                                //         isDis:arr[2],
                                //         title:arr[3]                       
                                //       }
                                    //   m++;
                                    //   j = buttonIndex.indexOf(arr[1].replace(/(^\s*)|(\s*$)/g, ""));
                                    //   if(j<0){
                                    //        j = m;
                                    //   }
114
                                      //添加到navcode数组中
liuxin committed
115 116
                            //           this.navcode.splice(j,0,newList)
                            //        }
117
                                   
liuxin committed
118 119 120 121 122 123 124 125 126 127 128 129 130
                            //    }
                             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],
                                    isDis:arr[2],
                                    title:arr[3],
                                    index:index                       
                                }
                                this.navcode.push(newList)
                             }
131

132
                        
133 134 135
                         }else{
                              this.navcode = [] 
                              this.$notify.error({ title: "错误", message: "服务请求失败!" });
136 137 138 139 140 141 142 143 144 145
                         }
                        
                    })
              })
         }
    

}
</script>
<style>
146 147


148
</style>