Ver Fonte

fix: cmd

lvkun996 há 1 ano atrás
pai
commit
bb4835de41

+ 5 - 0
src/pages/Iot/device/components/cloudview.vue

@@ -172,6 +172,7 @@
       >
       <a-descriptions-item :span="24" label="状态">{{ DeviceContriller.deviceMag.get(state.cmdDetail!.status! )?.name }}</a-descriptions-item>
       <a-descriptions-item :span="24" label="命令名称">{{state.cmdDetail.cmdLabel}}</a-descriptions-item>
+      <a-descriptions-item :span="24" label="命令编码">{{state.cmdDetail.cmdCode}}</a-descriptions-item>
       <a-descriptions-item :span="24" label="参数">{{state.cmdDetail.cmdPayload}}</a-descriptions-item>
       <!-- <a-descriptions-item :span="24" label="下发参数">{{state.cmdDetail.msgLabel}}</a-descriptions-item> -->
       <a-descriptions-item :span="24" label="消息创建时间">
@@ -240,6 +241,10 @@ const cmdColumns = [
     dataIndex: 'status',
     key: 'status'
   },
+  {
+    title: '命令编码',
+    dataIndex: 'cmdCode'
+  },
   {
     title: '命令名称',
     dataIndex: 'cmdLabel'

+ 2 - 2
src/pages/Iot/doc/deviceDoc.vue

@@ -75,8 +75,8 @@
               </a-form-item>
               <a-form-item label="描述"  >
                 <a-descriptions  bordered>
-                  <a-descriptions-item :span="24" label="clientId(客户端id,客户端标识)">设备id</a-descriptions-item>
-                  <a-descriptions-item :span="24" label="username(用户名)">模型id</a-descriptions-item>
+                  <a-descriptions-item :span="24" label="clientId(客户端id,客户端标识)">随机生成</a-descriptions-item>
+                  <a-descriptions-item :span="24" label="username(用户名)">设备id</a-descriptions-item>
                   <a-descriptions-item :span="24" label="password(密码)">设备密钥</a-descriptions-item>
                 </a-descriptions>
               </a-form-item>

+ 16 - 19
src/pages/Iot/model/components/modelDefine.vue

@@ -131,6 +131,16 @@
       <a-form-item label="命令名称" v-bind="validateInfosCmd.cmdLabel" >
         <a-input allowClear v-model:value="cmdRef.cmdLabel"  />
       </a-form-item>
+      <a-form-item label="命令编码" v-bind="validateInfosCmd.cmdCode" >
+        <a-input allowClear v-model:value="cmdRef.cmdCode"  />
+      </a-form-item>
+      <a-form-item label="命令类型" >
+        <a-select allowClear v-model:value="cmdRef.cmdType" >
+          <a-select-option :value="item.value" v-for="item in ModelCmdController.cmdTypes" :key="item.key" >
+            {{item.label}}
+          </a-select-option>
+        </a-select>
+      </a-form-item>
       <a-form-item label="下发参数">
         <a-row style="width: 100%;">
           <a-col :span="24" ><a-button type="link" @click="openModalCmdp('request', 'add')" >+ 新增输入参数</a-button></a-col>
@@ -210,13 +220,6 @@
           </a-select-option>
         </a-select>
       </a-form-item>
-      <a-form-item label="命令类型" >
-        <a-select allowClear v-model:value="cmdParamsRef.cmdType" >
-          <a-select-option :value="item.value" v-for="item in ModelCmdController.cmdTypes" :key="item.key" >
-            {{item.label}}
-          </a-select-option>
-        </a-select>
-      </a-form-item>
       <a-form-item label="参数描述" v-bind="validateInfosCmdP.paramLabel" >
         <a-textarea placeholder="请填写参数描述" v-model:value="cmdParamsRef.description"  />
       </a-form-item>
@@ -349,14 +352,6 @@ const dataTypes = [
   {
     value: 'JSON',
     label: 'JSON'
-  },
-  {
-    value: 'IMG',
-    label: '媒体图片'
-  },
-  {
-    value: 'VIDEO',
-    label: '媒体视频'
   }
 ]
 
@@ -404,11 +399,13 @@ const attrRef = reactive({
 })
 
 const cmdRef = reactive({
+  cmdCode: '',
   cmdLabel: '',
   cmdParams: [],
   cmdResponses: [],
   modelId: '',
-  canRemove: false
+  canRemove: false,
+  cmdType: 'DEFAULT'
 })
 
 const cmdParamsRef = reactive({
@@ -416,8 +413,7 @@ const cmdParamsRef = reactive({
   paramCode: '',
   paramLabel: '',
   description: '',
-  dataType: '',
-  cmdType: 'DEFAULT'
+  dataType: ''
 })
 
 const { resetFields, validate: validateAttr, validateInfos } = useForm(attrRef, reactive({
@@ -428,7 +424,8 @@ const { resetFields, validate: validateAttr, validateInfos } = useForm(attrRef,
 }))
 
 const { resetFields: resetFieldsCmd, validate: validateCmd, validateInfos: validateInfosCmd } = useForm(cmdRef, reactive({
-  cmdLabel: [{ required: true, message: '请填写模型命令' }]
+  cmdLabel: [{ required: true, message: '请填写模型命令' }],
+  cmdCode: [{ required: true, message: '请填写模型code' }]
 }))
 
 const { resetFields: resetFieldsCmdP, validate: validateCmdP, validateInfos: validateInfosCmdP } = useForm(cmdParamsRef, reactive({

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

@@ -167,6 +167,7 @@ declare namespace IOT {
         id: string
         'status': DeviceMsgEnum,
         'msgId': number,
+        'cmdCode': string,
         'cmdLabel': string,
         'cmdPayload': any // '{"method":null,"params":null}',
         'deviceId': string