From 9db9c13babb8e673dfab0026762f8f5d95ae175c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88?= <2960252003@qq.com> Date: Wed, 21 Feb 2024 10:24:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/dept.ts | 1 + src/api/ticket.ts | 2 + src/components/navbar/index.vue | 2 +- src/locale/en-US.ts | 3 +- src/locale/zh-CN.ts | 3 +- src/store/modules/user/index.ts | 1 - src/store/modules/user/types.ts | 1 - src/views/login/components/login-form.vue | 74 +++-- src/views/login/locale/en-US.ts | 3 +- src/views/login/locale/zh-CN.ts | 3 +- .../system/dept/components/dept-edit.vue | 33 +- src/views/system/dept/index.vue | 36 ++- src/views/system/dept/locale/en-US.ts | 24 +- src/views/system/dept/locale/zh-CN.ts | 16 +- .../system/role/components/role-edit.vue | 31 +- src/views/system/role/index.vue | 25 +- src/views/system/role/locale/en-US.ts | 30 +- src/views/system/role/locale/zh-CN.ts | 27 +- .../system/user/components/user-edit.vue | 110 ++++--- src/views/system/user/index.vue | 28 +- src/views/system/user/locale/en-US.ts | 69 +++-- src/views/system/user/locale/zh-CN.ts | 30 +- .../ticket/form/components/form-edit.vue | 289 ------------------ src/views/ticket/form/index.vue | 207 ------------- src/views/ticket/form/locale/en-US.ts | 4 - src/views/ticket/form/locale/zh-CN.ts | 15 - .../ticket/manage/components/form-edit.vue | 157 +++++++--- .../ticket/manage/components/ticket-edit.vue | 124 ++++---- src/views/ticket/manage/index.vue | 55 +++- src/views/ticket/manage/locale/en-US.ts | 85 ++++++ src/views/ticket/manage/locale/zh-CN.ts | 75 ++++- .../setting/components/basic-information.vue | 10 +- .../setting/components/password-reset.vue | 13 +- src/views/user/setting/locale/en-US.ts | 9 + src/views/user/setting/locale/zh-CN.ts | 4 + 35 files changed, 777 insertions(+), 822 deletions(-) delete mode 100644 src/views/ticket/form/components/form-edit.vue delete mode 100644 src/views/ticket/form/index.vue delete mode 100644 src/views/ticket/form/locale/en-US.ts delete mode 100644 src/views/ticket/form/locale/zh-CN.ts diff --git a/src/api/dept.ts b/src/api/dept.ts index c775a80..877c0ae 100644 --- a/src/api/dept.ts +++ b/src/api/dept.ts @@ -35,6 +35,7 @@ export function queryDeptList(data: DeptRecord) { }); } +// 获取区域列表 export function deptList() { return axios.get(`/api/rest/dept`); } diff --git a/src/api/ticket.ts b/src/api/ticket.ts index b973630..1372174 100644 --- a/src/api/ticket.ts +++ b/src/api/ticket.ts @@ -25,6 +25,7 @@ export interface auditRecord { ticketId: string; } +// 票据列表 export function queryTicket(data: any) { return axios({ url: '/api/rest/bill', // 路径 @@ -33,6 +34,7 @@ export function queryTicket(data: any) { }); } +// 详情 export function getDetail(id: string) { return axios.get(`/api/rest/bill/${id}`); } diff --git a/src/components/navbar/index.vue b/src/components/navbar/index.vue index 008d3f9..0fefe3b 100644 --- a/src/components/navbar/index.vue +++ b/src/components/navbar/index.vue @@ -10,7 +10,7 @@ :style="{ margin: 0, fontSize: '18px' }" :heading="5" > - 票据管理系统 + {{ $t('ticket.manage.system') }} - + - + - - + + - + - + - - + + @@ -164,7 +192,7 @@ const { loading, setLoading } = useLoading(); const userStore = useUserStore(); const { visible, setVisible } = useVisible(false); const userCreateRef = ref(); -const modalTitle = '注册用户信息'; +const modalTitle = t('create.user'); const formData = ref({ username: '', nickName: '', @@ -235,7 +263,7 @@ const handleSubmit = async ({ loginConfig.value.password = rememberPassword ? password : ''; } catch (err) { // errorMessage.value = (err as Error).message; - errorMessage.value = '登录失败'; + errorMessage.value = t('login.form.login.errMsg'); } finally { setLoading(false); } @@ -260,7 +288,7 @@ const handleOk = async () => { const res = await userStore.createUser(formData.value); if (res.status === 200) { Message.success({ - content: `${modalTitle}成功`, + content: t('create.sucess'), duration: 5 * 1000, }); } diff --git a/src/views/login/locale/en-US.ts b/src/views/login/locale/en-US.ts index 81a50a4..8611b12 100644 --- a/src/views/login/locale/en-US.ts +++ b/src/views/login/locale/en-US.ts @@ -1,5 +1,5 @@ export default { - 'login.form.title': 'Login to Arco Design Pro', + 'login.form.title': 'ZSC Learning Platform', 'login.form.userName.errMsg': 'Username cannot be empty', 'login.form.password.errMsg': 'Password cannot be empty', 'login.form.login.errMsg': 'Login error, refresh and try again', @@ -18,4 +18,5 @@ export default { 'Internationalization, routing configuration, state management everything', 'login.banner.slogan3': 'Access visualization enhancement tool AUX', 'login.banner.subSlogan3': 'Realize flexible block development', + 'create.user':'Create User' }; diff --git a/src/views/login/locale/zh-CN.ts b/src/views/login/locale/zh-CN.ts index f0aba2a..eb6d97c 100644 --- a/src/views/login/locale/zh-CN.ts +++ b/src/views/login/locale/zh-CN.ts @@ -1,5 +1,5 @@ export default { - 'login.form.title': '学院学习平台', + 'login.form.title': '中山学院学习平台', 'login.form.userName.errMsg': '用户名不能为空', 'login.form.password.errMsg': '密码不能为空', 'login.form.login.errMsg': '登录出错,请刷新重试', @@ -16,4 +16,5 @@ export default { 'login.banner.subSlogan2': '国际化,路由配置,状态管理应有尽有', 'login.banner.slogan3': '接入可视化增强工具AUX', 'login.banner.subSlogan3': '实现灵活的区块式开发', + 'create.user': '注册用户' }; diff --git a/src/views/system/dept/components/dept-edit.vue b/src/views/system/dept/components/dept-edit.vue index b06f286..8b1a3f8 100644 --- a/src/views/system/dept/components/dept-edit.vue +++ b/src/views/system/dept/components/dept-edit.vue @@ -22,20 +22,27 @@ - + - - + + diff --git a/src/views/system/user/locale/en-US.ts b/src/views/system/user/locale/en-US.ts index 7bdd1d7..bc46e57 100644 --- a/src/views/system/user/locale/en-US.ts +++ b/src/views/system/user/locale/en-US.ts @@ -1,21 +1,16 @@ export default { - 'menu.system.user': 'Users', + 'menu.system.user': 'User', 'menu.list.searchTable': 'Search Table', - 'searchTable.form.number': 'Set Number', - 'searchTable.form.number.placeholder': 'Please enter Set Number', - 'searchTable.form.name': 'Set Name', - 'searchTable.form.name.placeholder': 'Please enter Set Name', - 'searchTable.form.contentType': 'Content Type', - 'searchTable.form.contentType.img': 'image-text', - 'searchTable.form.contentType.horizontalVideo': 'Horizontal short video', - 'searchTable.form.contentType.verticalVideo': 'Vertical short video', - 'searchTable.form.filterType': 'Filter Type', - 'searchTable.form.filterType.artificial': 'artificial', - 'searchTable.form.filterType.rules': 'Rules', - 'searchTable.form.createdTime': 'Create Date', + 'searchTable.form.username': 'Username', + 'searchTable.form.username.placeholder': 'Please enter Username', + 'searchTable.form.phone': 'Phone', + 'searchTable.form.phone.placeholder': 'Please enter Phone', + 'searchTable.form.email': 'Email', + 'searchTable.form.email.placeholder': 'Please enter Email', 'searchTable.form.status': 'Status', - 'searchTable.form.status.online': 'Online', - 'searchTable.form.status.offline': 'Offline', + 'searchTable.form.status.placeholder': 'Please select Status', + 'searchTable.form.status.enable': 'Online', + 'searchTable.form.status.disable': 'Offline', 'searchTable.form.search': 'Search', 'searchTable.form.reset': 'Reset', 'searchTable.form.selectDefault': 'All', @@ -23,16 +18,14 @@ export default { 'searchTable.operation.import': 'Import', 'searchTable.operation.download': 'Download', // columns - 'searchTable.columns.index': 'Index', - 'searchTable.columns.number': 'Set Number', - 'searchTable.columns.name': 'Set Name', - 'searchTable.columns.contentType': 'Content Type', - 'searchTable.columns.filterType': 'Filter Type', - 'searchTable.columns.count': 'Count', - 'searchTable.columns.createdTime': 'CreatedTime', - 'searchTable.columns.status': 'Status', - 'searchTable.columns.operations': 'Operations', - 'searchTable.columns.operations.view': 'View', + 'userTable.columns.index': '#', + 'userTable.columns.nickName': 'NickName', + 'userTable.columns.username': 'Username', + 'userTable.columns.phone': 'Phone', + 'userTable.columns.email': 'Email', + 'userTable.columns.enabled': 'Enabled', + 'userTable.columns.avater': 'Avater', + 'userTable.columns.address': 'Address', // size 'searchTable.size.mini': 'mini', 'searchTable.size.small': 'small', @@ -45,4 +38,30 @@ export default { // modify 'modify.user.info.sucess': 'modify sucess', 'modify.user.info.fail': 'modify fail', + + + 'user.info.username':'Username', + 'user.info.username.placeholder':'Please enter Username', + 'user.info.username.required':'Username is required', + 'user.info.username.format':'Please enter the correct format', + 'user.info.password':'Password', + 'user.info.password.placeholder':'Please enter Password', + 'user.info.password.required':'Password is required', + 'user.info.nickName':'NickName', + 'user.info.nickName.placeholder':'Please enter NickName', + 'user.info.phone':'Phone', + 'user.info.phone.placeholder':'Please enter Phone', + 'user.info.phone.required':'Phone is required', + 'user.info.phone.format':'Please enter the correct format', + 'user.info.email':'Email', + 'user.info.email.placeholder':'Please enter Email', + 'user.info.email.required':'Email is required', + 'user.info.address':'Address', + 'user.info.address.placeholder':'Please enter Address', + 'user.info.dept':'Dept', + 'user.info.dept.placeholder':'Please select Dept', + 'user.info.dept.required': 'Dept is required', + 'user.info.role':'Role', + 'user.info.role.required': 'Role is required', + }; diff --git a/src/views/system/user/locale/zh-CN.ts b/src/views/system/user/locale/zh-CN.ts index 3d914ae..fcdc0b6 100644 --- a/src/views/system/user/locale/zh-CN.ts +++ b/src/views/system/user/locale/zh-CN.ts @@ -1,7 +1,4 @@ export default { - 'menu.system.permission': '权限管理', - 'menu.system.role': '角色管理', - 'menu.system.dept': '部门管理', 'menu.system.user': '用户管理', 'menu.list.searchTable': '查询表格', 'searchTable.form.username': '用户名', @@ -42,4 +39,29 @@ export default { // modify 'modify.user.info.sucess': '修改成功', 'modify.user.info.fail': '修改失败', -}; + + 'user.info.username':'用户名', + 'user.info.username.placeholder':'请输入用户名', + 'user.info.username.required':'用户名不能为空', + 'user.info.username.format':'请输入正确格式的用户名', + 'user.info.password':'密码', + 'user.info.password.placeholder':'请输入密码', + 'user.info.password.required':'密码不能为空', + 'user.info.nickName':'昵称', + 'user.info.nickName.placeholder':'请输入昵称', + 'user.info.phone':'电话号码', + 'user.info.phone.placeholder':'请输入电话号码', + 'user.info.phone.required':'电话号码不能为空', + 'user.info.phone.format':'请输入正确格式的电话号码', + 'user.info.email':'Email', + 'user.info.email.placeholder':'请输入Email', + 'user.info.email.required':'Email不能为空', + 'user.info.address':'地址', + 'user.info.address.placeholder':'请输入地址', + 'user.info.dept':'部门', + 'user.info.dept.placeholder':'请选择部门', + 'user.info.dept.required': '部门不能为空', + 'user.info.role':'角色', + 'user.info.role.required': '请选择一个', + +} \ No newline at end of file diff --git a/src/views/ticket/form/components/form-edit.vue b/src/views/ticket/form/components/form-edit.vue deleted file mode 100644 index 109aa5f..0000000 --- a/src/views/ticket/form/components/form-edit.vue +++ /dev/null @@ -1,289 +0,0 @@ - - - - - diff --git a/src/views/ticket/form/index.vue b/src/views/ticket/form/index.vue deleted file mode 100644 index d4199ae..0000000 --- a/src/views/ticket/form/index.vue +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - diff --git a/src/views/ticket/form/locale/en-US.ts b/src/views/ticket/form/locale/en-US.ts deleted file mode 100644 index 1d73110..0000000 --- a/src/views/ticket/form/locale/en-US.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default { - 'menu.ticket.manage': 'Ticket Manage', - 'menu.ticket.list': 'Ticket List', -}; diff --git a/src/views/ticket/form/locale/zh-CN.ts b/src/views/ticket/form/locale/zh-CN.ts deleted file mode 100644 index bfb87e4..0000000 --- a/src/views/ticket/form/locale/zh-CN.ts +++ /dev/null @@ -1,15 +0,0 @@ -export default { - 'menu.ticket.form': '票据表单', - 'menu.ticket.list': '票据列表', - - // columns - 'ticketTable.columns.index': '序号', - 'ticketTable.columns.companyName': '公司', - 'ticketTable.columns.title': '标题', - 'ticketTable.columns.money': '金额', - 'ticketTable.columns.createTime': '创建时间', - 'ticketTable.columns.status': '审核状态', - 'ticketTable.columns.type': '类型', - - 'searchTable.form.type.placeholder': '请选择票据类型', -}; diff --git a/src/views/ticket/manage/components/form-edit.vue b/src/views/ticket/manage/components/form-edit.vue index 420afb9..c439165 100644 --- a/src/views/ticket/manage/components/form-edit.vue +++ b/src/views/ticket/manage/components/form-edit.vue @@ -28,63 +28,82 @@ - + - + - + - + - + - + - - + +
{{ item.username }}
- + {{ formData.status }} - + {{ auditData.comment }} - 取消 + + {{ $t('cancel') }} 暂存 - 提交 + + {{ $t('submit') }}
@@ -168,7 +208,7 @@ const ticketStore = useTicketStore(); const userStore = useUserStore(); const roleStore = useRoleStore(); const modalTitle = computed(() => { - return props.isCreate ? '新增' : '修改'; + return props.isCreate ? t('create') : t('edit'); }); const { visible, setVisible } = useVisible(false); const createEditRef = ref(); @@ -202,34 +242,36 @@ const deptOptions = computedAsync(async () => { }); const typesOptions = computed(() => [ { - label: '银行支票', + label: t('bank'), value: 'BANK', }, { - label: '税务支票', + label: t('tax'), value: 'TAX', }, { - label: '其他支票', + label: t('other'), value: 'OTHER', }, ]); const statusOptions = computed(() => [ { - label: '待审核', + label: t('unreviewed'), value: 'EXAMINE', }, { - label: '审核通过', + label: t('pass'), value: 'PASS', }, { - label: '审核未通过', + label: t('failed'), value: 'FAILED', }, ]); let auiditRoleId = ''; + +// 获取审核员ID const getRoleId = async () => { const res = await roleStore.getRoleList(); res.data.forEach((item: any) => { @@ -238,9 +280,10 @@ const getRoleId = async () => { } }); }; -getRoleId(); const auditorOptions = ref([]); + +// 根据部门ID查询该部门的审核员 const optionDept = async (flag: boolean) => { if (flag) { formData.value.auditorId = undefined; @@ -254,16 +297,18 @@ const optionDept = async (flag: boolean) => { }); auditorOptions.value = res.data.records; }; + let formDifer = {}; const fileList = ref([]); + +// 上传附件 const Onchange = async (option: any) => { - // 发送请求给后端 const FormDatas = new FormData(); FormDatas.append('file', option.fileItem.file); const res = await ticketStore.uploadFileTicket(FormDatas); if (res.status === 200) { Message.success({ - content: t('上传成功'), + content: t('upload.sucess'), duration: 3 * 1000, }); res.data.name = res.data.fileName; @@ -271,35 +316,44 @@ const Onchange = async (option: any) => { formData.value.attachId = res.data.id; } else { Message.error({ - content: t('上传失败'), + content: t('upload.fail'), duration: 3 * 1000, }); } }; +// 删除附件 const removeAttact = () => { fileList.value.pop(); }; +// 组件被点击时 const handleClick = () => { + getRoleId(); const ticketId = props.prem?.id; + // 获取需要修改的数据 if (ticketId) { ticketStore .getDetail(ticketId) .then(async (res) => { + // 票据数据 formData.value = res.data.bill; + // 审核数据 auditData.value = res.data.audit; + // 附件内容 if (formData.value.attachId) { const data = await ticketStore.getAttachment(formData.value.attachId); data.data.name = data.data.fileName; fileList.value.push(data.data); } + // 审核员信息 const auditInfo = await userStore.getUserDetail( auditData.value.auditorId ); formData.value.deptId = auditInfo.data.deptId; formData.value.auditorId = auditData.value.auditorId; + formDifer = { ...res.data.bill }; }) .then(() => { @@ -323,26 +377,30 @@ const diffDataForm = (newData: any, oldData: any) => { return result; }; +// 提交 const handleOk = async () => { const valid = await createEditRef.value?.validate(); if (!valid) { formData.value.submit = true; formData.value.status = 'EXAMINE'; + // 新增 if (props.isCreate) { formData.value.userId = userStore.id; const res = await ticketStore.createTicket(formData.value); if (res.status === 200) { Message.success({ - content: `添加成功`, + content: t('create.sucess'), duration: 5 * 1000, }); } } else { + // 修改 formDifer = diffDataForm(formData.value, formDifer); + // 判断是否有进行修改 if (Object.keys(formDifer).length === 0) { Message.success({ - content: `未作任何修改`, + content: t('unmodified'), duration: 3 * 1000, }); } else { @@ -351,7 +409,7 @@ const handleOk = async () => { const res = await ticketStore.updateTicket(formDifer); if (res.status === 200) { Message.success({ - content: `提交成功`, + content: t('submit.sucess'), duration: 5 * 1000, }); } @@ -364,23 +422,27 @@ const handleOk = async () => { } }; +// 暂存 const handleStorage = async () => { const valid = await createEditRef.value?.validate(); if (!valid) { formData.value.submit = false; + // 新增 if (props.isCreate) { const res = await ticketStore.createTicket(formData.value); if (res.status === 200) { Message.success({ - content: '暂存成功', + content: t('storage.sucess'), duration: 5 * 1000, }); } } else { + formData.value.status = 'SUBMIT'; + // 修改 formDifer = diffDataForm(formData.value, formDifer); if (Object.keys(formDifer).length === 0) { Message.success({ - content: `未作任何修改`, + content: t('unmodified'), duration: 3 * 1000, }); } else { @@ -389,7 +451,7 @@ const handleStorage = async () => { const res = await ticketStore.updateTicket(formDifer); if (res.status === 200) { Message.success({ - content: `修改成功`, + content: t('modify.sucess'), duration: 5 * 1000, }); } @@ -402,6 +464,7 @@ const handleStorage = async () => { } }; +// 关闭 const handleCancel = async () => { removeAttact(); createEditRef.value?.resetFields(); diff --git a/src/views/ticket/manage/components/ticket-edit.vue b/src/views/ticket/manage/components/ticket-edit.vue index dcf54e6..4efafe8 100644 --- a/src/views/ticket/manage/components/ticket-edit.vue +++ b/src/views/ticket/manage/components/ticket-edit.vue @@ -26,49 +26,49 @@ > - +
{{ formData.companyName }}
- +
{{ formData.title }}
- +
{{ formData.body }}
- +
{{ formData.money }}
- +
{{ dayjs(formData.createTime).format('YYYY-MM-DD') }}
- +
{{ formData.contactEmail }}
- +
{{ formData.type }}
- + - + +
{{ item.username }} @@ -101,7 +101,11 @@ - +
{{ formData.status }}
@@ -110,19 +114,19 @@ - +
{{ auditData.comment }}
@@ -131,6 +135,7 @@