This commit is contained in:
sjl
2025-02-13 15:40:13 +08:00
parent ddeb84fcfe
commit 475d236b7e
10 changed files with 149 additions and 88 deletions

View File

@@ -3,7 +3,7 @@
<ProTable
ref='proTable'
:columns='columns'
:data='logData'
:request-api='getTableList'
@selection-change='handleSelectionChange'
type='selection'
>
@@ -21,41 +21,39 @@
<script setup lang='tsx' name='useProTable'>
// 根据实际路径调整
import TimeControl from '@/components/TimeControl/index.vue'
import { type Sys_Log_Audit } from '@/api/system/interface/log'
import { type AuditLog} from '@/api/system/log/interface/log.ts'
import ProTable from '@/components/ProTable/index.vue'
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
import logDataList from '@/api/system/log/logData'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { reactive,ref,watch } from 'vue'
import { useDictStore } from '@/stores/modules/dict'
import {
getAuditLog,
} from '@/api/system/log/index.ts'
defineOptions({
name: 'log'
})
let multipleSelection = ref<string[]>([])
const logData = logDataList
const dictStore = useDictStore()
// 定义包含和排除的单位
const includedUnits = ['日', '', '月', '自定义']; // 可以根据需要包含的单位
const excludedUnits = ['季度','']; // 要排除的单位
const defaultUnits = '日'; // 默认的单位
// defineOptions({
// name: 'log'
// })
const startDate = ref('')
const endDate = ref('')
// ProTable 实例
const proTable = ref<ProTableInstance>()
const getTableList = async (params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
newParams.searchEndTime = endDate.value
newParams.searchBeginTime = startDate.value
return getAuditLog(newParams)
}
// 表格配置项
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'id',
label: '序号',
width: 70,
},
{
prop: 'create_By',
prop: 'createBy',
label: '操作用户',
search: { el: 'input' },
minWidth: 100,
@@ -66,20 +64,19 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
minWidth: 120,
},
{
prop: 'create_Time',
prop: 'createTime',
label: '记录时间',
minWidth: 180,
search: {
span: 2,
render: () => {
return (
<div class='flx-flex-start'>
<TimeControl
include={includedUnits}
exclude={excludedUnits}
default={defaultUnits}
/>
</div>
<div class='flx-flex-start'>
<TimeControl
include={['日', '周', '月', '自定义']}
default={'月'}
onUpdate-dates={handleDateChange}
/>
</div>
)
},
},
@@ -108,18 +105,17 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
prop: 'operate_Type',
label: '日志类型',
width: 100,
search: { el: 'select', props: { filterable: true } },
},
])
//选中
// 处理选择变化
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
// 处理日期变化的回调函数
const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
startDate.value = startDateTemp
endDate.value = endDateTemp
}
</script>
<style scoped>