feat: 合并Gin_Vue

This commit is contained in:
TsMask
2023-10-16 17:12:24 +08:00
parent 771320a839
commit 743568861d
77 changed files with 734 additions and 1870 deletions

View File

@@ -175,7 +175,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -597,9 +597,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>

View File

@@ -18,6 +18,7 @@ import { parseDateToStr } from '@/utils/date-utils';
import { regExpMobile, regExpEmail } from '@/utils/regular-utils';
import useDictStore from '@/store/modules/dict';
import { parseDataToTree } from '@/utils/parse-tree-utils';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore();
const route = useRoute();
@@ -126,7 +127,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number) {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -220,7 +221,7 @@ function fnModalVisibleByVive(deptId: string | number) {
getDept(deptId).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 200 && res.data) {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
if (res.data.parentId === '0') {
modalState.treeData = [
{ deptId: '0', parentId: '0', deptName: '根节点' },
@@ -261,9 +262,12 @@ function fnModalVisibleByEdit(
// 获取部门信息同时查询部门列表(排除节点)
Promise.all([getDept(deptId), listDeptExcludeChild(deptId)])
.then(resArr => {
if (resArr[0].code === 200 && resArr[0].data) {
if (resArr[0].code === RESULT_CODE_SUCCESS && resArr[0].data) {
modalState.from = Object.assign(modalState.from, resArr[0].data);
if (resArr[1].code === 200 && Array.isArray(resArr[1].data)) {
if (
resArr[1].code === RESULT_CODE_SUCCESS &&
Array.isArray(resArr[1].data)
) {
if (resArr[1].data.length === 0) {
modalState.treeData = [
{ deptId: '0', parentId: '0', deptName: '根节点' },
@@ -299,7 +303,7 @@ function fnModalOk() {
const hide = message.loading('请稍等...', 0);
dept
.then(res => {
if (res.code === 200) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${modalState.title}成功`,
duration: 2,
@@ -350,7 +354,7 @@ function fnRecordDelete(deptId: string | number) {
const hide = message.loading('请稍等...', 0);
delDept(deptId).then(res => {
hide();
if (res.code === 200) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
duration: 2,
@@ -372,7 +376,7 @@ function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
listDept(toRaw(queryParams)).then(res => {
if (res.code === 200 && Array.isArray(res.data)) {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
const treeData = parseDataToTree(res.data, 'deptId');
// 初始上级部门和展开编号key
if (treeDataAll.length <= 0) {
@@ -504,9 +508,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>

View File

@@ -203,7 +203,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -595,9 +595,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -845,11 +845,12 @@ onMounted(() => {
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="数据排序" name="dictSort">
<a-input
<a-input-number
v-model:value="modalState.from.dictSort"
allow-clear
:min="0"
:max="65535"
placeholder="请输入数据排序"
></a-input>
></a-input-number>
</a-form-item>
</a-col>
</a-row>

View File

@@ -172,7 +172,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -608,9 +608,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>

View File

@@ -0,0 +1,557 @@
<script setup lang="ts">
import { useRoute } from 'vue-router';
import { reactive, ref, onMounted, toRaw } from 'vue';
import { PageContainer } from '@ant-design-vue/pro-layout';
import { message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table';
import {
exportSysLogLogin,
listSysLogLogin,
delSysLogLogin,
cleanSysLogLogin,
unlock,
} from '@/api/system/log/login';
import { saveAs } from 'file-saver';
import { parseDateToStr } from '@/utils/date-utils';
import useDictStore from '@/store/modules/dict';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore();
const route = useRoute();
/**路由标题 */
let title = ref<string>(route.meta.title ?? '标题');
/**字典数据 */
let dict: {
/**登录状态 */
sysCommonStatus: DictType[];
} = reactive({
sysCommonStatus: [],
});
/**开始结束时间 */
let queryRangePicker = ref<[string, string]>(['', '']);
/**查询参数 */
let queryParams = reactive({
/**登录地址 */
ipaddr: '',
/**登录账号 */
userName: '',
/**登录状态 */
status: undefined,
/**开始时间 */
beginTime: '',
/**结束时间 */
endTime: '',
/**当前页数 */
pageNum: 1,
/**每页条数 */
pageSize: 20,
});
/**查询参数重置 */
function fnQueryReset() {
queryParams = Object.assign(queryParams, {
ipaddr: '',
userName: '',
status: undefined,
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 20,
});
queryRangePicker.value = ['', ''];
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList();
}
/**表格状态类型 */
type TabeStateType = {
/**加载等待 */
loading: boolean;
/**紧凑型 */
size: SizeType;
/**斑马纹 */
striped: boolean;
/**搜索栏 */
seached: boolean;
/**记录数据 */
data: object[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
/**勾选单个的登录账号 */
selectedUserName: string;
};
/**表格状态 */
let tableState: TabeStateType = reactive({
loading: false,
size: 'middle',
striped: false,
seached: false,
data: [],
selectedRowKeys: [],
selectedUserName: '',
});
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '日志编号',
dataIndex: 'loginId',
align: 'center',
},
{
title: '登录账号',
dataIndex: 'userName',
align: 'center',
},
{
title: '登录地址',
dataIndex: 'ipaddr',
align: 'center',
},
{
title: '登录地点',
dataIndex: 'loginLocation',
align: 'center',
},
{
title: '操作系统',
dataIndex: 'os',
align: 'center',
},
{
title: '浏览器',
dataIndex: 'browser',
align: 'center',
},
{
title: '登录状态',
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '登录信息',
dataIndex: 'msg',
align: 'center',
},
{
title: '登录时间',
dataIndex: 'loginTime',
align: 'center',
customRender(opt) {
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
];
/**表格分页器参数 */
let tablePagination = reactive({
/**当前页数 */
current: 1,
/**每页条数 */
pageSize: 20,
/**默认的每页条数 */
defaultPageSize: 20,
/**指定每页可以显示多少条 */
pageSizeOptions: ['10', '20', '50', '100'],
/**只有一页时是否隐藏分页器 */
hideOnSinglePage: false,
/**是否可以快速跳转至某页 */
showQuickJumper: true,
/**是否可以改变 pageSize */
showSizeChanger: true,
/**数据总数 */
total: 0,
showTotal: (total: number) => `总共 ${total}`,
onChange: (page: number, pageSize: number) => {
tablePagination.current = page;
tablePagination.pageSize = pageSize;
queryParams.pageNum = page;
queryParams.pageSize = pageSize;
fnGetList();
},
});
/**表格紧凑型变更操作 */
function fnTableSize({ key }: MenuInfo) {
tableState.size = key as SizeType;
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
/**表格多选 */
function fnTableSelectedRows(
_: (string | number)[],
rows: Record<string, string>[]
) {
tableState.selectedRowKeys = rows.map(item => item.loginId);
// 针对单个登录账号解锁
if (rows.length === 1) {
tableState.selectedUserName = rows[0].userName;
} else {
tableState.selectedUserName = '';
}
}
/**记录删除 */
function fnRecordDelete() {
const ids = tableState.selectedRowKeys.join(',');
Modal.confirm({
title: '提示',
content: `确认删除访问编号为 【${ids}】 的数据项吗?`,
onOk() {
const key = 'delSysLogLogin';
message.loading({ content: '请稍等...', key });
delSysLogLogin(ids).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
key,
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
key,
duration: 3,
});
}
fnGetList();
});
},
});
}
/**列表清空 */
function fnCleanList() {
Modal.confirm({
title: '提示',
content: `确认清空所有登录日志数据项?`,
onOk() {
const key = 'cleanSysLogLogin';
message.loading({ content: '请稍等...', key });
cleanSysLogLogin().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `清空成功`,
key,
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
key,
duration: 3,
});
}
fnGetList();
});
},
});
}
/**登录账号解锁 */
function fnUnlock() {
const username = tableState.selectedUserName;
Modal.confirm({
title: '提示',
content: `确认解锁用户 【${username}】 数据项?`,
onOk() {
const hide = message.loading('请稍等...', 0);
unlock(username).then(res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${username} 解锁成功`,
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
});
},
});
}
/**列表导出 */
function fnExportList() {
Modal.confirm({
title: '提示',
content: `确认根据搜索条件导出xlsx表格文件吗?`,
onOk() {
const key = 'exportSysLogLogin';
message.loading({ content: '请稍等...', key });
exportSysLogLogin(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
key,
duration: 2,
});
saveAs(res.data, `sys_log_login_${Date.now()}.xlsx`);
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
});
},
});
}
/**查询登录日志列表 */
function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
if (!queryRangePicker.value) {
queryRangePicker.value = ['', ''];
}
queryParams.beginTime = queryRangePicker.value[0];
queryParams.endTime = queryRangePicker.value[1];
listSysLogLogin(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];
}
tablePagination.total = res.total;
tableState.data = res.rows;
}
tableState.loading = false;
});
}
onMounted(() => {
// 初始字典数据
Promise.allSettled([getDict('sys_common_status')]).then(resArr => {
if (resArr[0].status === 'fulfilled') {
dict.sysCommonStatus = resArr[0].value;
}
});
// 获取列表数据
fnGetList();
});
</script>
<template>
<PageContainer :title="title">
<template #content>
<a-typography-paragraph>
对登录进行日志收集登录锁定的信息存入
<a-typography-text code>Redis</a-typography-text>
可对登录账号进行解锁
</a-typography-paragraph>
</template>
<a-card
v-show="tableState.seached"
:bordered="false"
:body-style="{ marginBottom: '24px', paddingBottom: 0 }"
>
<!-- 表格搜索栏 -->
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录地址" name="ipaddr">
<a-input
v-model:value="queryParams.ipaddr"
allow-clear
:maxlength="128"
placeholder="请输入登录地址"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录账号" name="userName">
<a-input
v-model:value="queryParams.userName"
allow-clear
:maxlength="30"
placeholder="请输入登录账号"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录状态" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择登录状态"
:options="dict.sysCommonStatus"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录时间" name="queryRangePicker">
<a-range-picker
v-model:value="queryRangePicker"
allow-clear
bordered
value-format="YYYY-MM-DD"
:placeholder="['登录开始', '登录结束']"
style="width: 100%"
></a-range-picker>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList">
<template #icon><SearchOutlined /></template>
搜索</a-button
>
<a-button type="default" @click.prevent="fnQueryReset">
<template #icon><ClearOutlined /></template>
重置</a-button
>
</a-space>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-card>
<a-card :bordered="false" :body-style="{ padding: '0px' }">
<!-- 插槽-卡片左侧侧 -->
<template #title>
<a-space :size="8" align="center">
<a-button
type="primary"
:disabled="!tableState.selectedUserName"
@click.prevent="fnUnlock()"
v-perms:has="['system:log:login:unlock']"
>
<template #icon><UnlockOutlined /></template>
解锁
</a-button>
<a-button
type="default"
danger
:disabled="tableState.selectedRowKeys.length <= 0"
@click.prevent="fnRecordDelete()"
v-perms:has="['system:log:login:remove']"
>
<template #icon><DeleteOutlined /></template>
删除
</a-button>
<a-button
type="dashed"
danger
@click.prevent="fnCleanList()"
v-perms:has="['system:log:login:remove']"
>
<template #icon><DeleteOutlined /></template>
清空
</a-button>
<a-button
type="dashed"
@click.prevent="fnExportList()"
v-perms:has="['system:log:login:export']"
>
<template #icon><ExportOutlined /></template>
导出
</a-button>
</a-space>
</template>
<!-- 插槽-卡片右侧 -->
<template #extra>
<a-space :size="8" align="center">
<a-tooltip>
<template #title>搜索栏</template>
<a-switch
v-model:checked="tableState.seached"
checked-children=""
un-checked-children=""
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>表格斑马纹</template>
<a-switch
v-model:checked="tableState.striped"
checked-children=""
un-checked-children=""
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>刷新</template>
<a-button type="text" @click.prevent="fnGetList">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
<template #overlay>
<a-menu
:selected-keys="[tableState.size as string]"
@click="fnTableSize"
>
<a-menu-item key="default">默认</a-menu-item>
<a-menu-item key="middle">中等</a-menu-item>
<a-menu-item key="small">紧凑</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</a-tooltip>
</a-space>
</template>
<!-- 表格列表 -->
<a-table
class="table"
row-key="loginId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:row-class-name="fnTableStriped"
:scroll="{ x: true }"
:pagination="tablePagination"
:row-selection="{
type: 'checkbox',
selectedRowKeys: tableState.selectedRowKeys,
onChange: fnTableSelectedRows,
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<DictTag :options="dict.sysCommonStatus" :value="record.status" />
</template>
</template>
</a-table>
</a-card>
</PageContainer>
</template>
<style lang="less" scoped>
.table :deep(.table-striped) td {
background-color: #fafafa;
}
.table :deep(.ant-pagination) {
padding: 0 24px;
}
</style>

View File

@@ -2,19 +2,20 @@
import { useRoute } from 'vue-router';
import { reactive, ref, onMounted, toRaw } from 'vue';
import { PageContainer } from '@ant-design-vue/pro-layout';
import { message, Modal, Form } from 'ant-design-vue/lib';
import { message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table';
import {
listNotice,
getNotice,
delNotice,
addNotice,
updateNotice,
} from '@/api/system/notice';
exportSysLogOperate,
listSysLogOperate,
delSysLogOperate,
cleanSysLogOperate,
} from '@/api/system/log/operate';
import { saveAs } from 'file-saver';
import { parseDateToStr } from '@/utils/date-utils';
import useDictStore from '@/store/modules/dict';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore();
const route = useRoute();
@@ -23,25 +24,32 @@ let title = ref<string>(route.meta.title ?? '标题');
/**字典数据 */
let dict: {
/**公告类型 */
sysNoticeType: DictType[];
/**公告状态 */
sysNoticeStatus: DictType[];
/**业务类型 */
sysBusinessType: DictType[];
/**登录状态 */
sysCommonStatus: DictType[];
} = reactive({
sysNoticeType: [],
sysNoticeStatus: [],
sysBusinessType: [],
sysCommonStatus: [],
});
/**开始结束时间 */
let queryRangePicker = ref<[string, string]>(['', '']);
/**查询参数 */
let queryParams = reactive({
/**公告标题 */
noticeTitle: '',
/**创建者 */
createBy: undefined,
/**公告类型 */
noticeType: undefined,
/**公告状态 */
/**操作模块 */
title: '',
/**操作人员 */
operName: '',
/**业务类型 */
businessType: undefined,
/**操作状态 */
status: undefined,
/**开始时间 */
beginTime: '',
/**结束时间 */
endTime: '',
/**当前页数 */
pageNum: 1,
/**每页条数 */
@@ -51,13 +59,16 @@ let queryParams = reactive({
/**查询参数重置 */
function fnQueryReset() {
queryParams = Object.assign(queryParams, {
noticeTitle: '',
createBy: '',
noticeType: undefined,
title: '',
operName: '',
businessType: undefined,
status: undefined,
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 20,
});
queryRangePicker.value = ['', ''];
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList();
@@ -92,44 +103,63 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '公告编号',
dataIndex: 'noticeId',
title: '日志编号',
dataIndex: 'operId',
align: 'center',
},
{
title: '公告标题',
dataIndex: 'noticeTitle',
title: '模块名称',
dataIndex: 'title',
align: 'center',
},
{
title: '公告类型',
dataIndex: 'noticeType',
key: 'noticeType',
title: '业务类型',
dataIndex: 'businessType',
key: 'businessType',
align: 'center',
},
{
title: '状态',
title: '操作人员',
dataIndex: 'operName',
align: 'center',
},
{
title: '请求方式',
dataIndex: 'requestMethod',
align: 'center',
},
{
title: '请求主机',
dataIndex: 'operIp',
align: 'center',
},
{
title: '操作状态',
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '创建者',
dataIndex: 'createBy',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createTime',
title: '操作日期',
dataIndex: 'operTime',
align: 'center',
customRender(opt) {
if(+opt.value <= 0) return ''
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
{
title: '消耗时间',
dataIndex: 'costTime',
key: 'costTime',
align: 'center',
customRender(opt) {
return `${opt.value} ms`;
},
},
{
title: '操作',
key: 'noticeId',
key: 'operId',
align: 'center',
},
];
@@ -168,7 +198,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number) {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -181,177 +211,65 @@ function fnTableSelectedRowKeys(keys: (string | number)[]) {
type ModalStateType = {
/**详情框是否显示 */
visibleByView: boolean;
/**新增框或修改框是否显示 */
visibleByEdit: boolean;
/**标题 */
title: string;
/**表单数据 */
from: Record<string, any>;
/**确定按钮 loading */
confirmLoading: boolean;
};
/**对话框对象信息状态 */
let modalState: ModalStateType = reactive({
visibleByView: false,
visibleByEdit: false,
title: '公告',
title: '操作日志',
from: {
noticeId: undefined,
noticeTitle: '',
noticeContent: '',
noticeType: '2',
status: '1',
delFlag: '0',
remark: '',
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined,
operId: undefined,
businessType: 0,
deptName: '',
method: '',
operIp: '',
operLocation: '',
operMsg: '',
operName: '',
operParam: '',
operTime: 0,
operUrl: '',
operType: 1,
requestMethod: 'PUT',
status: 1,
title: '',
},
confirmLoading: false,
});
/**对话框内表单属性和校验规则 */
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
noticeTitle: [
{ required: true, min: 2, max: 50, message: '请正确输入公告标题' },
],
noticeType: [{ required: true, message: '请选择公告类型' }],
noticeContent: [
{
required: true,
min: 2,
max: 3000,
message: '请正确输入公告内容限10-3000个字符',
},
],
})
);
/**
* 对话框弹出显示为 查看
* @param noticeId 公告id
* @param row 操作日志信息对象
*/
function fnModalVisibleByVive(noticeId: string | number) {
if (!noticeId) {
message.error(`公告记录存在错误`, 2);
return;
}
if (modalState.confirmLoading) return;
const hide = message.loading('正在打开...', 0);
modalState.confirmLoading = true;
getNotice(noticeId).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 200) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '公告信息';
modalState.visibleByView = true;
} else {
message.error(`获取公告信息失败`, 2);
}
});
}
/**
* 对话框弹出显示为 新增或者修改
* @param noticeId 公告id, 不传为新增
*/
function fnModalVisibleByEdit(noticeId?: string | number) {
if (!noticeId) {
modalStateFrom.resetFields();
modalState.title = '添加公告';
modalState.visibleByEdit = true;
} else {
if (modalState.confirmLoading) return;
const hide = message.loading('正在打开...', 0);
modalState.confirmLoading = true;
getNotice(noticeId).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 200) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改公告';
modalState.visibleByEdit = true;
} else {
message.error(`获取公告信息失败`, 2);
}
});
}
}
/**
* 对话框弹出确认执行函数
* 进行表达规则校验
*/
function fnModalOk() {
modalStateFrom
.validate()
.then(() => {
modalState.confirmLoading = true;
const from = toRaw(modalState.from);
const notice = from.noticeId ? updateNotice(from) : addNotice(from);
const key = 'notice';
message.loading({ content: '请稍等...', key });
notice
.then(res => {
if (res.code === 200) {
message.success({
content: `${modalState.title}成功`,
key,
duration: 2,
});
modalState.visibleByEdit = false;
modalStateFrom.resetFields();
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
})
.finally(() => {
modalState.confirmLoading = false;
});
})
.catch(e => {
message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2);
});
function fnModalVisibleByVive(row: Record<string, string>) {
modalState.from = Object.assign(modalState.from, row);
modalState.title = '操作日志信息';
modalState.visibleByView = true;
}
/**
* 对话框弹出关闭执行函数
* 进行表达规则校验
*/
function fnModalCancel() {
modalState.visibleByEdit = false;
modalState.visibleByView = false;
modalStateFrom.resetFields();
}
/**
* 公告删除
* @param noticeId 公告编号ID
*/
function fnRecordDelete(noticeId: string = '0') {
if (noticeId === '0') {
noticeId = tableState.selectedRowKeys.join(',');
}
/**记录删除 */
function fnRecordDelete() {
const ids = tableState.selectedRowKeys.join(',');
Modal.confirm({
title: '提示',
content: `确认删除公告编号为 【${noticeId}】 的数据项?`,
content: `确认删除访问编号为 【${ids}】 的数据项?`,
onOk() {
const key = 'delNotice';
const key = 'delSysLogOperate';
message.loading({ content: '请稍等...', key });
delNotice(noticeId).then(res => {
if (res.code === 200) {
delSysLogOperate(ids).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: '删除成功',
key,
duration: 2,
});
@@ -359,7 +277,7 @@ function fnRecordDelete(noticeId: string = '0') {
} else {
message.error({
content: `${res.msg}`,
key: key,
key,
duration: 2,
});
}
@@ -368,12 +286,73 @@ function fnRecordDelete(noticeId: string = '0') {
});
}
/**查询公告列表 */
/**列表清空 */
function fnCleanList() {
Modal.confirm({
title: '提示',
content: `确认清空所有登录日志数据项?`,
onOk() {
const key = 'cleanSysLogOperate';
message.loading({ content: '请稍等...', key });
cleanSysLogOperate().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: '清空成功',
key,
duration: 2,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
});
},
});
}
/**列表导出 */
function fnExportList() {
Modal.confirm({
title: '提示',
content: `确认根据搜索条件导出xlsx表格文件吗?`,
onOk() {
const key = 'exportSysLogOperate';
message.loading({ content: '请稍等...', key });
exportSysLogOperate(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
key,
duration: 2,
});
saveAs(res.data, `sys_log_operate_${Date.now()}.xlsx`);
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
});
},
});
}
/**查询登录日志列表 */
function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
listNotice(toRaw(queryParams)).then(res => {
if (res.code === 200 && Array.isArray(res.rows)) {
if (!queryRangePicker.value) {
queryRangePicker.value = ['', ''];
}
queryParams.beginTime = queryRangePicker.value[0];
queryParams.endTime = queryRangePicker.value[1];
listSysLogOperate(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
//
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];
@@ -388,14 +367,14 @@ function fnGetList() {
onMounted(() => {
//
Promise.allSettled([
getDict('sys_notice_type'),
getDict('sys_notice_status'),
getDict('sys_oper_type'),
getDict('sys_common_status'),
]).then(resArr => {
if (resArr[0].status === 'fulfilled') {
dict.sysNoticeType = resArr[0].value;
dict.sysBusinessType = resArr[0].value;
}
if (resArr[1].status === 'fulfilled') {
dict.sysNoticeStatus = resArr[1].value;
dict.sysCommonStatus = resArr[1].value;
}
});
//
@@ -407,7 +386,7 @@ onMounted(() => {
<PageContainer :title="title">
<template #content>
<a-typography-paragraph>
发布公告给內部用户的通知
对接口请求进行日志收集统计高频接口分析优化等操作
</a-typography-paragraph>
</template>
@@ -420,45 +399,57 @@ onMounted(() => {
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="公告标题" name="noticeTitle">
<a-form-item label="操作模块" name="title">
<a-input
v-model:value="queryParams.noticeTitle"
v-model:value="queryParams.title"
allow-clear
placeholder="请输入公告标题"
placeholder="请输入操作模块"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="创建者" name="createBy">
<a-form-item label="操作人员" name="operName">
<a-input
v-model:value="queryParams.createBy"
v-model:value="queryParams.operName"
allow-clear
placeholder="请输入创建者"
placeholder="请输入操作人员"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="公告类型" name="noticeType">
<a-form-item label="业务类型" name="businessType">
<a-select
v-model:value="queryParams.noticeType"
v-model:value="queryParams.businessType"
allow-clear
placeholder="请选择公告类型"
:options="dict.sysNoticeType"
placeholder="请选择业务类型"
:options="dict.sysBusinessType"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="公告状态" name="status">
<a-form-item label="操作状态" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择公告状态"
:options="dict.sysNoticeStatus"
placeholder="请选择操作状态"
:options="dict.sysCommonStatus"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="操作时间" name="queryRangePicker">
<a-range-picker
v-model:value="queryRangePicker"
allow-clear
bordered
value-format="YYYY-MM-DD"
:placeholder="['操作开始', '操作结束']"
style="width: 100%"
></a-range-picker>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
@@ -481,24 +472,33 @@ onMounted(() => {
<!-- 插槽-卡片左侧侧 -->
<template #title>
<a-space :size="8" align="center">
<a-button
type="primary"
@click.prevent="fnModalVisibleByEdit()"
v-perms:has="['system:notice:add']"
>
<template #icon><PlusOutlined /></template>
新建
</a-button>
<a-button
type="default"
danger
:disabled="tableState.selectedRowKeys.length <= 0"
@click.prevent="fnRecordDelete()"
v-perms:has="['system:notice:remove']"
v-perms:has="['system:log:operate:remove']"
>
<template #icon><DeleteOutlined /></template>
删除
</a-button>
<a-button
type="dashed"
danger
@click.prevent="fnCleanList()"
v-perms:has="['system:log:operate:remove']"
>
<template #icon><DeleteOutlined /></template>
清空
</a-button>
<a-button
type="dashed"
@click.prevent="fnExportList()"
v-perms:has="['system:log:operate:export']"
>
<template #icon><ExportOutlined /></template>
导出
</a-button>
</a-space>
</template>
@@ -529,9 +529,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -553,14 +553,14 @@ onMounted(() => {
<!-- 表格列表 -->
<a-table
class="table"
row-key="noticeId"
row-key="operId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:row-class-name="fnTableStriped"
:pagination="tablePagination"
:scroll="{ x: true }"
:pagination="tablePagination"
:row-selection="{
type: 'checkbox',
selectedRowKeys: tableState.selectedRowKeys,
@@ -568,42 +568,26 @@ onMounted(() => {
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'noticeType'">
<DictTag :options="dict.sysNoticeType" :value="record.noticeType" />
<template v-if="column.key === 'businessType'">
<DictTag
:options="dict.sysBusinessType"
:value="record.businessType"
/>
</template>
<template v-if="column.key === 'status'">
<DictTag :options="dict.sysNoticeStatus" :value="record.status" />
<DictTag :options="dict.sysCommonStatus" :value="record.status" />
</template>
<template v-if="column.key === 'noticeId'">
<template v-if="column.key === 'operId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>查看详情</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByVive(record.noticeId)"
v-perms:has="['system:notice:query']"
@click.prevent="fnModalVisibleByVive(record)"
v-perms:has="['system:log:operate:query']"
>
<template #icon><ProfileOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>编辑</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.noticeId)"
v-perms:has="['system:notice:edit']"
>
<template #icon><FormOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>删除</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.noticeId)"
v-perms:has="['system:notice:remove']"
>
<template #icon><DeleteOutlined /></template>
详情
</a-button>
</a-tooltip>
</a-space>
@@ -622,105 +606,83 @@ onMounted(() => {
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="公告标题" name="noticeTitle">
{{ modalState.from.noticeTitle }}
<a-form-item label="日志编号" name="operId">
{{ modalState.from.operId }}
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="公告类型" name="noticeType">
<DictTag
:options="dict.sysNoticeType"
:value="modalState.from.noticeType"
/>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="公告状态" name="status">
<DictTag
:options="dict.sysNoticeStatus"
:value="modalState.from.status"
/>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="执行状态" name="status">
<a-tag :color="+modalState.from.status ? 'success' : 'error'">
{{ ['失败', '正常'][+modalState.from.status] }}
</a-tag>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="公告内容" name="noticeContent">
{{ modalState.from.noticeContent }}
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="业务类型" name="businessType">
{{ modalState.from.title }} /
<DictTag
:options="dict.sysBusinessType"
:value="modalState.from.businessType"
/>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="操作人员" name="operName">
{{ modalState.from.operName }} / {{ modalState.from.operIp }} /
{{ modalState.from.operLocation }}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="请求地址" name="operUrl">
{{ modalState.from.requestMethod }} -
{{ modalState.from.operUrl }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="操作时间" name="operTime">
<span v-if="+modalState.from.operTime > 0">
{{ parseDateToStr(+modalState.from.operTime) }}
</span>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="请求耗时" name="costTime">
{{ modalState.from.costTime }} ms
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="操作方法" name="method">
{{ modalState.from.method }}
</a-form-item>
</a-col>
</a-row>
<a-form-item label="请求参数" name="operParam">
<a-textarea
v-model:value="modalState.from.operParam"
:auto-size="{ minRows: 2, maxRows: 6 }"
placeholder="请求参数"
:disabled="true"
/>
</a-form-item>
<a-form-item label="操作信息" name="operMsg">
<a-textarea
v-model:value="modalState.from.operMsg"
:auto-size="{ minRows: 2, maxRows: 6 }"
placeholder="操作信息"
:disabled="true"
/>
</a-form-item>
</a-form>
<template #footer>
<a-button key="cancel" @click="fnModalCancel">关闭</a-button>
</template>
</a-modal>
<!-- 新增框或修改框 -->
<a-modal
width="800px"
:keyboard="false"
:mask-closable="false"
:visible="modalState.visibleByEdit"
:title="modalState.title"
:confirm-loading="modalState.confirmLoading"
@ok="fnModalOk"
@cancel="fnModalCancel"
>
<a-form name="modalStateFrom" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="公告标题"
name="noticeTitle"
v-bind="modalStateFrom.validateInfos.noticeTitle"
>
<a-input
v-model:value="modalState.from.noticeTitle"
allow-clear
placeholder="请输入公告标题"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item
label="公告类型"
name="noticeType"
v-bind="modalStateFrom.validateInfos.noticeType"
>
<a-select
v-model:value="modalState.from.noticeType"
default-value="1"
placeholder="公告类型"
:options="dict.sysNoticeType"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="公告状态" name="status">
<a-select
v-model:value="modalState.from.status"
default-value="0"
placeholder="公告状态"
:options="dict.sysNoticeStatus"
>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-form-item
label="公告内容"
name="noticeContent"
v-bind="modalStateFrom.validateInfos.noticeContent"
>
<a-textarea
v-model:value="modalState.from.noticeContent"
:auto-size="{ minRows: 4, maxRows: 14 }"
:maxlength="3000"
:show-count="true"
placeholder="请输入公告内容"
/>
</a-form-item>
</a-form>
</a-modal>
</PageContainer>
</template>

View File

@@ -161,7 +161,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -573,9 +573,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>

View File

@@ -17,6 +17,7 @@ import {
import { saveAs } from 'file-saver';
import { parseDateToStr } from '@/utils/date-utils';
import useDictStore from '@/store/modules/dict';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore();
const route = useRoute();
@@ -163,7 +164,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number) {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -231,7 +232,7 @@ function fnModalVisibleByVive(postId: string | number) {
getPost(postId).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 200 && res.data) {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '岗位信息';
modalState.visibleByView = true;
@@ -257,7 +258,7 @@ function fnModalVisibleByEdit(postId?: string | number) {
getPost(postId).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 200 && res.data) {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改岗位信息';
modalState.visibleByEdit = true;
@@ -283,7 +284,7 @@ function fnModalOk() {
message.loading({ content: '请稍等...', key });
post
.then(res => {
if (res.code === 200) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${modalState.title}成功`,
key,
@@ -334,7 +335,7 @@ function fnRecordDelete(postId: string = '0') {
const key = 'delPost';
message.loading({ content: '请稍等...', key });
delPost(postId).then(res => {
if (res.code === 200) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
key,
@@ -362,7 +363,7 @@ function fnExportList() {
const key = 'exportPost';
message.loading({ content: '请稍等...', key });
exportPost(toRaw(queryParams)).then(res => {
if (res.code === 200) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
key,
@@ -386,7 +387,7 @@ function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
listPost(toRaw(queryParams)).then(res => {
if (res.code === 200 && Array.isArray(res.rows)) {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];
@@ -531,9 +532,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>

View File

@@ -91,22 +91,22 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [
{
title: '用户编号',
dataIndex: 'id',
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
dataIndex: 'accountId',
dataIndex: 'userName',
align: 'center',
},
{
title: '用户',
dataIndex: 'name',
title: '用户昵称',
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
dataIndex: 'phone',
dataIndex: 'phonenumber',
align: 'center',
},
{
@@ -125,13 +125,13 @@ let tableColumns: ColumnsType = [
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value);
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
{
title: '操作',
key: 'id',
key: 'userId',
align: 'center',
},
];
@@ -170,7 +170,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -209,23 +209,25 @@ function fnModalOk(userIds: string[] | number[]) {
message.error(`请选择要分配的用户`, 2);
return;
}
const hide = message.loading('请稍等...', 0);
const key = 'authUserChecked';
message.loading({ content: '请稍等...', key });
authUserChecked({
checked: true,
userIds: userIds.join(','),
roleId: roleId,
}).then(res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
modalState.visibleBySelectUser = false;
message.success({
content: `授权用户添加成功`,
key,
duration: 3,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 3,
});
}
@@ -244,19 +246,21 @@ function fnRecordDelete(userId: string | number) {
title: '提示',
content: `确认取消用户编号为 【${userId}】 的数据项授权?`,
onOk() {
const hide = message.loading('请稍等...', 0);
const key = 'authUserChecked';
message.loading({ content: '请稍等...', key });
authUserChecked({ checked: false, userIds: userId, roleId: roleId }).then(
res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `取消授权成功`,
key,
duration: 3,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 3,
});
}
@@ -334,7 +338,7 @@ onMounted(() => {
></a-input>
</a-form-item>
</a-col>
<!-- <a-col :lg="6" :md="12" :xs="24">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-input
v-model:value="queryParams.phonenumber"
@@ -343,7 +347,7 @@ onMounted(() => {
placeholder="请输入手机号码"
></a-input>
</a-form-item>
</a-col> -->
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-select
@@ -429,9 +433,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -453,7 +457,7 @@ onMounted(() => {
<!-- 表格列表 -->
<a-table
class="table"
row-key="id"
row-key="userId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -471,13 +475,13 @@ onMounted(() => {
<template v-if="column.key === 'status'">
<DictTag :options="dict.sysNormalDisable" :value="record.status" />
</template>
<template v-if="column.key === 'id'">
<template v-if="column.key === 'userId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>取消授权</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.id)"
@click.prevent="fnRecordDelete(record.userId)"
v-perms:has="['system:role:remove']"
>
<template #icon><UserDeleteOutlined /></template>

View File

@@ -88,14 +88,24 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [
{
title: '用户编号',
dataIndex: 'id',
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
dataIndex: 'accountId',
dataIndex: 'userName',
align: 'center',
},
},
{
title: '用户昵称',
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
dataIndex: 'phonenumber',
align: 'center',
},
{
title: '用户状态',
dataIndex: 'status',
@@ -107,8 +117,8 @@ let tableColumns: ColumnsType = [
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value);
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
];
@@ -224,7 +234,7 @@ watch(
></a-input>
</a-form-item>
</a-col>
<!-- <a-col :lg="8" :md="12" :xs="24">
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-input
v-model:value="queryParams.phonenumber"
@@ -233,7 +243,7 @@ watch(
placeholder="请输入手机号码"
></a-input>
</a-form-item>
</a-col> -->
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-select
@@ -264,7 +274,7 @@ watch(
<a-table
class="table"
row-key="id"
row-key="userId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -277,11 +287,11 @@ watch(
onChange: fnTableSelectedRowKeys,
}"
>
<!-- <template #bodyCell="{ column, record }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<DictTag :options="dict.sysNormalDisable" :value="record.status" />
</template>
</template> -->
</template>
</a-table>
</a-modal>
</template>

View File

@@ -183,7 +183,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -624,18 +624,20 @@ function fnRecordDelete(roleId: string = '0') {
title: '提示',
content: `确认删除角色编号为 【${roleId}】 的数据项?`,
onOk() {
const hide = message.loading('请稍等...', 0);
const key = 'delRole';
message.loading({ content: '请稍等...', key });
delRole(roleId).then(res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
key,
duration: 2,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
@@ -650,17 +652,20 @@ function fnExportList() {
title: '提示',
content: `确认根据搜索条件导出xlsx表格文件吗?`,
onOk() {
const hide = message.loading('请稍等...', 0);
const key = 'exportRole';
message.loading({ content: '请稍等...', key });
exportRole(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
key,
duration: 2,
});
saveAs(res.data, `role_${Date.now()}.xlsx`);
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
@@ -838,9 +843,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -928,7 +933,7 @@ onMounted(() => {
<template #icon><DeleteOutlined /></template>
</a-button>
</a-tooltip>
<!-- <a-tooltip v-if="record.roleId !== '1'">
<a-tooltip v-if="record.roleId !== '1'">
<template #title>分配数据权限</template>
<a-button
type="link"
@@ -937,7 +942,7 @@ onMounted(() => {
>
<template #icon><SecurityScanOutlined /></template>
</a-button>
</a-tooltip> -->
</a-tooltip>
<a-tooltip v-if="record.roleId !== '1'">
<template #title>分配用户</template>
<a-button
@@ -1099,7 +1104,7 @@ onMounted(() => {
<a-input-number
v-model:value="modalState.from.roleSort"
:min="0"
:max="9999"
:max="65535"
:step="1"
placeholder="排序值"
></a-input-number>

View File

@@ -1,185 +0,0 @@
<script setup lang="ts">
import { reactive } from 'vue';
import { message } from 'ant-design-vue/lib';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { ResultType } from '@/plugins/http-fetch';
const emit = defineEmits(['close', 'update:visible']);
const props = defineProps({
/**窗口标题 */
title: {
type: String,
default: '标题',
},
/**是否弹出显示,必传 */
visible: {
type: Boolean,
required: true,
},
/**文件上传函数方法,必传 */
uploadFileMethod: {
type: Function,
required: true,
},
/**下载模板函数方法 */
downloadTemplateMethod: {
type: Function,
default: undefined,
},
/**显示更新已存在数据勾选项 */
showUpdateSupport: {
type: Boolean,
default: false,
},
/**允许上传的文件拓展类型,默认 xls、xlsx */
fileExt: {
type: Array<string>,
default: ['xls', 'xlsx'],
},
/**上传文件大小单位MB默认 10 */
fileSize: {
type: Number,
default: 10,
},
});
/**上传状态 */
let updateState = reactive({
/**是否更新已经存在的数据 */
updateSupport: false,
/**是否上传中 */
loading: false,
/**是否已上传文件 */
isUpload: false,
/**上传结果信息 */
msg: '',
});
/**重置上传状态 */
function fnResetUpdateState() {
updateState = Object.assign(updateState, {
updateSupport: false,
loading: false,
isUpload: false,
msg: '',
});
}
/**上传前检查或转换压缩 */
function fnBeforeUpload(file: FileType) {
if (updateState.loading) return false;
const isAllowType = props.fileExt.some(v => file.name.endsWith(v));
if (!isAllowType) {
message.error(`只支持上传文件格式 ${props.fileExt.join('、')}`, 3);
}
const isLtM = file.size / 1024 / 1024 < props.fileSize;
if (!isLtM) {
message.error(`上传文件大小必须小于 ${props.fileSize}MB`, 3);
}
return isAllowType && isLtM;
}
/**上传请求发出 */
function fnUpload(up: UploadRequestOption) {
if (typeof props.uploadFileMethod !== 'function') return;
const hide = message.loading('正在上传并解析数据...', 0);
updateState.loading = true;
let formData = new FormData();
formData.append('file', up.file);
formData.append('updateSupport', `${updateState.updateSupport}`);
props
.uploadFileMethod(formData)
.then((res: ResultType) => {
updateState.loading = false;
updateState.isUpload = true;
updateState.msg = res.msg?.replaceAll(/<br\/>+/g, '\r');
})
.catch((err: { code: number; msg: string }) => {
message.error(`上传失败 ${err.msg}`);
})
.finally(() => {
hide();
});
}
/**弹框确认按钮事件 */
function fnModalOk() {
emit('update:visible', false);
emit('close', updateState.isUpload);
fnResetUpdateState();
}
/**弹框取消按钮事件 */
function fnModalCancel() {
emit('update:visible', false);
emit('close', updateState.isUpload);
fnResetUpdateState();
}
</script>
<template>
<a-modal
width="500px"
:title="props.title"
:visible="props.visible"
:keyboard="false"
:mask-closable="false"
@ok="fnModalOk"
@cancel="fnModalCancel"
>
<a-space :size="8" direction="vertical" style="width: 100%">
<a-upload-dragger
:disabled="updateState.loading"
name="file"
:max-count="1"
:show-upload-list="false"
:before-upload="fnBeforeUpload"
:custom-request="fnUpload"
>
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
</p>
<p class="ant-upload-text">点击选择或将文件拖入边框区域进行上传</p>
<p class="ant-upload-hint">
仅允许导入
{{ props.fileExt.join('、') }}
格式文件上传文件大小
{{ props.fileSize }}
MB
</p>
</a-upload-dragger>
<a-row :gutter="18" justify="space-between" align="middle">
<a-col :span="12">
<a-checkbox
v-model:checked="updateState.updateSupport"
v-if="showUpdateSupport"
>
是否更新已经存在的数据
</a-checkbox>
</a-col>
<a-col :span="6">
<a-button
type="link"
title="下载模板"
@click="downloadTemplateMethod()"
v-if="downloadTemplateMethod"
>
下载模板
</a-button>
</a-col>
</a-row>
<a-textarea
:disabled="true"
:hidden="updateState.msg.length < 1"
:value="updateState.msg"
:auto-size="{ minRows: 2, maxRows: 8 }"
/>
</a-space>
</a-modal>
</template>
<style lang="less" scoped>
.table :deep(.ant-pagination) {
padding: 0 24px;
}
</style>

View File

@@ -6,7 +6,7 @@ import { message, Modal, Form } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table';
import UploadXlsxImport from './components/UploadXlsxImport.vue';
import UploadModal from '@/components/UploadModal/index.vue';
import {
importData,
importTemplate,
@@ -32,7 +32,6 @@ import {
import useDictStore from '@/store/modules/dict';
import useUserStore from '@/store/modules/user';
import { DataNode } from 'ant-design-vue/lib/tree';
import { hasPermissions } from '@/plugins/auth-user';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore();
const route = useRoute();
@@ -60,6 +59,8 @@ let queryParams = reactive({
userName: '',
/**手机号 */
phonenumber: '',
/**部门ID */
deptId: '',
/**用户状态 */
status: undefined,
/**记录开始时间 */
@@ -77,6 +78,7 @@ function fnQueryReset() {
queryParams = Object.assign(queryParams, {
userName: '',
phonenumber: '',
deptId: '',
status: undefined,
beginTime: '',
endTime: '',
@@ -119,37 +121,43 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [
{
title: '用户编号',
dataIndex: 'id',
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
dataIndex: 'accountId',
dataIndex: 'userName',
align: 'center',
},
{
title: '用户',
dataIndex: 'name',
title: '用户昵称',
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
dataIndex: 'phone',
dataIndex: 'phonenumber',
align: 'center',
},
{
title: '用户类型',
dataIndex: 'groupName',
key: 'groupName',
title: '部门名称',
dataIndex: 'deptId',
key: 'deptId',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createTime',
title: '登录地址',
dataIndex: 'loginIp',
key: 'loginIp',
align: 'center',
},
{
title: '登录时间',
dataIndex: 'loginDate',
align: 'center',
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value);
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
{
@@ -160,7 +168,7 @@ let tableColumns: ColumnsType = [
},
{
title: '操作',
key: 'id',
key: 'userId',
align: 'center',
},
];
@@ -209,12 +217,15 @@ function fnTableSelectedRowKeys(keys: (string | number)[]) {
}
type OptionsType = {
/**岗位选择列表 */
posts: Record<string, any>[];
/**角色选择列表 */
roles: Record<string, any>[];
};
/**初始用户选择列表 */
let options: OptionsType = {
posts: [],
roles: [],
};
@@ -261,6 +272,7 @@ let modalState: ModalStateType = reactive({
},
confirmLoading: false,
options: {
posts: [],
roles: [],
},
});
@@ -328,7 +340,13 @@ function fnModalVisibleByVive(userId: string | number) {
Reflect.set(m, 'disabled', disabled);
return m;
});
const posts = res.data.posts.map((m: Record<string, any>) => {
const disabled = m.status === '0';
Reflect.set(m, 'disabled', disabled);
return m;
});
modalState.options.roles = roles;
modalState.options.posts = posts;
const { user, roleIds, postIds } = res.data;
modalState.from = Object.assign(modalState.from, user);
modalState.from.roleIds = roleIds;
@@ -352,6 +370,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
modalStateFrom.resetFields();
if (options.roles.length > 0) {
modalState.options.roles = options.roles;
modalState.options.posts = options.posts;
modalState.title = '添加用户信息';
modalState.visibleByEdit = true;
} else {
@@ -368,8 +387,15 @@ function fnModalVisibleByEdit(userId?: string | number) {
Reflect.set(m, 'disabled', disabled);
return m;
});
const posts = res.data.posts.map((m: Record<string, any>) => {
const disabled = m.status === '0';
Reflect.set(m, 'disabled', disabled);
return m;
});
options.roles = roles;
options.posts = posts;
modalState.options.roles = roles;
modalState.options.posts = posts;
const { user, roleIds, postIds } = res.data;
modalState.from = Object.assign(modalState.from, user);
modalState.from.roleIds = roleIds;
@@ -394,7 +420,13 @@ function fnModalVisibleByEdit(userId?: string | number) {
Reflect.set(m, 'disabled', disabled);
return m;
});
const posts = res.data.posts.map((m: Record<string, any>) => {
const disabled = m.status === '0';
Reflect.set(m, 'disabled', disabled);
return m;
});
modalState.options.roles = roles;
modalState.options.posts = posts;
const { user, roleIds, postIds } = res.data;
modalState.from = Object.assign(modalState.from, user);
modalState.from.roleIds = roleIds;
@@ -463,6 +495,7 @@ function fnModalCancel() {
modalState.visibleByResetPwd = false;
modalStateFrom.resetFields();
modalState.options.roles = [];
modalState.options.posts = [];
}
/**
@@ -613,41 +646,67 @@ function fnExportList() {
}
/**对话框表格信息导入对象信息状态类型 */
type ModalUploadXlsxImportStateType = {
type ModalUploadImportStateType = {
/**是否显示 */
visible: boolean;
/**标题 */
title: string;
/**是否上传中 */
loading: boolean;
/**是否更新已经存在的数据 */
updateSupport: boolean;
/**上传结果信息 */
msg: string;
/**导入模板下载触发 */
templateDownload: boolean;
};
/**对话框表格信息导入对象信息状态 */
let modalUploadXlsxImportState: ModalUploadXlsxImportStateType = reactive({
let uploadImportState: ModalUploadImportStateType = reactive({
visible: false,
title: '用户导入',
loading: false,
updateSupport: false,
msg: '',
templateDownload: false,
});
/**
* 对话框表格信息导入确认执行函数
* @param isUpload 是否已上传文件
*/
function fnModalUploadXlsxImportClose(isUpload: boolean) {
if (isUpload) {
fnGetList();
}
}
/**对话框表格信息导入弹出窗口 */
function fnModalUploadXlsxImportOpen() {
modalUploadXlsxImportState.visible = true;
function fnModalUploadImportOpen() {
uploadImportState.updateSupport = false;
uploadImportState.msg = '';
uploadImportState.visible = true;
}
/**列表导入模板 */
function fnModalUploadXlsxImportExportTemplate() {
if (modalUploadXlsxImportState.templateDownload) return;
modalUploadXlsxImportState.templateDownload = true;
/**对话框表格信息导入关闭窗口 */
function fnModalUploadImportClose() {
uploadImportState.visible = false;
}
/**对话框表格信息导入上传 */
function fnModalUploadImportUpload(file: File) {
const hide = message.loading('正在上传并解析数据...', 0);
uploadImportState.loading = true;
let formData = new FormData();
formData.append('file', file);
formData.append('updateSupport', `${uploadImportState.updateSupport}`);
importData(formData)
.then(res => {
uploadImportState.msg = res.msg?.replaceAll(/<br\/>+/g, '\r');
})
.catch((err: { code: number; msg: string }) => {
message.error(`上传失败 ${err.msg}`);
})
.finally(() => {
hide();
uploadImportState.loading = false;
});
}
/**对话框表格信息导入模板 */
function fnModalUploadImportExportTemplate() {
if (uploadImportState.templateDownload) return;
uploadImportState.templateDownload = true;
const hide = message.loading('正在下载...', 0);
importTemplate()
.then(res => {
@@ -666,7 +725,7 @@ function fnModalUploadXlsxImportExportTemplate() {
})
.finally(() => {
hide();
modalUploadXlsxImportState.templateDownload = false;
uploadImportState.templateDownload = false;
});
}
@@ -739,25 +798,25 @@ onMounted(() => {
<!-- 表格搜索栏 -->
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录账号" name="userName">
<a-input
v-model:value="queryParams.userName"
allow-clear
:maxlength="30"
placeholder="请输入登录账号"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="4" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择"
:options="dict.sysNormalDisable"
<a-col :lg="18" :md="12" :xs="24">
<a-form-item label="部门名称" name="deptId">
<a-tree-select
v-model:value="queryParams.deptId"
placeholder="部门名称"
show-search
tree-default-expand-all
:tree-data="deptTreeData"
:field-names="{
children: 'children',
label: 'label',
value: 'id',
}"
tree-node-label-prop="label"
tree-node-filter-prop="label"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
>
</a-select>
</a-tree-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
@@ -775,6 +834,51 @@ onMounted(() => {
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录账号" name="userName">
<a-input
v-model:value="queryParams.userName"
allow-clear
:maxlength="30"
placeholder="请输入登录账号"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-input
v-model:value="queryParams.phonenumber"
allow-clear
:maxlength="11"
placeholder="请输入手机号码"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="4" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择"
:options="dict.sysNormalDisable"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="登录时间" name="queryRangePicker">
<a-range-picker
v-model:value="queryRangePicker"
allow-clear
bordered
value-format="YYYY-MM-DD"
:placeholder="['登录开始', '登录结束']"
style="width: 100%"
></a-range-picker>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-card>
@@ -800,9 +904,9 @@ onMounted(() => {
<template #icon><DeleteOutlined /></template>
删除
</a-button>
<!-- <a-button
<a-button
type="dashed"
@click.prevent="fnModalUploadXlsxImportOpen()"
@click.prevent="fnModalUploadImportOpen()"
v-perms:has="['system:user:import']"
>
<template #icon><ImportOutlined /></template>
@@ -815,7 +919,7 @@ onMounted(() => {
>
<template #icon><ExportOutlined /></template>
导出
</a-button> -->
</a-button>
</a-space>
</template>
@@ -846,9 +950,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -870,7 +974,7 @@ onMounted(() => {
<!-- 表格列表 -->
<a-table
class="table"
row-key="id"
row-key="userId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -885,10 +989,10 @@ onMounted(() => {
}"
>
<template #bodyCell="{ column, record }">
<!-- <template v-if="column.key === 'deptId'">
<template v-if="column.key === 'deptId'">
{{ record.dept?.deptName }}
</template> -->
<!-- <template v-if="column.key === 'status'">
</template>
<template v-if="column.key === 'status'">
<a-switch
v-if="record.userId !== '1'"
v-perms:has="['system:user:edit']"
@@ -905,14 +1009,14 @@ onMounted(() => {
:options="dict.sysNormalDisable"
:value="record.status"
/>
</template> -->
<template v-if="column.key === 'id'">
<a-space :size="8" align="center" v-if="record.id !== '1'">
</template>
<template v-if="column.key === 'userId'">
<a-space :size="8" align="center" v-if="record.userId !== '1'">
<a-tooltip>
<template #title>查看详情</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByVive(record.id)"
@click.prevent="fnModalVisibleByVive(record.userId)"
v-perms:has="['system:user:query']"
>
<template #icon><ProfileOutlined /></template>
@@ -922,7 +1026,7 @@ onMounted(() => {
<template #title>编辑</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.id)"
@click.prevent="fnModalVisibleByEdit(record.userId)"
v-perms:has="['system:user:edit']"
>
<template #icon><FormOutlined /></template>
@@ -932,13 +1036,13 @@ onMounted(() => {
<template #title>删除</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.id)"
@click.prevent="fnRecordDelete(record.userId)"
v-perms:has="['system:user:remove']"
>
<template #icon><DeleteOutlined /></template>
</a-button>
</a-tooltip>
<!-- <a-tooltip>
<a-tooltip>
<template #title>重置密码</template>
<a-button
type="link"
@@ -947,7 +1051,7 @@ onMounted(() => {
>
<template #icon><SecurityScanOutlined /></template>
</a-button>
</a-tooltip> -->
</a-tooltip>
</a-space>
</template>
</template>
@@ -1064,7 +1168,21 @@ onMounted(() => {
</a-form-item>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="用户岗位" name="postIds">
<a-select
:value="modalState.from.postIds"
disabled
mode="multiple"
placeholder="请选择用户岗位"
option-label-prop="postName"
:options="modalState.options.posts"
:field-names="{ label: 'postName', value: 'postId' }"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="用户角色" name="roleIds">
<a-select
:value="modalState.from.roleIds"
@@ -1230,7 +1348,23 @@ onMounted(() => {
</a-form-item>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="用户岗位" name="postIds">
<a-select
v-model:value="modalState.from.postIds"
allow-clear
mode="multiple"
placeholder="请选择用户岗位"
show-search
option-filter-prop="postName"
option-label-prop="postName"
:options="modalState.options.posts"
:field-names="{ label: 'postName', value: 'postId' }"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="用户角色" name="roleIds">
<a-select
v-model:value="modalState.from.roleIds"
@@ -1307,14 +1441,40 @@ onMounted(() => {
</a-modal>
<!-- 上传导入表格数据文件框 -->
<!-- <UploadXlsxImport
:title="modalUploadXlsxImportState.title"
v-model:visible="modalUploadXlsxImportState.visible"
:show-update-support="true"
:upload-file-method="importData"
:download-template-method="fnModalUploadXlsxImportExportTemplate"
@close="fnModalUploadXlsxImportClose"
/> -->
<UploadModal
:title="uploadImportState.title"
:loading="uploadImportState.loading"
@upload="fnModalUploadImportUpload"
@close="fnModalUploadImportClose"
v-model:visible="uploadImportState.visible"
:ext="['.xls', '.xlsx']"
:size="10"
>
<template #default>
<a-row :gutter="18" justify="space-between" align="middle">
<a-col :span="12">
<a-checkbox v-model:checked="uploadImportState.updateSupport">
是否更新已经存在的数据
</a-checkbox>
</a-col>
<a-col :span="6">
<a-button
type="link"
title="下载模板"
@click.prevent="fnModalUploadImportExportTemplate"
>
下载模板
</a-button>
</a-col>
</a-row>
<a-textarea
:disabled="true"
:hidden="!uploadImportState.msg"
:value="uploadImportState.msg"
:auto-size="{ minRows: 2, maxRows: 8 }"
/>
</template>
</UploadModal>
</PageContainer>
</template>