字段调整
This commit is contained in:
@@ -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/"]]
|
||||
# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||
VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,20 +7,20 @@ import http from '@/api'
|
||||
*/
|
||||
// 用户登录
|
||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
// return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||
return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
}
|
||||
|
||||
// 获取菜单列表
|
||||
export const getAuthMenuListApi = () => {
|
||||
return http.get<Menu.MenuOptions[]>(`${rePrefix}/menu/list`, {}, { loading: false })
|
||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
// return http.get<Menu.MenuOptions[]>(`${rePrefix}/menu/list`, {}, { loading: false })
|
||||
return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
}
|
||||
|
||||
// 获取按钮权限
|
||||
export const getAuthButtonListApi = () => {
|
||||
return http.get<Login.ResAuthButtons>(`${rePrefix}/auth/buttons`, {}, { loading: false })
|
||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
// return http.get<Login.ResAuthButtons>(`${rePrefix}/auth/buttons`, {}, { loading: false })
|
||||
return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
}
|
||||
|
||||
// 用户退出登录
|
||||
|
||||
@@ -8,7 +8,7 @@ import http from '@/api'
|
||||
*/
|
||||
// 获取用户列表
|
||||
export const getUserList = (params: User.ReqUserParams) => {
|
||||
return http.post<ResPage<User.ResUserList>>(`${rePrefix}/user/list`, params)
|
||||
return http.post<ResPage<User.UserBO>>(`/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<User.ResStatus[]>(`${rePrefix}/user/status`)
|
||||
}
|
||||
// export const getUserStatus = () => {
|
||||
// return http.get<User.ResStatus[]>(`${rePrefix}/user/status`)
|
||||
// }
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -88,10 +88,10 @@ const proTable = ref<ProTableInstance>()
|
||||
// 或者直接去 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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
142
frontend/src/views/authority/user/components/userPopup.vue
Normal file
142
frontend/src/views/authority/user/components/userPopup.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
||||
<div>
|
||||
<el-form :model="data"
|
||||
ref='formRuleRef'
|
||||
:rules='rules'
|
||||
>
|
||||
<el-form-item label="用户名" prop='name' :label-width="100">
|
||||
<el-input v-model="data.name" placeholder="请输入用户名" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录名" prop='loginName' :label-width="100">
|
||||
<el-input v-model="data.loginName" placeholder="请输入登录名" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop='password' :label-width="100">
|
||||
<el-input type="password" v-model="data.password" placeholder="请输入密码" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop='phone' :label-width="100">
|
||||
<el-input v-model="data.phone" placeholder="请输入手机号码" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱地址" prop='email' :label-width="100">
|
||||
<el-input v-model="data.email" placeholder="请输入邮箱地址" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最后一次登录时间" prop='loginTime' :label-width="100">
|
||||
<el-input v-model="data.loginTime" placeholder="请输入最后一次登录时间" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录错误次数" prop='loginErrorTimes' :label-width="100">
|
||||
<el-input v-model="data.loginErrorTimes" placeholder="请输入登录错误次数" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户密码错误锁定时间" prop='lockTime' :label-width="100">
|
||||
<el-input v-model="data.lockTime" placeholder="请输入用户密码错误锁定时间" autocomplete="off" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="handleOK">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref,computed } from 'vue'
|
||||
import {dialogSmall} from '@/utils/elementBind'
|
||||
import { FormInstance,FormItemRule } from 'element-plus'
|
||||
import {
|
||||
addUser,
|
||||
editUser,
|
||||
} from '@/api/user/user'
|
||||
|
||||
const {dialogVisible,title,data,openType,getTableList} = defineProps<{
|
||||
dialogVisible:boolean;
|
||||
title:string;
|
||||
openType:string;
|
||||
getTableList:Function;
|
||||
data:{
|
||||
id?: string; //用户ID,作为唯一标识
|
||||
name: string; //用户名(别名)
|
||||
loginName: string;//登录名
|
||||
password: string; //密码
|
||||
phone?: string; //手机号
|
||||
email?: string; //邮箱
|
||||
loginTime?: string;//最后一次登录时间
|
||||
loginErrorTimes: number;//登录错误次数
|
||||
lockTime?: string; //用户密码错误锁定时间
|
||||
}
|
||||
}>();
|
||||
|
||||
//定义规则
|
||||
const formRuleRef = ref<FormInstance>()
|
||||
//定义校验规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name: [{ required: true, message: '名称必填!', trigger: 'blur' }],
|
||||
loginName: [{ required: true, message: '登录名必填!', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '密码必填!', trigger: 'blur' }],
|
||||
loginErrorTimes: [{ required: true, message: '登录错误次数必填!', trigger: 'blur' }],
|
||||
})
|
||||
// const value = computed({
|
||||
// get: () => data.status === 1,
|
||||
// set: (value: boolean) => data.status = value ? 1 : 0
|
||||
// })
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e:'update:visible',value:boolean):void;
|
||||
}>();
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('update:visible',false)
|
||||
}
|
||||
|
||||
const handleOK = () => {
|
||||
|
||||
ElMessage.info('用户数据提交')
|
||||
try {
|
||||
formRuleRef.value?.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
// 将表单数据转为json,发送到后端
|
||||
// let confirmFormData = JSON.parse(JSON.stringify(form.value))
|
||||
// console.log(confirmFormData)
|
||||
if(openType === "add")
|
||||
{
|
||||
addUser(data).then(res => {
|
||||
if(res.code === "200")
|
||||
{
|
||||
ElMessage.success(res.message)
|
||||
getTableList()
|
||||
}
|
||||
else
|
||||
ElMessage.error(res.message)
|
||||
})
|
||||
}
|
||||
|
||||
if(openType === "edit")
|
||||
{
|
||||
editUser(data).then(res => {
|
||||
if(res.code === "200")
|
||||
{
|
||||
ElMessage.success(res.message)
|
||||
getTableList()
|
||||
}
|
||||
else
|
||||
ElMessage.error(res.message)
|
||||
})
|
||||
}
|
||||
|
||||
emit('update:visible',false)
|
||||
} else {
|
||||
ElMessage.error('表单验证失败!')
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('验证过程中发生错误', error)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,70 +0,0 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
||||
<div>
|
||||
<el-form :model="data">
|
||||
<el-form-item label="用户名" :label-width="100">
|
||||
<el-input v-model="data.username" placeholder="请输入用户名" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="真实姓名" :label-width="100">
|
||||
<el-input v-model="data.realname" placeholder="请输入真实姓名" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" :label-width="100">
|
||||
<el-input type="password" v-model="data.password" placeholder="请输入密码" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户角色" :label-width="100">
|
||||
<el-input v-model="data.rolename" placeholder="请输入用户角色" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户状态" :label-width="100">
|
||||
<el-switch
|
||||
v-model=value
|
||||
inline-prompt
|
||||
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="handleCancel">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref,computed } from 'vue'
|
||||
import {dialogSmall} from '@/utils/elementBind'
|
||||
|
||||
const {dialogVisible,title,data} = defineProps<{
|
||||
dialogVisible:boolean;
|
||||
title:string;
|
||||
data:{
|
||||
username:string;
|
||||
password:string;
|
||||
realname:string;
|
||||
status:number;
|
||||
rolename:string;
|
||||
}
|
||||
}>();
|
||||
|
||||
const value = computed({
|
||||
get: () => data.status === 1,
|
||||
set: (value: boolean) => data.status = value ? 1 : 0
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e:'update:visible',value:boolean):void;
|
||||
}>();
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('update:visible',false)
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -3,12 +3,14 @@
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:data='userData'
|
||||
:request-api="getTableList"
|
||||
:data-callback="dataCallback"
|
||||
>
|
||||
<!-- :data='userData' -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader='scope'>
|
||||
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增用户')">新增</el-button>
|
||||
<el-button type='primary' :icon='Download' plain @click='downloadFile'>导出数据</el-button>
|
||||
<el-button type='primary' :icon='Download' plain >导出数据</el-button>
|
||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||
@click='batchDelete(scope.selectedListIds)'>
|
||||
批量删除
|
||||
@@ -23,11 +25,13 @@
|
||||
|
||||
</ProTable>
|
||||
</div>
|
||||
<userUnit
|
||||
:dialogVisible = userUnitVisible
|
||||
:title = userUnitTitle
|
||||
:data = userUnitData
|
||||
@update:visible="userUnitVisible = $event"
|
||||
<userPopup
|
||||
:dialogVisible = userPopupVisible
|
||||
:title = userPopupTitle
|
||||
:data = userPopupData
|
||||
:openType=openType
|
||||
:getTableList="proTable?.getTableList || (() => {})"
|
||||
@update:visible="userPopupVisible = $event"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -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<User.ResUserList>({} as User.ResUserList)
|
||||
return {userUnitVisible,userUnitTitle,userUnitData};
|
||||
const userPopupVisible = ref(false)
|
||||
const userPopupTitle = ref()
|
||||
const userPopupData = ref<User.UserBO>({} as User.UserBO)
|
||||
return {userPopupVisible,userPopupTitle,userPopupData};
|
||||
}
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const userData = userDataList
|
||||
let openType = ''
|
||||
// const userData = userDataList
|
||||
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
|
||||
// 如果表格需要初始化请求参数,直接定义传给 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<ColumnProps<User.ResUserList>[]>([
|
||||
const columns = reactive<ColumnProps<User.UserBO>[]>([
|
||||
{ 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 (
|
||||
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
||||
)
|
||||
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<InstanceType<typeof ImportExcel> | 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<User.ResUserList> = {}) => {
|
||||
const openDrawer = (title: string, row: Partial<User.UserBO> = {}) => {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-button type='primary' link :icon='View' >查看</el-button>
|
||||
<el-button type='primary' link :icon='EditPen' >编辑</el-button>
|
||||
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
||||
<el-button type='primary' link :icon='Upload' >升级为模板</el-button>
|
||||
<el-button type='primary' :model-value="false" link :icon='Upload' >升级为模板</el-button>
|
||||
</template>
|
||||
|
||||
</ProTable>
|
||||
|
||||
Reference in New Issue
Block a user