Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
0154ca8a32
|
@ -1,25 +0,0 @@
|
||||||
// generated by unplugin-vue-components
|
|
||||||
// We suggest you to commit this file into source control
|
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
|
||||||
import '@vue/runtime-core'
|
|
||||||
|
|
||||||
export {}
|
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
|
||||||
export interface GlobalComponents {
|
|
||||||
BadgeStatus: typeof import('./src/components/BadgeStatus/index.vue')['default']
|
|
||||||
CardBox: typeof import('./src/components/CardBox/index.vue')['default']
|
|
||||||
FormFormBuilder: typeof import('./src/components/Form/FormBuilder.vue')['default']
|
|
||||||
GeoComponent: typeof import('./src/components/GeoComponent/index.vue')['default']
|
|
||||||
MonacoEditor: typeof import('./src/components/MonacoEditor/index.vue')['default']
|
|
||||||
PermissionButton: typeof import('./src/components/PermissionButton/index.vue')['default']
|
|
||||||
RadioCard: typeof import('./src/components/RadioCard/index.vue')['default']
|
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
|
||||||
SearchItem: typeof import('./src/components/Search/Item.vue')['default']
|
|
||||||
SearchSearch: typeof import('./src/components/Search/Search.vue')['default']
|
|
||||||
Table: typeof import('./src/components/Table/index.vue')['default']
|
|
||||||
TitleComponent: typeof import('./src/components/TitleComponent/index.vue')['default']
|
|
||||||
ValueItem: typeof import('./src/components/ValueItem/index.vue')['default']
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +1,16 @@
|
||||||
import server from '@/utils/request'
|
import server from '@/utils/request'
|
||||||
|
|
||||||
export const deleteMetadata = (deviceId: string) => server.remove(`/device-instance/${deviceId}/metadata`)
|
/**
|
||||||
|
* 删除设备物模型
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const deleteMetadata = (deviceId: string) => server.remove(`/device-instance/${deviceId}/metadata`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存设备物模型
|
||||||
|
* @param id 设备ID
|
||||||
|
* @param data 物模型
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const saveMetadata = (id: string, data: string) => server.put(`/device/instance/${id}/metadata`, data)
|
|
@ -1,3 +1,26 @@
|
||||||
import server from '@/utils/request'
|
import server from '@/utils/request'
|
||||||
|
import type { DeviceMetadata } from '@/views/device/Product/typings'
|
||||||
|
|
||||||
export const queryNoPagingPost = (data: any) => server.post(`/device-product/_query/no-paging?paging=false`, data)
|
/**
|
||||||
|
* 根据条件查询产品(不带翻页)
|
||||||
|
* @param data 查询条件
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const queryNoPagingPost = (data: any) => server.post(`/device-product/_query/no-paging?paging=false`, data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入第三方物模型
|
||||||
|
* @param direction from|to
|
||||||
|
* @param type 物模型类型
|
||||||
|
* @param data 物模型数据
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const convertMetadata = (direction: 'from' | 'to', type: string, data: any) => server.post<DeviceMetadata>(`/device/product/metadata/convert-${direction}/${type}`, data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改产品
|
||||||
|
* @param id 产品ID
|
||||||
|
* @param data 产品数据
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const modify = (id: string, data: any) => server.put(`/device-product/${id}`, data)
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { InstanceModel } from "@/views/device/instance/typings";
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useInstanceStore = defineStore({
|
||||||
|
id: 'device',
|
||||||
|
state: () => ({} as InstanceModel),
|
||||||
|
});
|
|
@ -0,0 +1,84 @@
|
||||||
|
export type DeviceInstance = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
describe: string;
|
||||||
|
description: string;
|
||||||
|
productId: string;
|
||||||
|
productName: string;
|
||||||
|
protocolName: string;
|
||||||
|
security: any;
|
||||||
|
deriveMetadata: string;
|
||||||
|
metadata: string;
|
||||||
|
binds: any;
|
||||||
|
state: {
|
||||||
|
value: string;
|
||||||
|
text: string;
|
||||||
|
};
|
||||||
|
creatorId: string;
|
||||||
|
creatorName: string;
|
||||||
|
createTime: number;
|
||||||
|
registryTime: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
aloneConfiguration?: boolean;
|
||||||
|
deviceType: {
|
||||||
|
value: string;
|
||||||
|
text: string;
|
||||||
|
};
|
||||||
|
transportProtocol: string;
|
||||||
|
messageProtocol: string;
|
||||||
|
orgId: string;
|
||||||
|
orgName: string;
|
||||||
|
configuration: Record<string, any>;
|
||||||
|
relations?: any[];
|
||||||
|
cachedConfiguration: any;
|
||||||
|
transport: string;
|
||||||
|
protocol: string;
|
||||||
|
address: string;
|
||||||
|
registerTime: number;
|
||||||
|
onlineTime: string | number;
|
||||||
|
offlineTime: string | number;
|
||||||
|
tags: any;
|
||||||
|
photoUrl: string;
|
||||||
|
independentMetadata?: boolean;
|
||||||
|
accessProvider?: string;
|
||||||
|
accessId?: string;
|
||||||
|
features?: any[];
|
||||||
|
parentId?: string;
|
||||||
|
classifiedName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Unit = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
symbol: string;
|
||||||
|
text: string;
|
||||||
|
type: string;
|
||||||
|
value: string;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PropertyData = {
|
||||||
|
data: {
|
||||||
|
value?:
|
||||||
|
| {
|
||||||
|
formatValue: string;
|
||||||
|
property: string;
|
||||||
|
value: any;
|
||||||
|
}
|
||||||
|
| any;
|
||||||
|
timeString: string;
|
||||||
|
timestamp: number;
|
||||||
|
formatValue: string;
|
||||||
|
property: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type InstanceModel = {
|
||||||
|
current: Partial<DeviceInstance>;
|
||||||
|
detail: Partial<DeviceInstance>;
|
||||||
|
config: any;
|
||||||
|
metadataItem: MetadataItem;
|
||||||
|
params: Set<string>; // 处理无限循环Card
|
||||||
|
active?: string; // 当前编辑的Card
|
||||||
|
selectedRows: Map<string, any>;
|
||||||
|
}
|
|
@ -0,0 +1,179 @@
|
||||||
|
import type { BaseItem, State } from '@/utils/typings';
|
||||||
|
|
||||||
|
type DeviceType = {
|
||||||
|
text: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ProductItem = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
classifiedId: string | string[];
|
||||||
|
classifiedName: string;
|
||||||
|
configuration: Record<string, any>;
|
||||||
|
createTime: number;
|
||||||
|
updateTime: number;
|
||||||
|
creatorId: string;
|
||||||
|
deviceType: DeviceType;
|
||||||
|
deviceTypeId?: string;
|
||||||
|
count?: number;
|
||||||
|
messageProtocol: string;
|
||||||
|
metadata: string;
|
||||||
|
orgId: string;
|
||||||
|
protocolName: string;
|
||||||
|
state: number;
|
||||||
|
transportProtocol: string;
|
||||||
|
describe?: string;
|
||||||
|
accessId?: string;
|
||||||
|
accessName?: string;
|
||||||
|
photoUrl?: string;
|
||||||
|
storePolicy?: string;
|
||||||
|
accessProvider?: string;
|
||||||
|
modifyTime?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ConfigProperty = {
|
||||||
|
property: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
type: {
|
||||||
|
name: string;
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
elements?: any[];
|
||||||
|
expands?: any;
|
||||||
|
};
|
||||||
|
scopes: any[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ConfigMetadata = {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
scopes: any[];
|
||||||
|
properties: ConfigProperty[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type MetadataType = 'events' | 'functions' | 'properties' | 'tags';
|
||||||
|
|
||||||
|
export type DeviceMetadata = {
|
||||||
|
events: Partial<EventMetadata>[];
|
||||||
|
properties: Partial<PropertyMetadata>[];
|
||||||
|
functions: Partial<FunctionMetadata>[];
|
||||||
|
tags: Partial<TagMetadata>[];
|
||||||
|
};
|
||||||
|
export type MetadataItem = Partial<EventMetadata | PropertyMetadata | FunctionMetadata> &
|
||||||
|
Record<string, any>;
|
||||||
|
|
||||||
|
type EventMetadata = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
expands?: {
|
||||||
|
eventType?: string;
|
||||||
|
level?: string;
|
||||||
|
} & Record<string, any>;
|
||||||
|
valueType: {
|
||||||
|
type: string;
|
||||||
|
properties: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
dataType: string;
|
||||||
|
valueType: {
|
||||||
|
type: string;
|
||||||
|
} & Record<any, any>;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
type FunctionMetadata = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
async: boolean;
|
||||||
|
output: Record<string, unknown>;
|
||||||
|
inputs: ({
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
valueType: {
|
||||||
|
type: string;
|
||||||
|
} & Record<any, any>;
|
||||||
|
} & Record<string, any>)[];
|
||||||
|
};
|
||||||
|
type PropertyMetadata = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
dataType?: string;
|
||||||
|
valueType: {
|
||||||
|
type: string;
|
||||||
|
} & Record<any, any>;
|
||||||
|
expands: Record<string, any>;
|
||||||
|
description?: string;
|
||||||
|
// 运行状态处需要数据
|
||||||
|
list?: Record<string, unknown>[];
|
||||||
|
};
|
||||||
|
type TagMetadata = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
valueType: {
|
||||||
|
type: string;
|
||||||
|
} & Record<string, any>;
|
||||||
|
expands: Record<string, any>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type AlarmRule = {
|
||||||
|
actions: {
|
||||||
|
configuration: Record<string, unknown>;
|
||||||
|
executor: string;
|
||||||
|
}[];
|
||||||
|
productId: string;
|
||||||
|
productName: string;
|
||||||
|
properties: Record<string, unknown>[];
|
||||||
|
shakeLimit: Record<string, unknown>;
|
||||||
|
triggers: Record<string, unknown>[];
|
||||||
|
} & BaseItem;
|
||||||
|
|
||||||
|
type AlarmSetting = {
|
||||||
|
state: State;
|
||||||
|
createTime: number;
|
||||||
|
target: string;
|
||||||
|
targetId: string;
|
||||||
|
alarmRule: AlarmRule[];
|
||||||
|
} & BaseItem;
|
||||||
|
|
||||||
|
type AlarmRecord = {
|
||||||
|
id: string;
|
||||||
|
alarmId: string;
|
||||||
|
alarmName: string;
|
||||||
|
alarmTime: number;
|
||||||
|
description: string;
|
||||||
|
deviceId: string;
|
||||||
|
deviceName: string;
|
||||||
|
productId: string;
|
||||||
|
productName: string;
|
||||||
|
state: string;
|
||||||
|
updateTime: number;
|
||||||
|
alarmData: {
|
||||||
|
alarmId: string;
|
||||||
|
alarmName: string;
|
||||||
|
deviceId: string;
|
||||||
|
deviceName: string;
|
||||||
|
id: string;
|
||||||
|
productId: string;
|
||||||
|
productName: string;
|
||||||
|
timestamp: number;
|
||||||
|
} & Record<string, unknown>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type UnitType = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
symbol: string;
|
||||||
|
text: string;
|
||||||
|
type: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ObserverMetadata = {
|
||||||
|
type: unknown[];
|
||||||
|
subscribe: (data: any) => void;
|
||||||
|
next: (data: any) => void;
|
||||||
|
};
|
Loading…
Reference in New Issue