|
@@ -168,32 +168,40 @@
|
|
|
</a-col>
|
|
</a-col>
|
|
|
</a-row>
|
|
</a-row>
|
|
|
<template #extra >
|
|
<template #extra >
|
|
|
- <a-button type="primary" @click="addEventList">发送</a-button>
|
|
|
|
|
|
|
+ <a-button type="primary" @click="openCmdModal">命令下发</a-button>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
</a-card>
|
|
</a-card>
|
|
|
</a-col>
|
|
</a-col>
|
|
|
</a-row>
|
|
</a-row>
|
|
|
|
|
|
|
|
-<a-drawer
|
|
|
|
|
- v-model:open="state.drawerVisible"
|
|
|
|
|
- size="large"
|
|
|
|
|
- class="custom-class"
|
|
|
|
|
- title="选择设备"
|
|
|
|
|
- placement="right"
|
|
|
|
|
- >
|
|
|
|
|
- <SelectDevice ref="selectDeviceRef" />
|
|
|
|
|
- <template #footer >
|
|
|
|
|
- <a-row justify="end" >
|
|
|
|
|
- <a-col>
|
|
|
|
|
- <a-space>
|
|
|
|
|
- <a-button @click="state.drawerVisible = false">取消</a-button>
|
|
|
|
|
- <a-button type="primary" @click="handleSelectDevice">确定</a-button>
|
|
|
|
|
- </a-space>
|
|
|
|
|
- </a-col>
|
|
|
|
|
- </a-row>
|
|
|
|
|
- </template>
|
|
|
|
|
- </a-drawer>
|
|
|
|
|
|
|
+ <a-drawer
|
|
|
|
|
+ v-model:open="state.drawerVisible"
|
|
|
|
|
+ size="large"
|
|
|
|
|
+ class="custom-class"
|
|
|
|
|
+ title="选择设备2233"
|
|
|
|
|
+ placement="right"
|
|
|
|
|
+ >
|
|
|
|
|
+ <SelectDevice ref="selectDeviceRef" />
|
|
|
|
|
+ <template #footer >
|
|
|
|
|
+ <a-row justify="end" >
|
|
|
|
|
+ <a-col>
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <a-button @click="state.drawerVisible = false">取消</a-button>
|
|
|
|
|
+ <a-button type="primary" @click="handleSelectDevice">确定</a-button>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </a-col>
|
|
|
|
|
+ </a-row>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-drawer>
|
|
|
|
|
+
|
|
|
|
|
+ <cmd-push
|
|
|
|
|
+ :visible="cmdState.visible"
|
|
|
|
|
+ :device-id="state.device.id"
|
|
|
|
|
+ :model-id="state.device.modelId"
|
|
|
|
|
+ @cancel="cmdState.visible = false"
|
|
|
|
|
+ @ok="cmdState.visible = false"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
<script lang='ts' setup >
|
|
<script lang='ts' setup >
|
|
|
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
|
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
|
@@ -203,24 +211,17 @@ import { DeviceContriller, EventController, ModelCmdController, ModelController
|
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
|
import { FieldTimeOutlined, ApiTwoTone } from '@ant-design/icons-vue'
|
|
import { FieldTimeOutlined, ApiTwoTone } from '@ant-design/icons-vue'
|
|
|
-
|
|
|
|
|
|
|
+import CmdPush from '@/pages/iot/device/modal/cmdPush.vue'
|
|
|
import { useScheduler } from '@/hooks'
|
|
import { useScheduler } from '@/hooks'
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
-const tabListNoTitle = [
|
|
|
|
|
- {
|
|
|
|
|
- key: 'app',
|
|
|
|
|
- tab: '应用模拟器'
|
|
|
|
|
- }
|
|
|
|
|
-// {
|
|
|
|
|
-// key: 'device',
|
|
|
|
|
-// tab: '设备模拟器'
|
|
|
|
|
-// }
|
|
|
|
|
-]
|
|
|
|
|
-
|
|
|
|
|
const selectDeviceRef = ref()
|
|
const selectDeviceRef = ref()
|
|
|
|
|
|
|
|
|
|
+const cmdState = reactive({
|
|
|
|
|
+ visible: false
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const state = reactive<{
|
|
const state = reactive<{
|
|
|
activeKey: 'app',
|
|
activeKey: 'app',
|
|
|
drawerVisible: boolean,
|
|
drawerVisible: boolean,
|
|
@@ -235,6 +236,7 @@ const state = reactive<{
|
|
|
device: {
|
|
device: {
|
|
|
id: string
|
|
id: string
|
|
|
deviceLabel: string
|
|
deviceLabel: string
|
|
|
|
|
+ modelId: string
|
|
|
}
|
|
}
|
|
|
}>({
|
|
}>({
|
|
|
activeKey: 'app',
|
|
activeKey: 'app',
|
|
@@ -248,28 +250,48 @@ const state = reactive<{
|
|
|
startTime: 0,
|
|
startTime: 0,
|
|
|
lastId: '',
|
|
lastId: '',
|
|
|
device: {
|
|
device: {
|
|
|
- id: '1',
|
|
|
|
|
- deviceLabel: ''
|
|
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ deviceLabel: '',
|
|
|
|
|
+ modelId: ''
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
watch(() => state.modelId, () => getModelCmdList())
|
|
watch(() => state.modelId, () => getModelCmdList())
|
|
|
|
|
|
|
|
-const cmdDetail = computed(() => {
|
|
|
|
|
- const detail = state.modelCmdList.find(item => item.id === state.cmdId)
|
|
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => state.device.id,
|
|
|
|
|
+ () => {
|
|
|
|
|
+ addEventList()
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ deep: true
|
|
|
|
|
+ }
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
- return detail
|
|
|
|
|
-})
|
|
|
|
|
|
|
+const cmdDetail = computed(() => state.modelCmdList.find(item => item.id === state.cmdId))
|
|
|
|
|
|
|
|
const clearLog = () => {
|
|
const clearLog = () => {
|
|
|
state.eventList = []
|
|
state.eventList = []
|
|
|
message.success('清除成功')
|
|
message.success('清除成功')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const openCmdModal = () => {
|
|
|
|
|
+ if (!state.device.id) {
|
|
|
|
|
+ message.error('请先选择设备')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ cmdState.visible = true
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const handleSelectDevice = () => {
|
|
const handleSelectDevice = () => {
|
|
|
|
|
+ console.log('我不处罚')
|
|
|
const _device = selectDeviceRef.value.getSelectDevice()
|
|
const _device = selectDeviceRef.value.getSelectDevice()
|
|
|
|
|
+ console.log('_device:', _device)
|
|
|
|
|
+
|
|
|
if (_device) {
|
|
if (_device) {
|
|
|
state.device = _device
|
|
state.device = _device
|
|
|
|
|
+ console.log('state.device:', state.device)
|
|
|
|
|
+
|
|
|
state.drawerVisible = false
|
|
state.drawerVisible = false
|
|
|
} else {
|
|
} else {
|
|
|
message.warn('请选择产品')
|
|
message.warn('请选择产品')
|