From 6ce9ab875c659ef669cb5fbd4dc006b3d6d47b0f Mon Sep 17 00:00:00 2001
From: fessor <352475718@qq.com>
Date: Mon, 27 Mar 2023 01:44:23 +0000
Subject: [PATCH 1/4] =?UTF-8?q?feat:=20ep=E9=87=8D=E5=86=99=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: fessor <352475718@qq.com>
---
src/views/system/user/AddForm.vue | 223 ++++++
src/views/system/user/ImportForm.vue | 153 +++++
src/views/system/user/RoleForm.vue | 90 +++
src/views/system/user/index.vue | 979 +++++++++++++--------------
src/views/system/user/utils.ts | 44 ++
5 files changed, 977 insertions(+), 512 deletions(-)
create mode 100644 src/views/system/user/AddForm.vue
create mode 100644 src/views/system/user/ImportForm.vue
create mode 100644 src/views/system/user/RoleForm.vue
create mode 100644 src/views/system/user/utils.ts
diff --git a/src/views/system/user/AddForm.vue b/src/views/system/user/AddForm.vue
new file mode 100644
index 00000000..12dc1737
--- /dev/null
+++ b/src/views/system/user/AddForm.vue
@@ -0,0 +1,223 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/user/ImportForm.vue b/src/views/system/user/ImportForm.vue
new file mode 100644
index 00000000..b029730a
--- /dev/null
+++ b/src/views/system/user/ImportForm.vue
@@ -0,0 +1,153 @@
+
+
+
+
+ 将文件拖到此处,或点击上传
+
+
+
+ 是否更新已经存在的用户数据
+
+
+
仅允许导入xls、xlsx格式文件。
+
下载模板
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/user/RoleForm.vue b/src/views/system/user/RoleForm.vue
new file mode 100644
index 00000000..694e5eeb
--- /dev/null
+++ b/src/views/system/user/RoleForm.vue
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 542ae2f0..ce034c4e 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -1,307 +1,325 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ dataFormater(row.deptId) }}
-
-
-
-
-
- {{ post === postObj.id ? postObj.name : '' }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ userRole.username }}
-
-
- {{ userRole.nickname }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 将文件拖到此处,或点击上传
-
- 请上传 .xls , .xlsx 标准格式文件
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/user/utils.ts b/src/views/system/user/utils.ts
new file mode 100644
index 00000000..3eb97aba
--- /dev/null
+++ b/src/views/system/user/utils.ts
@@ -0,0 +1,44 @@
+export const parseTime = (time) => {
+ if (!time) {
+ return null
+ }
+ const format = '{y}-{m}-{d} {h}:{i}:{s}'
+ let date
+ if (typeof time === 'object') {
+ date = time
+ } else {
+ if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
+ time = parseInt(time)
+ } else if (typeof time === 'string') {
+ time = time
+ .replace(new RegExp(/-/gm), '/')
+ .replace('T', ' ')
+ .replace(new RegExp(/\.[\d]{3}/gm), '')
+ }
+ if (typeof time === 'number' && time.toString().length === 10) {
+ time = time * 1000
+ }
+ date = new Date(time)
+ }
+ const formatObj = {
+ y: date.getFullYear(),
+ m: date.getMonth() + 1,
+ d: date.getDate(),
+ h: date.getHours(),
+ i: date.getMinutes(),
+ s: date.getSeconds(),
+ a: date.getDay()
+ }
+ const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
+ let value = formatObj[key]
+ // Note: getDay() returns 0 on Sunday
+ if (key === 'a') {
+ return ['日', '一', '二', '三', '四', '五', '六'][value]
+ }
+ if (result.length > 0 && value < 10) {
+ value = '0' + value
+ }
+ return value || 0
+ })
+ return time_str
+}
\ No newline at end of file
From d9e79250e2de6afe1c04bb26893510b1f91b7b5a Mon Sep 17 00:00:00 2001
From: fessor <352475718@qq.com>
Date: Mon, 27 Mar 2023 02:12:18 +0000
Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: fessor <352475718@qq.com>
---
src/views/system/user/AddForm.vue | 2 +-
src/views/system/user/ImportForm.vue | 2 +-
src/views/system/user/RoleForm.vue | 2 +-
src/views/system/user/utils.ts | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/views/system/user/AddForm.vue b/src/views/system/user/AddForm.vue
index 12dc1737..9a4d6029 100644
--- a/src/views/system/user/AddForm.vue
+++ b/src/views/system/user/AddForm.vue
@@ -220,4 +220,4 @@ const cancel = () => {
defineExpose({
resetForm
})
-
\ No newline at end of file
+
diff --git a/src/views/system/user/ImportForm.vue b/src/views/system/user/ImportForm.vue
index b029730a..4bfa4631 100644
--- a/src/views/system/user/ImportForm.vue
+++ b/src/views/system/user/ImportForm.vue
@@ -150,4 +150,4 @@ const closeDialog = () => {
const submitFileForm = () => {
uploadRef.value?.submit()
}
-
\ No newline at end of file
+
diff --git a/src/views/system/user/RoleForm.vue b/src/views/system/user/RoleForm.vue
index 694e5eeb..cb5603fe 100644
--- a/src/views/system/user/RoleForm.vue
+++ b/src/views/system/user/RoleForm.vue
@@ -87,4 +87,4 @@ const submit = async () => {
}
-
\ No newline at end of file
+
diff --git a/src/views/system/user/utils.ts b/src/views/system/user/utils.ts
index 3eb97aba..6473c2c9 100644
--- a/src/views/system/user/utils.ts
+++ b/src/views/system/user/utils.ts
@@ -41,4 +41,4 @@ export const parseTime = (time) => {
return value || 0
})
return time_str
-}
\ No newline at end of file
+}
From 3dbcbf4cf06e0b06a2599488b771cf4fa605e53b Mon Sep 17 00:00:00 2001
From: fessor <352475718@qq.com>
Date: Mon, 27 Mar 2023 02:18:41 +0000
Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9api=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E4=B8=8E=E5=91=BD=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: fessor <352475718@qq.com>
---
src/api/system/permission/index.ts | 2 +-
src/api/system/user/index.ts | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/api/system/permission/index.ts b/src/api/system/permission/index.ts
index aa355dfc..c529f884 100644
--- a/src/api/system/permission/index.ts
+++ b/src/api/system/permission/index.ts
@@ -37,6 +37,6 @@ export const listUserRolesApi = async (userId: number) => {
}
// 赋予用户角色
-export const aassignUserRoleApi = async (data: PermissionAssignUserRoleReqVO) => {
+export const assignUserRoleApi = async (data: PermissionAssignUserRoleReqVO) => {
return await request.post({ url: '/system/permission/assign-user-role', data })
}
diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts
index 058b320a..e488c0d7 100644
--- a/src/api/system/user/index.ts
+++ b/src/api/system/user/index.ts
@@ -43,12 +43,12 @@ export const getUserApi = (id: number) => {
}
// 新增用户
-export const createUserApi = (data: UserVO) => {
+export const createUserApi = (data: UserVO | Recordable) => {
return request.post({ url: '/system/user/create', data })
}
// 修改用户
-export const updateUserApi = (data: UserVO) => {
+export const updateUserApi = (data: UserVO | Recordable) => {
return request.put({ url: '/system/user/update', data })
}
From 4563f6a947d4287768a74da28a812cc70ea25cfa Mon Sep 17 00:00:00 2001
From: fessor <352475718@qq.com>
Date: Mon, 27 Mar 2023 04:32:33 +0000
Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20src/?=
=?UTF-8?q?views/system/user/user.data.ts?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/system/user/user.data.ts | 137 -----------------------------
1 file changed, 137 deletions(-)
delete mode 100644 src/views/system/user/user.data.ts
diff --git a/src/views/system/user/user.data.ts b/src/views/system/user/user.data.ts
deleted file mode 100644
index 3a702c04..00000000
--- a/src/views/system/user/user.data.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
-// 国际化
-const { t } = useI18n()
-const validateMobile = (rule: any, value: any, callback: any) => {
- const reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
- if (value === '') {
- callback(new Error('请输入联系手机'))
- } else {
- if (!reg.test(value)) {
- callback(new Error('请输入正确的手机号'))
- } else {
- callback()
- }
- }
-}
-// 表单校验
-export const rules = reactive({
- username: [required],
- nickname: [required],
- password: [required],
- deptId: [required],
- email: [
- { required: true, message: t('profile.rules.mail'), trigger: 'blur' },
- {
- type: 'email',
- message: t('profile.rules.truemail'),
- trigger: ['blur', 'change']
- }
- ],
- status: [required],
- mobile: [
- required,
- {
- len: 11,
- trigger: 'blur',
- message: '请输入正确的手机号码'
- },
- { validator: validateMobile, trigger: 'blur' }
- ]
-})
-// crudSchemas
-const crudSchemas = reactive({
- primaryKey: 'id',
- primaryType: 'id',
- primaryTitle: '用户编号',
- action: true,
- actionWidth: '200px',
- columns: [
- {
- title: '用户账号',
- field: 'username',
- isSearch: true
- },
- {
- title: '用户密码',
- field: 'password',
- isDetail: false,
- isTable: false,
- form: {
- component: 'InputPassword'
- }
- },
- {
- title: '用户' + t('profile.user.sex'),
- field: 'sex',
- dictType: DICT_TYPE.SYSTEM_USER_SEX,
- dictClass: 'number',
- table: { show: false }
- },
- {
- title: '用户昵称',
- field: 'nickname'
- },
- {
- title: '用户邮箱',
- field: 'email'
- },
- {
- title: '手机号码',
- field: 'mobile',
- isSearch: true
- },
- {
- title: '部门',
- field: 'deptId',
- isTable: false
- },
- {
- title: '岗位',
- field: 'postIds',
- isTable: false
- },
- {
- title: t('common.status'),
- field: 'status',
- dictType: DICT_TYPE.COMMON_STATUS,
- dictClass: 'number',
- isSearch: true,
- table: {
- slots: {
- default: 'status_default'
- }
- }
- },
- {
- title: '最后登录时间',
- field: 'loginDate',
- formatter: 'formatDate',
- isForm: false
- },
- {
- title: '最后登录IP',
- field: 'loginIp',
- isTable: false,
- isForm: false
- },
- {
- title: t('form.remark'),
- field: 'remark',
- isTable: false
- },
- {
- title: t('common.createTime'),
- field: 'createTime',
- formatter: 'formatDate',
- isTable: false,
- isForm: false,
- search: {
- show: true,
- itemRender: {
- name: 'XDataTimePicker'
- }
- }
- }
- ]
-})
-export const { allSchemas } = useVxeCrudSchemas(crudSchemas)