ソースを参照

update some name

wangxiao 3 年 前
コミット
ea60d9523f

BIN
public/favicon.ico


+ 9 - 2
src/pages/Iot/dashboard/deviceAccess/index.vue

@@ -4,8 +4,15 @@
     >
       <a-row :gutter="[8, 8]" justify="space-between" >
         <a-col :xs='24' :sm="24" :md='16' :lg="16" :xl="14" >
-          在物联网平台中,某一类具有相同能力或特征的设备的合集被称为一款产品。
-          如果您希望使用平台查看设备上报的数据信息,并对设备进行管理控制,就需要开发产品模型(Profile)。定义Profile,使平台理解该款设备支持的属性、命令等信息。根据产品的接入协议、数据格式等可能还需要您定义其他相关的内容 了解更多
+          在物联网平台中,某一类具有相同能力或特征的设备的合集被称为一款产品模型(Profile)。
+          如果您希望使用平台查看设备上报的数据信息,并对设备进行管理控制,就需要开发产品模型(Profile)。<br/>
+          定义Profile,使平台理解该款设备支持的属性、命令等信息。根据产品的接入协议、数据格式等可能还需要您定义其他相关的内容。
+        </a-col>
+        <a-col :xs='24' :sm="24" :md='16' :lg="16" :xl="14" >
+          如果你希望对设备上报的数据做一些计算功能,比如将温度除以100并且保留2位小数点,可以采用属性的计算表达式功能,上述案例可以写成表达式 #tem/100.00。当然可以支持更多丰富的功能,具体使用参考SPEL使用手册。
+        </a-col>
+        <a-col :xs='24' :sm="24" :md='16' :lg="16" :xl="14" >
+          对于二进制的负载数据,支持JavaScript脚本开发完成数据解析,同时对于下发的命令也可以通过插件解析完成数据的encode。
         </a-col>
         <a-col :xs='24' :sm="24" :md='8' :lg="8" :xl="8" >
           <img style="width: 100%" :src="staticImg.productIntroduction" alt="">

+ 3 - 0
src/pages/Iot/dataServer/history.vue

@@ -3,6 +3,7 @@
   <a-row>
     <a-col>
       <a-space>
+        <span>产品: </span>
         <a-select v-model:value="queryParams.modelId" style="width: 170px;" >
           <a-select-option
             v-for="item in state.modelList"
@@ -12,6 +13,7 @@
             {{item.modelLabel}}
           </a-select-option>
         </a-select>
+        <span>设备: </span>
         <a-select v-model:value="queryParams.deviceId" style="width: 170px;" >
           <a-select-option
             v-for="item in state.deviceList"
@@ -21,6 +23,7 @@
             {{item.deviceLabel}}
           </a-select-option>
         </a-select>
+        <span>触发时间: </span>
         <a-range-picker v-model:value="time" :format="['DD/MM/YYYY', 'DD/MM/YYYY']"  />
       </a-space>
 

+ 3 - 2
src/pages/Iot/devOps/msgTracking.vue

@@ -13,17 +13,18 @@
       <a-col>
         <a-form layout="inline" >
           <a-form-item label="业务类型" >
-            <a-select v-model:value="queryParamsState.eventType" style="width: 170px;" >
+            <a-select v-model:value="queryParamsState.eventType" style="width: 170px;"  >
             <a-select-option
               v-for="item in eventTypeList"
               :key="item.key"
               :value="item.key"
+              placeholder="请选择业务类型"
             >
               {{item.name}}
             </a-select-option>
           </a-select>
           </a-form-item>
-          <a-form-item label="成功状态" >
+          <a-form-item label="消息状态" >
             <a-select v-model:value="queryParamsState.success" style="width: 170px;" >
               <a-select-option
                 v-for="item in successList"

+ 1 - 0
src/pages/Iot/devOps/nowAlert.vue

@@ -2,6 +2,7 @@
   <a-card>
     <a-row justify="end" >
       <a-col>
+        <span>时间间隔: </span>
         <a-select
           style="width: 170px;"
           v-model:value="queryParams.duration"

+ 1 - 1
src/pages/Iot/device/components/deviceTag.vue

@@ -1,7 +1,7 @@
 <template>
   <a-card>
       <a-row justify="end" >
-        <a-col><a-button @click="state.visible = true" >绑定标签</a-button></a-col>
+        <a-col><a-button type="primary" @click="state.visible = true" >绑定标签</a-button></a-col>
       </a-row>
       <a-table
         style="margin-top: 20px;"

+ 6 - 4
src/pages/Iot/device/components/overview.vue

@@ -3,11 +3,13 @@
     <a-row  align="middle" style="width: 100%;height: 68px" class="title">
       <a-col  >
         <a-space :size="50" >
-          <span>{{state.deviceDetail?.deviceLabel}}</span>
+          <span>设备名称:{{state.deviceDetail?.deviceLabel}}</span>
           <a-button type="primary" @click="state.visible = true" >修改</a-button>
-          <a-tag :color="DeviceContriller.deviceStatusMap.get(state.deviceDetail?.deviceStatus!)?.color " >
-            {{ DeviceContriller.deviceStatusMap.get(state.deviceDetail?.deviceStatus!)?.name  }}
-          </a-tag>
+          <span>设备状态:
+            <a-tag :color="DeviceContriller.deviceStatusMap.get(state.deviceDetail?.deviceStatus!)?.color " >
+              {{ DeviceContriller.deviceStatusMap.get(state.deviceDetail?.deviceStatus!)?.name  }}
+            </a-tag>
+          </span>
           <a-tag style="scale: 1.2;" >
             <span>所属产品:{{state.deviceDetail?.modelLabel}}</span>
           </a-tag>

+ 1 - 0
src/pages/Iot/device/components/subDevice.vue

@@ -26,6 +26,7 @@
               v-model:value="state.queryParams.searchValue"
               enter-button
               @search="getSubDevicePage"
+              placeholder="请输入查询值"
             />
           </a-space>
         </a-col>

+ 24 - 5
src/pages/Iot/device/group.vue

@@ -77,11 +77,14 @@
             @change="changePage"
         >
         <template #bodyCell="{column, record}">
+          <template v-if="column.key === 'id'" >
+            <a @click="goDetailPage(record.id)">{{record.id}}</a>
+          </template>
           <template v-if="column.key === 'deviceStatus'" >
-          <a-tag :color="record.deviceStatus.color" >{{record.deviceStatus.name}}</a-tag>
-        </template>
+            <a-tag :color="record.deviceStatus.color" >{{record.deviceStatus.name}}</a-tag>
+          </template>
           <template v-if="column.key === 'deviceNodeType'" >
-          {{record.deviceNodeType == 'GATEWAY' ? '直连类型' : '非直连类型' }}
+          <a-Tag>{{record.deviceNodeType == 'GATEWAY' ? '直连类型' : '非直连类型' }}</a-Tag>
         </template>
         </template>
         </a-table>
@@ -118,6 +121,9 @@
           }"
         >
           <template  #bodyCell="{column, record}" >
+            <template v-if="column.key === 'id'" >
+              <a @click="goDetailPage(record.id)">{{record.id}}</a>
+            </template>
             <template v-if="column.key === 'action'" >
               <a-space>
                 <a >详情</a>
@@ -234,10 +240,17 @@ import { ReloadIconTsx } from '@/components/MicroComponents/index'
 import { DeviceContriller, ModelController } from '@/controller'
 import { computed, onMounted, reactive, ref, watch } from 'vue'
 import { PlusCircleOutlined, DeleteOutlined } from '@ant-design/icons-vue'
-import { Form } from 'ant-design-vue'
+import { Form, Tag } from 'ant-design-vue'
+import { useRouter } from 'vue-router'
+
+const router = useRouter()
 
 const useForm = Form.useForm
 
+const goDetailPage = (id: string) => {
+  router.push({ path: '/device/detail', query: { id } })
+}
+
 const columns = [
 
   {
@@ -247,7 +260,8 @@ const columns = [
   },
   {
     title: '设备ID',
-    dataIndex: 'id'
+    dataIndex: 'id',
+    key: 'id'
   },
   {
     title: '设备名称',
@@ -277,6 +291,11 @@ const columns = [
 ]
 
 const groupDeviceColumns = [
+  {
+    title: '设备ID',
+    dataIndex: 'id',
+    key: 'id'
+  },
   {
     title: '设备名称',
     dataIndex: 'deviceLabel'

+ 8 - 4
src/pages/Iot/device/index.vue

@@ -22,14 +22,14 @@
       <a-col :span="20"  >
         <a-form layout="inline" >
           <a-form-item label="设备名称" >
-            <a-input v-model:value="searchState.deviceStatus" />
+            <a-input v-model:value="searchState.deviceStatus" placeholder="请输入设备名称"/>
           </a-form-item>
           <a-form-item style="width: 400px;">
             <a-input-group compact >
               <a-select v-model:value="searchState.searchKey" style="width: 150px;" >
                 <a-select-option v-for="item in searchList" :key="item.key" :value="item.key">{{item.name}}</a-select-option>
               </a-select>
-              <a-input v-model:value="searchState.searchValue" style="width: 176px" />
+              <a-input v-model:value="searchState.searchValue" style="width: 176px" placeholder="请输入查询值"/>
             </a-input-group>
           </a-form-item>
           <a-form-item><a-button @click="resetFields([])">重置</a-button></a-form-item>
@@ -50,11 +50,14 @@
       @change="changePage"
     >
       <template #bodyCell="{column, record}">
+        <template v-if="column.key === 'id'" >
+          <a @click="goDetailPage(record.id)">{{record.id}}</a>
+        </template>
         <template v-if="column.key === 'deviceStatus'" >
           <a-tag :color="record.deviceStatus.color" >{{record.deviceStatus.name}}</a-tag>
         </template>
         <template v-if="column.key === 'deviceNodeType'" >
-          {{record.deviceNodeType == 'GATEWAY' ? '直连类型' : '非直连类型' }}
+          <a-tag>{{record.deviceNodeType == 'GATEWAY'?'直连类型':'非直连类型'}}</a-tag>
         </template>
         <template v-if="column.key === 'action'">
             <a-space>
@@ -128,7 +131,8 @@ const columns = [
 
   {
     title: '设备ID',
-    dataIndex: 'id'
+    dataIndex: 'id',
+    key: 'id'
   },
   {
     title: '设备名称',

+ 7 - 5
src/pages/Iot/model/components/onlineTest.vue

@@ -27,7 +27,7 @@
 <script lang="ts" setup >
 import { EventController, DeviceContriller } from '@/controller/index'
 import { onMounted, reactive } from 'vue'
-import { useRouter } from 'vue-router'
+import { useRoute } from 'vue-router'
 
 const columns = [
 
@@ -67,25 +67,27 @@ const columns = [
   }
 ]
 
-const router = useRouter()
+const route = useRoute()
 
+const modelId = route.query.id as string
 const state = reactive({
   loading: false,
   dataSource: [],
   queryParams: {
     page: 1,
     pageSize: 200,
-    total: 0
+    total: 0,
+    modelId: modelId
   }
 })
 
 const goDebugPage = (record) => {
-  router.push({ path: '/devOps/onlineTest', query: { deviceId: record.id } })
+  route.push({ path: '/devOps/onlineTest', query: { deviceId: record.id } })
 }
 
 const getDevicePage = async () => {
   state.loading = true
-  const { data, sum } = await DeviceContriller.page({ page: 1, pageSize: 200 })
+  const { data, sum } = await DeviceContriller.page({ page: 1, pageSize: 200, modelId: modelId })
   state.loading = false
   state.dataSource = data
   state.queryParams.total = sum

+ 20 - 20
src/pages/Iot/model/components/plugins.vue

@@ -100,26 +100,26 @@ const getPlugin = async () => {
   state.modelPluginBody = data != null
     ? data.modelPluginBody
     : `/**
-        * 设备上报数据到物联网平台时调用此接口进行解码, 将设备的原始数据解码为符合产品模型定义的JSON格式数据。
-        * 该接口名称和入参已经定义好,开发者只需要实现具体接口即可。
-        * @param byte[] payload   设备上报的原始码流
-        * @return string json     符合产品模型定义的JSON格式字符串
-        */
-        function decode(payload) {
-            let jsonObj = {};
-            return JSON.stringify(jsonObj);
-        }
-
-        /**
-         * 物联网平台下发指令时,调用此接口进行编码, 将产品模型定义的JSON格式数据编码为设备的原始码流。
-         * 该接口名称和入参格式已经定义好,开发者只需要实现具体接口即可。
-         * @param string json      符合产品模型定义的JSON格式字符串
-         * @return byte[] payload  编码后的原始码流
-         */
-        function encode(json) {
-            let payload = [];
-            return payload;
-        }`
+  * 设备上报数据到物联网平台时调用此接口进行解码, 将设备的原始数据解码为符合产品模型定义的JSON格式数据。
+  * 该接口名称和入参已经定义好,开发者只需要实现具体接口即可。
+  * @param byte[] payload   设备上报的原始码流
+  * @return string json     符合产品模型定义的JSON格式字符串
+  */
+function decode(payload) {
+  let jsonObj = {};
+  return JSON.stringify(jsonObj);
+}
+
+/**
+ * 物联网平台下发指令时,调用此接口进行编码, 将产品模型定义的JSON格式数据编码为设备的原始码流。
+ * 该接口名称和入参格式已经定义好,开发者只需要实现具体接口即可。
+ * @param string json      符合产品模型定义的JSON格式字符串
+ * @return byte[] payload  编码后的原始码流
+ */
+function encode(json) {
+    let payload = [];
+    return payload;
+}`
   state.pluginId = data != null ? data.id : ''
   createView()
 }

+ 1 - 1
src/pages/Iot/model/detail.vue

@@ -15,7 +15,7 @@
     :labelStyle="{color: '#8a8e99'}"
     :contentStyle="{fontSize: '12px'}"
   >
-        <a-descriptions-item label="产品名称">{{state.model?.modelLabel}}</a-descriptions-item>
+        <a-descriptions-item label="产品模型名称">{{state.model?.modelLabel}}</a-descriptions-item>
         <a-descriptions-item label="设备类型">{{state.model?.deviceType}}</a-descriptions-item>
         <a-descriptions-item label="协议类型">{{state.model?.transportType}}</a-descriptions-item>
         <a-descriptions-item label="数据类型">{{state.model?.payloadType}}</a-descriptions-item>

+ 18 - 5
src/pages/Iot/model/index.vue

@@ -4,7 +4,7 @@
       <a-col>
         <a-input-search
           v-model:value="state.queryParams.modelLabel"
-          placeholder="请输入产品名称"
+          placeholder="请输入产品模型名称"
           enter-button
           @search="getModel"
         />
@@ -20,6 +20,7 @@
         </a-space>
       </a-col>
     </a-row>
+
     <a-table
       style="margin-top: 10px;"
       :columns="columns"
@@ -28,7 +29,19 @@
       :loading="state.loading"
       @change="change"
     >
+    <template #name="{ text }">
+      <a @click="goDetailPage(text)" >{{ text }}</a>
+    </template>
       <template #bodyCell="{ column, record }">
+        <template v-if="column.key === 'id'" >
+          <a  @click="goDetailPage(record.id)">{{record.id}}</a>
+        </template>
+        <template v-if="column.key === 'transportType'" >
+          <a-tag  >{{record.transportType}}</a-tag>
+        </template>
+        <template v-if="column.key === 'payloadType'" >
+          <a-tag  color="blue">{{record.payloadType}}</a-tag>
+        </template>
           <template v-if="column.key === 'action'">
             <a-space>
               <a @click="goDetailPage(record.id)" >查看</a>
@@ -55,7 +68,7 @@
     @ok="ok"
   >
    <a-form :label-col="{span: 4}" :wrapper-col="{span: 14}">
-     <a-form-item label="产品名称" v-bind="validateInfos.modelLabel">
+     <a-form-item label="产品模型名称" v-bind="validateInfos.modelLabel">
       <a-input v-model:value="modelRef.modelLabel"  />
     </a-form-item>
     <a-form-item label="协议类型" v-bind="validateInfos.transportType">
@@ -87,12 +100,12 @@ import { useRouter } from 'vue-router'
 
 const columns = [
   {
-    title: '模型名称',
+    title: '产品模型名称',
     dataIndex: 'modelLabel',
     key: 'modelLabel'
   },
   {
-    title: '产品id',
+    title: '产品模型id',
     dataIndex: 'id',
     key: 'id'
   },
@@ -139,7 +152,7 @@ const state = reactive<{
   payloadType: ['JSON', '二进制流']
 })
 
-const modalTitle = computed(() => state.opraState === 'add' ? '新增产品' : '编辑产品')
+const modalTitle = computed(() => state.opraState === 'add' ? '新增产品模型' : '编辑产品模型')
 
 const useForm = Form.useForm
 

+ 3 - 3
src/router/index.ts

@@ -16,18 +16,18 @@ const routes: Array<ROUTER.RoutesProps> = [
       },
       {
         path: '/product',
-        name: '产品',
+        name: '产品模型',
         redirect: '/product/index',
         icon: 'AppstoreOutlined',
         children: [
           {
             path: '/product/index',
-            name: '产品',
+            name: '产品模型',
             component: () => import('@/pages/iot/model/index.vue')
           },
           {
             path: '/product/detail',
-            name: '产品详情',
+            name: '产品模型详情',
             hidden: true,
             component: () => import('@/pages/iot/model/detail.vue')
           }