diff --git a/frontend/.env.development b/frontend/.env.development index 1573e27..403fe95 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -18,5 +18,7 @@ VITE_PWA=false VITE_API_URL=/api # 开发环境跨域代理,支持配置多个 - VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]//awen -#VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]//zwen \ No newline at end of file + +VITE_PROXY=[["/api","http://192.168.1.122:18092/"]] +# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]] +# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]] diff --git a/frontend/src/api/system/dictionary/dictData/index.ts b/frontend/src/api/system/dictionary/dictData/index.ts index e69de29..afa9c7c 100644 --- a/frontend/src/api/system/dictionary/dictData/index.ts +++ b/frontend/src/api/system/dictionary/dictData/index.ts @@ -0,0 +1,29 @@ +import http from '@/api' +import {type Dict} from '@/api/system/dictionary/interface' +import type {ResultData} from "@/api/interface"; + +//获取字典数据 +export const getDictDataListByTypeId = (params: Dict.ReqDictDataParams) => { + return http.post(`/dictData/listByTypeId`, params) +} + +//添加字典数据 +export const addDictData = (params: Dict.ResDictData) => { + return http.post(`/dictData/add`, params) +} + +//编辑字典数据 +export const updateDictData = (params: Dict.ResDictData) => { + return http.post(`/dictData/update`, params) +} + +//删除字典数据 +export const deleteDictData = (params: string[]) => { + return http.post(`/dictData/delete`, params) +} + +export const getDicDataById = (params: string) => { + return http.post('/dictData/getDicDataById', params) +} + + diff --git a/frontend/src/api/system/dictionary/dictExample.ts b/frontend/src/api/system/dictionary/dictExample.ts deleted file mode 100644 index 16a4145..0000000 --- a/frontend/src/api/system/dictionary/dictExample.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { type Dict } from "@/api/system/dictionary/interface"; - -export const dictTypeList: Dict.ResDictType[] = [ - { - id: "1", - name: "用户性别", - code: "EXAMPLE_CODE1", - sort: 100, - openLevel: 1, - openDescribe: 1, - remark: "示例描述示例描述示例描述12231", - state: 1, - createBy: "admin", - createTime: "2023-10-01 12:00:00", - updateBy: "admin", - updateTime: "2023-10-12 14:40:00", - }, - { - id: "231", - name: "菜单状态", - code: "EXAMPLE_CODE2", - sort: 100, - openLevel: 1, - openDescribe: 1, - remark: "示例描述示例描述示例描述11133", - state: 0, - createBy: "admin", - createTime: "2023-10-01 12:00:00", - updateBy: "admin", - updateTime: "2023-10-10 12:00:00", - }, - { - id: "33", - name: "系统开关", - code: "EXAMPLE_CODE3", - sort: 100, - openLevel: 1, - openDescribe: 1, - remark: "示例描述示例描述示例描述11144", - state: 1, - createBy: "admin", - createTime: "2023-10-01 12:00:00", - updateBy: "admin", - updateTime: "2023-10-10 12:00:00", - }, -]; - -export const dictDataList: Dict.ResDictData[] = [ - { - id: "210", - typeId: "101", - name: "字典项1", - code: "EXAMPLE_00111", - sort:100, - level: 1, - algoDescribe: null, - value: "字典值1", - state: 1, - createBy: "admin", - createTime: "2023-10-01 12:00:00", - updateBy: "admin", - updateTime: "2023-10-01 14:43:03", - }, - { - id: "2210", - typeId: "101", - name: "字典项2", - code: "EXAMPLE_00121", - sort:100, - level: 2, - algoDescribe: null, - value: "字典值2", - state: 1, - createBy: "admin", - createTime: "2023-10-03 12:00:00", - updateBy: "admin", - updateTime: "2023-10-05 14:43:03", - }, - { - id: "212", - typeId: "101", - name: "字典项3", - code: "EXAMPLE_00141", - sort:100, - level: 3, - algoDescribe: null, - value: "字典值3", - state: 0, - createBy: "admin", - createTime: "2023-10-01 11:00:00", - updateBy: "admin", - updateTime: "2023-10-05 16:43:03", - }, - { - id: "210", - typeId: "101", - name: "字典项4", - code: "EXAMPLE_00311", - sort:100, - level: null, - algoDescribe: null, - value: "字典值4", - state: 0, - createBy: "admin", - createTime: "2023-10-03 12:40:00", - updateBy: "admin", - updateTime: "2023-10-04 14:43:03", - }, - { - id: "217", - typeId: "101", - name: "字典项5", - code: "EXAMPLE_00341", - sort:100, - level: undefined, - algoDescribe: null, - value: "字典值5", - state: 1, - createBy: "admin", - createTime: "2023-10-06 12:45:03", - updateBy: "admin", - updateTime: "2023-10-07 19:37:03", - }, - { - id: "237", - typeId: "101", - name: "字典项6", - code: "EXAMPLE_00318", - sort:100, - level: 0, - algoDescribe: null, - value: "字典值6", - state: 1, - createBy: "admin", - createTime: "2023-10-16 10:45:03", - updateBy: "admin", - updateTime: "2023-10-17 19:37:03", - }, -]; diff --git a/frontend/src/api/system/dictionary/index.ts b/frontend/src/api/system/dictionary/index.ts deleted file mode 100644 index 1a98d7b..0000000 --- a/frontend/src/api/system/dictionary/index.ts +++ /dev/null @@ -1,70 +0,0 @@ -import http from "@/api"; -import { ADMIN as rePrefix } from "@/api/config/serviceName"; -import { type Dict } from "@/api/system/dictionary/interface"; - -//获取字典类型 -export const getDictTypeList = (params: Dict.ReqDictTypeParams) => { - return http.post(`${rePrefix}/dict/list`, params); -}; - -//添加字典类型 -export const addDictType = (params: Dict.ReqDictTypeParams) => { - return http.post(`${rePrefix}/dict/add`,params); -}; - -//删除字典类型 -export const deleteDictType = (params: { id: string[] }) => { - return http.post(`${rePrefix}/dict/delete`, { data: params }); -}; - -//编辑字典类型 -export const updateDictType = (params: Dict.ReqDictTypeParams) => { - return http.post(`${rePrefix}/dict/update`, params); -}; - -//导出字典类型 -export const exportDictType = (params: Dict.ResDictType) => { - return http.download(`${rePrefix}/dict/export`, params); -}; - -//批量添加字典类型 -export const batchAddDictType = (params: FormData) => { - return http.post(`${rePrefix}/dict/import`, params); -}; - - - - - -//获取字典数据 -export const getDictDataList = (params: Dict.ReqDictDataParams) => { - return http.post(`${rePrefix}/dict-data/list`, params); -}; - -//添加字典数据 -export const addDictData = (params: Dict.ReqDictDataParams) => { - return http.post(`${rePrefix}/dict-data/add`, params); -}; - -//删除字典数据 -export const deleteDictData = (params: { id: string[] }) => { - return http.post(`${rePrefix}/dict-data/delete`, { data: params }); -}; - -//编辑字典数据 -export const updateDictData = (params: Dict.ReqDictDataParams) => { - return http.post(`${rePrefix}/dict-data/update`, params); -}; - -//导出字典数据 -export const exportDictData = (params: Dict.ResDictData) => { - return http.download(`${rePrefix}/dict-data/export`, params); -}; - -//批量添加字典数据 -export const batchAddDictData = (params: FormData) => { - return http.post(`${rePrefix}/dict-data/import`, params); -}; - - - diff --git a/frontend/src/api/system/dictionary/interface/index.ts b/frontend/src/api/system/dictionary/interface/index.ts index db8b700..6b6fec8 100644 --- a/frontend/src/api/system/dictionary/interface/index.ts +++ b/frontend/src/api/system/dictionary/interface/index.ts @@ -65,6 +65,7 @@ export namespace Dict { level?: number | null; // 事件等级:0-普通;1-中等;2-严重 (默认为0) algoDescribe?: number | null; // 与高级算法内部Id描述对应 value?: string | null; // 字典针对电压等级 + dictValue?:string|null; state: number; // 状态:0-删除 1-正常 createBy?: string | null; // 创建用户 createTime?: string | null; // 创建时间 diff --git a/frontend/src/api/user/interface/index.ts b/frontend/src/api/user/interface/index.ts index 2651a06..8fb2052 100644 --- a/frontend/src/api/user/interface/index.ts +++ b/frontend/src/api/user/interface/index.ts @@ -18,29 +18,21 @@ export namespace Login { // 用户管理模块 export namespace User { - // 用户列表 - export interface ResUserList { - id: string; //用户ID,作为唯一标识 - username: string; //用户名 + // 用户接口 + export interface UserBO { + id?: string; //用户ID,作为唯一标识 + name: string; //用户名(别名) + loginName: string;//登录名 password: string; //密码 - realname: string; //真实姓名 - status: number; //用户状态 - rolename: string; //角色名称 - } - - export interface ReqUserParams extends ReqPage { - id: string; //用户ID,作为唯一标识 - username: string; //用户名 - password: string; //密码 - realname: string; //真实姓名 - status: number; //用户状态 - rolename: string; //角色名称 - } - - export interface ResStatus { - userLabel: string; - userValue: number; + phone?: string; //手机号 + email?: string; //邮箱 + loginTime?: string;//最后一次登录时间 + loginErrorTimes: number;//登录错误次数 + lockTime?: string; //用户密码错误锁定时间 } + // 用户+分页 + export interface ReqUserParams extends ReqPage,UserBO { + } } diff --git a/frontend/src/api/user/user.ts b/frontend/src/api/user/user.ts index a1302ca..be38090 100644 --- a/frontend/src/api/user/user.ts +++ b/frontend/src/api/user/user.ts @@ -8,7 +8,7 @@ import http from '@/api' */ // 获取用户列表 export const getUserList = (params: User.ReqUserParams) => { - return http.post>(`${rePrefix}/user/list`, params) + return http.post>(`/user/list`, params) } // 获取树形用户列表 @@ -17,8 +17,8 @@ export const getUserList = (params: User.ReqUserParams) => { // } // 新增用户 -export const addUser = (params: { id: string }) => { - return http.post(`${rePrefix}/user/add`, params) +export const addUser = (params: User.UserBO) => { + return http.post(`/user/add`, params) } // 批量添加用户 @@ -27,24 +27,24 @@ export const BatchAddUser = (params: FormData) => { } // 编辑用户 -export const editUser = (params: { id: string }) => { - return http.post(`${rePrefix}/user/edit`, params) +export const editUser = (params: User.UserBO) => { + return http.post(`/user/edit`, params) } // 删除用户 export const deleteUser = (params: { id: string[] }) => { - return http.post(`${rePrefix}/user/delete`, params) + return http.post(`/user/delete`, params) } // 切换用户状态 -export const changeUserStatus = (params: { id: string; status: number }) => { - return http.post(`${rePrefix}/user/change`, params) -} +// export const changeUserStatus = (params: { id: string; status: number }) => { +// return http.post(`${rePrefix}/user/change`, params) +// } // 重置用户密码 -export const resetUserPassWord = (params: { id: string }) => { - return http.post(`${rePrefix}/user/rest_password`, params) -} +// export const resetUserPassWord = (params: { id: string }) => { +// return http.post(`${rePrefix}/user/rest_password`, params) +// } // 导出用户数据 export const exportUserInfo = (params: User.ReqUserParams) => { @@ -52,6 +52,6 @@ export const exportUserInfo = (params: User.ReqUserParams) => { } // 获取用户状态字典 -export const getUserStatus = () => { - return http.get(`${rePrefix}/user/status`) -} +// export const getUserStatus = () => { +// return http.get(`${rePrefix}/user/status`) +// } diff --git a/frontend/src/api/user/userData.ts b/frontend/src/api/user/userData.ts index d22e8ba..3c777ac 100644 --- a/frontend/src/api/user/userData.ts +++ b/frontend/src/api/user/userData.ts @@ -15,118 +15,118 @@ const data = [ 'status': 1, 'rolename': '管理员', }, - { - 'id': '652286556713195552', - 'username': 'operator_A', - 'password': '12345678', - 'realname': '潘霞', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '373930342176416776', - 'username': 'operator_B', - 'password': '12345678', - 'realname': '郝秀英', - 'status': 0, - 'rolename': '操作员', - }, - { - 'id': '429621442453555775', - 'username': 'operator_C', - 'password': '12345678', - 'realname': '吕洋', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '387231964476618937', - 'username': 'operator_D', - 'password': '12345678', - 'realname': '江磊', - 'status': 0, - 'rolename': '操作员', - }, - { - 'id': '604013348875476647', - 'username': 'operator_E', - 'password': '12345678', - 'realname': '姚静', - 'status': 0, - 'rolename': '操作员', - }, - { - 'id': '028222596330483467', - 'username': 'operator_F', - 'password': '12345678', - 'realname': '龙艳', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '739427478368274267', - 'username': 'operator_G', - 'password': '12345678', - 'realname': '武涛', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '448686878612127243', - 'username': 'operator_H', - 'password': '12345678', - 'realname': '孙芳', - 'status': 0, - 'rolename': '操作员', - }, - { - 'id': '448686878612127244', - 'username': 'operator_I', - 'password': '12345678', - 'realname': '孙芳1', - 'status': 0, - 'rolename': '操作员', - }, - { - 'id': '448686878612127245', - 'username': 'operator_J', - 'password': '12345678', - 'realname': '孙芳2', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '448686878612127245', - 'username': 'operator_J', - 'password': '12345678', - 'realname': '孙芳2', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '448686878612127245', - 'username': 'operator_J', - 'password': '12345678', - 'realname': '孙芳2', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '448686878612127245', - 'username': 'operator_J', - 'password': '12345678', - 'realname': '孙芳2', - 'status': 1, - 'rolename': '操作员', - }, - { - 'id': '448686878612127245', - 'username': 'operator_J', - 'password': '12345678', - 'realname': '孙芳2', - 'status': 1, - 'rolename': '操作员', - } + // { + // 'id': '652286556713195552', + // 'username': 'operator_A', + // 'password': '12345678', + // 'realname': '潘霞', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '373930342176416776', + // 'username': 'operator_B', + // 'password': '12345678', + // 'realname': '郝秀英', + // 'status': 0, + // 'rolename': '操作员', + // }, + // { + // 'id': '429621442453555775', + // 'username': 'operator_C', + // 'password': '12345678', + // 'realname': '吕洋', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '387231964476618937', + // 'username': 'operator_D', + // 'password': '12345678', + // 'realname': '江磊', + // 'status': 0, + // 'rolename': '操作员', + // }, + // { + // 'id': '604013348875476647', + // 'username': 'operator_E', + // 'password': '12345678', + // 'realname': '姚静', + // 'status': 0, + // 'rolename': '操作员', + // }, + // { + // 'id': '028222596330483467', + // 'username': 'operator_F', + // 'password': '12345678', + // 'realname': '龙艳', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '739427478368274267', + // 'username': 'operator_G', + // 'password': '12345678', + // 'realname': '武涛', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127243', + // 'username': 'operator_H', + // 'password': '12345678', + // 'realname': '孙芳', + // 'status': 0, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127244', + // 'username': 'operator_I', + // 'password': '12345678', + // 'realname': '孙芳1', + // 'status': 0, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127245', + // 'username': 'operator_J', + // 'password': '12345678', + // 'realname': '孙芳2', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127245', + // 'username': 'operator_J', + // 'password': '12345678', + // 'realname': '孙芳2', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127245', + // 'username': 'operator_J', + // 'password': '12345678', + // 'realname': '孙芳2', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127245', + // 'username': 'operator_J', + // 'password': '12345678', + // 'realname': '孙芳2', + // 'status': 1, + // 'rolename': '操作员', + // }, + // { + // 'id': '448686878612127245', + // 'username': 'operator_J', + // 'password': '12345678', + // 'realname': '孙芳2', + // 'status': 1, + // 'rolename': '操作员', + // } ] diff --git a/frontend/src/components/ProTable/components/Pagination.vue b/frontend/src/components/ProTable/components/Pagination.vue index 3bd67fe..5dafd73 100644 --- a/frontend/src/components/ProTable/components/Pagination.vue +++ b/frontend/src/components/ProTable/components/Pagination.vue @@ -23,8 +23,14 @@ interface Pageable { total: number; } +interface ResPageable { + current: number; + size: number; + total: number; +} + interface PaginationProps { - pageable: Pageable; + pageable: ResPageable; handleSizeChange: (size: number) => void; handleCurrentChange: (currentPage: number) => void; } diff --git a/frontend/src/components/ProTable/index.vue b/frontend/src/components/ProTable/index.vue index 5c30c26..f556b79 100644 --- a/frontend/src/components/ProTable/index.vue +++ b/frontend/src/components/ProTable/index.vue @@ -94,7 +94,7 @@ @@ -173,6 +173,7 @@ const { selectionChange, selectedList, selectedListIds, isSelected } = useSelect const { tableData, pageable, + resPageable, searchParam, searchInitParam, getTableList, @@ -190,7 +191,7 @@ const clearSelection = () => tableRef.value!.clearSelection() onMounted(() => { dragSort() props.requestAuto && getTableList() - props.data && (pageable.value.total = props.data.length) + props.data && (resPageable.value.total = props.data.length) }) // 处理表格数据 @@ -198,8 +199,8 @@ const processTableData = computed(() => { if (!props.data) return tableData.value if (!props.pagination) return props.data return props.data.slice( - (pageable.value.pageNum - 1) * pageable.value.pageSize, - pageable.value.pageSize * pageable.value.pageNum, + (resPageable.value.current - 1) * resPageable.value.size, + resPageable.value.size * resPageable.value.current, ) }) diff --git a/frontend/src/hooks/interface/index.ts b/frontend/src/hooks/interface/index.ts index ac5a300..55b12a2 100644 --- a/frontend/src/hooks/interface/index.ts +++ b/frontend/src/hooks/interface/index.ts @@ -4,9 +4,17 @@ export namespace Table { pageSize: number; total: number; } + + export interface ResPageable { + current: number; + size: number; + total: number; + } + export interface StateProps { tableData: any[]; pageable: Pageable; + resPageable: ResPageable; searchParam: { [key: string]: any; }; diff --git a/frontend/src/hooks/useTable.ts b/frontend/src/hooks/useTable.ts index 49aa741..c64c5c8 100644 --- a/frontend/src/hooks/useTable.ts +++ b/frontend/src/hooks/useTable.ts @@ -20,6 +20,15 @@ export const useTable = ( tableData: [], // 分页数据 pageable: { + // 当前页数 + pageNum: 1, + // 每页显示条数 + pageSize: 10, + // 总条数 + total: 0, + }, + // 响应分页 + resPageable: { // 当前页数 current: 1, // 每页显示条数 @@ -71,9 +80,9 @@ export const useTable = ( state.tableData = isPageable ? data.records : data; // 解构后台返回的分页数据 (如果有分页更新分页信息) if (isPageable) { - state.pageable.total = data.total; - state.pageable.current = data.current; - state.pageable.size = data.size; + state.resPageable.total = data.total; + state.resPageable.current = data.current; + state.resPageable.size = data.size; } } catch (error) { requestError && requestError(error); diff --git a/frontend/src/hooks/useViewSize.ts b/frontend/src/hooks/useViewSize.ts index 5ab9197..0eb4e53 100644 --- a/frontend/src/hooks/useViewSize.ts +++ b/frontend/src/hooks/useViewSize.ts @@ -3,17 +3,16 @@ import { ref } from 'vue' export const useViewSize = () => { const popupBaseView = ref(null) - const viewWidth = ref("0") - const viewHeight = ref("0") - const unit = 'px' + const viewWidth = ref(0) + const viewHeight = ref(0) /** * 更新宽和高的数据 */ const updateDimensions = () => { if (popupBaseView.value) { - viewWidth.value = popupBaseView.value.offsetWidth + unit - viewHeight.value = popupBaseView.value.offsetHeight + unit + viewWidth.value = popupBaseView.value.offsetWidth + viewHeight.value = popupBaseView.value.offsetHeight } } diff --git a/frontend/src/views/authority/role/components/rolePopup.vue b/frontend/src/views/authority/role/components/rolePopup.vue index c6270bd..34dab98 100644 --- a/frontend/src/views/authority/role/components/rolePopup.vue +++ b/frontend/src/views/authority/role/components/rolePopup.vue @@ -100,26 +100,26 @@ if(openType === "add") { addRole(data).then(res => { - if(res.code === "200") - { + // if(res.code === "200") + // { ElMessage.success(res.message) getTableList() - } - else - ElMessage.error(res.message) + // } + // else + // ElMessage.error(res.message) }) } if(openType === "edit") { editRole(data).then(res => { - if(res.code === "200") - { + // if(res.code === "200") + // { ElMessage.success(res.message) getTableList() - } - else - ElMessage.error(res.message) + // } + // else + // ElMessage.error(res.message) }) } diff --git a/frontend/src/views/authority/role/index.vue b/frontend/src/views/authority/role/index.vue index 549982f..dd0692f 100644 --- a/frontend/src/views/authority/role/index.vue +++ b/frontend/src/views/authority/role/index.vue @@ -88,10 +88,10 @@ const proTable = ref() // 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行 const dataCallback = (data: any) => { return { - list: data.list, + records: data.list, total: data.total, - pageNum: data.pageNum, - pageSize: data.pageSize, + current: data.pageNum, + size: data.pageSize, } } diff --git a/frontend/src/views/authority/user/components/userPopup.vue b/frontend/src/views/authority/user/components/userPopup.vue new file mode 100644 index 0000000..c97acda --- /dev/null +++ b/frontend/src/views/authority/user/components/userPopup.vue @@ -0,0 +1,142 @@ + + + \ No newline at end of file diff --git a/frontend/src/views/authority/user/components/userUnit.vue b/frontend/src/views/authority/user/components/userUnit.vue deleted file mode 100644 index 95334b7..0000000 --- a/frontend/src/views/authority/user/components/userUnit.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - \ No newline at end of file diff --git a/frontend/src/views/authority/user/index.vue b/frontend/src/views/authority/user/index.vue index e132d77..8998194 100644 --- a/frontend/src/views/authority/user/index.vue +++ b/frontend/src/views/authority/user/index.vue @@ -3,12 +3,14 @@ + @@ -37,7 +41,7 @@ import { useDownload } from '@/hooks/useDownload' import { useAuthButtons } from '@/hooks/useAuthButtons' import ProTable from '@/components/ProTable/index.vue' - import userUnit from './components/userUnit.vue' + import userPopup from './components/userPopup.vue' import ImportExcel from '@/components/ImportExcel/index.vue' import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface' @@ -50,28 +54,25 @@ BatchAddUser, editUser, deleteUser, - changeUserStatus, - exportUserInfo, - getUserStatus, } from '@/api/user/user' - const {userUnitVisible,userUnitTitle,userUnitData} = useCount(); + const {userPopupVisible,userPopupTitle,userPopupData} = useCount(); function useCount() { - const userUnitVisible = ref(false) - const userUnitTitle = ref() - const userUnitData = ref({} as User.ResUserList) - return {userUnitVisible,userUnitTitle,userUnitData}; + const userPopupVisible = ref(false) + const userPopupTitle = ref() + const userPopupData = ref({} as User.UserBO) + return {userPopupVisible,userPopupTitle,userPopupData}; } const dictStore = useDictStore() - - const userData = userDataList + let openType = '' + // const userData = userDataList // ProTable 实例 const proTable = ref() // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据) - const initParam = reactive({ type: 1 }) + // const initParam = reactive({ type: 1 }) // dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段 // 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行 @@ -79,6 +80,8 @@ return { list: data.list, total: data.total, + pageNum: data.pageNum, + pageSize: data.pageSize, } } @@ -96,102 +99,116 @@ const { BUTTONS } = useAuthButtons() // 表格配置项 - const columns = reactive[]>([ + const columns = reactive[]>([ { type: 'selection', fixed: 'left', width: 70 }, { type: 'index', fixed: 'left', width: 70, label: '序号' }, { - prop: 'username', + prop: 'name', label: '用户名', search: { el: 'input' }, minWidth: 150, }, { - prop: 'realname', - label: '真实姓名', + prop: 'loginName', + label: '登录名', + search: { el: 'input' }, minWidth: 180, }, { - prop: 'rolename', - label: '角色类型', + prop: 'password', + label: '密码', minWidth: 180, }, { - prop: 'status', - - label: '状态', - enum: dictStore.getDictData('status'), - search: { el: 'tree-select', props: { filterable: true } }, - minWidth: 100, - fieldNames: { label: 'label', value: 'code' }, - render: scope => { - return ( - {scope.row.status ? '启用' : '禁用'} - ) - }, + prop: 'phone', + label: '手机号', + minWidth: 180, + }, + { + prop: 'email', + label: '邮箱', + minWidth: 180, + }, + { + prop: 'loginTime', + label: '最后一次登录时间', + minWidth: 180, + }, + { + prop: 'loginErrorTimes', + label: '登录错误次数', + minWidth: 180, + }, + { + prop: 'lockTime', + label: '用户密码错误锁定时间', + minWidth: 180, }, { prop: 'operation', label: '操作', fixed: 'right', width: 330 }, ]) - // 删除角色信息 - const deleteAccount = async (params: User.ResUserList) => { - await useHandleData(deleteUser, { id: [params.id] }, `删除【${params.rolename}】角色`) + // 删除用户信息 + const deleteAccount = async (params: User.UserBO) => { + await useHandleData(deleteUser, { id: [params.id] }, `删除【${params.name}】用户`) proTable.value?.getTableList() } // 批量删除角色信息 const batchDelete = async (id: string[]) => { - await useHandleData(deleteUser, { id }, '删除所选角色信息') + await useHandleData(deleteUser, { id }, '删除所选用户信息') proTable.value?.clearSelection() proTable.value?.getTableList() } - // 切换角色状态 - const changeStatus = async (row: User.ResUserList) => { - await useHandleData(changeUserStatus, { - id: row.id, - status: row.status == 1 ? 0 : 1, - }, `切换【${row.rolename}】角色状态`) - proTable.value?.getTableList() - } // 导出角色列表 - const downloadFile = async () => { - ElMessageBox.confirm('确认导出角色数据?', '温馨提示', { type: 'warning' }).then(() => - useDownload(exportUserInfo, '角色列表', proTable.value?.searchParam), - ) - } + // const downloadFile = async () => { + // ElMessageBox.confirm('确认导出角色数据?', '温馨提示', { type: 'warning' }).then(() => + // useDownload(exportUserInfo, '角色列表', proTable.value?.searchParam), + // ) + // } // 批量添加角色 const dialogRef = ref | null>(null) const batchAdd = () => { - const params = { - title: '角色', - tempApi: exportUserInfo, - importApi: BatchAddUser, - getTableList: proTable.value?.getTableList, - } - dialogRef.value?.acceptParams(params) + // const params = { + // title: '角色', + // tempApi: exportUserInfo, + // importApi: BatchAddUser, + // getTableList: proTable.value?.getTableList, + // } + // dialogRef.value?.acceptParams(params) } // 打开 drawer(新增、查看、编辑) - const openDrawer = (title: string, row: Partial = {}) => { + const openDrawer = (title: string, row: Partial = {}) => { if(title === "查看用户" ||title === "新增用户" || title === '编辑用户' ) { - userUnitVisible.value = true - userUnitTitle.value = title + if (title === '查看用户') + openType = 'view' + else if (title === '新增用户') + openType = 'add' + else if (title === '编辑用户') + openType = 'edit' + + userPopupVisible.value = true + userPopupTitle.value = title if (row) { // 确保 row 的所有属性都符合 User.ResUserList 的要求 - const safeRow: User.ResUserList = { + const safeRow: User.UserBO = { id: row.id || '', - username: row.username || '', + name: row.name || '', + loginName: row.loginName || '', password: row.password || '', - realname: row.realname || '', - status: row.status || 0, - rolename: row.rolename || '', + phone: row.phone || '', + email: row.email || '', + loginTime: row.loginTime || '', + loginErrorTimes: row.loginErrorTimes || 0, + lockTime: row.lockTime || '', }; - userUnitData.value = safeRow; + userPopupData.value = safeRow; } } diff --git a/frontend/src/views/demo/proTable/open.vue b/frontend/src/views/demo/proTable/open.vue index 308b5dc..f32e1d2 100644 --- a/frontend/src/views/demo/proTable/open.vue +++ b/frontend/src/views/demo/proTable/open.vue @@ -3,11 +3,11 @@ -
+
查看 编辑 删除 - 升级为模板 + 升级为模板 diff --git a/frontend/src/views/system/dictionary/data.vue b/frontend/src/views/system/dictionary/data.vue deleted file mode 100644 index 2546342..0000000 --- a/frontend/src/views/system/dictionary/data.vue +++ /dev/null @@ -1,282 +0,0 @@ - - - diff --git a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue new file mode 100644 index 0000000..63faa99 --- /dev/null +++ b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue @@ -0,0 +1,128 @@ + + \ No newline at end of file diff --git a/frontend/src/views/system/dictionary/dictData/index.vue b/frontend/src/views/system/dictionary/dictData/index.vue index e69de29..c1e59e6 100644 --- a/frontend/src/views/system/dictionary/dictData/index.vue +++ b/frontend/src/views/system/dictionary/dictData/index.vue @@ -0,0 +1,139 @@ + + + diff --git a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue index ea60098..7c089c8 100644 --- a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue +++ b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue @@ -8,6 +8,18 @@ + + + + + + + + + + + + @@ -103,8 +115,6 @@ const save = () => { close() // 刷新表格 await props.refreshTable!() - } else { - ElMessage.error('表单验证失败!') } }) } catch (err) { diff --git a/frontend/src/views/system/dictionary/dictType/index.vue b/frontend/src/views/system/dictionary/dictType/index.vue index 29aed39..5176cc9 100644 --- a/frontend/src/views/system/dictionary/dictType/index.vue +++ b/frontend/src/views/system/dictionary/dictType/index.vue @@ -21,34 +21,34 @@
- - + +