表单验证
This commit is contained in:
@@ -21,14 +21,16 @@
|
||||
<script setup lang='tsx' name='useProTable'>
|
||||
// 根据实际路径调整
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type Log } from '@/api/log/interface'
|
||||
import { type Sys_Log_Audit } from '@/api/log/interface'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
|
||||
import logDataList from '@/api/log/logData'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { reactive,ref,watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
let multipleSelection = ref<string[]>([])
|
||||
const logData = logDataList
|
||||
const dictStore = useDictStore()
|
||||
// 定义包含和排除的单位
|
||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
||||
@@ -36,7 +38,7 @@ const defaultUnits = '日'; // 默认的单位
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Log.LogList>[]>([
|
||||
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{
|
||||
prop: 'id',
|
||||
@@ -44,15 +46,20 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
|
||||
width: 70,
|
||||
},
|
||||
{
|
||||
prop: 'user',
|
||||
prop: 'create_By',
|
||||
label: '操作用户',
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
width: 150,
|
||||
search: { el: 'input' },
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
prop: 'record_Time',
|
||||
prop: 'ip',
|
||||
label: 'IP',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
prop: 'create_Time',
|
||||
label: '记录时间',
|
||||
width: 200,
|
||||
minWidth: 180,
|
||||
search: {
|
||||
span: 2,
|
||||
render: () => {
|
||||
@@ -69,28 +76,38 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'content',
|
||||
label: '内容',
|
||||
|
||||
prop: 'remark',
|
||||
label: '事件描述',
|
||||
minWidth: 400,
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
prop: 'result',
|
||||
label: '事件结果',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
prop: 'warn',
|
||||
label: '告警标志',
|
||||
enum: dictStore.getDictData('status'),
|
||||
minWidth: 100,
|
||||
fieldNames: { label: 'label', value: 'code' },
|
||||
render: scope => {
|
||||
return (
|
||||
<el-tag type={scope.row.warn ? 'danger' : 'success'}>{scope.row.warn ? '告警' : '未告警'}</el-tag>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'operate_Type',
|
||||
label: '日志类型',
|
||||
width: 200,
|
||||
width: 100,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
},
|
||||
{
|
||||
prop: 'level',
|
||||
label: '日志等级',
|
||||
width: 200,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
//选中
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (selection: Log.LogList[]) => {
|
||||
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
|
||||
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user