2024-05-12 02:05:33 +08:00
|
|
|
<script lang="ts" setup>
|
2024-05-11 14:48:02 +08:00
|
|
|
import { ref } from "vue";
|
|
|
|
import { useRole } from "./hook";
|
|
|
|
import { getPickerShortcuts } from "../../utils";
|
2024-05-12 02:05:33 +08:00
|
|
|
import { PureTableBar } from "@/components/TableBar";
|
2024-05-11 14:48:02 +08:00
|
|
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
2024-05-12 02:05:33 +08:00
|
|
|
import PureTable from "@pureadmin/table";
|
2024-05-11 14:48:02 +08:00
|
|
|
import View from "@iconify-icons/ep/view";
|
|
|
|
import Delete from "@iconify-icons/ep/delete";
|
|
|
|
import Refresh from "@iconify-icons/ep/refresh";
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
name: "SystemLog"
|
|
|
|
});
|
|
|
|
|
|
|
|
const formRef = ref();
|
|
|
|
const tableRef = ref();
|
|
|
|
|
|
|
|
const {
|
|
|
|
form,
|
|
|
|
loading,
|
|
|
|
columns,
|
|
|
|
dataList,
|
|
|
|
pagination,
|
|
|
|
selectedNum,
|
|
|
|
onSearch,
|
|
|
|
onDetail,
|
|
|
|
clearAll,
|
|
|
|
resetForm,
|
|
|
|
onbatchDel,
|
|
|
|
handleSizeChange,
|
|
|
|
onSelectionCancel,
|
|
|
|
handleCellDblclick,
|
|
|
|
handleCurrentChange,
|
|
|
|
handleSelectionChange
|
|
|
|
} = useRole(tableRef);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="main">
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-form ref="formRef" :inline="true" :model="form" class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
2024-05-11 14:48:02 +08:00
|
|
|
<el-form-item label="所属模块" prop="module">
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-input v-model="form.module" class="!w-[170px]" clearable placeholder="请输入所属模块" />
|
2024-05-11 14:48:02 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="请求时间" prop="requestTime">
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-date-picker v-model="form.requestTime" :shortcuts="getPickerShortcuts()" end-placeholder="结束日期时间" range-separator="至" start-placeholder="开始日期时间" type="datetimerange" />
|
2024-05-11 14:48:02 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-button :icon="useRenderIcon('ri:search-line')" :loading="loading" type="primary" @click="onSearch"> 搜索 </el-button>
|
|
|
|
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> 重置</el-button>
|
2024-05-11 14:48:02 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
|
2024-05-12 02:05:33 +08:00
|
|
|
<PureTableBar :columns="columns" title="系统日志(仅演示,操作后不生效)" @refresh="onSearch">
|
2024-05-11 14:48:02 +08:00
|
|
|
<template #buttons>
|
|
|
|
<el-popconfirm title="确定要删除所有日志数据吗?" @confirm="clearAll">
|
|
|
|
<template #reference>
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-button :icon="useRenderIcon(Delete)" type="danger"> 清空日志</el-button>
|
2024-05-11 14:48:02 +08:00
|
|
|
</template>
|
|
|
|
</el-popconfirm>
|
|
|
|
</template>
|
|
|
|
<template v-slot="{ size, dynamicColumns }">
|
2024-05-12 02:05:33 +08:00
|
|
|
<div v-if="selectedNum > 0" v-motion-fade class="bg-[var(--el-fill-color-light)] w-full h-[46px] mb-2 pl-4 flex items-center">
|
2024-05-11 14:48:02 +08:00
|
|
|
<div class="flex-auto">
|
2024-05-12 02:05:33 +08:00
|
|
|
<span class="text-[rgba(42,46,54,0.5)] dark:text-[rgba(220,220,242,0.5)]" style="font-size: var(--el-font-size-base)"> 已选 {{ selectedNum }} 项 </span>
|
|
|
|
<el-button text type="primary" @click="onSelectionCancel"> 取消选择</el-button>
|
2024-05-11 14:48:02 +08:00
|
|
|
</div>
|
|
|
|
<el-popconfirm title="是否确认删除?" @confirm="onbatchDel">
|
|
|
|
<template #reference>
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-button class="mr-1" text type="danger"> 批量删除</el-button>
|
2024-05-11 14:48:02 +08:00
|
|
|
</template>
|
|
|
|
</el-popconfirm>
|
|
|
|
</div>
|
|
|
|
<pure-table
|
|
|
|
ref="tableRef"
|
|
|
|
:adaptiveConfig="{ offsetBottom: 108 }"
|
|
|
|
:columns="dynamicColumns"
|
2024-05-12 02:05:33 +08:00
|
|
|
:data="dataList"
|
2024-05-11 14:48:02 +08:00
|
|
|
:header-cell-style="{
|
|
|
|
background: 'var(--el-fill-color-light)',
|
|
|
|
color: 'var(--el-text-color-primary)'
|
|
|
|
}"
|
2024-05-12 02:05:33 +08:00
|
|
|
:loading="loading"
|
|
|
|
:pagination="pagination"
|
|
|
|
:paginationSmall="size === 'small' ? true : false"
|
|
|
|
:size="size"
|
|
|
|
adaptive
|
|
|
|
align-whole="center"
|
|
|
|
row-key="id"
|
|
|
|
table-layout="auto"
|
2024-05-11 14:48:02 +08:00
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
@page-size-change="handleSizeChange"
|
|
|
|
@page-current-change="handleCurrentChange"
|
|
|
|
@cell-dblclick="handleCellDblclick"
|
|
|
|
>
|
|
|
|
<template #operation="{ row }">
|
2024-05-12 02:05:33 +08:00
|
|
|
<el-button :icon="useRenderIcon(View)" :size="size" class="reset-margin !outline-none" link type="primary" @click="onDetail(row)"> 详情 </el-button>
|
2024-05-11 14:48:02 +08:00
|
|
|
</template>
|
|
|
|
</pure-table>
|
|
|
|
</template>
|
|
|
|
</PureTableBar>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2024-05-12 02:05:33 +08:00
|
|
|
<style lang="scss" scoped>
|
2024-05-11 14:48:02 +08:00
|
|
|
:deep(.el-dropdown-menu__item i) {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.main-content {
|
|
|
|
margin: 24px 24px 0 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-form {
|
|
|
|
:deep(.el-form-item) {
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|