index.vue 13.4 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 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
<template>
  <div class="eContainer">
    <c-page :title="title">
      <el-form
        ref="modelForm"
        label-width="160px"
        size="small"
        label-position="right"
        :model="model"
        :rules="Pattern"
        :validate-on-rule-change="false"
        
      >
        <c-tabs v-model="tabVal" ref="elment" type="card" @tab-click="handleClick">
          <el-tab-pane label="基本信息" name="pty">
            <c-content>
              <m-pty-info :model="model" :type="type" :branchlist="branchlist"/>
            </c-content>
          </el-tab-pane>
          <el-tab-pane label="地址信息" name="adr">
            <c-content>
              <m-adr-list :model="model" ref="adrChild" :type="type" />
            </c-content>
          </el-tab-pane>
          <el-tab-pane label="账号信息" name="act" v-if="model.ptytyp !=='H'">
            <c-content>
              <m-act-list :model="model" ref="actChild" :type="type"/>
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="汇率/费率信息" name="ptyrat"  v-if="model.ptytyp =='C' && model.idtype =='2' && model.akkcom =='10313'">
            <c-content>
              <m-rat-list :model="model" ref="ptyrat" :type="type" />
            </c-content>
          </el-tab-pane>
          <el-tab-pane label="ECIF客户信息" name="ecif"  v-if="model.ptytyp =='C' && model.idtype =='2' && model.akkcom =='10313'">
            <c-content>
              <m-ecif :model="model" ref="ecif" :type="type" />
            </c-content>
          </el-tab-pane>

          <el-tab-pane label="签约信息" name="signing" v-if="model.ptytyp =='C' && model.idtype =='2' && model.akkcom =='10313'">
            <c-content>
              <m-sign-list :model="model" ref="signChild" :type="type"/>
            </c-content>
          </el-tab-pane>
          <el-tab-pane label="银行密押查询" name="ptm" v-if="model.ptytyp ==='A'|| model.ptytyp ==='B'|| (model.ptytyp ==='C' &&  model.akkcom !='10313')">
            <c-content>
              <m-ptm-list :model="model" ref="ptmChild" :type="type"/>
            </c-content>
          </el-tab-pane>
          <el-tab-pane label="消息及停用信息" name="oit">
            <c-content>
              <m-oit-info :model="model" ref="oitChild" :type="type"></m-oit-info>
            </c-content>
          </el-tab-pane>
          <el-tab-pane v-if="type!=='add'" label="OCRM客户信息" name="ocrm">
            <c-content>
              <m-ocrm-info :model="model" :ptycrm="ptycrm" :type="type" ref="ocrmChild"></m-ocrm-info>
            </c-content>
          </el-tab-pane>
        </c-tabs>
      </el-form>
      <div style="text-align: center">
        <c-button
          type="primary"
          style="margin-right: 10px"
          @click="commitAdd"
          v-if="type === 'add' && tabVal==='pty'"
          >提 交</c-button
        >
        <c-button
          type="primary"
          style="margin-right: 10px"
          @click="commitEdit"
          v-if="type === 'edit' && tabVal==='pty'"
          :disabled="(isZhongHang && isChaiwu)||(!isZhongHang && !isChaiwu)||(!isZhongHang && isChaiwu && this.$route.query.zFlg != 'Y')"
          >提 交</c-button
        >
        <c-button
          type="primary"
          style="margin-right: 10px"
          @click="commitDelete"
          v-if="type === 'delete'"
          >提 交</c-button
        >
        <c-button type="primary" @click="goBack" v-if="type == 'info'">返 回</c-button>
        <c-button type="primary" @click="backTableHome" v-if="type != 'info'">返 回</c-button>
      </div>
    </c-page>
  </div>
</template>

<script>
import Utils from "~/utils";
import commonFunctions from '~/mixin/commonFunctions.js';
import Ptyn, { Pattern1, Pattern2 } from "./Ptyn.js";
import Ptycrm from  "./ocrm/PtycrmModel.js"

// 组件
import PtyInfo from "./PtyInfo";
import AdrList from "./AdrList";
import ActList from "./ActList";
import RatList from "./rat/RatList.vue";
import ECIF from "./ECIFInfo.vue";
import OcrmInfo from "./ocrm/OcrmInfo.vue"
import SignList from "./SignList";
import PtmList from "./PtmList";
import OitInfo from "./OitInfo";
import Api from "~/service/Api"

// 方法
import { add, edit, deleteById, queryDetailById, getBranchPn } from "~/service/manage/ptyn.js";
import {getBchcodlist } from "~/service/manage/pty.js";

export default {
  name: "StaticsDbiptyN",
  components: {
      "m-pty-info": PtyInfo,
      "m-adr-list": AdrList,
      "m-act-list": ActList,
      "m-rat-list": RatList,
      "m-ecif": ECIF,
      "m-sign-list": SignList,
      "m-ptm-list": PtmList,
      "m-oit-info": OitInfo,
      "m-ocrm-info": OcrmInfo
  },
  provide() {
    return {
      root: this,
      opertype: "",
    };
  },
  props: {
		type: {
			type: String,
			default: "info"
		},
		title: {
			type: String,
			default: "dbipty"
		}
	},
  data() {
    return {
      model: new Ptyn().data,
      ptycrm: new Ptycrm().data,
      tabVal: "pty",
      branchlist: [],
      // showInsertBtn:true,
      // showUpdateBtn:true,
      // showDeleteBtn:true,
      bchAuthMod:{
        cod_:"",
        msg_:"",

        zFlg:"N",
        zMsg:"",
        zBchList:[],
        zBchkeyList:[],
        zBranchList:[],

        xFlg:"N",
        xMsg:"",
        xBchList:[],
        xBchkeyList:[],
        xBranchList:[],

        isZhongHang:false,
        isChaiwu:false,
      },
    };
  },
  watch: {
    "model.ptytyp": {
      handler(newVal) {
        //this.model.ecifno = "";
      }
    }
  },
  computed: {
    isDisabled() {
      return this.type === "info" || this.type === "delete";
    },
    Pattern: function(){
      if (this.model.ptytyp == 'H') {
        return Pattern2
      } else {
        return Pattern1
      }
    },
    isChaiwu (){
      let flg=false
      console.log("~~~~~~~~~~~~~~~~~~dbipty---index",this.model)
      if (this.model.ptytyp=='C' && this.model.idtype=='2' && this.model.akkcom=='10313'  ){
        flg = true
      }
      return flg
    },
    isZhongHang(){
      let zhongFlg=false
      let currentOrg = this.$store.state.UserContext.currentOrg
      if (currentOrg) {
        if (currentOrg.level == '0' || currentOrg.level == 0) {
          zhongFlg=true
        }
      }
      return zhongFlg
    },
    
  },
  created() {
    if (this.type !== "add") {
      const inr = this.$route.query.inr;
      queryDetailById({"inr" : inr}).then((res)=> {
        if (res.respCode == "AAAAAA") {
          this.$set(this, "model", res.data)
          // this.getBranchlist()
          if (this.$route.query.zhFlg=="Y"){
            this.getZonghang()
          }else{
            getBchcodlist({}).then((res => {
            if (res.respCode == "AAAAAA") {
              //1--归属机构下的可经办机构
              this.$set(this, "branchlist", res.data)

              //2--0930主办机构
              let bchAuthMod={}
              let tmp=JSON.parse(localStorage.getItem("bchAuthMod"))
              if (tmp !==null && tmp !==undefined){bchAuthMod=tmp}

              //3--this.model.branch 原支行代码

              //处理-- 下拉值由两部分组成,1-原支行代码,2-从归属机构下的可经办机构中筛选出0930主办机构
              let bchListTmp =[]
              if (this.model.branchbch !=null){
                bchListTmp.push(this.model.branchbch)
              }

              if (bchAuthMod.zBranchList != null && bchAuthMod.zBranchList.length >0){
                for (let z of bchAuthMod.zBranchList){
                  for (let kjb of this.branchlist){
                    if (z.branch === kjb.branch && z.branch !=this.model.branchcode) {
                      bchListTmp.push(z)
                    }
                  }
                }
              }
              console.log("---------@@--"+this.model.branchbch)
              this.branchlist = bchListTmp
            
            }

            }))
          }
          
          
          console.log(" dbipty-n -res-----",res.data)
          console.log(" dbipty-n- model----",this.model)
        } else {
          this.$notify.error("客户不存在")
        }
      });

      let tmp=JSON.parse(localStorage.getItem("bchAuthMod"))
      if (tmp !==null && tmp !==undefined){this.bchAuthMod=tmp}
      this.bchAuthMod.isZhongHang=this.isZhongHang
      this.bchAuthMod.isChaiWu=this.isChaiwu

      
    }
  },
  mounted(){
    this.getHiddenButtonVue();
	},
  
  methods: {
    getZonghang() {
      getBranchPn().then((res) => {
        if(res.respCode == "AAAAAA") {
          this.$set(this, "branchlist", res.data)
        }
      })
    },
    handleClick(tab, event) {
      let name = tab.name
      switch(name) {
        case 'ptm':
          this.$refs.ptmChild.getAdrList();
          this.$refs.ptmChild.searchTable();
          break;
        case 'adr':
          this.$refs.adrChild.init();
          break;
        case 'act': 
          this.$refs.actChild.init();
          break;
        case 'ptyrat':
          this.$refs.ptyrat.init();
          break;
        case 'ecif': 
          this.$refs.ecif.init();
          break;
        case 'signing':
          this.$refs.signChild.init();
          break;
        case 'oit':
          this.$refs.oitChild.init();
          break;
        case 'ocrm':
          this.$refs.ocrmChild.init();
          break;
        default:
          return;
      }
    },
    getHiddenButtonVue(){
    this.$buttonControlService.hiddenBtnList()
    .then((res)=>{
      for(let i = 0;i<res.length;i++){
        if(res[i].ITEMID === 'adrUpdateBtn'){
          this.$refs.adrChild.showUpdateBtn = false;
        }
        if(res[i].ITEMID === 'adrDeleteBtn'){
          this.$refs.adrChild.showDeleteBtn = false;
        }  
        if(res[i].ITEMID === 'adrInsertBtn'){
          this.$refs.adrChild.showInsertBtn = false;
        }
        if(res[i].ITEMID === 'actUpdateBtn'){
          this.$refs.actChild.showUpdateBtn = false;
        }
        if(res[i].ITEMID === 'actDeleteBtn'){
          this.$refs.actChild.showDeleteBtn = false;
        }  
        if(res[i].ITEMID === 'actInsertBtn'){
          this.$refs.actChild.showInsertBtn = false;
        }
        if(res[i].ITEMID === 'signInsertBtn'){
          this.$refs.signChild.showInsertBtn = false;
        }
        if(res[i].ITEMID === 'signUpdateBtn'){
          this.$refs.signChild.showUpdateBtn = false;
        }
        // if(res[i].ITEMID === 'ptmNInsertBtn'){
        //   this.$refs.ptmChild.isShowAddBtn = false;
        // }
        // if(res[i].ITEMID === 'ptmNUpdateBtn'){
        //   this.$refs.ptmChild.isShowUpdBtn = false;
        // }
        // if(res[i].ITEMID === 'ptmNDeleteBtn'){
        //   this.$refs.ptmChild.isShowDelBtn = false;
        // }
      }
    })
  },
  getBranchlist() {
    getBranchPn().then((res) => {
      if(res.respCode == "AAAAAA") {
        this.$set(this, "branchlist", res.data)
      } else {
        this.$notify.error(res.respMsg)
      }
    })
  },
    commitAdd() {
      this.$refs.modelForm.validate((validated) => {
        if (validated) {
          add(this.model)
            .then((res) => {
              if (res.respCode == "AAAAAA") {
                this.$notify.success("保存成功!");
                this.goBack(true)
              } else {
                this.$notify.error(res.respMsg)
              }
            })
            .catch((err) => {
              this.$notify.error("保存失败!");
            });
        } else {
          this.$notify.error({
            title: '失败',
            message: '请检查必输项!'
          });
        }
      });
    },
    commitEdit() {
      this.$refs.modelForm.validate((validated) => {
        if (validated) {
          edit({...this.model, "ptycrm":this.ptycrm})
            .then((res) => {
              if(res.respCode == "AAAAAA") {
                this.$notify.success("保存成功!");
                this.goBack()
              } else {
                this.$message.info(res.respMsg);
              }
            })
            .catch((err) => {
              this.$notify.error(res.respMsg);
            });
        } else {
          this.$notify.error({
            title: '失败',
            message: '请检查必输项!'
          });
        }
      });
    },
    commitDelete() {
      this.$confirm("是否确认删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deleteById(this.model.inr)
            .then((res) => {
              this.$notify.success("删除成功!");
              this.goBack(true)
            })
            .catch((err) => {
              this.$notify.error("删除失败!");
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    /**
     * update 是否更新infpty的查询列表
     */
    goBack(update) {
      this.$store.commit('delTagsArry', this.$route.path);
      this.$router.go(-1);
    },

    backTableHome(){
      this.$confirm(cancelMsg, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
				})
				.then(()=>{
					this.$store.commit('delTagsArry', this.$route.path)
          this.$router.go(-1)
				})
				.catch(() => {
            this.$message({
                type: "info",
                message: "已取消",
            });
        });
    }

  },
};
</script>

<style>
</style>