😎调整职位管理页面vxe-table

This commit is contained in:
zuohuaijun 2024-06-30 21:35:50 +08:00
parent 4399f07d8f
commit 0646a1a7f3
13 changed files with 639 additions and 68 deletions

View File

@ -56,10 +56,11 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
new SysMenu{ Id=1310000000145, Pid=1310000000141, Title="删除", Permission="sysOrg:delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000151, Pid=1310000000101, Title="职位管理", Path="/system/pos", Name="sysPos", Component="/system/pos/index",Icon="ele-Mug", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=130 },
new SysMenu{ Id=1310000000152, Pid=1310000000151, Title="查询", Permission="sysPos:list", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000153, Pid=1310000000151, Title="编辑", Permission="sysPos:update", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000154, Pid=1310000000151, Title="增加", Permission="sysPos:add", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000155, Pid=1310000000151, Title="删除", Permission="sysPos:delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000152, Pid=1310000000151, Title="查询", Permission="sysPos:page", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000153, Pid=1310000000151, Title="列表", Permission="sysPos:list", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000154, Pid=1310000000151, Title="编辑", Permission="sysPos:update", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000155, Pid=1310000000151, Title="增加", Permission="sysPos:add", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000156, Pid=1310000000151, Title="删除", Permission="sysPos:delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
new SysMenu{ Id=1310000000161, Pid=1310000000101, Title="个人中心", Path="/system/userCenter", Name="sysUserCenter", Component="/system/user/component/userCenter",Icon="ele-Medal", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=140 },
new SysMenu{ Id=1310000000162, Pid=1310000000161, Title="修改密码", Permission="sysUser:changePwd", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },

View File

@ -6,6 +6,19 @@
namespace Admin.NET.Core.Service;
public class PagePosInput : BasePageInput
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public string Code { get; set; }
}
public class PosInput
{
/// <summary>

View File

@ -7,6 +7,17 @@
namespace Admin.NET.Core.Service;
public class PosOutput : SysPos
{
/// <summary>
/// 租户名称
/// </summary>
public string TenantName { get; set; }
}
/// <summary>
/// 职位分页列表输出参数
/// </summary>
public class PagePosOutput : SysPos
{
/// <summary>
/// 租户名称

View File

@ -25,6 +25,27 @@ public class SysPosService : IDynamicApiController, ITransient
_sysUserExtOrgService = sysUserExtOrgService;
}
/// <summary>
/// 获取职位分页列表 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("获取职位分页列表")]
public async Task<SqlSugarPagedList<PagePosOutput>> Page(PagePosInput input)
{
return await _sysPosRep.AsQueryable()
.LeftJoin<SysTenant>((u, a) => u.TenantId == a.Id)
.LeftJoin<SysOrg>((u, a, b) => a.OrgId == b.Id)
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
.WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code))
.Select((u, a, b) => new PagePosOutput
{
TenantName = b.Name
}, true)
.OrderBy(u => u.OrderNo)
.ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 获取职位列表 🔖
/// </summary>

View File

@ -19,7 +19,9 @@ import { Configuration } from '../configuration';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { AddPosInput } from '../models';
import { AdminResultListPosOutput } from '../models';
import { AdminResultSqlSugarPagedListPagePosOutput } from '../models';
import { DeletePosInput } from '../models';
import { PagePosInput } from '../models';
import { UpdatePosInput } from '../models';
/**
* SysPosApi - axios parameter creator
@ -176,6 +178,54 @@ export const SysPosApiAxiosParamCreator = function (configuration?: Configuratio
options: localVarRequestOptions,
};
},
/**
*
* @summary 🔖
* @param {PagePosInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysPosPagePost: async (body?: PagePosInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysPos/page`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication Bearer required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @summary 🔖
@ -276,6 +326,20 @@ export const SysPosApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary 🔖
* @param {PagePosInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysPosPagePost(body?: PagePosInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultSqlSugarPagedListPagePosOutput>>> {
const localVarAxiosArgs = await SysPosApiAxiosParamCreator(configuration).apiSysPosPagePost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary 🔖
@ -330,6 +394,16 @@ export const SysPosApiFactory = function (configuration?: Configuration, basePat
async apiSysPosListGet(name?: string, code?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListPosOutput>> {
return SysPosApiFp(configuration).apiSysPosListGet(name, code, options).then((request) => request(axios, basePath));
},
/**
*
* @summary 🔖
* @param {PagePosInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysPosPagePost(body?: PagePosInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultSqlSugarPagedListPagePosOutput>> {
return SysPosApiFp(configuration).apiSysPosPagePost(body, options).then((request) => request(axios, basePath));
},
/**
*
* @summary 🔖
@ -384,6 +458,17 @@ export class SysPosApi extends BaseAPI {
public async apiSysPosListGet(name?: string, code?: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListPosOutput>> {
return SysPosApiFp(this.configuration).apiSysPosListGet(name, code, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary 🔖
* @param {PagePosInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysPosApi
*/
public async apiSysPosPagePost(body?: PagePosInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultSqlSugarPagedListPagePosOutput>> {
return SysPosApiFp(this.configuration).apiSysPosPagePost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary 🔖

View File

@ -0,0 +1,69 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { SqlSugarPagedListPagePosOutput } from './sql-sugar-paged-list-page-pos-output';
/**
*
*
* @export
* @interface AdminResultSqlSugarPagedListPagePosOutput
*/
export interface AdminResultSqlSugarPagedListPagePosOutput {
/**
*
*
* @type {number}
* @memberof AdminResultSqlSugarPagedListPagePosOutput
*/
code?: number;
/**
* successwarningerror
*
* @type {string}
* @memberof AdminResultSqlSugarPagedListPagePosOutput
*/
type?: string | null;
/**
*
*
* @type {string}
* @memberof AdminResultSqlSugarPagedListPagePosOutput
*/
message?: string | null;
/**
* @type {SqlSugarPagedListPagePosOutput}
* @memberof AdminResultSqlSugarPagedListPagePosOutput
*/
result?: SqlSugarPagedListPagePosOutput;
/**
*
*
* @type {any}
* @memberof AdminResultSqlSugarPagedListPagePosOutput
*/
extras?: any | null;
/**
*
*
* @type {Date}
* @memberof AdminResultSqlSugarPagedListPagePosOutput
*/
time?: Date;
}

View File

@ -63,6 +63,7 @@ export * from './admin-result-sm-key-pair-output';
export * from './admin-result-sql-sugar-paged-list-job-detail-output';
export * from './admin-result-sql-sugar-paged-list-oauth-user-output';
export * from './admin-result-sql-sugar-paged-list-open-access-output';
export * from './admin-result-sql-sugar-paged-list-page-pos-output';
export * from './admin-result-sql-sugar-paged-list-page-role-output';
export * from './admin-result-sql-sugar-paged-list-sys-code-gen';
export * from './admin-result-sql-sugar-paged-list-sys-config';
@ -234,6 +235,8 @@ export * from './page-log-input';
export * from './page-notice-input';
export * from './page-online-user-input';
export * from './page-plugin-input';
export * from './page-pos-input';
export * from './page-pos-output';
export * from './page-print-input';
export * from './page-region-input';
export * from './page-role-input';
@ -266,6 +269,7 @@ export * from './sort-version';
export * from './sql-sugar-paged-list-job-detail-output';
export * from './sql-sugar-paged-list-oauth-user-output';
export * from './sql-sugar-paged-list-open-access-output';
export * from './sql-sugar-paged-list-page-pos-output';
export * from './sql-sugar-paged-list-page-role-output';
export * from './sql-sugar-paged-list-sys-code-gen';
export * from './sql-sugar-paged-list-sys-config';

View File

@ -30,12 +30,6 @@ export interface MemberInfo {
*/
memberType?: MemberTypes;
/**
* @type {string}
* @memberof MemberInfo
*/
name?: string | null;
/**
* @type {Type}
* @memberof MemberInfo
@ -48,6 +42,12 @@ export interface MemberInfo {
*/
reflectedType?: Type;
/**
* @type {string}
* @memberof MemberInfo
*/
name?: string | null;
/**
* @type {Module}
* @memberof MemberInfo

View File

@ -0,0 +1,78 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
*
*
* @export
* @interface PagePosInput
*/
export interface PagePosInput {
/**
*
*
* @type {number}
* @memberof PagePosInput
*/
page?: number;
/**
*
*
* @type {number}
* @memberof PagePosInput
*/
pageSize?: number;
/**
*
*
* @type {string}
* @memberof PagePosInput
*/
field?: string | null;
/**
*
*
* @type {string}
* @memberof PagePosInput
*/
order?: string | null;
/**
*
*
* @type {string}
* @memberof PagePosInput
*/
descStr?: string | null;
/**
*
*
* @type {string}
* @memberof PagePosInput
*/
name?: string | null;
/**
*
*
* @type {string}
* @memberof PagePosInput
*/
code?: string | null;
}

View File

@ -0,0 +1,141 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { StatusEnum } from './status-enum';
/**
*
*
* @export
* @interface PagePosOutput
*/
export interface PagePosOutput {
/**
* Id
*
* @type {number}
* @memberof PagePosOutput
*/
id?: number;
/**
*
*
* @type {Date}
* @memberof PagePosOutput
*/
createTime?: Date;
/**
*
*
* @type {Date}
* @memberof PagePosOutput
*/
updateTime?: Date | null;
/**
* Id
*
* @type {number}
* @memberof PagePosOutput
*/
createUserId?: number | null;
/**
*
*
* @type {string}
* @memberof PagePosOutput
*/
createUserName?: string | null;
/**
* Id
*
* @type {number}
* @memberof PagePosOutput
*/
updateUserId?: number | null;
/**
*
*
* @type {string}
* @memberof PagePosOutput
*/
updateUserName?: string | null;
/**
*
*
* @type {boolean}
* @memberof PagePosOutput
*/
isDelete?: boolean;
/**
* Id
*
* @type {number}
* @memberof PagePosOutput
*/
tenantId?: number | null;
/**
*
*
* @type {string}
* @memberof PagePosOutput
*/
name: string;
/**
*
*
* @type {string}
* @memberof PagePosOutput
*/
code?: string | null;
/**
*
*
* @type {number}
* @memberof PagePosOutput
*/
orderNo?: number;
/**
*
*
* @type {string}
* @memberof PagePosOutput
*/
remark?: string | null;
/**
* @type {StatusEnum}
* @memberof PagePosOutput
*/
status?: StatusEnum;
/**
*
*
* @type {string}
* @memberof PagePosOutput
*/
tenantName?: string | null;
}

View File

@ -0,0 +1,79 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { PagePosOutput } from './page-pos-output';
/**
*
*
* @export
* @interface SqlSugarPagedListPagePosOutput
*/
export interface SqlSugarPagedListPagePosOutput {
/**
*
*
* @type {number}
* @memberof SqlSugarPagedListPagePosOutput
*/
page?: number;
/**
*
*
* @type {number}
* @memberof SqlSugarPagedListPagePosOutput
*/
pageSize?: number;
/**
*
*
* @type {number}
* @memberof SqlSugarPagedListPagePosOutput
*/
total?: number;
/**
*
*
* @type {number}
* @memberof SqlSugarPagedListPagePosOutput
*/
totalPages?: number;
/**
*
*
* @type {Array<PagePosOutput>}
* @memberof SqlSugarPagedListPagePosOutput
*/
items?: Array<PagePosOutput> | null;
/**
*
*
* @type {boolean}
* @memberof SqlSugarPagedListPagePosOutput
*/
hasPrevPage?: boolean;
/**
*
*
* @type {boolean}
* @memberof SqlSugarPagedListPagePosOutput
*/
hasNextPage?: boolean;
}

View File

@ -1,59 +1,79 @@
<template>
<div class="sys-pos-container">
<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.name" placeholder="职位名称" clearable />
</el-form-item>
<el-form-item label="职位编码">
<el-input v-model="state.queryParams.code" placeholder="职位编码" clearable />
</el-form-item>
<el-form-item>
<div class="sys-pos-container" v-loading="options.loading">
<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="name">
<el-input v-model="state.queryParams.name" 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="code">
<el-input v-model="state.queryParams.code" 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" v-auth="'sysPos:list'"> 查询 </el-button>
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" v-auth="'sysPos: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="openAddPos" v-auth="'sysPos:add'"> 新增 </el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table :data="state.posData" style="width: 100%" v-loading="state.loading" border>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="name" label="职位名称" align="center" show-overflow-tooltip />
<el-table-column prop="code" label="职位编码" align="center" show-overflow-tooltip />
<el-table-column prop="tenantName" label="租户名称" width="180" align="center" show-overflow-tooltip />
<el-table-column prop="orderNo" label="排序" width="70" align="center" show-overflow-tooltip />
<el-table-column label="状态" width="70" align="center" show-overflow-tooltip>
<template #default="scope">
<el-tag type="success" v-if="scope.row.status === 1">启用</el-tag>
<el-tag type="danger" v-else>禁用</el-tag>
</template>
</el-table-column>
<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="140" fixed="right" align="center" show-overflow-tooltip>
<template #default="scope">
<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditPos(scope.row)" v-auth="'sysPos:update'"> 编辑 </el-button>
<el-button icon="ele-Delete" size="small" text type="danger" @click="delPos(scope.row)" v-auth="'sysPos:delete'"> 删除 </el-button>
</template>
</el-table-column>
</el-table>
<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="'sysPos:add'"> 新增 </el-button>
</template>
<template #toolbar_tools> </template>
<template #empty>
<el-empty :image-size="200" />
</template>
<template #row_status="{ row }">
<el-tag v-if="row.status === 1" type="success">启用</el-tag>
<el-tag v-else type="danger">禁用</el-tag>
</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="'sysPos:update'" @click="handleEdit(row)"> </el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPos:delete'" @click="handleDelete(row)"> </el-button>
</el-tooltip>
</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>
<EditPos ref="editPosRef" :title="state.editPosTitle" @handleQuery="handleQuery" />
<EditPos ref="editPosRef" :title="state.title" @handleSearch="handleQuery" />
</div>
</template>
<script lang="ts" setup name="sysPos">
import { onMounted, reactive, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { VxeGridInstance, VxePagerEvents, VxePagerDefines } from 'vxe-table';
import { useVxeTable } from '/@/hooks/vxeTableOptionsHook';
import EditPos from '/@/views/system/pos/component/editPos.vue';
import ModifyRecord from '/@/components/table/modifyRecord.vue';
@ -61,50 +81,98 @@ import { getAPI } from '/@/utils/axios-utils';
import { SysPosApi } from '/@/api-services/api';
import { PosOutput } from '/@/api-services/models';
const xGrid = ref<VxeGridInstance>();
const editPosRef = ref<InstanceType<typeof EditPos>>();
const state = reactive({
loading: false,
posData: [] as Array<PosOutput>,
queryParams: {
name: undefined,
code: undefined,
},
editPosTitle: '',
tableParams: {
page: 1,
pageSize: 50,
field: 'id', //
order: 'aes', //
descStr: 'desc', //
total: 0 as any,
},
visible: false,
title: '',
});
//
const options = useVxeTable<PosOutput>({
id: 'sysPos',
name: '职位',
columns: [
// { type: 'checkbox', width: 40, fixed: 'left' },
{ type: 'seq', title: '序号', width: 60, fixed: 'left' },
{ field: 'name', title: '职位名称', minWidth: 200, showOverflow: 'tooltip', sortable: true },
{ field: 'code', title: '职位编码', minWidth: 200, showOverflow: 'tooltip', sortable: true },
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip', sortable: true },
{ field: 'status', title: '状态', width: 80, showOverflow: 'tooltip', sortable: true, slots: { default: 'row_status' } },
{ field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
{ title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
],
searchCallback: () => handleQuery(),
queryAllCallback: () => fetchData({ pageSize: 99999 }),
});
//
onMounted(async () => {
handleQuery();
await handleQuery();
});
//
const handleQuery = async () => {
state.loading = true;
var res = await getAPI(SysPosApi).apiSysPosListGet(state.queryParams.name, state.queryParams.code);
state.posData = res.data.result ?? [];
state.loading = false;
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;
options.loading = false;
};
//
const fetchData = async (tableParams: any) => {
let params = Object.assign(state.queryParams, state.tableParams, tableParams);
return getAPI(SysPosApi).apiSysPosPagePost(params);
};
//
const resetQuery = () => {
state.queryParams.name = undefined;
state.queryParams.code = undefined;
state.queryParams.name = undefined;
handleQuery(true);
};
//
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 openAddPos = () => {
state.editPosTitle = '添加职位';
const handleAdd = () => {
state.title = '添加职位';
editPosRef.value?.openDialog({ status: 1, orderNo: 100 });
};
//
const openEditPos = (row: any) => {
state.editPosTitle = '编辑职位';
const handleEdit = (row: any) => {
state.title = '编辑职位';
editPosRef.value?.openDialog(row);
};
//
const delPos = (row: any) => {
const handleDelete = (row: any) => {
ElMessageBox.confirm(`确定删除职位:【${row.name}】?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',

View File

@ -119,10 +119,11 @@ const state = reactive({
visible: false,
title: '',
});
//
//
const options = useVxeTable<PageRoleOutput>({
id: 'sysRole',
// name: '',
name: '角色',
columns: [
// { type: 'checkbox', width: 40, fixed: 'left' },
{ type: 'seq', title: '序号', width: 60, fixed: 'left' },