From 462c2e2110e542c4d2c168950ee44721ba22c7a2 Mon Sep 17 00:00:00 2001 From: lilinyuan <1084668738@qq.com> Date: Tue, 26 Mar 2024 16:31:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90user=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BC=96=E8=BE=91=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user/user.js | 23 +++- src/views/system/user/add.vue | 235 ++++++++++++++++++++++++++++++++ src/views/system/user/index.vue | 48 ++++++- 3 files changed, 297 insertions(+), 9 deletions(-) create mode 100644 src/views/system/user/add.vue diff --git a/src/api/user/user.js b/src/api/user/user.js index 30d10b5..fcd2c33 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -16,6 +16,22 @@ export const getSubCompOpt = () => { }) } +// 查询角色信息 +export const getRolesOpt = () => { + return request({ + url: '/admin/role/option', + method: 'get', + }) +} + +// 获取岗位下拉 +export const getJobOpt = () => { + return request({ + url: '/admin/job/option', + method: 'get', + }) +} + export const getUserList = (params) => { return request({ url: '/admin/user', @@ -23,18 +39,17 @@ export const getUserList = (params) => { params }) } - //获取用户详情 export const getUserDetail = (userId) => { return request({ - url: `/admin/user/info/${userId}`, + url: `/admin/mosr/user/info/${userId}`, method: "get" }); }; // 新增用户 export const addUser = (data) => { return request({ - url: '/admin/user', + url: '/admin/mosr/user', method: 'post', data }) @@ -42,7 +57,7 @@ export const addUser = (data) => { // 修改用户 export const editUser = (data) => { return request({ - url: '/admin/user', + url: '/admin/mosr/user', method: 'put', data }) diff --git a/src/views/system/user/add.vue b/src/views/system/user/add.vue new file mode 100644 index 0000000..af2541d --- /dev/null +++ b/src/views/system/user/add.vue @@ -0,0 +1,235 @@ + + + + + \ No newline at end of file diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 7ec0a9f..674b2a4 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -7,9 +7,11 @@ import Tag from '@/components/Tag.vue' import fvSelect from '@/fvcomponents/fvSelect/index.vue' import { useAuthStore } from '@/stores/userstore.js' -import { getDeptOpt, getSubCompOpt } from '../../../api/user/user'; +import { getDeptOpt, getSubCompOpt } from '../../../api/user/user.js'; +import { ElMessageBox } from 'element-plus'; const authStore = useAuthStore() +const router = useRouter() const searchConfig = ref([ { @@ -117,15 +119,18 @@ const tableConfig = reactive({ currentRender: ({row, index}) => { return (
- 编辑 - 删除 + handleEdit(row)}>编辑 + handleDel(row)}>删除
) } } ], api: '/admin/mosr/user', - params: {} + params: {}, + btns: [ + {name: '新增', type: 'primary', auth: ['admin:user:add'], key: 'add'} + ] }) const init = async () => { @@ -147,7 +152,40 @@ const search = (val) => { tableIns.value.refresh() } -const headBtnClick = (key) => {} +const handleAdd = () => { + router.push({ + path: '/system/useradd', + query: { + isAdd: 1 + } + }) +} + +const handleEdit = (row) => { + router.push({ + path: '/system/useredit', + query: { + id: row.userId + } + }) +} + +const handleDel = (row) => { + ElMessageBox.confirm('确定删除该条数据吗?', '确定删除', { + type: 'warning', + confirmButtonText: '确定', + cancelButtonText: '取消' + }).then(async res => { + // const { code } = await + }).catch(()=>{}) +} + +const headBtnClick = (key) => { + switch(key) { + case 'add': handleAdd() + break; + } +}