index.js 2.16 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
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
export default {
	mixins: [commonFunctions],
	methods: {
		initTrndia (requestParams) {
			this.model.trndia.buildParams = requestParams
			this.processTrndia()
		},
		buildTrndia () {
			let params = {
        ...this.model.trndia.buildParams,
        dias: this.model.trndia.dias||[],
        liaallg: this.model.liaall === undefined ? null : this.model.liaall.liaallg,
        oldredflg: this.model.trndia.oldredflg,
        setamt: this.model.setmod === undefined ? 0 : this.model.setmod.docamt,
        setcur: this.model.setmod === undefined ? "" : this.model.setmod.doccur,
        setfeg: this.model.setmod === undefined ? null : this.model.setmod.setfeg,
        doceot: this.model.docpan ? this.model.docpan.doceot : []
			};
			return params
		},
		async processTrndia() {
			const loading = this.loading('正在请求备忘录数据');
			let trndiaRequest = this.buildTrndia()
			let objtyp = trndiaRequest.rec.objtyp;
			//trndiaRequest.sptinr = this.$route.query.businessInr || ''
			let rtnmsg = await Api.post(`/${this.moduleRouter()}/${ objtyp.toLowerCase() }/trndia/calcDiaries`, trndiaRequest);
			if (rtnmsg.respCode == SUCCESS) {
         this.model.trndia.oldredflg = rtnmsg.data.oldredflg,
         this.model.trndia.dias = rtnmsg.data.dias||[]
			}
			loading.close();
    },
    async delete(diary){
      this.customAddModify(diary, 'donflg');
      diary.donflg = 'X';
      let objtyp = this.model.trndia.buildParams.rec.objtyp;
      let rtnmsg = await Api.post(`/${this.moduleRouter()}/${ objtyp.toLowerCase() }/trndia/calculateDiamodflg`, diary);
			if (rtnmsg.respCode == SUCCESS) {
        diary.diamodflg = rtnmsg.data;
			}
    },
    async update(diary) {
      diary.objinr = this.model.trndia.buildParams.rec.objinr;
      diary.objtyp = this.model.trndia.buildParams.rec.objtyp;
      diary.ownusr = window.sessionStorage ? window.sessionStorage.userName : "";
      let rtnmsg = await Api.post(`/${this.moduleRouter()}/${ (diary.objtyp).toLowerCase() }/trndia/calculateDiamodflg`, diary);
			if (rtnmsg.respCode == SUCCESS) {
        diary.diamodflg = rtnmsg.data;
			}
    }
	}
};