index.js 6.46 KB
Newer Older
fukai committed
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
import Api from '~/service/Api';
import Utils from '~/utils';
import commonFunctions from '~/mixin/commonFunctions.js';

export default {
    mixins: [commonFunctions],
    methods: {

        // 获取地区机构号列表
        async getOwnExtkeyCondition() {
            const loading = this.loading();
            let body = { ownExtKey: "" };
			let res = await Api.post('/business/bch/getBranchListByownExtKey',body);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.ownExtkeyList = res.data;
            }
		},

        //签约变动勾选控制 + 采集标志赋值
        onCfaflgeca(e) {
			if (e === undefined) {
				return
			}
			switch (this.model.cfaeca.cfaflg) {
				case "1":
					this.model.cfaeca.basflg = 'X';
                    this.model.cfaeca.dclflg = 'X';
                    this.model.cfaeca.cfatyp = 'A';
					break;
				case "2":
					this.model.cfaeca.basflg = 'X';
                    this.model.cfaeca.dclflg = '';
                    this.model.cfaeca.cfatyp = 'M';
					break;
				case "3":
					this.model.cfaeca.basflg = '';
                    this.model.cfaeca.dclflg = 'X';
                    this.model.cfaeca.cfatyp = 'S';
					break;
				case "4":
					this.model.cfaeca.basflg = '';
                    this.model.cfaeca.dclflg = '';
                    this.model.cfaeca.cfatyp = '';
					break;
				default:
					this.model.cfaeca.basflg = '';
                    this.model.cfaeca.dclflg = '';
                    this.model.cfaeca.cfatyp = '';
			}
			
			if (this.model.cfaeca.cfaflg === "4" || this.model.cfaeca.cfaflg === "") {
                this.model.cfaeca.ownextkey = "";
                this.model.cfaeca.cdaflg = '';
			}
        },
        
        onCfaflgead(e) {
			if (e === undefined) {
				return
			}
			switch (this.model.cfaead.cfaflg) {
				case "1":
					this.model.cfaead.basflg = 'X';
                    this.model.cfaead.dclflg = 'X';
                    this.model.cfaead.cfatyp = 'A';
				
					break;
				case "2":
					this.model.cfaead.basflg = 'X';
                    this.model.cfaead.dclflg = '';
                    this.model.cfaead.cfatyp = 'M';
					break;
				case "3":
					this.model.cfaead.basflg = '';
                    this.model.cfaead.dclflg = 'X';
                    this.model.cfaead.cfatyp = 'S';
					break;
				case "4":
					this.model.cfaead.basflg = '';
                    this.model.cfaead.dclflg = '';
                    this.model.cfaead.cfatyp = '';
					break;
				default:
					this.model.cfaead.basflg = '';
                    this.model.cfaead.dclflg = '';
                    this.model.cfaead.cfatyp = '';
			}
			
			if (this.model.cfaead.cfaflg === "4" || this.model.cfaead.cfaflg === "") {
				this.model.cfaead.ownextkey = "";
			}
        },
        
        onCfaflgeaf(e) {
			if (e === undefined) {
				return
			}
			switch (this.model.cfaeaf.cfaflg) {
				case "1":
					this.model.cfaeaf.basflg = 'X';
                    this.model.cfaeaf.dclflg = 'X';
                    this.model.cfaeaf.cfatyp = 'A';
                    this.model.cfaeaf.cfabrttxt = '';
					break;
				case "2":
					this.model.cfaeaf.basflg = 'X';
                    this.model.cfaeaf.dclflg = '';
                    this.model.cfaeaf.cfatyp = 'M';
                    this.model.cfaeaf.cfabrttxt = '';
					break;
				case "3":
					this.model.cfaeaf.basflg = '';
                    this.model.cfaeaf.dclflg = 'X';
                    this.model.cfaeaf.cfatyp = 'S';
                    this.model.cfaeaf.cfabrttxt = '';
					break;
				case "4":
					this.model.cfaeaf.basflg = '';
                    this.model.cfaeaf.dclflg = '';
                    this.model.cfaeaf.cfatyp = '';
					break;
				default:
					this.model.cfaeaf.basflg = '';
                    this.model.cfaeaf.dclflg = '';
                    this.model.cfaeaf.cfatyp = '';
                    this.model.cfaeaf.cfabrttxt = '';
                    
			}
			
			if (this.model.cfaeaf.cfaflg === "4" || this.model.cfaeaf.cfaflg === "") {
				this.model.cfaeaf.ownextkey = "";
			}
        },

        onCfaflgcda(e) {
			if (e === undefined) {
				return
			}
			if(this.model.cfaeca.cdaflg!=='X'){
                this.model.cfaeca.cda.inr = '';
                this.model.cfaeca.cda.trninr = '';
                this.model.cfaeca.cda.cfeogudamount = '';
                this.model.cfaeca.cda.cfeogudcurr = '';
                this.model.cfaeca.cda.useofunds = '';
                this.model.cfaeca.cda.cfeogudad = '';
            }
        },
        
        //试算数据 进页签会触发
        async initCfabop(requestParams) {
            let cfabop = this.model.cfabop;
            if(cfabop == null){
                cfabop = this.model;
            }
            cfabop.buildParams = requestParams
           
            return this.queryCfabop(cfabop.buildParams);


        },

        //资本项目试算方法
        async queryCfabop(requestParams) {
            let cfabop = this.model.cfabop;
            if(cfabop == null){
                cfabop = this.model;
            }
            if (requestParams) {
                cfabop.buildParams = requestParams
            }
            //设置试算参数
            let cfaboppar = this.buildCfabop();
            //设置业务类型
            let busTyp = requestParams.transName.substr(0, 2) + "d";

            //调用后端试算接口
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/${busTyp}/calcCfabop`, cfaboppar);
            if (rtnmsg.respCode == SUCCESS) {
                if(cfabop.cfaeca.basflg === 'X' || cfabop.cfaeca.dclflg === 'X'){
                    Utils.copyValueFromVoData(cfabop.cfaeca, rtnmsg.data.cfaeca);
                }
                if(cfabop.cfaead.basflg === 'X' || cfabop.cfaead.dclflg === 'X'){
                    Utils.copyValueFromVoData(cfabop.cfaead, rtnmsg.data.cfaead);
                }
                if(cfabop.cfaeaf.basflg === 'X' || cfabop.cfaeaf.dclflg === 'X'){
                    Utils.copyValueFromVoData(cfabop.cfaeaf, rtnmsg.data.cfaeaf);
                }
                
            }

            return rtnmsg;
        },

        //构建参数组
        buildCfabop() {
            let cfabop = this.model.cfabop;
            if(cfabop == null){
                cfabop = this.model;
            }

            let params = {
                ...cfabop.buildParams,
                cfaeca: cfabop.cfaeca,
                cfaead: cfabop.cfaead,
                cfaeaf: cfabop.cfaeaf,
            };
            return params;
        },

        
    }
}