【功能完善】IoT: 场景联动执行器-数据桥梁选择

This commit is contained in:
puhui999
2025-03-29 12:52:26 +08:00
parent 6b99fdb41f
commit 279d88e729
4 changed files with 17 additions and 29 deletions

View File

@ -170,7 +170,7 @@ export const DeviceApi = {
// 根据ProductKey和DeviceNames获取设备列表 // 根据ProductKey和DeviceNames获取设备列表
getDevicesByProductKeyAndNames: async (productKey: string, deviceNames: string[]) => { getDevicesByProductKeyAndNames: async (productKey: string, deviceNames: string[]) => {
return await request.get({ return await request.get({
url: `/iot/device/get-by-product-key-and-names`, url: `/iot/device/list-by-product-key-and-names`,
params: { params: {
productKey, productKey,
deviceNames: deviceNames.join(',') deviceNames: deviceNames.join(',')

View File

@ -124,8 +124,8 @@ export const DataBridgeApi = {
return await request.delete({ url: `/iot/data-bridge/delete?id=` + id }) return await request.delete({ url: `/iot/data-bridge/delete?id=` + id })
}, },
// 导出数据桥梁 Excel // 查询数据桥梁(精简)列表
exportDataBridge: async (params) => { getSimpleDataBridgeList() {
return await request.download({ url: `/iot/data-bridge/export-excel`, params }) return request.get({ url: '/iot/data-bridge/simple-list' })
} }
} }

View File

@ -79,6 +79,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useVModel } from '@vueuse/core' import { useVModel } from '@vueuse/core'
import { isEmpty } from '@/utils/is'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import ProductTableSelect from '@/views/iot/product/product/components/ProductTableSelect.vue' import ProductTableSelect from '@/views/iot/product/product/components/ProductTableSelect.vue'
import DeviceTableSelect from '@/views/iot/device/device/components/DeviceTableSelect.vue' import DeviceTableSelect from '@/views/iot/device/device/components/DeviceTableSelect.vue'

View File

@ -1,13 +1,8 @@
<template> <template>
<div class="bg-[#dbe5f6] p-10px"> <div class="bg-[#dbe5f6] p-10px">
<div class="flex items-center"> <div class="flex items-center">
<span class="mr-10px w-80px">数据桥</span> <span class="mr-10px w-80px">数据桥</span>
<el-select <el-select v-model="dataBridgeId" class="!w-240px" clearable placeholder="选择数据桥接">
v-model="dataBridgeId"
class="!w-240px"
clearable
placeholder="选择数据桥接"
>
<el-option <el-option
v-for="bridge in dataBridgeList" v-for="bridge in dataBridgeList"
:key="bridge.id" :key="bridge.id"
@ -21,6 +16,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useVModel } from '@vueuse/core' import { useVModel } from '@vueuse/core'
import { DataBridgeApi } from '@/api/iot/rule/databridge'
/** 数据桥接执行器组件 */ /** 数据桥接执行器组件 */
defineOptions({ name: 'DataBridgeAction' }) defineOptions({ name: 'DataBridgeAction' })
@ -29,23 +25,14 @@ const props = defineProps<{ modelValue: any }>()
const emits = defineEmits(['update:modelValue']) const emits = defineEmits(['update:modelValue'])
const dataBridgeId = useVModel(props, 'modelValue', emits) const dataBridgeId = useVModel(props, 'modelValue', emits)
// 模拟数据桥接列表实际项目中应该从API获取 const dataBridgeList = ref<any[]>([]) // 数据桥接列表
const dataBridgeList = ref([
{ id: 1, name: '数据桥接1' },
{ id: 2, name: '数据桥接2' },
{ id: 3, name: '数据桥接3' }
])
// 实际项目中应该从API获取数据桥接列表 // 获取数据桥接列表
// const getDataBridgeList = async () => { const getDataBridgeList = async () => {
// try { dataBridgeList.value = await DataBridgeApi.getSimpleDataBridgeList()
// dataBridgeList.value = await DataBridgeApi.getSimpleList() }
// } catch (error) {
// console.error('获取数据桥接列表失败', error)
// }
// }
// onMounted(() => { onMounted(() => {
// getDataBridgeList() getDataBridgeList()
// }) })
</script> </script>