From 8bcae193690e66730cf3d8489d477b5b9ee32783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Mon, 23 Mar 2026 13:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86=E9=A1=B5=E9=9D=A2=E5=92=8C?= =?UTF-8?q?=E5=8C=BB=E9=99=A2=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/_core/authentication/login.vue | 169 ++++------ .../src/views/system/pharmacy/index.vue | 25 +- .../src/views/system/store-input/api/index.ts | 47 +++ .../src/views/system/store-input/audit.vue | 147 ++++++++ .../store-input/components/AuditModal.vue | 87 +++++ .../store-input/components/DetailModal.vue | 110 ++++++ .../system/store-input/components/modal.vue | 80 +++++ .../views/system/store-input/config/form.ts | 315 ++++++++++++++++++ .../views/system/store-input/config/search.ts | 47 +++ .../views/system/store-input/config/table.ts | 175 ++++++++++ .../src/views/system/store-input/index.vue | 150 +++++++++ .../web-antd/src/views/system/store/index.vue | 15 + 12 files changed, 1267 insertions(+), 100 deletions(-) create mode 100644 apps/web-antd/src/views/system/store-input/api/index.ts create mode 100644 apps/web-antd/src/views/system/store-input/audit.vue create mode 100644 apps/web-antd/src/views/system/store-input/components/AuditModal.vue create mode 100644 apps/web-antd/src/views/system/store-input/components/DetailModal.vue create mode 100644 apps/web-antd/src/views/system/store-input/components/modal.vue create mode 100644 apps/web-antd/src/views/system/store-input/config/form.ts create mode 100644 apps/web-antd/src/views/system/store-input/config/search.ts create mode 100644 apps/web-antd/src/views/system/store-input/config/table.ts create mode 100644 apps/web-antd/src/views/system/store-input/index.vue diff --git a/apps/web-antd/src/views/_core/authentication/login.vue b/apps/web-antd/src/views/_core/authentication/login.vue index 553f695f..17326c77 100644 --- a/apps/web-antd/src/views/_core/authentication/login.vue +++ b/apps/web-antd/src/views/_core/authentication/login.vue @@ -43,59 +43,49 @@ const formSchema = computed((): VbenFormSchema[] => { dependencies: { trigger(values, form) { loginMethod.value = values.login_method; - // 切换登录方式时清空其他字段 - if (values.login_method === 'phone') { - form.setValues({ login_account: '', job_number: '' }); - } else if (values.login_method === 'login_account') { - form.setValues({ username: '', job_number: '' }); - } else if (values.login_method === 'job_number') { - form.setValues({ username: '', login_account: '' }); - } + // 切换登录方式时清空输入框 + form.setValues({ login_value: '' }); }, triggerFields: ['login_method'], }, }, ]; - // 2. 根据选择动态显示输入框 + // 2. 统一的登录输入框(根据登录方式动态更新 label 和 placeholder) const loginMethodValue = loginMethod.value; + let loginLabel = ''; + let loginPlaceholder = ''; + let loginRules: any; + if (loginMethodValue === 'phone') { - schema.push({ - component: 'VbenInput', - componentProps: { - placeholder: $t('authentication.usernameTip'), - }, - fieldName: 'username', - label: $t('authentication.username'), - rules: z - .string() - .min(1, { message: $t('authentication.mobileTip') }) - .refine((v) => /^\d{11}$/.test(v), { - message: $t('authentication.mobileErrortip'), - }), - }); + loginLabel = $t('authentication.username'); + loginPlaceholder = $t('authentication.usernameTip'); + loginRules = z + .string() + .min(1, { message: $t('authentication.mobileTip') }) + .refine((v) => /^\d{11}$/.test(v), { + message: $t('authentication.mobileErrortip'), + }); } else if (loginMethodValue === 'login_account') { - schema.push({ - component: 'VbenInput', - componentProps: { - placeholder: '请输入登录账号', - }, - fieldName: 'login_account', - label: '登录账号', - rules: z.string().min(1, { message: '请输入登录账号' }), - }); + loginLabel = '登录账号'; + loginPlaceholder = '请输入登录账号'; + loginRules = z.string().min(1, { message: '请输入登录账号' }); } else if (loginMethodValue === 'job_number') { - schema.push({ - component: 'VbenInput', - componentProps: { - placeholder: '请输入工号', - }, - fieldName: 'job_number', - label: '工号', - rules: z.string().min(1, { message: '请输入工号' }), - }); + loginLabel = '工号'; + loginPlaceholder = '请输入工号'; + loginRules = z.string().min(1, { message: '请输入工号' }); } + schema.push({ + component: 'VbenInput', + componentProps: { + placeholder: loginPlaceholder, + }, + fieldName: 'login_value', + label: loginLabel, + rules: loginRules, + }); + // 3. 密码输入框(常驻) schema.push({ component: 'VbenInputPassword', @@ -128,62 +118,42 @@ const formSchema = computed((): VbenFormSchema[] => { const values = await formApi.getValues(); const loginMethodValue = values.login_method || 'phone'; + const loginValue = values.login_value || ''; try { - let result; - if (loginMethodValue === 'phone') { - // 手机号登录:验证手机号 - await formApi.validateField('username'); - const isPhoneReady = await formApi.isFieldValid('username'); - if (!isPhoneReady) { - loading.value = false; - throw new Error('手机号格式不正确'); - } - const password = await formApi.isFieldValid('password'); - if (!password) { - loading.value = false; - throw new Error('密码不符合要求'); - } - result = await sendVerificationCode({ - login_method: 'phone', - username: values.username - }); - } else if (loginMethodValue === 'login_account') { - // 登录账号登录:验证登录账号 - await formApi.validateField('login_account'); - const isAccountReady = await formApi.isFieldValid('login_account'); - if (!isAccountReady) { - loading.value = false; - throw new Error('登录账号不能为空'); - } - const password = await formApi.isFieldValid('password'); - if (!password) { - loading.value = false; - throw new Error('密码不符合要求'); - } - result = await sendVerificationCode({ - login_method: 'login_account', - login_account: values.login_account - }); - } else if (loginMethodValue === 'job_number') { - // 工号登录:验证工号 - await formApi.validateField('job_number'); - const isJobNumberReady = await formApi.isFieldValid('job_number'); - if (!isJobNumberReady) { - loading.value = false; - throw new Error('工号不能为空'); - } - const password = await formApi.isFieldValid('password'); - if (!password) { - loading.value = false; - throw new Error('密码不符合要求'); - } - result = await sendVerificationCode({ - login_method: 'job_number', - job_number: values.job_number - }); + // 统一验证 login_value 字段 + await formApi.validateField('login_value'); + const isValid = await formApi.isFieldValid('login_value'); + if (!isValid) { + loading.value = false; + const errorMsg = loginMethodValue === 'phone' + ? '手机号格式不正确' + : loginMethodValue === 'login_account' + ? '登录账号不能为空' + : '工号不能为空'; + throw new Error(errorMsg); } + const password = await formApi.isFieldValid('password'); + if (!password) { + loading.value = false; + throw new Error('密码不符合要求'); + } + + // 根据登录方式组装参数 + const params: any = { + login_method: loginMethodValue, + }; + if (loginMethodValue === 'phone') { + params.username = loginValue; + } else if (loginMethodValue === 'login_account') { + params.login_account = loginValue; + } else if (loginMethodValue === 'job_number') { + params.job_number = loginValue; + } + + const result = await sendVerificationCode(params); + if (result) { if (result.need_select && result.accounts && result.accounts.length > 1) { needSelectAccount.value = true; @@ -219,20 +189,21 @@ const formSchema = computed((): VbenFormSchema[] => { // 自定义提交处理 async function handleLogin(values: Recordable) { const loginMethodValue = values.login_method || 'phone'; + const loginValue = values.login_value || ''; // 验证必填字段 if (loginMethodValue === 'phone') { - if (!values.username || !/^\d{11}$/.test(values.username)) { + if (!loginValue || !/^\d{11}$/.test(loginValue)) { message.error('请输入正确的手机号'); return; } } else if (loginMethodValue === 'login_account') { - if (!values.login_account || values.login_account.trim() === '') { + if (!loginValue || loginValue.trim() === '') { message.error('请输入登录账号'); return; } } else if (loginMethodValue === 'job_number') { - if (!values.job_number || values.job_number.trim() === '') { + if (!loginValue || loginValue.trim() === '') { message.error('请输入工号'); return; } @@ -246,11 +217,11 @@ async function handleLogin(values: Recordable) { // 根据登录方式组装参数 if (loginMethodValue === 'phone') { - loginData.phone = values.username; + loginData.phone = loginValue; } else if (loginMethodValue === 'login_account') { - loginData.login_account = values.login_account; + loginData.login_account = loginValue; } else if (loginMethodValue === 'job_number') { - loginData.job_number = values.job_number; + loginData.job_number = loginValue; } await authStore.authLogin(loginData); diff --git a/apps/web-antd/src/views/system/pharmacy/index.vue b/apps/web-antd/src/views/system/pharmacy/index.vue index 85dbdb30..075fdf94 100644 --- a/apps/web-antd/src/views/system/pharmacy/index.vue +++ b/apps/web-antd/src/views/system/pharmacy/index.vue @@ -1,9 +1,11 @@ + + diff --git a/apps/web-antd/src/views/system/store-input/components/AuditModal.vue b/apps/web-antd/src/views/system/store-input/components/AuditModal.vue new file mode 100644 index 00000000..c3277a23 --- /dev/null +++ b/apps/web-antd/src/views/system/store-input/components/AuditModal.vue @@ -0,0 +1,87 @@ + + +