|
|
@@ -192,7 +192,13 @@
|
|
|
size="small"
|
|
|
:pagination="false"
|
|
|
>
|
|
|
+
|
|
|
<template #bodyCell="{column, record}" >
|
|
|
+ <template v-if="column.key === 'cmdParameters'" >
|
|
|
+
|
|
|
+ <span> {{JSON.stringify(record.cmdParameters)}}</span>
|
|
|
+
|
|
|
+ </template>
|
|
|
<template v-if="column.key === 'action'" >
|
|
|
<a @click="delCondiTionsAndActions(record.id, 'actions')" >
|
|
|
删除
|
|
|
@@ -263,7 +269,13 @@
|
|
|
label="选择"
|
|
|
:open="state.formVisible"
|
|
|
@cancel="state.formVisible = false"
|
|
|
- @ok="selectConditionAndAction"
|
|
|
+ destroyOnClose
|
|
|
+ @ok="() => {
|
|
|
+ if (fnDispatchCount === 0 ) {
|
|
|
+ fnDispatchCount++
|
|
|
+ selectConditionAndAction()
|
|
|
+ }
|
|
|
+ }"
|
|
|
style="width: 700px;"
|
|
|
zIndex="1001"
|
|
|
>
|
|
|
@@ -692,7 +704,7 @@ import { ModelAttrController, ModelCmdController, ModelController, RuleControlle
|
|
|
import { computed, onMounted, reactive, ref, watch, getCurrentInstance } from 'vue'
|
|
|
import { DownOutlined, QuestionCircleOutlined } from '@ant-design/icons-vue'
|
|
|
import SelectDevice from './components/selectDevice.vue'
|
|
|
-import { useId } from '@/hooks'
|
|
|
+import { useId, useSchedulerOnce } from '@/hooks'
|
|
|
import { Form } from 'ant-design-vue'
|
|
|
import TestDialog from './components/testDialog.vue'
|
|
|
import StatisticsTemplate from '@/components/StatisticsTemplate/index.vue'
|
|
|
@@ -703,6 +715,8 @@ const {
|
|
|
|
|
|
const useForm = Form.useForm
|
|
|
|
|
|
+const fnDispatchCount = ref(0)
|
|
|
+
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '状态',
|
|
|
@@ -780,7 +794,7 @@ const actionsColumns = reactive({
|
|
|
DEVICE_CMD: [
|
|
|
{ title: '触发动作', dataIndex: 'actionType' }, { title: '产品ID', dataIndex: 'modelId' },
|
|
|
{ title: '设备id', dataIndex: 'deviceId' }, { title: '命令名称', dataIndex: 'cmdLabel' },
|
|
|
- { title: '命令参数', dataIndex: 'cmdParameters' }, { title: '操作', dataIndex: 'action', key: 'action' }
|
|
|
+ { title: '命令参数', key: 'cmdParameters', dataIndex: 'cmdParameters' }, { title: '操作', dataIndex: 'action', key: 'action' }
|
|
|
],
|
|
|
REPORT_WARN: [
|
|
|
{ title: '触发动作', dataIndex: 'actionType' }, { title: '设备id', dataIndex: 'deviceId' },
|
|
|
@@ -1026,10 +1040,10 @@ const dispatchDebug = async () => {
|
|
|
state.testVisble = false
|
|
|
}
|
|
|
|
|
|
-const delForwardRule = async (id: string) => {
|
|
|
- await RuleController.delForwardRule(id)
|
|
|
- getForwardList()
|
|
|
-}
|
|
|
+// const delForwardRule = async (id: string) => {
|
|
|
+// await RuleController.delForwardRule(id)
|
|
|
+// getForwardList()
|
|
|
+// }
|
|
|
|
|
|
const openModal = (_opraState: 'add' | 'update' | 'preview', record: any) => {
|
|
|
resetFields({
|
|
|
@@ -1111,13 +1125,18 @@ const delCondiTionsAndActions = (id: string, key: 'conditions' | 'actions') => {
|
|
|
bodyParamsState[key].splice(index, 1)
|
|
|
}
|
|
|
|
|
|
-const selectConditionAndAction = () => {
|
|
|
+function selectConditionAndAction () {
|
|
|
if (state.opraModel === 'conditions') {
|
|
|
- bodyParamsState.conditions.push({ ...initConditionsData, id: useId() })
|
|
|
+ bodyParamsState.conditions.push({ ...JSON.parse(JSON.stringify(initConditionsData)), id: useId() })
|
|
|
} else {
|
|
|
bodyParamsState.actions.push({ ...initActionsData, id: useId() })
|
|
|
}
|
|
|
+ console.log('bodyParamsState.conditions:', bodyParamsState.conditions)
|
|
|
+
|
|
|
state.formVisible = false
|
|
|
+ useSchedulerOnce(() => {
|
|
|
+ fnDispatchCount.value = 0
|
|
|
+ }, 500)
|
|
|
}
|
|
|
|
|
|
// 获取命令
|