+
Date: Fri, 1 Nov 2024 13:49:32 +0800
Subject: [PATCH 4/7] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/.env.development | 4 +-
frontend/src/api/user/interface/index.ts | 34 ++--
frontend/src/api/user/login.ts | 12 +-
frontend/src/api/user/user.ts | 30 ++--
.../authority/role/components/rolePopup.vue | 20 +--
frontend/src/views/authority/role/index.vue | 6 +-
.../authority/user/components/userPopup.vue | 142 ++++++++++++++++
.../authority/user/components/userUnit.vue | 70 --------
frontend/src/views/authority/user/index.vue | 157 ++++++++++--------
.../src/views/machine/testScript/index.vue | 2 +-
10 files changed, 279 insertions(+), 198 deletions(-)
create mode 100644 frontend/src/views/authority/user/components/userPopup.vue
delete mode 100644 frontend/src/views/authority/user/components/userUnit.vue
diff --git a/frontend/.env.development b/frontend/.env.development
index d53b7f8..345f0f4 100644
--- a/frontend/.env.development
+++ b/frontend/.env.development
@@ -18,5 +18,5 @@ VITE_PWA=false
VITE_API_URL=/api
# 开发环境跨域代理,支持配置多个
- VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
-#VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]
\ No newline at end of file
+# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
+VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]
\ No newline at end of file
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/login.ts b/frontend/src/api/user/login.ts
index e363d15..3583e5a 100644
--- a/frontend/src/api/user/login.ts
+++ b/frontend/src/api/user/login.ts
@@ -7,20 +7,20 @@ import http from '@/api'
*/
// 用户登录
export const loginApi = (params: Login.ReqLoginForm) => {
- return http.post(`${rePrefix}/login`, params, { loading: false })
- // return http.post(`/Register1`, params, { loading: false })
+ // return http.post(`${rePrefix}/login`, params, { loading: false })
+ return http.post(`/Register1`, params, { loading: false })
}
// 获取菜单列表
export const getAuthMenuListApi = () => {
- return http.get(`${rePrefix}/menu/list`, {}, { loading: false })
- // return http.post(`/Register2`, {}, { loading: false })
+ // return http.get(`${rePrefix}/menu/list`, {}, { loading: false })
+ return http.post(`/Register2`, {}, { loading: false })
}
// 获取按钮权限
export const getAuthButtonListApi = () => {
- return http.get(`${rePrefix}/auth/buttons`, {}, { loading: false })
- // return http.post(`/Register3`, {}, { loading: false })
+ // return http.get(`${rePrefix}/auth/buttons`, {}, { loading: false })
+ return http.post(`/Register3`, {}, { loading: false })
}
// 用户退出登录
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/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..d8a5067 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,
+ recoards: 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 @@
+
新增
- 导出数据
+ 导出数据
批量删除
@@ -23,11 +25,13 @@
-
@@ -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/machine/testScript/index.vue b/frontend/src/views/machine/testScript/index.vue
index 55643d3..7164e32 100644
--- a/frontend/src/views/machine/testScript/index.vue
+++ b/frontend/src/views/machine/testScript/index.vue
@@ -21,7 +21,7 @@
查看
编辑
删除
- 升级为模板
+ 升级为模板
From 3b1b8d36e2417dfb2d1de29046591e6f22bc2f49 Mon Sep 17 00:00:00 2001
From: hongawen <83944980@qq.com>
Date: Fri, 1 Nov 2024 13:53:50 +0800
Subject: [PATCH 5/7] weitiao
---
frontend/src/views/authority/role/index.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/views/authority/role/index.vue b/frontend/src/views/authority/role/index.vue
index d8a5067..dd0692f 100644
--- a/frontend/src/views/authority/role/index.vue
+++ b/frontend/src/views/authority/role/index.vue
@@ -88,7 +88,7 @@ const proTable = ref()
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
const dataCallback = (data: any) => {
return {
- recoards: data.list,
+ records: data.list,
total: data.total,
current: data.pageNum,
size: data.pageSize,
From 22868b887b3cb69a2db3aa9b6fd6a2dbc55ccd77 Mon Sep 17 00:00:00 2001
From: caozehui <2427765068@qq.com>
Date: Fri, 1 Nov 2024 14:25:25 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E5=BE=AE=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/.env.development | 5 +++--
.../dictionary/dictData/components/dataPopup.vue | 14 +++++++-------
.../src/views/system/dictionary/dictData/index.vue | 6 +++---
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/frontend/.env.development b/frontend/.env.development
index 345f0f4..e4424ec 100644
--- a/frontend/.env.development
+++ b/frontend/.env.development
@@ -18,5 +18,6 @@ VITE_PWA=false
VITE_API_URL=/api
# 开发环境跨域代理,支持配置多个
-# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
-VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]
\ 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/"]]
\ No newline at end of file
diff --git a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
index ff78606..09127cd 100644
--- a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
+++ b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
@@ -3,8 +3,8 @@
v-bind="dialogSmall">
-
-
+
+
@@ -44,12 +44,12 @@ const rules: Ref>> = ref({
})
const dialogFormRef = ref()
-const {dialogVisible, titleType, formContent, dictTypeCode} = useMetaInfo();
+const {dialogVisible, titleType, formContent, dictTypeName} = useMetaInfo();
function useMetaInfo() {
const dialogVisible = ref(false)
const titleType = ref('add')
- const dictTypeCode = ref('')
+ const dictTypeName = ref('')
const formContent = ref({
id: "",
@@ -62,7 +62,7 @@ function useMetaInfo() {
state: 1,
})
- return {dialogVisible, titleType, formContent, dictTypeCode};
+ return {dialogVisible, titleType, formContent, dictTypeName};
}
let dialogTitle = computed(() => {
@@ -86,12 +86,12 @@ const close = () => {
resetFormContent()
dialogFormRef.value?.resetFields()
}
-const open = (sign: string, typeId: string, code: string, data: Dict.ResDictData) => {
+const open = (sign: string, typeId: string, name: string, data: Dict.ResDictData) => {
resetFormContent()
titleType.value = sign
formContent.value.typeId = typeId
- dictTypeCode.value = code
+ dictTypeName.value = name
dialogVisible.value = true
if (data.id) {
formContent.value = {...data}
diff --git a/frontend/src/views/system/dictionary/dictData/index.vue b/frontend/src/views/system/dictionary/dictData/index.vue
index ba5c5a7..c1e59e6 100644
--- a/frontend/src/views/system/dictionary/dictData/index.vue
+++ b/frontend/src/views/system/dictionary/dictData/index.vue
@@ -38,7 +38,7 @@ const proTable = ref()
const dialogVisible = ref(false)
//字典数据所属的字典类型Id
const dictTypeId = ref('')
-const dictTypeCode = ref('')
+const dictTypeName = ref('')
const initParam = reactive({typeId: ''})
@@ -113,7 +113,7 @@ const columns = reactive[]>([
const open = (row: Dict.ResDictType) => {
dialogVisible.value = true
dictTypeId.value = row.id
- dictTypeCode.value = row.code
+ dictTypeName.value = row.name
initParam.typeId = row.id
}
@@ -121,7 +121,7 @@ defineExpose({open})
// 打开 dialog(新增、查看、编辑)
const openDialog = (titleType: string, row: Partial = {}) => {
- dataPopup.value?.open(titleType, dictTypeId.value, dictTypeCode.value, row)
+ dataPopup.value?.open(titleType, dictTypeId.value, dictTypeName.value, row)
}
// 批量删除字典数据
From f530c482284b6467c1622c662cff93f264ac67ed Mon Sep 17 00:00:00 2001
From: hongawen <83944980@qq.com>
Date: Fri, 1 Nov 2024 15:17:18 +0800
Subject: [PATCH 7/7] =?UTF-8?q?=E5=BE=AE=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../views/system/dictionary/dictData/components/dataPopup.vue | 2 --
.../views/system/dictionary/dictType/components/typePopup.vue | 2 --
2 files changed, 4 deletions(-)
diff --git a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
index 09127cd..63faa99 100644
--- a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
+++ b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue
@@ -113,8 +113,6 @@ const save = () => {
ElMessage.success({message: `${dialogTitle.value}成功!`})
close()
await props.refreshTable!()
- } else {
- ElMessage.error('表单验证失败!')
}
})
} catch (err) {
diff --git a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue
index f6364e5..7c089c8 100644
--- a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue
+++ b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue
@@ -115,8 +115,6 @@ const save = () => {
close()
// 刷新表格
await props.refreshTable!()
- } else {
- ElMessage.error('表单验证失败!')
}
})
} catch (err) {