index.js 3.19 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
import commonFunctions from '~/mixin/commonFunctions.js';
import operationFunc from "~/mixin/commonDepend";
import Api from "~/service/Api"
export default {
	mixins: [commonFunctions, operationFunc],
	methods:{
		commitAdd() {
            this.$refs['modelForm'].validate(async (validStatic) => {
                if (validStatic) {
                    let rmb2180 = new Rmb2180();
                    rmb2180.recgrp = this.model.recgrp;
                    save('rmb2111', rmb2180).then(response => {
                        if (response.respCode === SUCCESS) {
                            this.$notify({
                                title: "成功",
                                message: "提交成功",
                                type: "success",
                            });
                            this.$store.commit('delTagsArry', this.$route.path);
                            this.$router.back()
                        } else {
                            this.$notify({
                                title: "失败",
                                message: "提交失败",
                                type: "error",
                            });
                        }
                    });
                } else {
                    // 前端校验失败
                    this.$notify({
                        title: '失败',
                        message: '校验失败',
                        type: 'error',
                    });
                }
            })
        },
		async checkTdb(){
			this.$refs['modelForm'].validate(async (validStatic) => {
				if (validStatic) {
					let data = {
						inr:"",
						ownextkey:this.model.rmbbut.ownextkey,
						reldat: this.model.pblmod.pbl.reldat,
						tfbgrp:this.model.recgrp
					}
					const loading = this.loading('正在校验数据');
					const rtnmsg = await Api.post('/report/rmbsel/validate2180', data);
					if (rtnmsg.respCode == SUCCESS) {
						const fieldErrors = rtnmsg.data;
						if (fieldErrors && Object.keys(fieldErrors).length == 0) {
							// 清除之前的校验状态
							this.$refs.modelForm.clearValidate();
							this.$notify({
								title: "成功",
								message: "校验成功",
								type: "success",
							});
							loading.close();
							return
						}
						const tab = this.showBackendErrors(fieldErrors);
						if (tab) {
							// 判断校验失败的表单不属于当前的tab,则切换tab到对应报错的tab页面
							if (tab.name !== this.tabVal) {
								this.tabClick(tab, '1');
							}
						}
						loading.close();
					}
				} else {
					// 前端校验失败
					this.$notify({
						title: '失败',
						message: '校验失败',
						type: 'error',
					});
				}
			})
		},
		async getInf(val) {
			let params = {
				banktrano: this.model.recgrp.ads.banktrano,
				rmbtyp: val
			}
			let rtnmsg = await Api.post("/report/rmbsel/getRef", params)
			if (rtnmsg.respCode == SUCCESS) {
				this.model.recgrp.ads.levyno = rtnmsg.data
				this.flg = true
				this.i = this.i + 1
			}
		},
		async ownextkeyChange(val) {
			let res = await Api.post('/report/rmbsel/getDecnum', val);
			if (res.respCode === SUCCESS) {
				this.model.recgrp.ads.bankorgcode = res.data;
			}
		},
  },
}