From e1738a6ea1b0cb1cab3823f8d8b2f4c990e4608d Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 18 Jul 2025 14:54:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=8A=B6=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/customerManagement/index.vue | 40 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/views/customerManagement/index.vue b/src/views/customerManagement/index.vue index 95257f6..e5b4f26 100644 --- a/src/views/customerManagement/index.vue +++ b/src/views/customerManagement/index.vue @@ -9,10 +9,10 @@ - + - - + + @@ -53,10 +53,10 @@ - + @@ -104,7 +104,7 @@ - + @@ -171,8 +171,16 @@ const initData: PageData = { trigger: 'blur' } ], + password: [ { required: true, message: '请输入账号密码', trigger: 'blur' }, + { + min: 5, + max: 20, + message: '用户密码长度必须介于 5 和 20 之间', + trigger: 'blur' + }, + { pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' } ], } }; @@ -199,6 +207,7 @@ const handleQuery = () => { const resetQuery = () => { dateRange.value = ['', '']; queryParams.value.pageNum = 1; + queryParams.value.status='' handleQuery(); }; @@ -227,19 +236,24 @@ const handleDelete = async (row?: UserVO) => { /** 用户状态修改 */ const handleStatusChange = async (row: any) => { - console.log(row, '33333333'); - const newStatus = row.enabled; // 获取新的状态值(取反) - const text = newStatus ? '启用' : '停用'; + // 计算新状态(取反) + const originalStatus = row.status; + const actionText = row.status == 0 ? '启用' : '停用'; try { - await proxy?.$modal.confirm(`确认要${text}"${row.nickName}"客户吗?`); + await proxy?.$modal.confirm(`确认要${actionText}"${row.nickName}"客户吗?`); await api.updateCustomer({ customerId: row.customerId, - enabled: newStatus + enabled: originalStatus == 0 ? true : false }); - proxy?.$modal.msgSuccess(text + '成功'); + proxy?.$modal.msgSuccess(actionText + '成功'); await getList(); } catch (err) { - row.enabled = !newStatus; // 回滚状态 + if (err == 'cancel') { // 这里假设confirm方法在用户取消时reject with 'cancel' + console.log(err, 'errr'); + proxy?.$modal.msgWarning('操作已取消'); + await getList(); + } + } };