diff --git a/src/components/XyDialog/index.vue b/src/components/XyDialog/index.vue index 8691ecd..d6b8c5b 100644 --- a/src/components/XyDialog/index.vue +++ b/src/components/XyDialog/index.vue @@ -33,10 +33,6 @@ export default { }, okText:{ type:String - }, - loading:{ - type:Boolean, - default:false } }, data() { @@ -49,16 +45,16 @@ export default { if(this.type === 'form'){ return (
- - + +
) } if(this.type === 'normal'){ return (
- - + +
) } @@ -88,13 +84,15 @@ export default { if(this.type === 'normal'){ return } - this.$refs['elForm'].resetFields() + if (this.$refs['elForm']) { + this.$refs['elForm'].resetFields() + } }, submit(){ if(this.type === 'normal'){ return } - if(this.loading){ + if (!this.$refs['elForm']) { return } this.$refs['elForm'].validate().then(res=>{ @@ -156,16 +154,6 @@ export default { } } return ( -
-
) }else{ return ( @@ -244,10 +231,6 @@ export default { overflow: scroll; } -.xy-dialog-form-loading { - position: relative; - min-height: 260px; -} .xy-table-item{ display: flex; align-items: center; diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue index 71eeed4..29dcc33 100644 --- a/src/views/contract/components/paymentRegistration.vue +++ b/src/views/contract/components/paymentRegistration.vue @@ -1,12 +1,11 @@ + @@ -319,6 +324,7 @@ export default { paymentType: ["首付款","进度款", "结算款", "质保金"], isShowPaymentRegistration: false, detailLoading: false, + detailLoadingInstance: null, paymentRegistrationForm: { applyMoney: "", //deductionMoney: "", @@ -450,9 +456,51 @@ export default { return Number(this.contract.money) ? ((total / Number(this.contract.money)) * 100).toFixed(2) : 0; }, + closeDetailLoading() { + if (this.detailLoadingInstance) { + this.detailLoadingInstance.close() + this.detailLoadingInstance = null + } + this.detailLoading = false + }, + openDetailLoading() { + this.detailLoading = true + this.$nextTick(() => { + if (this.detailLoadingInstance) { + return + } + const modalBody = document.querySelector('.payment-registration-dialog .ivu-modal-body') + if (!modalBody) { + return + } + this.detailLoadingInstance = this.$loading({ + target: modalBody, + lock: true, + text: '加载中...' + }) + }) + }, + resetPaymentForm() { + if (this.detailLoading) { + return + } + this.$refs.paymentRegistration?.reset() + }, + triggerSubmit() { + if (this.detailLoading) { + return + } + this.$refs.paymentRegistration?.submit() + }, + async open(row) { + this.isShowPaymentRegistration = true + await this.$nextTick() + await this.getContract(row) + }, + //获取合同信息 async getContract(info) { - this.detailLoading = true + this.openDetailLoading() this.contract = {} this.payment = [] try { @@ -489,7 +537,7 @@ export default { message: '加载合同信息失败,请重试', }) } finally { - this.detailLoading = false + this.closeDetailLoading() } }, @@ -620,7 +668,7 @@ export default { if (newVal) { this.getBudgets() } else { - this.detailLoading = false + this.closeDetailLoading() this.contract = {} this.payment = [] } @@ -633,6 +681,13 @@ export default {