import Api from '~/service/Api';
import CommonEvent from "../../common/event/CommonEvent"
export default {
	mixins:[CommonEvent],
	methods: {
		async getBranchList() {
			const loading = this.loading();
			let body = { ownExtKey: "" };
			let res = await Api.post('/report/cfa/public/getBranchListByownExtKey',body);
			if (res.respCode == SUCCESS) {
				this.model.bchtypList = res.data;
			}
			loading.close();
		},
		async query() {

			this.root.$refs['modelForm'].clearValidate();
            this.root.$refs['modelForm'].validate(async(validStatic)=>{
                if(!validStatic){
                    this.$notify({ title: '失败', type: 'error', message: '查询栏位校验失败,请重新录入' })
                }else{
					if(!this.selbop()){
						return;
					}
					const loading = this.loading();
					let params = {
						...this.model.argmod,
						pageNum: this.pagination.pageNum,
						pageSize: this.pagination.pageSize
					}
					let bchcod=this.model.argmod.bchcod.substring(0,this.model.argmod.bchcod.indexOf("-"));
                    params.bchcod=bchcod;
					delete params.markSet;
					delete params.modifySet;
					const rtnmsg = await Api.post(`/${this.moduleRouter()}/${this.root.trnName}/query`, params);
					if (rtnmsg.respCode === SUCCESS) {
						this.model.reclst = rtnmsg.data.list;
						this.pagination.total = rtnmsg.data.total;
					}
					loading.close();
				}
			})

			
		},
		formSubmit() {
            this.query();
        },
        async currentChange(num) {
            this.pagination.pageNum = num;
            this.formSubmit();
        },
		reset() {

		},
		go(trnName, params) {
			this.routerPush({ path: `/business/${trnName}`, query: params });
		},
		check() {

		},
		upload() {

		},
		download() {

		},
		delall() {

		}

	}
}