From 518390837ff3484e1944b3b02499f05215dd8ada Mon Sep 17 00:00:00 2001 From: leiqiaochu Date: Mon, 20 Feb 2023 09:42:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=91=8A=E8=AD=A6=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/rule-engine/config.ts | 5 + src/store/product.ts | 7 +- .../device/Product/Detail/BasicInfo/indev.vue | 5 +- .../Product/Detail/DeviceAccess/index.vue | 8 +- src/views/device/Product/Detail/index.vue | 1 + src/views/rule-engine/Alarm/Config/index.vue | 91 +++++++++++++++++++ .../rule-engine/Alarm/Config/typing.d.ts | 26 ++++++ 7 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 src/api/rule-engine/config.ts create mode 100644 src/views/rule-engine/Alarm/Config/index.vue create mode 100644 src/views/rule-engine/Alarm/Config/typing.d.ts diff --git a/src/api/rule-engine/config.ts b/src/api/rule-engine/config.ts new file mode 100644 index 00000000..51a9495e --- /dev/null +++ b/src/api/rule-engine/config.ts @@ -0,0 +1,5 @@ +import server from '@/utils/request'; +/** + * 查询等级 + */ +export const queryLevel = () => server.get('/alarm/config/default/level'); \ No newline at end of file diff --git a/src/store/product.ts b/src/store/product.ts index c5144d8c..0cf68527 100644 --- a/src/store/product.ts +++ b/src/store/product.ts @@ -1,6 +1,7 @@ import { ProductItem } from "@/views/device/Product/typings"; import { defineStore } from "pinia"; -import { detail} from '@/api/device/product' +import { detail , getDeviceNumber} from '@/api/device/product' +import encodeQuery from "@/utils/encodeQuery"; export const useProductStore = defineStore({ id: 'product', @@ -16,9 +17,13 @@ export const useProductStore = defineStore({ }, async refresh(id: string) { const resp = await detail(id) + const res = await getDeviceNumber(encodeQuery({ terms: { productId: id } })) if(resp.status === 200){ this.current = resp.result this.detail = resp.result + if(res.status === 200){ + this.current.count = res.result + } } }, setTabActiveKey(key: string) { diff --git a/src/views/device/Product/Detail/BasicInfo/indev.vue b/src/views/device/Product/Detail/BasicInfo/indev.vue index bcdcbd8b..582cb591 100644 --- a/src/views/device/Product/Detail/BasicInfo/indev.vue +++ b/src/views/device/Product/Detail/BasicInfo/indev.vue @@ -29,10 +29,10 @@ }} {{ - productStore.current.createTime + moment(productStore.current.createTime).format('YYYY-MM-DD HH:mm:ss') }} {{ - productStore.current.modifyTime + moment(productStore.current.modifyTime).format('YYYY-MM-DD HH:mm:ss') }} @@ -47,6 +47,7 @@ + \ No newline at end of file diff --git a/src/views/rule-engine/Alarm/Config/typing.d.ts b/src/views/rule-engine/Alarm/Config/typing.d.ts new file mode 100644 index 00000000..0d4dd421 --- /dev/null +++ b/src/views/rule-engine/Alarm/Config/typing.d.ts @@ -0,0 +1,26 @@ +import { BaseItem } from '@/utils/typings'; + +type LevelItem = { + level: number; + title: string; +}; + +type IOConfigItem = { + id?: string; + address: string; + topic: string; + username: string; + password: string; +}; +type IOItem = { + alarmConfigId: string; + sourceType: string; + config: Partial<{ + type: string; + dataSourceId: string; + config: Partial; + }>; + exchangeType: 'consume' | 'producer'; //订阅|推送 + state: 'disable' | 'enabled'; //禁用|正常 + description: string; +} & BaseItem;