index.js 6.77 KB
Newer Older
李少勇 committed
1
import Api from '~/service/Api';
李少勇 committed
2 3 4 5 6 7 8
import commonFunctions from '~/mixin/commonFunctions.js';
import buildFn from './buildCommons.js';
import setmod from '~/components/business/setmod/event';
import glentry from '~/components/business/glentry/event';
import engp from '~/components/business/engp/event';
import docpan from '~/components/business/docpan/event';
import ccvpan from '~/components/business/ccvpan/event';
郭旭 committed
9

李少勇 committed
10
export default {
11
  mixins: [commonFunctions],
李少勇 committed
12
  methods: {
13 14 15 16 17
    ...setmod,
    ...glentry,
    ...engp,
    ...docpan,
    ...ccvpan,
李少勇 committed
18 19 20 21 22 23 24
    // 提交
    handleSubmit() {
      console.log('提交', this.model);
    },
    // 检核
    async handleCheck() {
      const loading = this.loading('正在校验数据');
25
      const rtnmsg = await Api.post('/service/gitopn/checkAll', {
李少勇 committed
26 27 28 29 30
        ...this.model,
        transName: this.trnName,
        userId: window.sessionStorage.userId || 'ZL',
      });
      if (rtnmsg.respCode === SUCCESS) {
李少勇 committed
31
        let errorRules = rtnmsg.data;
李少勇 committed
32 33 34 35 36 37
        Object.keys(errorRules).map((ruleKey) => {
          // 此处判断是为了区分,如果在前端做了校验后端也校验了就不采用自定义校验规则
          if (!this.rules[ruleKey]) {
            this.rules[ruleKey] = [
              {
                validator: (rule, value, callback) => {
李少勇 committed
38
                  callback(new Error(errorRules[ruleKey]));
39
                },
李少勇 committed
40 41 42
                trigger: ['change', 'blur'],
              },
            ];
李少勇 committed
43
          }
李少勇 committed
44 45
        });
        console.log('rules', this.rules);
李少勇 committed
46
        this.$refs['modelForm'].validate((valid) => {
李少勇 committed
47 48
          console.log('valid', valid);
        });
李少勇 committed
49
      }
李少勇 committed
50 51 52 53 54
      // this.$notify({
      //   title: '成功',
      //   message: '校验成功',
      //   type: 'success',
      // });
李少勇 committed
55 56 57
      loading.close();
    },
    // 暂存
58
    async handleStash() {
李少勇 committed
59 60 61
      const loading = this.loading('正在暂存数据');
      let params = {
        transName: this.trnName.toUpperCase(),
62
        userId: window.sessionStorage.userId || 'ZL',
李少勇 committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
        liaccvg: this.model.liaccv.liaccvg,
        liaallg: this.model.liaall.liaallg,
        setfog: this.model.setmod.setfog,
        setfeg: this.model.setmod.setfeg,
        setglg: this.model.setmod.setglg,
        doceot: this.model.docpan.doceot,
        gidgrp: this.model.gidgrp,
        gitp: this.model.gitp,
      }
      const res = await Api.post('/service/gitopn/txnHold', params);
      if (res.respCode === SUCCESS) {
        this.$notify({
          title: '成功',
          message: '暂存成功',
          type: 'success',
        });
        loading.close();
        this.$router.push('/taskList')
      }
李少勇 committed
82
    },
83 84
    async tabClick(tab) {
      if (this.isInDisplay) {
李少勇 committed
85
        return;
86 87 88 89 90 91 92 93 94 95 96 97 98
      }
      let name = tab.name;
      switch (name) {
        case 'ccvpan':
          let ccvpanRequest = buildFn.builCcvpan(this.model, this.trnName);
          this.processLiaccv(ccvpanRequest);
          break;
        case 'engp':
          let engpRequest = buildFn.builDengp(this.model, this.trnName);
          this.processLiaall(engpRequest);
          break;
        case 'setpan':
          let setfegRequest = buildFn.buildSetfeg(this.model, this.trnName);
99 100
          // 此处利用回调是为了等setfeg的接口调用完成后才去获取setglg参数,由于setglg参数依赖于setfeg函数的返回值
          this.processSetpan(setfegRequest, () => {
李少勇 committed
101
            return buildFn.buildSetglg(this.model, this.trnName);
102
          });
103 104 105 106 107 108 109 110 111 112 113 114 115
          break;
        case 'docpan':
          let docpanRequest = buildFn.builDocpan(this.model, this.trnName);
          this.processTrndoc(docpanRequest);
          break;
        case 'glepan':
          let glentryRequest = buildFn.buildGlentry(this.model, this.trnName);
          this.processGlentry(glentryRequest);
          break;
        default:
          return;
      }
    },
李少勇 committed
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
    // 点击获取按钮拉取当前key字段下的表单数据
    queryFormData(key) {
      console.log(key);
    },
    // 业务信息=》基本信息=》保函编号-----获取保函编号
    async queryOwnref() {
      let params = {
        ptainr: this.model.gidgrp.apl.pts.ptainr,
        businessType: 'LG',
        tbl: 'LG',
      };
      const loading = this.loading();
      let res = await Api.post('/service/gitopn/getOwnRef', params);
      if (res.respCode == SUCCESS) {
        loading.close();
        this.model.gidgrp.rec.ownref = res.data;
      }
    },
    // 获取gitopn弹框表格数据
    async queryGridEtyPromptDialogData(type, ptytyp) {
      let params = {
        userId: window.sessionStorage.userId || 'ZL',
        ptytyp: ptytyp,
        extkey: this.model.gidgrp[type.toLowerCase()].pts.extkey,
      };
      let res = await Api.post('/service/ptspta/list', params);
      if (res.respCode == SUCCESS) {
        this.root.$refs['etyDialog'].show = true;
        this.root.promptData.data = res.data.ptaInfos;
        this.root.promptData.type = type;
      }
    },
    // 选中gitopn弹框表格的行数据
    async selectGridEtyPromptData(row) {
      let params = {
        ...row,
      };
      let res = await Api.post('/service/ptspta/fetch', params);
      if (res.respCode == SUCCESS) {
        this.$set(this.model.gidgrp, row.role.toLowerCase(), res.data);
      }
    },
    // 业务信息=》基本信息=》支出目的
    purposChange(key, value) {
      this.handleChangeForm(key, value);
    },
    // 初始化保函开立类型码表下拉列表
    async queryHndtypCodeTableList(trnName) {
      let params = {
        gitp: {
          swiftflg: this.model.gitp.swiftflg,
李少勇 committed
167
        },
李少勇 committed
168 169 170 171
        gidgrp: {
          rec: {
            purpos: this.model.gidgrp.rec.purpos,
          },
李少勇 committed
172
        },
李少勇 committed
173 174 175 176 177 178 179 180 181 182 183 184 185 186
        transName: trnName.toUpperCase(),
      };
      let res = await Api.post('/service/gitopn/initHndtyp', params);
      if (res.respCode == SUCCESS) {
        this.$set(this.codes, 'voHndtyp', res.data);
      }
    },
    // 是否SWIFT格式修改--联动保函开立类型
    handleChangeSwiftflg() {
      this.queryHndtypCodeTableList(this.root.trnName);
    },
    // 支出目的修改--联动保函开立类型
    handleChangePurpos() {
      this.queryHndtypCodeTableList(this.root.trnName);
chengzhuoshen committed
187
    },
188 189 190 191 192 193 194 195 196
    // 公共组件setmod处理方式改变触发联动
    changeSetmodModel (emitParams) {
      let reqParams = {}
      switch (emitParams.code) {
        case 'processMethods':
          reqParams = buildFn.buildSetglg(this.model, this.trnName);
          this.calcPayDetail(reqParams)
          break
        case 'changeDsp':
197 198 199 200
          let setglgRequest = buildFn.buildSetglg(this.model, this.trnName);
          setglgRequest.setglg = {setgll:  emitParams.list};
          this.setgllAccts(setglgRequest, emitParams.index)
          emitParams.list = this.model.setmod.setglg.setgll;
201 202 203 204 205
          break
        default:
          return
      }
    }
李少勇 committed
206 207
  },
};