diff --git a/src/api/device/alert.js b/src/api/device/alert.js new file mode 100644 index 0000000..ead6e93 --- /dev/null +++ b/src/api/device/alert.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询设备告警列表 +export function listAlert(query) { + return request({ + url: "/device/alert/list", + method: "get", + params: query, + }); +} + +// 查询设备告警详细 +export function getAlert(alertId) { + return request({ + url: "/device/alert/" + alertId, + method: "get", + }); +} + +// 新增设备告警 +export function addAlert(data) { + return request({ + url: "/device/alert", + method: "post", + data: data, + }); +} + +// 修改设备告警 +export function updateAlert(data) { + return request({ + url: "/device/alert", + method: "put", + data: data, + }); +} + +// 删除设备告警 +export function delAlert(alertId) { + return request({ + url: "/device/alert/" + alertId, + method: "delete", + }); +} diff --git a/src/api/product/alertRule.js b/src/api/product/alertRule.js new file mode 100644 index 0000000..f941fbe --- /dev/null +++ b/src/api/product/alertRule.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询设备告警列表 +export function listAlertRule(query) { + return request({ + url: "/product/alertRule/list", + method: "get", + params: query, + }); +} + +// 查询设备告警详细 +export function getAlertRule(alertId) { + return request({ + url: "/product/alertRule/" + alertId, + method: "get", + }); +} + +// 新增设备告警 +export function addAlertRule(data) { + return request({ + url: "/product/alertRule", + method: "post", + data: data, + }); +} + +// 修改设备告警 +export function updateAlertRule(data) { + return request({ + url: "/product/alertRule", + method: "put", + data: data, + }); +} + +// 删除设备告警 +export function delAlertRule(alertId) { + return request({ + url: "/product/alertRule/" + alertId, + method: "delete", + }); +} diff --git a/src/api/thingsmodel/model.js b/src/api/thingsmodel/model.js new file mode 100644 index 0000000..f09f1a9 --- /dev/null +++ b/src/api/thingsmodel/model.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询物模型列表 +export function listModel(query) { + return request({ + url: "/thingsmodel/model/list", + method: "get", + params: query, + }); +} + +// 查询物模型详细 +export function getModel(modelId) { + return request({ + url: "/thingsmodel/model/" + modelId, + method: "get", + }); +} + +// 新增物模型 +export function addModel(data) { + return request({ + url: "/thingsmodel/model", + method: "post", + data: data, + }); +} + +// 修改物模型 +export function updateModel(data) { + return request({ + url: "/thingsmodel/model", + method: "put", + data: data, + }); +} + +// 删除物模型 +export function delModel(modelId) { + return request({ + url: "/thingsmodel/model/" + modelId, + method: "delete", + }); +} diff --git a/src/api/thingsmodel/template.js b/src/api/thingsmodel/template.js new file mode 100644 index 0000000..c53bfb2 --- /dev/null +++ b/src/api/thingsmodel/template.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询物模型模板列表 +export function listTemplate(query) { + return request({ + url: "/thingsmodel/template/list", + method: "get", + params: query, + }); +} + +// 查询物模型模板详细 +export function getTemplate(templateId) { + return request({ + url: "/thingsmodel/template/" + templateId, + method: "get", + }); +} + +// 新增物模型模板 +export function addTemplate(data) { + return request({ + url: "/thingsmodel/template", + method: "post", + data: data, + }); +} + +// 修改物模型模板 +export function updateTemplate(data) { + return request({ + url: "/thingsmodel/template", + method: "put", + data: data, + }); +} + +// 删除物模型模板 +export function delTemplate(templateId) { + return request({ + url: "/thingsmodel/template/" + templateId, + method: "delete", + }); +} diff --git a/src/constant/dict.js b/src/constant/dict.js index 8402846..6eff47b 100644 --- a/src/constant/dict.js +++ b/src/constant/dict.js @@ -13,16 +13,25 @@ export const vertificateMethodOptions = new Map([ [2, "加密认证"], [3, "简单+加密"], ]); - -export const isTopMap = new Map([ - [0, "是"], - [1, "否"], +export const dataTypeMap = new Map([ + ["integer", "整数"], + ["decimal", "小数"], + ["bool", "布尔"], + ["enum", "枚举"], + ["string", "字符串"], + ["array", "数组"], ]); - -export const isMonitor = new Map([ - [0, "是"], - [1, "否"], +// export const isTopMap = new Map([[0, "是"], [1, "否"]]); +export const isSysMap = new Map([ + [0, "否"], + [1, "是"], ]); +export const modelType = new Map([ + [1, "属性"], + [2, "功能"], + [3, "事件"], +]); +// export const isMonitor = new Map([[0, "是"], [1, "否"]]); export const productStatusMap = [ { diff --git a/src/utils/thingsmodel.js b/src/utils/thingsmodel.js new file mode 100644 index 0000000..d11f1db --- /dev/null +++ b/src/utils/thingsmodel.js @@ -0,0 +1,49 @@ +/** 格式化显示数据定义 */ +export const formatSpecsDisplay = (json) => { + let specs = JSON.parse(json); + if (!specs) { + return; + } + if (specs.type === "integer" || specs.type === "decimal") { + return ( + "最大值:" + + specs.max + + '最小值:' + + specs.min + + "
步长:" + + specs.step + + '单位:' + + specs.unit + ); + } else if (specs.type === "string") { + return ( + '最大长度:' + specs.maxLength + "" + ); + } else if (specs.type === "array") { + return ( + '数组类型:' + specs.arrayType + "" + ); + } else if (specs.type === "enum") { + let items = ""; + for (let i = 0; i < specs.enumList.length; i++) { + items = + items + + "" + + specs.enumList[i].value + + ":" + + specs.enumList[i].text + + ""; + if (i > 0 && i % 2 !== 0) { + items = items + "
"; + } + } + return items; + } else if (specs.type === "bool") { + return ( + "0:" + + specs.falseText + + '1:' + + specs.trueText + ); + } +}; diff --git a/src/views/components/model-type-tags/index.vue b/src/views/components/model-type-tags/index.vue new file mode 100644 index 0000000..f3ff386 --- /dev/null +++ b/src/views/components/model-type-tags/index.vue @@ -0,0 +1,21 @@ + + + + + diff --git a/src/views/product/device/alert/index.vue b/src/views/product/device/alert/index.vue new file mode 100644 index 0000000..b8dd120 --- /dev/null +++ b/src/views/product/device/alert/index.vue @@ -0,0 +1,349 @@ + + + diff --git a/src/views/product/firmware/index.vue b/src/views/product/firmware/index.vue index 7c0f9c7..571e8a4 100644 --- a/src/views/product/firmware/index.vue +++ b/src/views/product/firmware/index.vue @@ -5,6 +5,7 @@ ref="queryRef" :inline="true" :model="queryParams" + :size="productId ? 'small' : 'default'" label-position="left" label-width="100px" > @@ -89,6 +90,7 @@ @@ -234,7 +240,7 @@
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 提交 - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -142,7 +229,9 @@ - + + +
@@ -151,7 +240,7 @@ - + diff --git a/src/views/product/product/index.vue b/src/views/product/product/index.vue index bc975f8..1ec2523 100644 --- a/src/views/product/product/index.vue +++ b/src/views/product/product/index.vue @@ -28,6 +28,7 @@ - + - + @@ -196,7 +197,10 @@ @@ -212,7 +216,7 @@ link type="primary" @click="handleUpdate(scope.row)" - >修改 + >{{ scope.row.status === 2 ? "查看" : "修改" }}
+
+ + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + + 新增 + + + + 刷新 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 自定义表达式 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + 删除 + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + diff --git a/src/views/product/product/components/firmware.vue b/src/views/product/product/panes/firmware.vue similarity index 100% rename from src/views/product/product/components/firmware.vue rename to src/views/product/product/panes/firmware.vue diff --git a/src/views/product/product/components/model.vue b/src/views/product/product/panes/model.vue similarity index 60% rename from src/views/product/product/components/model.vue rename to src/views/product/product/panes/model.vue index 6dc4262..13da348 100644 --- a/src/views/product/product/components/model.vue +++ b/src/views/product/product/panes/model.vue @@ -12,7 +12,12 @@
- 导入 @@ -22,7 +27,7 @@ plain size="small" type="warning" - @click="emits('model-updated')" + @click="getList" >刷新 @@ -32,14 +37,24 @@ plain size="small" type="info" - @click="openJsonViewer = true" + @click="handleOpenThingsModel" >预览 + + 导出 + + - - + + @@ -53,41 +68,44 @@ - + @@ -128,16 +146,16 @@ - + - + @@ -149,9 +167,9 @@ 事件 - + - - - - + +
+ + + +
+
+ + + + + + + +
将文件拖到此处,或点击上传
+ +
+
@@ -347,12 +429,18 @@ diff --git a/src/views/thingsmodel/model/index.vue b/src/views/thingsmodel/model/index.vue new file mode 100644 index 0000000..9aa57c5 --- /dev/null +++ b/src/views/thingsmodel/model/index.vue @@ -0,0 +1,730 @@ + + + diff --git a/src/views/thingsmodel/template/index.vue b/src/views/thingsmodel/template/index.vue new file mode 100644 index 0000000..5ebda08 --- /dev/null +++ b/src/views/thingsmodel/template/index.vue @@ -0,0 +1,688 @@ + + + diff --git a/vite.config.js b/vite.config.js index 804e73b..72e5d13 100644 --- a/vite.config.js +++ b/vite.config.js @@ -31,7 +31,7 @@ export default defineConfig(({ mode, command }) => { proxy: { // https://cn.vitejs.dev/config/#server-proxy "/dev-api": { - target: "http://192.168.1.5:1616", + target: "http://192.168.1.6:1616", changeOrigin: true, rewrite: (p) => p.replace(/^\/dev-api/, ""), },