import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';

export default {
	mixins: [commonFunctions],
	methods: {
		sfzsqywChange() {
			if (this.model.limchg.lim.sfzsqyw != '1') {
				this.model.limchg.lim.mgskhbh = "";
			}
		},
		sffgsywChange() {
			if (this.model.limchg.lim.sffgsyw != '1') {
				this.model.limchg.lim.zgskhbh = "";
			}
		},
		othmflgChange() {
			if (this.model.limchg.lim.othmflg != '1') {
				this.model.limchg.lim.othmgs = "";
			}
		},
		othextkeyChange() {
			if (this.model.limchg.othextkey == "" || this.model.limchg.othextkey == null) {
				this.model.limchg.lim.othmflg = "0";
				this.model.limchg.lim.othmgs = "";
			}
		},
		othfflgChange() {
			if (this.model.limchg.lim.othfflg != '1') {
				this.model.limchg.lim.othzgs = "";
			}
		},
		async othSearch() {
			let data = {
				extkey: this.model.limchg.othextkey,
			}
			const loading = this.loading();
			let res = await Api.post('/Domlc/ditzsqSearch/othsearch', data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.model.limchg.lim.othmgs = res.data;
			}
		},
		async wrkSearch() {
			let data = {
				extkey: this.model.limchg.ptyextkey,
			}
			const loading = this.loading();
			let res = await Api.post('/Domlc/ditzsqSearch/othsearch', data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.model.limchg.lim.mgskhbh = res.data;
			}

		},
		async zgskhbhSearch(){
			let data = {
				extkey: this.model.limchg.ptyextkey,
			}
			const loading = this.loading();
			let res = await Api.post('/Domlc/ditzsqSearch/othsearch', data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.model.limchg.lim.zgskhbh = res.data;
			}
		},
		async othzgsSearch(){
			let data = {
				extkey: this.model.limchg.othextkey,
			}
			const loading = this.loading();
			let res = await Api.post('/Domlc/ditzsqSearch/othsearch', data);
			loading.close();
			if (res.respCode === SUCCESS) {
				this.model.limchg.lim.othzgs = res.data;
			}
		}
	}
}