From 25ee85681c14dfc10266b18ce4043fa0187eb585 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Fri, 24 Feb 2023 18:07:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=90=E8=A1=8C=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/api/device/instance.ts | 18 +- src/store/menu.ts | 3 + .../Diagnose/Status/ManualInspection.tsx | 14 +- .../Instance/Detail/Diagnose/Status/index.tsx | 284 +-- .../Instance/Detail/Running/Event/index.vue | 63 +- .../Detail/Running/Property/Detail/AMap.vue | 55 +- .../Detail/Running/Property/Detail/Chart.vue | 43 + .../Detail/Running/Property/Detail/Charts.vue | 219 ++- .../Running/Property/Detail/PropertyAMap.vue | 74 + .../Detail/Running/Property/Detail/Table.vue | 71 +- .../Detail/Running/Property/Detail/index.vue | 10 +- .../Detail/Running/Property/PropertyCard.vue | 62 +- .../Detail/Running/Property/ValueDetail.vue | 18 +- .../Detail/Running/Property/ValueRender.vue | 9 +- .../Detail/Running/Property/index.vue | 56 +- src/views/device/Instance/Detail/index.vue | 2 +- src/views/device/Instance/index.vue | 17 +- yarn.lock | 1555 ++++++++--------- 19 files changed, 1466 insertions(+), 1108 deletions(-) create mode 100644 src/views/device/Instance/Detail/Running/Property/Detail/Chart.vue create mode 100644 src/views/device/Instance/Detail/Running/Property/Detail/PropertyAMap.vue diff --git a/package.json b/package.json index 7174015a..78feb7a7 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "unplugin-vue-components": "^0.22.12", "vite-plugin-monaco-editor": "^1.1.0", "vue": "^3.2.45", + "vue-json-viewer": "^3.0.4", "vue-router": "^4.1.6", "vue3-markdown-it": "^1.0.10", "vue3-ts-jsoneditor": "^2.7.1" diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index 2ea8aef8..5148bca8 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -466,4 +466,20 @@ export const saveEdgeMap = (deviceId: string, data?: any) => server.post(`/edge/ * @param params * @returns */ -export const getPropertyData = (deviceId: string, params: Record) => server.get(`/device-instance/${deviceId}/properties/_query`, params) \ No newline at end of file +export const getPropertyData = (deviceId: string, params: Record) => server.get(`/device-instance/${deviceId}/properties/_query`, params) + +/** + * 聚合查询设备属性 + * @param deviceId + * @param data + * @returns + */ +export const getPropertiesInfo = (deviceId: string, data: Record) => server.post(`/device-instance/${deviceId}/agg/_query`, data) + +/** + * 聚合查询设备属性 + * @param deviceId + * @param data + * @returns + */ +export const getPropertiesList = (deviceId: string, property: string, data: Record) => server.post(`/device-instance/${deviceId}/property/${property}/_query`, data) \ No newline at end of file diff --git a/src/store/menu.ts b/src/store/menu.ts index 44c0d9fe..49445fb8 100644 --- a/src/store/menu.ts +++ b/src/store/menu.ts @@ -4,6 +4,8 @@ import { filterAsnycRouter, MenuItem } from '@/utils/menu' import { isArray } from 'lodash-es' import { usePermissionStore } from './permission' import router from '@/router' +import { message } from 'ant-design-vue' +import { onlyMessage } from '@/utils/comm' const defaultOwnParams = [ { @@ -77,6 +79,7 @@ export const useMenuStore = defineStore({ name, params, query }) } else { + onlyMessage('暂无权限,请联系管理员', 'error') console.warn(`没有找到对应的页面: ${name}`) } }, diff --git a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx index 5482befe..6bec31e0 100644 --- a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx +++ b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx @@ -1,4 +1,6 @@ import AIcon from "@/components/AIcon"; +import { useInstanceStore } from "@/store/instance"; +import { useMenuStore } from "@/store/menu"; import { Button, Descriptions, Modal } from "ant-design-vue" import styles from './index.module.less' @@ -14,6 +16,10 @@ const ManualInspection = defineComponent({ const { data } = props + const instanceStore = useInstanceStore(); + + const menuStory = useMenuStore(); + const dataRender = () => { if (data.type === 'device' || data.type === 'product') { return ( @@ -207,7 +213,13 @@ const ManualInspection = defineComponent({ emit('save', data) }} onCancel={() => { - // TODO 跳转设备和产品 + if (data.type === 'device') { + instanceStore.tabActiveKey = 'Info' + } else if (data.type === 'product') { + menuStory.jumpPage('device/Product/Detail', { id: data.productId, tab: 'access' }); + } else { + menuStory.jumpPage('link/AccessConfig/Detail', { id: data.configuration?.id }); + } }}>
{dataRender()}
diff --git a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx index f075aea9..3dbc27d2 100644 --- a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx +++ b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx @@ -11,6 +11,8 @@ import _ from "lodash" import DiagnosticAdvice from './DiagnosticAdvice' import ManualInspection from './ManualInspection' import { deployDevice } from "@/api/initHome" +import PermissionButton from '@/components/PermissionButton/index.vue' +import { useMenuStore } from "@/store/menu" type TypeProps = 'network' | 'child-device' | 'media' | 'cloud' | 'channel' @@ -41,6 +43,7 @@ const Status = defineComponent({ const diagnoseData = ref>>() const bindParentVisible = ref(false) + const menuStory = useMenuStore(); const configuration = reactive<{ product: Record, @@ -57,19 +60,8 @@ const Status = defineComponent({ artificialData.value = params } - // TODO const jumpAccessConfig = () => { - // const purl = getMenuPathByCode(MENUS_CODE['device/Product/Detail']); - // if (purl) { - // history.push( - // `${getMenuPathByParams(MENUS_CODE['device/Product/Detail'], device.productId)}`, - // { - // tab: 'access', - // }, - // ); - // } else { - // message.error('规则可能有加密处理,请联系管理员'); - // } + menuStory.jumpPage('device/Product/Detail', { id: unref(device).productId, tab: 'access' }); }; const jumpDeviceConfig = () => { @@ -123,34 +115,40 @@ const Status = defineComponent({ 网络组件已禁用,请先 { - const res = await startNetwork( - unref(gateway)?.channelId, - ); - if (res.status === 200) { - message.success('操作成功!'); - list.value = modifyArrayList( - list.value, - { - key: 'network', - name: '网络组件', - desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败', - status: 'success', - text: '正常', - info: null, - }, - ); - } - }} - > - - + 网络组件已禁用,请先 + { + const res = await startNetwork( + unref(gateway)?.channelId, + ); + if (res.status === 200) { + message.success('操作成功!'); + list.value = modifyArrayList( + list.value, + { + key: 'network', + name: '网络组件', + desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败', + status: 'success', + text: '正常', + info: null, + }, + ); + } + } + }} + > + 启用 + + } /> - + ) : (
@@ -287,28 +285,31 @@ const Status = defineComponent({ 设备接入网关已禁用,请先 - { - const resp = await startGateway(unref(device).accessId || ''); - if (resp.status === 200) { - message.success('操作成功!'); - list.value = modifyArrayList( - list.value, - { - key: 'gateway', - name: '设备接入网关', - desc: desc, - status: 'success', - text: '正常', - info: null, - }, - ); + { + const resp = await startGateway(unref(device).accessId || ''); + if (resp.status === 200) { + message.success('操作成功!'); + list.value = modifyArrayList( + list.value, + { + key: 'gateway', + name: '设备接入网关', + desc: desc, + status: 'success', + text: '正常', + info: null, + }, + ); + } } }} > - - + 启用 + } />
@@ -411,28 +412,32 @@ const Status = defineComponent({ status="default" text={ - 设备接入网关已禁用,请先 { - const resp = await startGateway(unref(device).accessId || ''); - if (resp.status === 200) { - message.success('操作成功!'); - list.value = modifyArrayList( - list.value, - { - key: 'gateway', - name: '设备接入网关', - desc: desc, - status: 'success', - text: '正常', - info: null, - }, - ); + 设备接入网关已禁用,请先 + { + const resp = await startGateway(unref(device).accessId || ''); + if (resp.status === 200) { + message.success('操作成功!'); + list.value = modifyArrayList( + list.value, + { + key: 'gateway', + name: '设备接入网关', + desc: desc, + status: 'success', + text: '正常', + info: null, + }, + ); + } } }} > - - + 启用 + } /> @@ -519,28 +524,32 @@ const Status = defineComponent({ status="default" text={ - 网关父设备已禁用,请先 { - const resp = await _deploy(response?.result?.id || ''); - if (resp.status === 200) { - message.success('操作成功!'); - list.value = modifyArrayList( - list.value, - { - key: 'parent-device', - name: '网关父设备', - desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败', - status: 'success', - text: '正常', - info: null, - }, - ); + 网关父设备已禁用,请先 + { + const resp = await _deploy(response?.result?.id || ''); + if (resp.status === 200) { + message.success('操作成功!'); + list.value = modifyArrayList( + list.value, + { + key: 'parent-device', + name: '网关父设备', + desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败', + status: 'success', + text: '正常', + info: null, + }, + ); + } } }} > - - + 启用 + } /> @@ -623,28 +632,32 @@ const Status = defineComponent({ status="default" text={ - 产品已禁用,请 { - const resp = await _deployProduct(unref(device).productId || ''); - if (resp.status === 200) { - message.success('操作成功!'); - list.value = modifyArrayList( - list.value, - { - key: 'product', - name: '产品状态', - desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败', - status: 'success', - text: '正常', - info: null, - }, - ); + 产品已禁用,请 + { + const resp = await _deployProduct(unref(device).productId || ''); + if (resp.status === 200) { + message.success('操作成功!'); + list.value = modifyArrayList( + list.value, + { + key: 'product', + name: '产品状态', + desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败', + status: 'success', + text: '正常', + info: null, + }, + ); + } } }} > - - + 启用 + 产品 } @@ -695,29 +708,34 @@ const Status = defineComponent({ status="default" text={ - 设备已禁用,请 { - const resp = await _deploy(unref(device)?.id || ''); - if (resp.status === 200) { - instanceStore.current.state = { value: 'offline', text: '离线' } - message.success('操作成功!'); - list.value = modifyArrayList( - list.value, - { - key: 'device', - name: '设备状态', - desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败', - status: 'success', - text: '正常', - info: null, - }, - ); + 设备已禁用,请 + { + const resp = await _deploy(unref(device)?.id || ''); + if (resp.status === 200) { + instanceStore.current.state = { value: 'offline', text: '离线' } + message.success('操作成功!'); + list.value = modifyArrayList( + list.value, + { + key: 'device', + name: '设备状态', + desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败', + status: 'success', + text: '正常', + info: null, + }, + ); + } } }} > - - 设备 + 启用 + + 设备 } /> diff --git a/src/views/device/Instance/Detail/Running/Event/index.vue b/src/views/device/Instance/Detail/Running/Event/index.vue index ec35af49..a9e169ad 100644 --- a/src/views/device/Instance/Detail/Running/Event/index.vue +++ b/src/views/device/Instance/Detail/Running/Event/index.vue @@ -5,7 +5,7 @@ :columns="columns" :request="_getEventList" model="TABLE" - :bodyStyle="{padding: '0 24px'}" + :bodyStyle="{ padding: '0 24px' }" > \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/Detail/AMap.vue b/src/views/device/Instance/Detail/Running/Property/Detail/AMap.vue index db5458d2..e0656cec 100644 --- a/src/views/device/Instance/Detail/Running/Property/Detail/AMap.vue +++ b/src/views/device/Instance/Detail/Running/Property/Detail/AMap.vue @@ -1,3 +1,54 @@ + \ No newline at end of file +
+
+
+ + 开始动画 + 停止动画 + +
+
+ +
+ + + + + diff --git a/src/views/device/Instance/Detail/Running/Property/Detail/Chart.vue b/src/views/device/Instance/Detail/Running/Property/Detail/Chart.vue new file mode 100644 index 00000000..9c5a4031 --- /dev/null +++ b/src/views/device/Instance/Detail/Running/Property/Detail/Chart.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/views/device/Instance/Detail/Running/Property/Detail/Charts.vue b/src/views/device/Instance/Detail/Running/Property/Detail/Charts.vue index f54b82c5..57c25647 100644 --- a/src/views/device/Instance/Detail/Running/Property/Detail/Charts.vue +++ b/src/views/device/Instance/Detail/Running/Property/Detail/Charts.vue @@ -1,3 +1,218 @@ \ No newline at end of file + +
+ +
+ 统计周期: + + 实际值 + 按分钟统计 + 按小时统计 + 按天统计 + 按周统计 + 按月统计 + +
+
+ 统计规则: + + 平均值 + 最大值 + 最小值 + 总数 + +
+
+
+
+ + +
+
+ + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/Detail/PropertyAMap.vue b/src/views/device/Instance/Detail/Running/Property/Detail/PropertyAMap.vue new file mode 100644 index 00000000..b7860f91 --- /dev/null +++ b/src/views/device/Instance/Detail/Running/Property/Detail/PropertyAMap.vue @@ -0,0 +1,74 @@ + + + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/Detail/Table.vue b/src/views/device/Instance/Detail/Running/Property/Detail/Table.vue index bc945471..83bba809 100644 --- a/src/views/device/Instance/Detail/Running/Property/Detail/Table.vue +++ b/src/views/device/Instance/Detail/Running/Property/Detail/Table.vue @@ -18,6 +18,13 @@ +
+ +
自定义属性
+ + + +
\ No newline at end of file + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Running/Property/Detail/index.vue b/src/views/device/Instance/Detail/Running/Property/Detail/index.vue index 6ba7173e..6bdb9c4b 100644 --- a/src/views/device/Instance/Detail/Running/Property/Detail/index.vue +++ b/src/views/device/Instance/Detail/Running/Property/Detail/index.vue @@ -2,15 +2,15 @@
- + - + - - + + @@ -21,7 +21,7 @@ import type { Dayjs } from 'dayjs'; import TimeComponent from './TimeComponent.vue' import Charts from './Charts.vue' -import AMap from './AMap.vue' +import PropertyAMap from './PropertyAMap.vue' import Table from './Table.vue' const props = defineProps({ diff --git a/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue b/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue index 220765b2..8ad0c5ef 100644 --- a/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue +++ b/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue @@ -1,15 +1,15 @@