import Api from '~/service/Api';
import CommonEvent from "../../common/event/CommonEvent"
export default {
    mixins: [CommonEvent],
	methods: {
		async query(){
            if (this.model.recp.rptno == null) {
				this.$notify.error({ title: '错误', message: '请输入申报号码!' });
				          return;
				 		}
			const loading = this.loading();
            const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/query`,
            {
                ...this.model.recp,
                pageNum: this.pagination.pageNum,
                pageSize: this.pagination.pageSize
            });
			if (rtnmsg.respCode === SUCCESS) {
			  this.model.dbllst = rtnmsg.data.list;
			  console.log( this.boperrlst);
			  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()
        },
		  toDetail(row) {
			let objtype = row.objtyp
            switch (objtype) {
                case 'DBA':
                    this.routerPush({
                        path: "/business/dbainf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBB':
                    this.routerPush({
                        path: "/business/dbbinf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBC':
                    this.routerPush({
                        path: "/business/dbcinf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBD':
                    this.routerPush({
                        path: "/business/dbdinf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBE':
                    this.routerPush({
                        path: "/business/dbeinf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBF':
                    this.routerPush({
                        path: "/business/dbfinf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBJ':
                    this.routerPush({
                        path: "/business/dbjinf",
                        query: {inr: row.objinr}
                    })
                    break
                case 'DBW':
                    this.routerPush({
                        path: "/business/dbwinf",
                        query: {inr: row.objinr}
                    })
                    break
              
            }
        },
		reset(){
			this.model.recp.rptno = "";
		}

	}
}