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 })
}
diff --git a/src/views/system/user/AddForm.vue b/src/views/system/user/AddForm.vue
new file mode 100644
index 00000000..9a4d6029
--- /dev/null
+++ b/src/views/system/user/AddForm.vue
@@ -0,0 +1,223 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/user/ImportForm.vue b/src/views/system/user/ImportForm.vue
new file mode 100644
index 00000000..4bfa4631
--- /dev/null
+++ b/src/views/system/user/ImportForm.vue
@@ -0,0 +1,153 @@
+
+
+
+
+ 将文件拖到此处,或点击上传
+
+
+
+ 是否更新已经存在的用户数据
+
+
+
仅允许导入xls、xlsx格式文件。
+
下载模板
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/user/RoleForm.vue b/src/views/system/user/RoleForm.vue
new file mode 100644
index 00000000..cb5603fe
--- /dev/null
+++ b/src/views/system/user/RoleForm.vue
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 2bc1893b..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/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)
diff --git a/src/views/system/user/utils.ts b/src/views/system/user/utils.ts
new file mode 100644
index 00000000..6473c2c9
--- /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
+}