From bda471b8c00939c34b9041f4cb201b17ff5f8dda Mon Sep 17 00:00:00 2001 From: lzhizhao <790086754@qq.com> Date: Sun, 14 Sep 2025 21:03:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permission/merchant-account/index.vue | 38 +++++++++++++++++-- .../permission/sub-operator/index.vue | 27 ++++++++++++- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/views/modules/operation-management/permission/merchant-account/index.vue b/src/views/modules/operation-management/permission/merchant-account/index.vue index c6a9c30..875b6f8 100644 --- a/src/views/modules/operation-management/permission/merchant-account/index.vue +++ b/src/views/modules/operation-management/permission/merchant-account/index.vue @@ -602,10 +602,37 @@ export default { this.businessHours[1].getHours() * 60 + this.businessHours[1].getMinutes() } - debugger shopBaseConfig({ shopId }, shopData).then(() => { this.$message.success('商户创建成功,权限及店铺信息已设置') - this.$refs.ruleFormRef.resetFields() + // 保留操作类型,只重置其他字段 + const operationType = this.form.operationType; + this.form.mobile = ''; + this.form.password = ''; + this.form.permissionCodes = []; + this.form.merchantId = null; + this.form.enable = true; + this.form.name = ''; + this.form.categoryId = ''; + this.form.background = ''; + this.form.isAutoBusiness = true; + this.form.contactPhone = ''; + this.form.fileList = []; + this.form.address = ''; + this.form.permits = []; + this.form.lng = ''; + this.form.lat = ''; + this.form.detailAddress = ''; + this.form.pickName = ''; + this.form.pickLng = ''; + this.form.pickAddress = ''; + this.form.pickLat = ''; + this.form.pickImg = ''; + this.form.promisePickDeliveryTime = ''; + this.form.operationType = operationType; // 保留操作类型 + // 重置权限树的勾选状态 + if (this.$refs.permissionTree) { + this.$refs.permissionTree.setCheckedKeys([]); + } }) }) }) @@ -628,7 +655,12 @@ export default { } setMerchantPermissions(permissionsData).then(() => { this.$message.success('商户信息更新成功') - this.$refs.ruleFormRef.resetFields() + // 只重置部分字段,保留merchantId和operationType + this.form.permissionCodes = []; + // 重置权限树的勾选状态 + if (this.$refs.permissionTree) { + this.$refs.permissionTree.setCheckedKeys([]); + } }) } } diff --git a/src/views/modules/operation-management/permission/sub-operator/index.vue b/src/views/modules/operation-management/permission/sub-operator/index.vue index e6e3ed4..aa4c407 100644 --- a/src/views/modules/operation-management/permission/sub-operator/index.vue +++ b/src/views/modules/operation-management/permission/sub-operator/index.vue @@ -316,7 +316,21 @@ export default { } createSubAccount(createData).then(() => { this.$message.success('创建成功'); - this.$refs.ruleFormRef.resetFields(); + // 保留操作类型,只重置其他字段 + const operationType = this.form.operationType; + this.form.username = ''; + this.form.password = ''; + this.form.name = ''; + this.form.mobile = ''; + this.form.remark = ''; + this.form.permissionCodes = []; + this.form.accountId = null; + this.form.enable = true; + this.form.operationType = operationType; // 保留操作类型 + // 重置权限树的勾选状态 + if (this.$refs.permissionTree) { + this.$refs.permissionTree.setCheckedKeys([]); + } }); } else if (this.form.operationType === 'update') { if (!this.form.accountId) { @@ -334,7 +348,16 @@ export default { }; updateSubAccount(updateData).then(() => { this.$message.success('更新成功'); - this.$refs.ruleFormRef.resetFields(); + // 只重置部分字段,保留accountId和operationType + this.form.name = ''; + this.form.mobile = ''; + this.form.remark = ''; + this.form.permissionCodes = []; + this.form.enable = true; + // 重置权限树的勾选状态 + if (this.$refs.permissionTree) { + this.$refs.permissionTree.setCheckedKeys([]); + } }); } }