diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index 0465df68..562118ac 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -174,4 +174,46 @@ export const delTags = (deviceId: string, id: string) => server.remove(`/device/ * @param deviceId 设备id * @returns */ -export const configurationReset = (deviceId: string) => server.put(`/device-instance/${deviceId}/configuration/_reset`) \ No newline at end of file +export const configurationReset = (deviceId: string) => server.put(`/device-instance/${deviceId}/configuration/_reset`) + +/** + * 查询事件详情列表 + * @param deviceId 设备id + * @param eventId 事件id + * @param data + * @returns + */ +export const getEventList = (deviceId: string, eventId: string, data: Record) => server.post(`/device-instance/${deviceId}/event/${eventId}?format=true`, data) + +/** + * 设置属性至设备 + * @param deviceId 设备id + * @param data + * @returns + */ +export const setProperty = (deviceId: string, data: Record) => server.put(`/device-instance/${deviceId}/property`, data) + +/** + * 获取最新属性值 + * @param deviceId 设备id + * @param type 属性id + * @returns + */ +export const getProperty = (deviceId: string, type: string) => server.get(`/device/standard/${deviceId}/property/${type}`) + +/** + * 查询设备的物模型指标 + * @param deviceId 设备id + * @param propertyId 属性id + * @returns + */ +export const queryMetric = (deviceId: string, propertyId: string) => server.get(`/device-instance/${deviceId}/metric/property/${propertyId}`) + +/** + * 保存设备的物模型指标 + * @param deviceId 设备id + * @param propertyId 属性id + * @param data + * @returns + */ +export const saveMetric = (deviceId: string, propertyId: string, data: Record) => server.patch(`/device-instance/${deviceId}/metric/property/${propertyId}`, data) diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index 45929b39..a9536fb0 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -74,7 +74,8 @@ const JTable = defineComponent({ slots: [ 'headerTitle', // 顶部左边插槽 'card', // 卡片内容 - 'rightExtraRender' + 'rightExtraRender', + 'paginationRender' // 分页 ], emits: [ 'modelChange', // 切换卡片和表格 @@ -354,27 +355,31 @@ const JTable = defineComponent({ { (!!_dataSource.value.length) && !props.noPagination && props.type === 'PAGE' &&
- { - const minSize = pageIndex.value * pageSize.value + 1; - const MaxSize = (pageIndex.value + 1) * pageSize.value; - return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`; - }} - onChange={(page, size) => { - handleSearch({ - ...props.params, - pageSize: size, - pageIndex: pageSize.value === size ? (page ? page - 1 : 0) : 0 - }) - }} - /> + { + slots?.paginationRender ? + slots.paginationRender() : + { + const minSize = pageIndex.value * pageSize.value + 1; + const MaxSize = (pageIndex.value + 1) * pageSize.value; + return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`; + }} + onChange={(page, size) => { + handleSearch({ + ...props.params, + pageSize: size, + pageIndex: pageSize.value === size ? (page ? page - 1 : 0) : 0 + }) + }} + /> + }
} diff --git a/src/views/device/Instance/Detail/Running/Event/index.vue b/src/views/device/Instance/Detail/Running/Event/index.vue index bb863222..02459461 100644 --- a/src/views/device/Instance/Detail/Running/Event/index.vue +++ b/src/views/device/Instance/Detail/Running/Event/index.vue @@ -3,7 +3,7 @@ @@ -16,16 +16,24 @@ + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/Indicators.vue b/src/views/device/Instance/Detail/Running/Property/Indicators.vue new file mode 100644 index 00000000..9c5b599e --- /dev/null +++ b/src/views/device/Instance/Detail/Running/Property/Indicators.vue @@ -0,0 +1,156 @@ + + + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue b/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue index d21fb23d..dd63a89d 100644 --- a/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue +++ b/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue @@ -5,33 +5,20 @@
{{ _props.data.name }}
- - - - - - - - - - - - + + + + +
@@ -55,6 +42,10 @@ const _props = defineProps({ type: Object, default: () => {}, }, + actions: { + type: Array, + default: () => [] + }, }); const loading = ref(true); diff --git a/src/views/device/Instance/Detail/Running/Property/Save.vue b/src/views/device/Instance/Detail/Running/Property/Save.vue new file mode 100644 index 00000000..ff55951c --- /dev/null +++ b/src/views/device/Instance/Detail/Running/Property/Save.vue @@ -0,0 +1,85 @@ + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/ValueRender.vue b/src/views/device/Instance/Detail/Running/Property/ValueRender.vue index 44681001..c9141b29 100644 --- a/src/views/device/Instance/Detail/Running/Property/ValueRender.vue +++ b/src/views/device/Instance/Detail/Running/Property/ValueRender.vue @@ -1,14 +1,74 @@ \ No newline at end of file + +const imgMap = new Map(); +imgMap.set('txt', getImage('/running/txt.png')); +imgMap.set('doc', getImage('/running/doc.png')); +imgMap.set('xls', getImage('/running/xls.png')); +imgMap.set('ppt', getImage('/running/ppt.png')); +imgMap.set('docx', getImage('/running/docx.png')); +imgMap.set('xlsx', getImage('/running/xlsx.png')); +imgMap.set('pptx', getImage('/running/pptx.png')); +imgMap.set('pdf', getImage('/running/pdf.png')); +imgMap.set('img', getImage('/running/img.png')); +imgMap.set('error', getImage('/running/error.png')); +imgMap.set('video', getImage('/running/video.png')); +imgMap.set('other', getImage('/running/other.png')); +imgMap.set('obj', getImage('/running/obj.png')); + +const imgList = ['.jpg', '.png', '.swf', '.tiff']; +const videoList = ['.m3u8', '.flv', '.mp4', '.rmvb', '.mvb']; +const fileList = ['.txt', '.doc', '.xls', '.pdf', '.ppt', '.docx', '.xlsx', '.pptx']; + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/index.vue b/src/views/device/Instance/Detail/Running/Property/index.vue index 24ed16b6..d09224e6 100644 --- a/src/views/device/Instance/Detail/Running/Property/index.vue +++ b/src/views/device/Instance/Detail/Running/Property/index.vue @@ -1,19 +1,20 @@ diff --git a/src/views/device/Instance/Detail/Running/index.vue b/src/views/device/Instance/Detail/Running/index.vue index e97db6d1..a4975108 100644 --- a/src/views/device/Instance/Detail/Running/index.vue +++ b/src/views/device/Instance/Detail/Running/index.vue @@ -111,7 +111,6 @@ const tabChange = (key: string) => { display: flex; .property-box-left { width: 200px; - margin-right: 20px; } .property-box-right { flex: 1;