Explorar el Código

feat: model新增canremove字段 device新增rts字段

lvkun996 hace 2 años
padre
commit
e319f48415

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

@@ -166,7 +166,7 @@ import { Form, message } from 'ant-design-vue'
 import dayjs from 'dayjs'
 
 const msg = '消息下发不依赖产品模型,平台会以异步方式(消息下发后无需等待设备侧回复响应)下发消息给设备。当前仅MQTT设备支持消息下发。'
-const cmdMsg = '如果设备所属产品定义了命令功能,则您可以通过应用调用平台接口或者操作下面的“下发命令”按钮下发命令。当前MQTT设备仅支持同步命令下发,NB设备仅支持异步命令下发 。'
+const cmdMsg = '如果设备所属产品定义了命令功能,则您可以通过应用调用平台接口或者操作下面的“下发命令”按钮下发命令。当前MQTT设备仅支持同步命令下发,设备仅支持异步命令下发 。'
 const modalTitle = '新增下发消息'
 const tabListNoTitle = [
   {

+ 10 - 0
src/pages/Iot/device/components/live.vue

@@ -0,0 +1,10 @@
+<template>
+  <a-card>
+
+  </a-card>
+</template>
+
+<script lang="ts" setup >
+</script>
+
+<style></style>

+ 20 - 18
src/pages/Iot/device/components/ota.vue

@@ -1,6 +1,7 @@
 <template>
   <a-card>
-    <a-row  align="middle" justify="space-between" style="width: 100%;height: 68px" class="title">
+
+    <a-row  align="middle" justify="space-between" style="width: 100%; height: 68px" class="title">
       <a-col :span="12" >
         <a-space :size="50" >
           <span  style="font-size: 14px;font-weight: 500;" >OTA包名称:    {{state.otaDetail.otaPkgLabel}}   </span>
@@ -32,6 +33,7 @@
         </template>
       </template>
     </a-table>
+
   </a-card>
 
   <modal-pro
@@ -40,27 +42,27 @@
     @cancel="state.visible = false"
     @ok="ok"
   >
-  <a-form  :labelCol="{span: 6}" :wrapperCol="{span: 14}" >
-    <a-form-item label="所属产品" v-bind="validateInfos.deviceId" >
-      <!-- 这个写法丑陋的一批 -->
-      <select-tsx
-        v-model:value="otaState.deviceId"
-        :request="async () => {
-          const { data } = await DeviceContriller.list()
-          return data.filter(_ => _.deviceStatus === 'CONNECT').map(item => ({name: item.deviceLabel, value: item.id, key: item.id}))
-        }"
-      />
-      </a-form-item>
-      <a-form-item label="所属OTA包" v-bind="validateInfos.otaPkgId" >
+    <a-form  :labelCol="{span: 6}" :wrapperCol="{span: 14}" >
+      <a-form-item label="所属产品" v-bind="validateInfos.deviceId" >
+        <!-- 这个写法丑陋的一批 -->
         <select-tsx
-          v-model:value="otaState.otaPkgId"
+          v-model:value="otaState.deviceId"
           :request="async () => {
-            const { data } = await OtaController.list()
-            return data.map(item => ({name: item.label, value: item.id, key: item.id}))
+            const { data } = await DeviceContriller.list()
+            return data.filter(_ => _.deviceStatus === 'CONNECT').map(item => ({name: item.deviceLabel, value: item.id, key: item.id}))
           }"
         />
-      </a-form-item>
-  </a-form>
+        </a-form-item>
+        <a-form-item label="所属OTA包" v-bind="validateInfos.otaPkgId" >
+          <select-tsx
+            v-model:value="otaState.otaPkgId"
+            :request="async () => {
+              const { data } = await OtaController.list()
+              return data.map(item => ({name: item.label, value: item.id, key: item.id}))
+            }"
+          />
+        </a-form-item>
+    </a-form>
   </modal-pro>
 </template>
 

+ 4 - 0
src/pages/Iot/device/detail.vue

@@ -58,6 +58,10 @@ const tabs = [
   {
     name: 'OTA',
     key: '7'
+  },
+  {
+    name: 'Live',
+    key: '8'
   }
 ]
 

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

@@ -66,6 +66,9 @@
         <template v-if="column.key === 'deviceNodeType'" >
           <a-tag>{{record.deviceNodeType == 'GATEWAY'?'直连类型':'非直连类型'}}</a-tag>
         </template>
+        <template v-if="column.key === 'rtsUrl'" >
+          {{record.rtsUrl ? '支持': '否'}}
+        </template>
         <template v-if="column.key === 'action'">
             <a-space>
               <a @click="goDetailPage(record.id)">查看</a>
@@ -165,6 +168,11 @@ const columns = [
     title: '所属产品',
     dataIndex: 'modelLabel'
   },
+  {
+    title: '是否支持live',
+    dataIndex: 'rtsUrl',
+    key: 'rtsUrl'
+  },
   {
     title: '状态',
     dataIndex: 'deviceStatus',

+ 4 - 1
src/pages/Iot/model/components/modelDefine.vue

@@ -57,6 +57,7 @@
                 <a-space>
                     <a @click="openModel('cmdVisible', 'update', record)" >修改</a>
                     <a-popconfirm
+                      v-if="record.canRemove"
                       title="确实要删除吗?"
                       ok-text="确定"
                       cancel-text="取消"
@@ -345,7 +346,8 @@ const cmdRef = reactive({
   cmdLabel: '',
   cmdParams: [],
   cmdResponses: [],
-  modelId: ''
+  modelId: '',
+  canRemove: false
 })
 
 const cmdParamsRef = reactive({
@@ -446,6 +448,7 @@ const openModel = (key: string, opraState: 'add' | 'update', record: any = {}) =
     resetFields(record)
   } else {
     resetFieldsCmd(record)
+    if (!record.cmdParams) return
     state.dataCmdParams.requestData = record.cmdParams.map(item => {
       return {
         ...item,

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

@@ -17,11 +17,11 @@
     :labelStyle="{color: '#8a8e99'}"
     :contentStyle="{fontSize: '12px'}"
   >
-        <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>
-        <a-descriptions-item label="产品描述">{{state.model?.modelDescription}}</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>
+    <a-descriptions-item label="产品描述">{{state.model?.modelDescription}}</a-descriptions-item>
   </a-descriptions>
   </a-card>
 

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

@@ -109,6 +109,9 @@
     <a-form-item label="厂商描述">
       <a-textarea  :disabled="formOptions.disabled" v-model:value="modelRef.modelDescription" />
     </a-form-item>
+    <a-form-item label="支持视频流">
+      <a-switch v-model:checked="modelRef.rts" checked-children="支持" un-checked-children="不支持" />
+    </a-form-item>
    </a-form>
   </a-modal>
 </template>
@@ -196,7 +199,8 @@ const modelRef = reactive({
   transportType: '',
   payloadType: '',
   deviceType: '',
-  modelDescription: ''
+  modelDescription: '',
+  rts: false
 })
 
 const rulesRef = reactive({

+ 3 - 1
src/type/iot.d.ts

@@ -17,6 +17,7 @@ declare namespace IOT {
         payloadType: string,
         deviceType: string,
         modelDescription: string,
+        rts: boolean // 用来标志是否具备视频流能力
       }
 
       interface ModelDot extends Model {
@@ -91,7 +92,8 @@ declare namespace IOT {
           'scope': string,
           'description': string
         }[],
-        'modelId': string
+        'modelId': string,
+        canRemove: boolean // 用来标志是否可以被删除,具备该值且者该值为true的情况下 命令是不能有删除按钮
       }
     }