position.data.ts
2.38 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tooltip } from 'ant-design-vue';
import { handeleCopy } from '../../../device/profiles/step/topic';
import { useI18n } from '/@/hooks/web/useI18n';
import { Tag } from 'ant-design-vue';
const { t } = useI18n();
export enum PositionListAuthEnum {
/**
* @description 新增
*/
CREATE = 'api:yt:archive:position:post',
/**
* @description 删除
*/
DELETE = 'api:yt:archive:position:delete',
/**
* @description 编辑
*/
UPDATE = 'api:yt:archive:position:update',
/**
* @description 启用
*/
ENABLE = 'api:yt:archive:position:enable',
/**
* @description 停用
*/
STOP = 'api:yt:archive:position:stop',
}
// 表格列数据
export const columns: BasicColumn[] = [
{
dataIndex: 'position',
title: t('archive.position.positionName'),
width: 210,
slots: { customRender: 'position', title: 'deviceTitle' },
className: 'position-name-edge',
customRender: ({ record }) => {
return h('div', { class: 'py-3 px-3.5' }, [
h(
'div',
{
class: 'cursor-pointer text-blue-500 truncate',
onClick: () => {
handeleCopy(`${record.position}`);
},
},
h(
Tooltip,
{
placement: 'topLeft',
title: `${record.position}`,
},
() => `${record.position}`
)
),
]);
},
},
{
title: t('archive.position.status'),
dataIndex: 'status',
width: 110,
customRender: ({ record }) => {
const color = record?.status == 'ENABLE' ? 'blue' : 'red';
const text = record.status == 'ENABLE' ? t('common.enableText') : t('common.stop');
return h(Tag, { color: color }, () => text);
},
},
{
title: t('archive.position.remark'),
dataIndex: 'notes',
width: 120,
},
{
title: t('archive.position.creator'),
dataIndex: 'creatorName',
width: 120,
},
{
title: t('archive.position.createTime'),
dataIndex: 'createTime',
width: 120,
},
];
// 查询字段
export const searchFormSchema: FormSchema[] = [
{
field: 'position',
label: t('archive.position.positionName'),
component: 'Input',
colProps: { span: 6 },
componentProps: {
maxLength: 255,
},
},
];