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(); + } + } };