config.ts
1.97 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
import { BasicColumn, FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { findDictItemByCode } from '/@/api/system/dict';
// 表格配置
export const columns: BasicColumn[] = [
{
title: '接口名称',
dataIndex: 'name',
width: 80,
},
{
title: '请求方式',
dataIndex: 'method',
width: 120,
},
{
title: '接口内容',
dataIndex: 'content',
width: 120,
},
{
title: '状态',
dataIndex: 'status',
width: 120,
customRender: ({ record }) => {
const status = record.status;
const color = status == 0 ? 'green' : 'red';
const text = status == 0 ? '发布' : '未发布';
return h(Tag, { color: color }, () => text);
},
},
];
//模拟数据
export const list = [
{
name: '传感器趋势图',
method: 'get',
content: '/api/sensor',
status: 0,
},
{
name: '报警器趋势图',
method: 'get',
content: '/api/alarm',
status: 1,
},
];
//表单配置
// 新增编辑配置
export const schemas: FormSchema[] = [
{
field: 'name',
label: '接口名称',
colProps: { span: 24 },
required: true,
component: 'Input',
componentProps: {
maxLength: 64,
placeholder: '请输入接口名称',
},
},
{
field: 'address',
label: '接口地址',
colProps: { span: 24 },
required: true,
component: 'Input',
componentProps: {
maxLength: 64,
placeholder: '请输入接口地址',
},
},
{
field: 'method',
label: '选择方式',
component: 'ApiSelect',
required: true,
colProps: { span: 24 },
componentProps: {
placeholder: '请选择选择方式',
api: findDictItemByCode,
params: {
dictCode: 'dataview_select_methods',
},
labelField: 'itemText',
valueField: 'itemValue',
},
},
];