From 0f0199fd417f199c0613345eba0550d317508bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E5=87=AF?= <2448379534@qq.com> Date: Wed, 29 Apr 2026 11:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=20=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/register/index.vue | 22 ++-- frontend/src/views/system/review/index.vue | 16 ++- frontend/src/views/system/user/index.vue | 142 ++++++++++++--------- 3 files changed, 106 insertions(+), 74 deletions(-) diff --git a/frontend/src/views/register/index.vue b/frontend/src/views/register/index.vue index 3236617..3a2ec80 100644 --- a/frontend/src/views/register/index.vue +++ b/frontend/src/views/register/index.vue @@ -25,7 +25,7 @@ - + @@ -297,11 +297,18 @@ const registerRules = { } // 4. 用户名关联检查(严格模式,忽略大小写) - const username = registerData.username.toLowerCase(); + // 4.0 先判断用户名是否为空,若为空则跳过该检查 + const username = registerData.username; + if (!username || username.trim() === '') { + // 用户名为空,跳过用户名关联检查 + return Promise.resolve(); + } + + const usernameLower = username.toLowerCase(); const passwordLower = value.toLowerCase(); // 4.1 检查密码是否完整包含用户名 - if (passwordLower.includes(username)) { + if (passwordLower.includes(usernameLower)) { return Promise.reject("密码不能包含用户名"); } @@ -309,14 +316,14 @@ const registerRules = { const passwordLetters = passwordLower.replace(/[^a-z]/g, ''); // 4.3 如果密码字母部分长度 >= 3,检查是否是用户名的子串 - if (passwordLetters.length >= 3 && username.includes(passwordLetters)) { + if (passwordLetters.length >= 3 && usernameLower.includes(passwordLetters)) { return Promise.reject("密码的字母部分不能是用户名的子串"); } // 4.4 检查用户名中是否包含密码的任意连续3位字母 for (let i = 0; i <= passwordLetters.length - 3; i++) { const substring = passwordLetters.substring(i, i + 3); - if (username.includes(substring)) { + if (usernameLower.includes(substring)) { return Promise.reject("密码不能与用户名存在明显关联"); } } @@ -801,7 +808,7 @@ const filterOption = (inputValue: string, option: any) => { } :deep(.ant-form-item) { - margin-bottom: clamp(8px, 1vh, 14px); + margin-bottom: 8px; } } } @@ -829,5 +836,4 @@ const filterOption = (inputValue: string, option: any) => { } } } -} - \ No newline at end of file +} diff --git a/frontend/src/views/system/review/index.vue b/frontend/src/views/system/review/index.vue index df2d061..2c56a66 100644 --- a/frontend/src/views/system/review/index.vue +++ b/frontend/src/views/system/review/index.vue @@ -204,7 +204,9 @@ function setpassword(row: any) { userid.value = row.id } - +function closeResult(){ + resultPawss.value = false +} //过去设施权限维护 const fishway = ref(false) const userId = ref('') @@ -1083,7 +1085,7 @@ function handleClearSelection() { - @@ -1099,8 +1101,14 @@ function handleClearSelection() { - - 已将密码重置为{{ msgText }} + + 已将密码重置为:{{ msgText }} + diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index 88aed23..082324e 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -251,9 +251,11 @@ function handleClose() { //重置密码 const userid = ref(""); +const resultPawss = ref(false) +const msgText = ref('') function setpassword(row: any) { ElMessageBox.confirm( - '确定将该账号密码重置为123456吗?', + '确定要重置此账号密码吗?', '重置密码', { confirmButtonText: '确定', @@ -265,16 +267,23 @@ function setpassword(row: any) { const params = { id: userid.value } - setpass(params).then(() => { - ElMessage({ - type: 'success', - message: '密码重置成功', - }) + setpass(params).then((res: any) => { + if (res.code == 0) { + resultPawss.value = true + msgText.value = res.data + } + // ElMessage({ + // type: 'success', + // message: '密码重置成功', + // }) }) }) userid.value = row.id } +function closeResult() { + resultPawss.value = false +} //过去设施权限维护 const fishway = ref(false) @@ -289,12 +298,12 @@ const isFishDataLoaded = ref(false) async function openFishway(row: any) { fishway.value = true userId.value = row.id - + // 重置状态 fishhui.value = [] tableDatafish.value = [] isFishDataLoaded.value = false - + try { // 使用 Promise.all 并行等待两个请求都完成 await Promise.all([ @@ -319,11 +328,11 @@ async function openFishway(row: any) { } }) ]) - + // 两个请求都完成后,标记数据已加载 isFishDataLoaded.value = true console.log('所有数据加载完成,准备回显') - + } catch (error) { console.error('加载数据失败:', error) ElMessage.error('加载数据失败,请重试') @@ -347,13 +356,13 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => { // 再设置新的选中状态 setTimeout(() => { fishTreeRef.value.setCheckedKeys(fishhui.value, false); - + // 验证回显结果 const checkedKeys = fishTreeRef.value.getCheckedKeys(); const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys(); console.log('回显完成 - 全选节点:', checkedKeys); console.log('回显完成 - 半选节点:', halfCheckedKeys); - + // 同步表格数据 fishTableData.value = tableDatafish.value }, 100); @@ -759,18 +768,18 @@ function getName(arr: any[], type: any): string { if (!arr || !Array.isArray(arr) || type === undefined || type === null) { return '' } - + const item = arr.find((item: any) => item?.itemCode === type) return item?.dictName || '' } onMounted(() => { getTree(); - getdictdata() + getdictdata() }); const dictData = ref([]) -function getdictdata(){ - getDictItemsByCode({dictCode:'resourceType'}).then(res=>{ +function getdictdata() { + getDictItemsByCode({ dictCode: 'resourceType' }).then(res => { dictData.value = res.data }) } @@ -1019,58 +1028,57 @@ function handleClearSelection() { - -
-
-
- - - -
- 全选 - 反选 - 取消选中 -
+
+
+
+ + + +
+ 全选 + 反选 + 取消选中
+
- - - -
-
-
- 移除权限 -
- - - - - - - - - - - -
+ + +
+
+
+ 移除权限 +
+ + + + + + + + + + + +
+
@@ -1078,6 +1086,16 @@ function handleClearSelection() { 保存 + + 已将密码重置为:{{ msgText }} + +