You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
4.2 KiB

import type { Ref } from 'vue'
import type { BasicColumn, FormSchema } from '@/components/Table'
import { useSystemEnumStoreWithOut } from '@/store/modules/systemEnum'
const { getSystemEnumLabel, getSystemEnums } = useSystemEnumStoreWithOut()
export const columns: BasicColumn[] = [
{
title: '产品名称',
dataIndex: 'productName',
},
{
title: '产品标识',
dataIndex: 'productKey',
},
{
title: '节点类型',
dataIndex: 'nodeType',
customRender: ({ value }) => getSystemEnumLabel('eProductNodeType', value),
},
{
title: '联网方式',
dataIndex: 'networkType',
customRender: ({ value }) => getSystemEnumLabel('eNetworkType', value),
},
{
title: '鉴权方式',
dataIndex: 'authType',
customRender: ({ value }) => getSystemEnumLabel('eAuthType', value),
},
{
title: '安全类型',
dataIndex: 'securityType',
customRender: ({ value }) => getSystemEnumLabel('eProductSecurityType', value),
},
{
title: '通信协议',
dataIndex: 'networkProtocol',
customRender: ({ value }) => getSystemEnumLabel('eNetworkProtocol', value),
},
{
title: '数据格式',
dataIndex: 'dataType',
customRender: ({ value }) => getSystemEnumLabel('eDataType', value),
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 200,
},
]
export const searchFormSchemas: FormSchema[] = [
{
label: '产品名称',
field: 'productName',
component: 'Input',
colProps: { span: 6 },
},
{
label: '联网方式',
field: 'networkType',
component: 'Select',
componentProps: {
options: getSystemEnums('eNetworkType'),
},
colProps: { span: 6 },
},
{
label: '通信协议',
field: 'networkProtocol',
component: 'Select',
componentProps: {
options: getSystemEnums('eNetworkProtocol'),
},
colProps: { span: 6 },
},
{
label: '节点类型',
field: 'nodeType',
component: 'Select',
componentProps: {
options: getSystemEnums('eProductNodeType'),
},
colProps: { span: 6 },
},
{
label: '安全类型',
field: 'securityType',
component: 'Select',
componentProps: {
options: getSystemEnums('eProductSecurityType'),
},
colProps: { span: 6 },
},
{
label: '数据格式',
field: 'dataType',
component: 'Select',
componentProps: {
options: getSystemEnums('eDataType'),
},
colProps: { span: 6 },
},
]
export function getFormSchema(isUpdate: Ref<boolean>): FormSchema[] {
return [
{
field: 'id',
show: false,
component: 'Input',
},
{
label: '产品名称',
field: 'productName',
required: true,
component: 'Input',
},
{
label: '联网方式',
field: 'networkType',
component: 'Select',
componentProps: {
options: getSystemEnums('eNetworkType'),
},
},
{
label: '通信协议',
field: 'networkProtocol',
component: 'Select',
componentProps: {
options: getSystemEnums('eNetworkProtocol'),
},
ifShow: () => !isUpdate.value,
},
{
label: '节点类型',
field: 'nodeType',
required: true,
component: 'Select',
componentProps: {
options: getSystemEnums('eProductNodeType'),
},
ifShow: () => !isUpdate.value,
},
{
label: '安全类型',
field: 'securityType',
component: 'Select',
componentProps: {
options: getSystemEnums('eProductSecurityType'),
},
ifShow: () => !isUpdate.value,
},
{
label: '鉴权方式',
field: 'authType',
required: true,
component: 'Select',
componentProps: {
options: getSystemEnums('eAuthType'),
},
ifShow: () => !isUpdate.value,
},
{
label: '数据格式',
field: 'dataType',
required: true,
component: 'Select',
componentProps: {
options: getSystemEnums('eDataType'),
},
ifShow: () => !isUpdate.value,
},
{
label: '产品描述',
field: 'productDesc',
component: 'InputTextArea',
},
]
}
export enum ProductTabEnums {
TopicManage = '1',
Model = '2',
Subscription = '3',
}