index.js 2.81 KB

import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import CommonEvent from "../../common/event/CommonEvent"
import { modifyAlpha } from 'zrender/lib/tool/color';
export default {
	mixins:[CommonEvent],
	methods: {
		async query(){
			if (this.model.bopp.rptno == null||this.model.bopp.rptno == "") {
							this.$notify.error({ title: '错误', message: '请输入完整的申报号码' });
				          return;
	         }
			const loading = this.loading();
            const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/query`,
            {
                ...this.model.bopp,
                pageNum: this.pagination.pageNum,
                pageSize: this.pagination.pageSize
            });
			if (rtnmsg.respCode === SUCCESS) {
			  this.model.dbllst = rtnmsg.data.list;
			
			  this.pagination.total =rtnmsg.data.total;
			}
			else{

                this.model.dbllst = rtnmsg.data.list;
                this.pagination.total =rtnmsg.data.total;
			}
			loading.close();
		  },
		  async currentChange(num){
			this.pagination.pageNum = num 
			this.query()
		},
		reset(){
			this.model.bopp.rptno='';
			this.pagination= {
				pageNum: 1,
				pageSize: 10,
				total: 0,
			};
			this.model.dbllst=[];
		},
		async init(inr){
			const rtnmsg = await Api.post(`/report/bopnew/public/getDblByInr`,{inr:inr})
			if(rtnmsg.respCode==SUCCESS){
				this.model.bopgrp.dbl=rtnmsg.data;
			}
		},
		async modify(){

			const rtnmsgchk = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/checkAll`,{...this.model})
			if(rtnmsgchk.respCode==SUCCESS){
				var haserr=rtnmsgchk.data.errorMap;
				if(haserr){
					 this.$confirm('存在非法状态,是否需要保存?', '提示', {
						confirmButtonText: "是",
						cancelButtonText: "否",
						type: "warning"
					  }).then(async() => {
						let rtnmsgame = await Api.post(`/report/bopnew/public/ameDblSta`,{...this.model.bopgrp.dbl})
						if(rtnmsgame.respCode==SUCCESS){
							this.$notify({ title: '成功', type: 'success', message: '修改成功' })
						}else{
							this.$notify({ title: '失败', type: 'error', message: '修改失败' })
						}
						this.closeDialogOpen();
						this.query();
					  }).catch((e)=>{
						  
							var errorstr="";
							for(var i in haserr){
								errorstr+=haserr[i];
							}
							this.$msgbox({ title: "错误", message: errorstr, type: "error" })
						  
					  });
				}else{
					let rtnmsgame = await Api.post(`/report/bopnew/public/ameDblSta`,{...this.model.bopgrp.dbl})
					if(rtnmsgame.respCode==SUCCESS){
						this.$notify({ title: '成功', type: 'success', message: '修改成功' })
					}else{
						this.$notify({ title: '失败', type: 'error', message: '修改失败' })
					}
					this.closeDialogOpen();
					this.query();
				}

				
			}
			
		}

		
	}
}