【功能完善】IoT: 场景联动执行器-数据桥梁选择
This commit is contained in:
@ -170,7 +170,7 @@ export const DeviceApi = {
|
||||
// 根据ProductKey和DeviceNames获取设备列表
|
||||
getDevicesByProductKeyAndNames: async (productKey: string, deviceNames: string[]) => {
|
||||
return await request.get({
|
||||
url: `/iot/device/get-by-product-key-and-names`,
|
||||
url: `/iot/device/list-by-product-key-and-names`,
|
||||
params: {
|
||||
productKey,
|
||||
deviceNames: deviceNames.join(',')
|
||||
|
||||
@ -124,8 +124,8 @@ export const DataBridgeApi = {
|
||||
return await request.delete({ url: `/iot/data-bridge/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出数据桥梁 Excel
|
||||
exportDataBridge: async (params) => {
|
||||
return await request.download({ url: `/iot/data-bridge/export-excel`, params })
|
||||
// 查询数据桥梁(精简)列表
|
||||
getSimpleDataBridgeList() {
|
||||
return request.get({ url: '/iot/data-bridge/simple-list' })
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useVModel } from '@vueuse/core'
|
||||
import { isEmpty } from '@/utils/is'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import ProductTableSelect from '@/views/iot/product/product/components/ProductTableSelect.vue'
|
||||
import DeviceTableSelect from '@/views/iot/device/device/components/DeviceTableSelect.vue'
|
||||
|
||||
@ -1,13 +1,8 @@
|
||||
<template>
|
||||
<div class="bg-[#dbe5f6] p-10px">
|
||||
<div class="flex items-center">
|
||||
<span class="mr-10px w-80px">数据桥接</span>
|
||||
<el-select
|
||||
v-model="dataBridgeId"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="选择数据桥接"
|
||||
>
|
||||
<span class="mr-10px w-80px">数据桥梁</span>
|
||||
<el-select v-model="dataBridgeId" class="!w-240px" clearable placeholder="选择数据桥接">
|
||||
<el-option
|
||||
v-for="bridge in dataBridgeList"
|
||||
:key="bridge.id"
|
||||
@ -21,6 +16,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useVModel } from '@vueuse/core'
|
||||
import { DataBridgeApi } from '@/api/iot/rule/databridge'
|
||||
|
||||
/** 数据桥接执行器组件 */
|
||||
defineOptions({ name: 'DataBridgeAction' })
|
||||
@ -29,23 +25,14 @@ const props = defineProps<{ modelValue: any }>()
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
const dataBridgeId = useVModel(props, 'modelValue', emits)
|
||||
|
||||
// 模拟数据桥接列表,实际项目中应该从API获取
|
||||
const dataBridgeList = ref([
|
||||
{ id: 1, name: '数据桥接1' },
|
||||
{ id: 2, name: '数据桥接2' },
|
||||
{ id: 3, name: '数据桥接3' }
|
||||
])
|
||||
const dataBridgeList = ref<any[]>([]) // 数据桥接列表
|
||||
|
||||
// 实际项目中,应该从API获取数据桥接列表
|
||||
// const getDataBridgeList = async () => {
|
||||
// try {
|
||||
// dataBridgeList.value = await DataBridgeApi.getSimpleList()
|
||||
// } catch (error) {
|
||||
// console.error('获取数据桥接列表失败', error)
|
||||
// }
|
||||
// }
|
||||
// 获取数据桥接列表
|
||||
const getDataBridgeList = async () => {
|
||||
dataBridgeList.value = await DataBridgeApi.getSimpleDataBridgeList()
|
||||
}
|
||||
|
||||
// onMounted(() => {
|
||||
// getDataBridgeList()
|
||||
// })
|
||||
onMounted(() => {
|
||||
getDataBridgeList()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user