添加岗位、登录日志过滤

This commit is contained in:
xie7654
2025-07-03 16:53:40 +08:00
parent ccb4536b37
commit 18f9afb924
17 changed files with 217 additions and 65 deletions

View File

@@ -85,12 +85,12 @@
"dict_type": {
"name": "Dictionary Name",
"title": "Dictionary Name",
"type": "Dictionary Type"
"value": "Dictionary Type"
},
"dict_data": {
"name": "Dictionary Label",
"title": "Dictionary Data",
"type": "Dictionary Value"
"value": "Dictionary Value"
},
"post": {
"name": "Post",

View File

@@ -86,12 +86,12 @@
"dict_type": {
"name": "字典名称",
"title": "字典名称",
"type": "字典类型"
"value": "字典类型"
},
"dict_data": {
"name": "字典数据",
"title": "字典数据",
"type": "字典键值"
"value": "字典键值"
},
"post": {
"name": "岗位",

View File

@@ -239,7 +239,7 @@ function navTo(nav: WorkbenchProjectItem | WorkbenchQuickNavItem) {
:avatar="userStore.userInfo?.avatar || preferences.app.defaultAvatar"
>
<template #title>
早安, {{ userStore.userInfo?.realName }}, 开始您一天的工作吧
早安, {{ userStore.userInfo?.username }}, 开始您一天的工作吧
</template>
<template #description> 今日晴20 - 32 </template>
</WorkbenchHeader>

View File

@@ -27,14 +27,14 @@ export function useSchema(): VbenFormSchema[] {
},
{
component: 'Input',
fieldName: 'type',
fieldName: 'value',
label: '字典类型',
rules: z
.string()
.min(2, $t('ui.formRules.minLength', [$t('system.dict_type.type'), 2]))
.min(2, $t('ui.formRules.minLength', [$t('system.dict_type.value'), 2]))
.max(
20,
$t('ui.formRules.maxLength', [$t('system.dict_type.type'), 20]),
$t('ui.formRules.maxLength', [$t('system.dict_type.value'), 20]),
),
},
{
@@ -90,7 +90,7 @@ export function useColumns(
title: '字典名称',
},
{
field: 'type',
field: 'value',
title: '字典类型',
width: 180,
},
@@ -145,3 +145,32 @@ export function useColumns(
},
];
}
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'name',
label: '字典名称',
componentProps: { allowClear: true },
},
{
component: 'Input',
fieldName: 'value',
label: '字典类型',
componentProps: { allowClear: true },
},
{
component: 'Select',
fieldName: 'status',
label: '状态',
componentProps: {
allowClear: true,
options: [
{ label: '启用', value: 1 },
{ label: '禁用', value: 0 },
],
},
},
];
}

View File

@@ -15,6 +15,7 @@ import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteDictType, getDictTypeList } from '#/api/system/dict_type';
import { $t } from '#/locales';
import { useGridFormSchema } from '#/views/system/dict_type/data';
import { useColumns } from './data';
import Form from './modules/form.vue';
@@ -95,6 +96,10 @@ function onActionClick({
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
submitOnChange: true,
},
gridEvents: {},
gridOptions: {
columns: useColumns(onActionClick),
@@ -119,6 +124,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
export: false,
refresh: { code: 'query' },
zoom: true,
search: true,
},
treeConfig: {
parentField: 'pid',

View File

@@ -93,3 +93,24 @@ export function useColumns(): VxeTableGridOptions<SystemLoginLogApi.SystemLoginL
},
];
}
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'username',
label: '用户名',
componentProps: { allowClear: true },
},
{
component: 'RangePicker',
fieldName: 'create_time',
label: '创建时间',
componentProps: {
allowClear: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},
},
];
}

View File

@@ -6,11 +6,15 @@ import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { SystemLoginLogModel } from '#/models/system/login_log';
import { useColumns } from './data';
import { useColumns, useGridFormSchema } from './data';
const formModel = new SystemLoginLogModel();
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
submitOnChange: true,
},
gridEvents: {},
gridOptions: {
columns: useColumns(),
@@ -22,11 +26,17 @@ const [Grid] = useVbenVxeGrid({
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await formModel.list({
const { create_time, ...rest } = formValues;
const params = {
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
...rest,
};
if (Array.isArray(create_time) && create_time.length === 2) {
params.create_time_after = create_time[0];
params.create_time_before = create_time[1];
}
return await formModel.list(params);
},
},
},
@@ -35,6 +45,7 @@ const [Grid] = useVbenVxeGrid({
export: false,
refresh: { code: 'query' },
zoom: true,
search: true,
},
} as VxeTableGridOptions,
});

View File

@@ -122,3 +122,32 @@ export function useColumns(
},
];
}
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'name',
label: '岗位名称',
componentProps: { allowClear: true },
},
{
component: 'Input',
fieldName: 'code',
label: '岗位编码',
componentProps: { allowClear: true },
},
{
component: 'Select',
fieldName: 'status',
label: '状态',
componentProps: {
allowClear: true,
options: [
{ label: '启用', value: 1 },
{ label: '禁用', value: 0 },
],
},
},
];
}

View File

@@ -13,6 +13,7 @@ import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { $t } from '#/locales';
import { SystemPostModel } from '#/models/system/post';
import { useGridFormSchema } from '#/views/system/post/data';
import { useColumns } from './data';
import Form from './modules/form.vue';
@@ -81,6 +82,10 @@ function onActionClick({
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
submitOnChange: true,
},
gridEvents: {},
gridOptions: {
columns: useColumns(onActionClick),
@@ -105,6 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
export: false,
refresh: { code: 'query' },
zoom: true,
search: true,
},
} as VxeTableGridOptions,
});

View File

@@ -198,18 +198,18 @@ export function useColumns(
title: $t('system.modifier'),
width: 80,
},
{
field: 'update_time',
title: $t('system.updateTime'),
width: 150,
formatter: ({ cellValue }) => format_datetime(cellValue),
},
{
field: 'create_time',
title: $t('system.createTime'),
width: 150,
formatter: ({ cellValue }) => format_datetime(cellValue),
},
// {
// field: 'update_time',
// title: $t('system.updateTime'),
// width: 150,
// formatter: ({ cellValue }) => format_datetime(cellValue),
// },
// {
// field: 'create_time',
// title: $t('system.createTime'),
// width: 150,
// formatter: ({ cellValue }) => format_datetime(cellValue),
// },
{
align: 'center',
cellRender: {