😎调整用户管理页面vxe-table
This commit is contained in:
parent
22807ac386
commit
62d86d085b
@ -10,7 +10,7 @@
|
||||
<el-tabs v-loading="state.loading" v-model="state.selectedTabName">
|
||||
<el-tab-pane label="基础信息" style="height: 550px">
|
||||
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
|
||||
<el-row :gutter="35">
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="账号名称" prop="account" :rules="[{ required: true, message: '账号名称不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="state.ruleForm.account" placeholder="账号名称" clearable />
|
||||
@ -102,13 +102,13 @@
|
||||
<el-divider border-style="dashed" content-position="center">
|
||||
<div style="color: #b1b3b8">附属机构</div>
|
||||
</el-divider>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb10">
|
||||
<el-button icon="ele-Plus" type="primary" plain @click="addExtOrgRow"> 增加附属机构 </el-button>
|
||||
<span style="font-size: 12px; color: gray; padding-left: 5px"> 具有相应组织机构的数据权限 </span>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<template v-if="state.ruleForm.extOrgIdList != undefined && state.ruleForm.extOrgIdList.length > 0">
|
||||
<el-row :gutter="35" v-for="(v, k) in state.ruleForm.extOrgIdList" :key="k">
|
||||
<el-row :gutter="10" v-for="(v, k) in state.ruleForm.extOrgIdList" :key="k">
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="机构" :prop="`extOrgIdList[${k}].orgId`" :rules="[{ required: true, message: `机构不能为空`, trigger: 'blur' }]">
|
||||
<template #label>
|
||||
@ -139,14 +139,14 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-empty :image-size="50" description="空数据" v-else></el-empty>
|
||||
<el-empty :image-size="70" description="空数据" v-else></el-empty>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="档案信息" style="height: 550px">
|
||||
<el-form :model="state.ruleForm" label-width="auto">
|
||||
<el-row :gutter="35">
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="证件类型" prop="cardType">
|
||||
<el-select v-model="state.ruleForm.cardType" placeholder="证件类型" class="w100">
|
||||
@ -263,10 +263,9 @@
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysPosApi, SysRoleApi, SysUserApi } from '/@/api-services/api';
|
||||
import { RoleOutput, SysOrg, SysPos, UpdateUserInput } from '/@/api-services/models';
|
||||
import { RoleOutput, SysOrg, PagePosOutput, UpdateUserInput } from '/@/api-services/models';
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
@ -281,16 +280,16 @@ const state = reactive({
|
||||
isShowDialog: false,
|
||||
selectedTabName: '0', // 选中的 tab 页
|
||||
ruleForm: {} as UpdateUserInput,
|
||||
posData: [] as Array<SysPos>, // 职位数据
|
||||
posData: [] as Array<PagePosOutput>, // 职位数据
|
||||
roleData: [] as Array<RoleOutput>, // 角色数据
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
state.loading = true;
|
||||
var res = await getAPI(SysPosApi).apiSysPosListGet();
|
||||
state.posData = res.data.result ?? [];
|
||||
var res1 = await getAPI(SysRoleApi).apiSysRoleListGet();
|
||||
state.roleData = res1.data.result ?? [];
|
||||
const { data } = await getAPI(SysPosApi).apiSysPosPagePost({ page: 1, pageSize: 9999 });
|
||||
state.posData = data.result?.items ?? [];
|
||||
const { data: res } = await getAPI(SysRoleApi).apiSysRoleListGet();
|
||||
state.roleData = res.result ?? [];
|
||||
state.loading = false;
|
||||
});
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<el-tabs>
|
||||
<el-tab-pane label="基础信息" v-loading="state.loading">
|
||||
<el-form :model="state.ruleFormBase" ref="ruleFormBaseRef" label-width="auto">
|
||||
<el-row :gutter="35">
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="真实姓名" prop="realName" :rules="[{ required: true, message: '真实姓名不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="state.ruleFormBase.realName" placeholder="真实姓名" clearable />
|
||||
@ -132,7 +132,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog v-model="state.signDialogVisible" draggable width="600px">
|
||||
<el-dialog v-model="state.signDialogVisible" draggable :close-on-click-modal="false" width="600px">
|
||||
<template #header>
|
||||
<div style="color: #fff">
|
||||
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-EditPen /> </el-icon>
|
||||
|
||||
@ -1,120 +1,109 @@
|
||||
<template>
|
||||
<div class="sys-user-container">
|
||||
<el-row :gutter="5" style="width: 100%; flex: 1">
|
||||
<el-col :span="4" :xs="24">
|
||||
<OrgTree ref="orgTreeRef" @node-click="nodeClick" />
|
||||
<div class="sys-user-container" v-loading="options.loading">
|
||||
<el-row :gutter="5" style="width: 100%; height: 100%">
|
||||
<el-col :span="4" :xs="24" style="display: flex; height: 100%">
|
||||
<OrgTree ref="treeRef" @node-click="handleNodeChange" />
|
||||
</el-col>
|
||||
|
||||
<el-col :span="20" :xs="24" style="display: flex; flex-direction: column">
|
||||
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
|
||||
<el-form :model="state.queryParams" ref="queryForm" :inline="true">
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="state.queryParams.account" placeholder="账号" clearable />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="姓名">
|
||||
<el-input v-model="state.queryParams.realName" placeholder="姓名" clearable />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="手机号码">
|
||||
<el-input v-model="state.queryParams.phone" placeholder="手机号码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button-group>
|
||||
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'sysUser:page'"> 查询 </el-button>
|
||||
<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="ele-Plus" @click="openAddUser" v-auth="'sysUser:add'"> 新增 </el-button>
|
||||
</el-form-item>
|
||||
<el-col :span="20" :xs="24" style="display: flex; flex-direction: column; height: 100%">
|
||||
<el-card shadow="hover" :body-style="{ padding: '5px 5px 0 5px', display: 'flex', width: '100%', height: '100%', alignItems: 'start' }">
|
||||
<el-form :model="state.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true" :label-width="'60px'" style="flex: 1 1 0%">
|
||||
<el-row :gutter="10">
|
||||
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||
<el-form-item label="账号" prop="account">
|
||||
<el-input v-model="state.queryParams.account" placeholder="账号" clearable @keyup.enter.native="handleQuery(true)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||
<el-form-item label="姓名" prop="realName">
|
||||
<el-input v-model="state.queryParams.realName" placeholder="姓名" clearable @keyup.enter.native="handleQuery(true)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||
<el-form-item label="手机号码" prop="phone">
|
||||
<el-input v-model="state.queryParams.phone" placeholder="手机号码" clearable @keyup.enter.native="handleQuery(true)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-divider style="height: calc(100% - 5px); margin: 0 10px" direction="vertical" />
|
||||
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-button-group>
|
||||
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" v-auth="'sysUser:page'" :loading="options.loading"> 查询 </el-button>
|
||||
<el-button icon="ele-Refresh" @click="resetQuery" :loading="options.loading"> 重置 </el-button>
|
||||
</el-button-group>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
||||
<el-table :data="state.userData" style="width: 100%" v-loading="state.loading" border>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" fixed />
|
||||
<el-table-column label="头像" width="80" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-avatar :src="scope.row.avatar" size="small">{{ scope.row.nickName?.slice(0, 1) ?? scope.row.realName?.slice(0, 1) }} </el-avatar>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="account" label="账号" width="120" align="center" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="nickName" label="昵称" width="120" align="center" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="realName" label="姓名" width="120" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="phone" label="手机号码" width="120" align="center" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="出生日期" width="100" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatDate(new Date(scope.row.birthday), 'YYYY-mm-dd') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="性别" width="70" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag type="success" v-if="scope.row.sex === 1"> 男 </el-tag>
|
||||
<el-tag type="danger" v-else-if="scope.row.sex === 2"> 女 </el-tag>
|
||||
<el-tag type="info" v-else> 其他 </el-tag>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="账号类型" width="110" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.accountType === 888"> 系统管理员 </el-tag>
|
||||
<el-tag v-else-if="scope.row.accountType === 777"> 普通账号 </el-tag>
|
||||
<el-tag v-else-if="scope.row.accountType === 666"> 会员 </el-tag>
|
||||
<el-tag v-else> 其他 </el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="roleName" label="角色集合" min-width="150" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="orgName" label="所属机构" min-width="120" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="posName" label="职位名称" min-width="120" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="状态" width="70" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="2" size="small" @change="changeStatus(scope.row)" v-auth="'sysUser:setStatus'" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderNo" label="排序" width="70" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="修改记录" width="100" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<ModifyRecord :data="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="130" align="center" fixed="right" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditUser(scope.row)" v-auth="'sysUser:update'"> 编辑 </el-button>
|
||||
<el-dropdown>
|
||||
<el-button icon="ele-MoreFilled" size="small" text type="primary" style="padding-left: 12px" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item icon="ele-RefreshLeft" @click="resetUserPwd(scope.row)" :disabled="!auth('sysUser:resetPwd')"> 重置密码 </el-dropdown-item>
|
||||
<el-dropdown-item icon="ele-Unlock" @click="unlockLogin(scope.row)" divided :disabled="!auth('sysUser:unlockLogin')"> 解除锁定 </el-dropdown-item>
|
||||
<el-dropdown-item icon="ele-Delete" @click="delUser(scope.row)" divided :disabled="!auth('sysUser:delete')"> 删除账号 </el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-model:currentPage="state.tableParams.page"
|
||||
v-model:page-size="state.tableParams.pageSize"
|
||||
:total="state.tableParams.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
small
|
||||
background
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
/>
|
||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px; flex: 1">
|
||||
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" @sort-change="sortChange">
|
||||
<template #toolbar_buttons>
|
||||
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysUser:add'"> 新增 </el-button>
|
||||
</template>
|
||||
<template #toolbar_tools> </template>
|
||||
<template #empty>
|
||||
<el-empty :image-size="200" />
|
||||
</template>
|
||||
<template #row_avatar="{ row }">
|
||||
<el-avatar :src="row.avatar" size="small"> {{ row.nickName?.slice(0, 1) ?? row.realName?.slice(0, 1) }} </el-avatar>
|
||||
</template>
|
||||
<template #row_sex="{ row }">
|
||||
<el-tag v-if="row.sex === 1" type="success">男</el-tag>
|
||||
<el-tag v-else-if="row.sex === 2" type="danger">女</el-tag>
|
||||
<el-tag v-else type="info">其他</el-tag>
|
||||
</template>
|
||||
<template #row_accountType="{ row }">
|
||||
<el-tag v-if="row.accountType === 888">系统管理员</el-tag>
|
||||
<el-tag v-else-if="row.accountType === 777">普通账号</el-tag>
|
||||
<el-tag v-else-if="row.accountType === 666">会员</el-tag>
|
||||
<el-tag v-else>其他</el-tag>
|
||||
</template>
|
||||
<template #row_status="{ row }">
|
||||
<el-switch v-model="row.status" :active-value="1" :inactive-value="2" size="small" @change="changeStatus(row)" v-auth="'sysUser:setStatus'" />
|
||||
</template>
|
||||
<template #row_record="{ row }">
|
||||
<ModifyRecord :data="row" />
|
||||
</template>
|
||||
<template #row_buttons="{ row }">
|
||||
<el-tooltip content="编辑" placement="top">
|
||||
<el-button icon="ele-Edit" text type="primary" v-auth="'sysUser:update'" @click="handleEdit(row)"> </el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button icon="ele-Delete" text type="danger" v-auth="'sysUser:delete'" @click="handleDelete(row)"> </el-button>
|
||||
</el-tooltip>
|
||||
<el-button icon="ele-RefreshLeft" text type="danger" v-auth="'sysUser:resetPwd'" @click="resetQueryPwd(row)">重置密码</el-button>
|
||||
<el-button icon="ele-Unlock" text type="primary" v-auth="'sysUser:unlockLogin'" @click="handleUnlock(row)">解除锁定</el-button>
|
||||
</template>
|
||||
<template #pager>
|
||||
<vxe-pager
|
||||
:loading="options.loading"
|
||||
v-model:current-page="state.tableParams.page"
|
||||
v-model:page-size="state.tableParams.pageSize"
|
||||
:total="state.tableParams.total"
|
||||
@page-change="pageChange"
|
||||
/>
|
||||
</template>
|
||||
</vxe-grid>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<EditUser ref="editUserRef" :title="state.editUserTitle" :orgData="state.orgTreeData" @handleQuery="handleQuery" />
|
||||
<EditUser ref="editUserRef" :title="state.title" :orgData="state.treeData" @handleQuery="handleQuery" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="sysUser">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { onMounted, reactive, ref, onActivated } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
// import { formatDate } from '/@/utils/formatTime';
|
||||
import { auth } from '/@/utils/authFunction';
|
||||
import { VxeGridInstance, VxePagerEvents, VxePagerDefines } from 'vxe-table';
|
||||
import { useVxeTable } from '/@/hooks/vxeTableOptionsHook';
|
||||
import XEUtils from 'xe-utils';
|
||||
|
||||
import OrgTree from '/@/views/system/org/component/orgTree.vue';
|
||||
import EditUser from '/@/views/system/user/component/editUser.vue';
|
||||
import ModifyRecord from '/@/components/table/modifyRecord.vue';
|
||||
@ -123,12 +112,11 @@ import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysUserApi, SysOrgApi } from '/@/api-services/api';
|
||||
import { SysUser, SysOrg } from '/@/api-services/models';
|
||||
|
||||
const orgTreeRef = ref<InstanceType<typeof OrgTree>>();
|
||||
const xGrid = ref<VxeGridInstance>();
|
||||
const treeRef = ref<InstanceType<typeof OrgTree>>();
|
||||
const editUserRef = ref<InstanceType<typeof EditUser>>();
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
userData: [] as Array<SysUser>,
|
||||
orgTreeData: [] as Array<SysOrg>,
|
||||
treeData: [] as Array<SysOrg>,
|
||||
queryParams: {
|
||||
orgId: -1,
|
||||
account: undefined,
|
||||
@ -137,33 +125,69 @@ const state = reactive({
|
||||
},
|
||||
tableParams: {
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
pageSize: 50,
|
||||
field: 'id', // 默认的排序字段
|
||||
order: 'aes', // 排序方向
|
||||
descStr: 'desc', // 降序排序的关键字符
|
||||
total: 0 as any,
|
||||
},
|
||||
editUserTitle: '',
|
||||
visible: false,
|
||||
title: '',
|
||||
});
|
||||
|
||||
// 表格参数配置
|
||||
const options = useVxeTable<SysUser>({
|
||||
id: 'sysUser',
|
||||
name: '账号',
|
||||
columns: [
|
||||
// { type: 'checkbox', width: 40, fixed: 'left' },
|
||||
{ type: 'seq', title: '序号', width: 60, fixed: 'left' },
|
||||
{ field: 'avatar', title: '头像', minWidth: 80, showOverflow: 'tooltip', slots: { default: 'row_avatar' } },
|
||||
{ field: 'account', title: '账号', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'nickName', title: '昵称', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'realName', title: '姓名', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'phone', title: '手机号码', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'birthday', title: '出生日期', minWidth: 100, showOverflow: 'tooltip', formatter: ({ cellValue }: any) => XEUtils.toDateString(cellValue, 'yyyy-MM-dd') },
|
||||
{ field: 'sex', title: '性别', minWidth: 70, showOverflow: 'tooltip', slots: { default: 'row_sex' } },
|
||||
{ field: 'accountType', title: '账号类型', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_accountType' } },
|
||||
{ field: 'roleName', title: '角色集合', minWidth: 130, showOverflow: 'tooltip' },
|
||||
{ field: 'orgName', title: '所属机构', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'posName', title: '职位名称', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'status', title: '状态', width: 80, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
||||
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip' },
|
||||
{ field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||
{ title: '操作', fixed: 'right', width: 280, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||
],
|
||||
enableExport: auth('sysUser:page'),
|
||||
searchCallback: () => handleQuery(),
|
||||
queryAllCallback: () => fetchData({ pageSize: 99999 }),
|
||||
});
|
||||
|
||||
// 页面初始化
|
||||
onMounted(async () => {
|
||||
loadOrgData();
|
||||
handleQuery();
|
||||
fetchOrgData();
|
||||
await handleQuery();
|
||||
});
|
||||
|
||||
// 查询机构数据
|
||||
const loadOrgData = async () => {
|
||||
state.loading = true;
|
||||
var res = await getAPI(SysOrgApi).apiSysOrgListGet(0);
|
||||
state.orgTreeData = res.data.result ?? [];
|
||||
state.loading = false;
|
||||
};
|
||||
// 组织架构节点切换
|
||||
onActivated(async () => {
|
||||
await fetchOrgData();
|
||||
});
|
||||
|
||||
// 查询操作
|
||||
const handleQuery = async () => {
|
||||
state.loading = true;
|
||||
let params = Object.assign(state.queryParams, state.tableParams);
|
||||
var res = await getAPI(SysUserApi).apiSysUserPagePost(params);
|
||||
state.userData = res.data.result?.items ?? [];
|
||||
const handleQuery = async (reset = false) => {
|
||||
options.loading = true;
|
||||
if (reset) state.tableParams.page = 1;
|
||||
var res = await fetchData(null);
|
||||
xGrid.value?.loadData(res.data.result?.items ?? []);
|
||||
state.tableParams.total = res.data.result?.total;
|
||||
state.loading = false;
|
||||
options.loading = false;
|
||||
};
|
||||
|
||||
// 获取表数据
|
||||
const fetchData = async (tableParams: any) => {
|
||||
let params = Object.assign(state.queryParams, state.tableParams, tableParams);
|
||||
return getAPI(SysUserApi).apiSysUserPagePost(params);
|
||||
};
|
||||
|
||||
// 重置操作
|
||||
@ -172,23 +196,43 @@ const resetQuery = () => {
|
||||
state.queryParams.account = undefined;
|
||||
state.queryParams.realName = undefined;
|
||||
state.queryParams.phone = undefined;
|
||||
handleQuery(true);
|
||||
};
|
||||
|
||||
// 查询机构数据
|
||||
const fetchOrgData = async () => {
|
||||
var res = await getAPI(SysOrgApi).apiSysOrgListGet(0);
|
||||
state.treeData = res.data.result ?? [];
|
||||
};
|
||||
|
||||
// 改变页码序号或页面容量
|
||||
const pageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }: VxePagerDefines.PageChangeEventParams) => {
|
||||
state.tableParams.page = currentPage;
|
||||
state.tableParams.pageSize = pageSize;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
// 列排序
|
||||
const sortChange = (options: any) => {
|
||||
state.tableParams.field = options.field;
|
||||
state.tableParams.order = options.order;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
// 打开新增页面
|
||||
const openAddUser = () => {
|
||||
state.editUserTitle = '添加账号';
|
||||
const handleAdd = () => {
|
||||
state.title = '添加账号';
|
||||
editUserRef.value?.openDialog({ id: undefined, birthday: '2000-01-01', sex: 1, orderNo: 100, cardType: 0, cultureLevel: 5 });
|
||||
};
|
||||
|
||||
// 打开编辑页面
|
||||
const openEditUser = (row: any) => {
|
||||
state.editUserTitle = '编辑账号';
|
||||
const handleEdit = (row: any) => {
|
||||
state.title = '编辑账号';
|
||||
editUserRef.value?.openDialog(row);
|
||||
};
|
||||
|
||||
// 删除
|
||||
const delUser = (row: any) => {
|
||||
const handleDelete = (row: any) => {
|
||||
ElMessageBox.confirm(`确定删除账号:【${row.account}】?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@ -202,18 +246,6 @@ const delUser = (row: any) => {
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 改变页面容量
|
||||
const handleSizeChange = (val: number) => {
|
||||
state.tableParams.pageSize = val;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
// 改变页码序号
|
||||
const handleCurrentChange = (val: number) => {
|
||||
state.tableParams.page = val;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
// 修改状态
|
||||
const changeStatus = (row: any) => {
|
||||
getAPI(SysUserApi)
|
||||
@ -227,7 +259,7 @@ const changeStatus = (row: any) => {
|
||||
};
|
||||
|
||||
// 重置密码
|
||||
const resetUserPwd = async (row: any) => {
|
||||
const resetQueryPwd = async (row: any) => {
|
||||
ElMessageBox.confirm(`确定重置密码:【${row.account}】?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@ -244,7 +276,7 @@ const resetUserPwd = async (row: any) => {
|
||||
};
|
||||
|
||||
// 解除登录锁定
|
||||
const unlockLogin = async (row: any) => {
|
||||
const handleUnlock = async (row: any) => {
|
||||
ElMessageBox.confirm(`确定解除登录锁定:【${row.account}】?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@ -261,11 +293,11 @@ const unlockLogin = async (row: any) => {
|
||||
};
|
||||
|
||||
// 树组件点击
|
||||
const nodeClick = async (node: any) => {
|
||||
const handleNodeChange = async (node: any) => {
|
||||
state.queryParams.orgId = node.id;
|
||||
state.queryParams.account = undefined;
|
||||
state.queryParams.realName = undefined;
|
||||
state.queryParams.phone = undefined;
|
||||
handleQuery();
|
||||
handleQuery(true);
|
||||
};
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user