From 07e8201a4335988937d3308c79e1f3fd43aa9870 Mon Sep 17 00:00:00 2001 From: zyn Date: Thu, 23 Nov 2023 11:17:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=91=E7=8A=B6=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E7=BC=96=E8=BE=91-=E6=8C=89=E9=92=AE=E6=B7=BB=E5=8A=A0loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attributeCustom/components/standSystem.vue | 11 +++++++++-- .../policy/components/addStructure.vue | 9 +++++++-- .../components/RegulatoryMaterialsTree.vue | 17 +++++++++++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/pages/config/pages/attributeCustom/components/standSystem.vue b/src/pages/config/pages/attributeCustom/components/standSystem.vue index 56a18b401..fca3ae845 100644 --- a/src/pages/config/pages/attributeCustom/components/standSystem.vue +++ b/src/pages/config/pages/attributeCustom/components/standSystem.vue @@ -58,10 +58,12 @@ class="common-button-primary" icon="el-icon-check" type="primary" + :loading="btnLoading" @click="handleSubmit">提交 取消 @@ -102,6 +104,7 @@ export default { drawerVisible: false, addModel: {}, loading: false, + btnLoading: false, rules }; }, @@ -228,13 +231,17 @@ export default { } }) if (!flag) return; + const config = { + _this: this, + loading: 'loading' + } let res = {} switch (this.drawerTitle) { case '新增体系': - res = await this.$http._postData(this.api.addMenuStandard,this.addModel) + res = await this.$http._postData(this.api.addMenuStandard,this.addModel, config) break case '编辑体系': - res = await this.$http._putData(this.api.updateMenuStandard, this.addModel) + res = await this.$http._putData(this.api.updateMenuStandard, this.addModel, config) break } if(res.ok){ diff --git a/src/pages/policyRegulation/policy/components/addStructure.vue b/src/pages/policyRegulation/policy/components/addStructure.vue index 05f42f7b9..ccbdf0528 100644 --- a/src/pages/policyRegulation/policy/components/addStructure.vue +++ b/src/pages/policyRegulation/policy/components/addStructure.vue @@ -50,10 +50,12 @@ class="common-button-primary" icon="el-icon-check" type="primary" + :loading="loading" @click="saveProduct('productModelAdd')">提交 取消 @@ -93,6 +95,7 @@ export default { {type: 'string', max: 500, message: '最多输入500位', trigger: 'blur'} ], }, + loading: false, } }, methods: { @@ -150,7 +153,8 @@ export default { this.productModelAdd.validFlag = '0' if (this.modalType === 1) { this.$http.postData('sarResource/ts-resource/add', this.productModelAdd, { - _this: this + _this: this, + loading: 'loading' }, res => { if (res.ok) { this.$emit('selectMenuList') @@ -161,7 +165,8 @@ export default { }, e => {}) } else if (this.modalType === 2) { this.$http.putData('sarResource/ts-resource', this.productModelAdd, { - _this: this + _this: this, + loading: 'loading' }, res => { this.$emit('selectMenuList') this.closeDrawer() diff --git a/src/pages/policyRegulation/regulatoryMaterials/components/RegulatoryMaterialsTree.vue b/src/pages/policyRegulation/regulatoryMaterials/components/RegulatoryMaterialsTree.vue index de5b00173..6665f2501 100644 --- a/src/pages/policyRegulation/regulatoryMaterials/components/RegulatoryMaterialsTree.vue +++ b/src/pages/policyRegulation/regulatoryMaterials/components/RegulatoryMaterialsTree.vue @@ -89,11 +89,13 @@ class="common-button-primary" icon="el-icon-check" type="primary" + :loading="loading" @click="handleSubmit">提交 取消 @@ -123,10 +125,12 @@ export default { }, DrawerRules: { name: [ - {required: true, message: '目录名称不能为空', trigger: 'change'} + {required: true, message: '目录名称不能为空', trigger: 'change'}, + {type: 'string', max: 100, message: '最多输入100位'} ], sort: [ - {required: true, message: '目录顺序不能为空', trigger: 'change'} + {required: true, message: '目录顺序不能为空且为正整数', trigger: 'change'}, + {type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'} ] }, @@ -135,7 +139,8 @@ export default { addTreeNode: 'lawss/sarLawsInformation/tree/addTreeNode', updateTreeNode: 'lawss/sarLawsInformation/tree/updateTreeNode', deleteTreeNode: 'lawss/sarLawsInformation/tree/deleteTreeNode', - } + }, + loading: false, } }, created() { @@ -219,7 +224,11 @@ export default { if (valid) { let method = this.DrawerTitle === '新增目录' ? '_postData' : '_putData' let url = this.DrawerTitle === '新增目录' ? this.url.addTreeNode : this.url.updateTreeNode - this.$http[method](url, this.DrawerModel).then(res => { + const config = { + _this: this, + loading: 'loading', + } + this.$http[method](url, this.DrawerModel, config).then(res => { if (res.ok) { this.$message.success('操作成功') this.getMenuList()