import Api from '~/service/Api'; 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'; import Utils from "~/utils" export default { mixins: [commonFunctions], methods: { ...setmod, ...glentry, ...engp, ...docpan, ...ccvpan, async init () { const res = await Api.post('/service/gitatt/init', { transName: this.trnName, userId: window.sessionStorage.userId || 'ZL', gidInr: this.$route.query.inr }); if (!res.data) { return } this.copyValueFromVoData(this.model, res.data) this.copyValueFromVoData(this.model.setmod.setfeg, res.data.setfeg) this.copyValueFromVoData(this.model.setmod.setfog, res.data.setfog) this.copyValueFromVoData(this.model.setmod.setglg, res.data.setglg) }, // 兼容处理在前端model中定义了字段,后端返回的数据中不存在字段的问题 copyValueFromVoData (model, data) { let keysList = Object.keys(model) keysList.map((key) => { if (data[key]) { if (Utils.typeOf(model[key]) === 'Object') { this.copyValueFromVoData(model[key], data[key]) } else { this.$set(model, key, data[key]) } } }) }, buildLiaccv () { let params = { ...buildFn.buildCommonData(this.model, this.trnName), liaccvg: this.model.liaccv.liaccvg, oldamt: this.model.liaccv.oldamt, chgamt: this.model.liaccv.chgamt, concur: this.model.liaccv.concur, }; return params }, } }