index.vue
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<script lang="ts" setup>
import { BasicTable, useTable } from '/@/components/Table';
import { formSchemas, columnSchema } from './config';
import { BasicModal, useModal } from '/@/components/Modal';
import { Textarea } from 'ant-design-vue';
import { ref } from 'vue';
import { formatToDateTime } from '/@/utils/dateUtil';
import { EyeOutlined } from '@ant-design/icons-vue';
const outputData = ref<string>();
const [register] = useTable({
columns: columnSchema,
size: 'small',
showIndexColumn: false,
useSearchForm: true,
showTableSetting: true,
bordered: true,
dataSource: [
{
time: formatToDateTime(new Date()),
identifier: '标识符',
eventName: '事件名',
eventType: '告警',
outputParams: { test: 1 },
},
],
formConfig: {
layout: 'inline',
baseColProps: { span: 6 },
labelWidth: 80,
schemas: formSchemas,
},
handleSearchInfoFn: (params: Recordable) => {
// console.log(params);
return params;
},
});
const [registerModal, { openModal }] = useModal();
const handleViewDetail = () => {
outputData.value = JSON.stringify(
{
test: '123',
},
null,
2
);
openModal(true);
};
</script>
<template>
<BasicTable class="event-manage-table" @register="register">
<template #outputParams>
<span class="cursor-pointer text-blue-500" @click="handleViewDetail">
<EyeOutlined class="svg:text-blue-500" />
<span class="ml-2">详情</span>
</span>
</template>
</BasicTable>
<BasicModal title="输出参数" @register="registerModal">
<Textarea v-model:value="outputData" :autosize="true" />
</BasicModal>
</template>
<style lang="less" scoped>
.event-manage-table {
background-color: #f0f2f5;
}
</style>