feat: 网络组件详情 表单共享配置基本样式

This commit is contained in:
jackhoo_98 2023-02-15 21:01:46 +08:00
parent 91ae45d227
commit 6acc522ed5
4 changed files with 1450 additions and 25 deletions

View File

@ -13,4 +13,20 @@ export const start = (data: object) =>
export const supports = () => server.get(`/network/config/supports`); export const supports = () => server.get(`/network/config/supports`);
export const query = (data: Object) => server.post(`/network/config/_query`, data); export const query = (data: Object) =>
server.post(`/network/config/_query`, data);
export const providers = () => server.get(`/gateway/device/providers`);
export const resourcesCurrent = () =>
server.get(`/network/resources/alive/_current`);
export const resourceClusters = () => server.get(`network/resources/clusters`);
export const resourceClustersById = (id: string) =>
server.get(`/network/resources/alive/${id}`);
export const allResources = () => server.get(`/network/resources/alive/_all`);
export const certificates = () =>
server.get(`/network/certificate/_query/no-paging?paging=false`);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
export const FormStates = {
name: '',
type: 'UDP',
shareCluster: true,
parserType: '',
configuration: {
port: '',
host: '0.0.0.0',
publicPort: '',
publicHost: '',
remoteHost: '',
remotePort: '',
secure: false,
username: '',
password: '',
topicPrefix: '',
maxMessageSize: '',
certId: '',
privateKeyAlias: '',
clientId: '',
parserConfiguration: {
delimited: '',
lang: '',
script: '',
size: '',
length: '',
offset: '',
little: '',
},
},
description: '',
};
const VisibleMost = [
'COAP_SERVER',
'MQTT_SERVER',
'WEB_SOCKET_SERVER',
'TCP_SERVER',
'UDP',
'HTTP_SERVER',
];
export const VisibleData = {
parserType: ['TCP_SERVER'],
// configuration: {
port: VisibleMost,
host: VisibleMost,
publicPort: VisibleMost,
publicHost: VisibleMost,
remoteHost: ['MQTT_CLIENT'],
remotePort: ['MQTT_CLIENT'],
secure: ['TCP_SERVER', 'UDP', 'COAP_SERVER'],
username: ['MQTT_CLIENT'],
password: ['MQTT_CLIENT'],
topicPrefix: ['MQTT_CLIENT'],
maxMessageSize: ['MQTT_SERVER', 'MQTT_CLIENT'],
// certId: '',
// privateKeyAlias: '',
clientId: ['MQTT_CLIENT'],
// parserConfiguration: {
delimited: ['DELIMITED'],
lang: ['SCRIPT'],
script: ['SCRIPT'],
size: ['FIXED_LENGTH'],
length: ['LENGTH_FIELD'],
offset: ['LENGTH_FIELD'],
little: ['LENGTH_FIELD'],
// },
// },
};
export const ParserTypeOptions = [
{ value: 'DIRECT', label: '不处理' },
{ value: 'DELIMITED', label: '分隔符' },
{ value: 'SCRIPT', label: '自定义脚本' },
{ value: 'FIXED_LENGTH', label: '固定长度' },
{ value: 'LENGTH_FIELD', label: '长度字段' },
];
export const isVisible = (LastName: string, dependencies: string | boolean) =>
VisibleData[LastName].includes(dependencies);

View File

@ -357,36 +357,32 @@ const getActions = (
}; };
const handlAdd = () => { const handlAdd = () => {
// router.push({ router.push({
// path: `/iot/link/certificate/detail/:id`, path: `/iot/link/type/detail/:id`,
// query: { view: false }, query: { view: false },
// }); });
}; };
const handlEye = (id: string) => { const handlEye = (id: string) => {
console.log(111, id); router.push({
path: `/iot/link/type/detail/${id}`,
// router.push({ query: { view: true },
// path: `/iot/link/certificate/detail/${id}`, });
// query: { view: true },
// });
}; };
const handlEdit = (id: string) => { const handlEdit = (id: string) => {
console.log(111, id); router.push({
path: `/iot/link/type/detail/${id}`,
// router.push({ query: { view: false },
// path: `/iot/link/certificate/detail/${id}`, });
// query: { view: false },
// });
}; };
const handlDelete = async (id: string) => { const handlDelete = async (id: string) => {
// const res = await remove(id); const res = await remove(id);
// if (res.success) { if (res.success) {
// message.success(''); message.success('操作成功');
// tableRef.value.reload(); tableRef.value.reload();
// } }
}; };
const getDetails = (slotProps: Partial<Record<string, any>>) => { const getDetails = (slotProps: Partial<Record<string, any>>) => {