|
|
|
@ -70,22 +70,32 @@ ref="tableRef" v-loading="loading" :data="list" :stripe="true" :show-overflow-to
|
|
|
|
<el-table-column type="selection" width="55" reserve-selection />
|
|
|
|
<el-table-column type="selection" width="55" reserve-selection />
|
|
|
|
<el-table-column label="设备编号" align="left" prop="deviceCode" />
|
|
|
|
<el-table-column label="设备编号" align="left" prop="deviceCode" />
|
|
|
|
<el-table-column label="设备名称" align="left" prop="deviceName" />
|
|
|
|
<el-table-column label="设备名称" align="left" prop="deviceName" />
|
|
|
|
|
|
|
|
<el-table-column label="运行状态" align="center" prop="operatingStatus" width="120px">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-tag
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
:type="getOperatingStatusType(scope.row.operatingStatus)"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ getOperatingStatusLabel(scope.row.operatingStatus) }}
|
|
|
|
|
|
|
|
</el-tag>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
<!-- <el-table-column label="设备类型" align="left" prop="deviceType" width="150px"> -->
|
|
|
|
<!-- <el-table-column label="设备类型" align="left" prop="deviceType" width="150px"> -->
|
|
|
|
<!-- <template #default="scope">
|
|
|
|
<!-- <template #default="scope">
|
|
|
|
<dict-tag :type="DICT_TYPE.IOT_DEVICE_TYPE" :value="scope.row.deviceType" />
|
|
|
|
<dict-tag :type="DICT_TYPE.IOT_DEVICE_TYPE" :value="scope.row.deviceType" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column> -->
|
|
|
|
</el-table-column> -->
|
|
|
|
<el-table-column label="采集协议" align="left" prop="protocol" width="200px">
|
|
|
|
<el-table-column label="采集协议" align="left" prop="protocol" width="120px">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :type="DICT_TYPE.IOT_PROTOCOL" :value="scope.row.protocol" />
|
|
|
|
<dict-tag :type="DICT_TYPE.IOT_PROTOCOL" :value="scope.row.protocol" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="连接状态" align="center" prop="status" width="200px">
|
|
|
|
<el-table-column label="连接状态" align="center" prop="status" width="120px">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :type="DICT_TYPE.IOT_GATEWAY_STATUS" :value="scope.row.status" />
|
|
|
|
<dict-tag :type="DICT_TYPE.IOT_GATEWAY_STATUS" :value="scope.row.status" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="采集周期(s)" align="center" prop="sampleCycle" width="100px" />
|
|
|
|
<el-table-column label="采集周期(s)" align="center" prop="sampleCycle" width="120px" />
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <el-table-column label="读主题" align="center" prop="readTopic" />
|
|
|
|
<!-- <el-table-column label="读主题" align="center" prop="readTopic" />
|
|
|
|
<el-table-column label="写主题" align="center" prop="writeTopic" />
|
|
|
|
<el-table-column label="写主题" align="center" prop="writeTopic" />
|
|
|
|
@ -107,11 +117,18 @@ ref="tableRef" v-loading="loading" :data="list" :stripe="true" :show-overflow-to
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
width="170px"
|
|
|
|
width="170px"
|
|
|
|
/> -->
|
|
|
|
/> -->
|
|
|
|
<el-table-column label="是否启用" align="center" prop="isEnable" width="100px">
|
|
|
|
<el-table-column label="是否启用" align="center" prop="isEnable" width="120px">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.isEnable" />
|
|
|
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.isEnable" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
|
|
label="采集时间"
|
|
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
|
|
prop="collectionTime"
|
|
|
|
|
|
|
|
width="180px"
|
|
|
|
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
|
|
|
|
/>
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="380px">
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="380px">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-button link type="primary" @click.stop="handleShowAttribute(scope.row)">点位</el-button>
|
|
|
|
<el-button link type="primary" @click.stop="handleShowAttribute(scope.row)">点位</el-button>
|
|
|
|
@ -454,20 +471,40 @@ const queryParams = reactive({
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getOperatingStatusLabel = (value: string | number | undefined) => {
|
|
|
|
|
|
|
|
const text = String(value ?? '').trim()
|
|
|
|
|
|
|
|
if (!text) return '离线'
|
|
|
|
|
|
|
|
return text
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getOperatingStatusType = (value: string | number | undefined) => {
|
|
|
|
|
|
|
|
const text = String(value ?? '').trim()
|
|
|
|
|
|
|
|
if (!text) return 'info'
|
|
|
|
|
|
|
|
if (text === '运行') return 'success'
|
|
|
|
|
|
|
|
if (text === '待机中') return 'info'
|
|
|
|
|
|
|
|
if (text === '故障中') return 'danger'
|
|
|
|
|
|
|
|
if (text === '报警中') return 'warning'
|
|
|
|
|
|
|
|
return 'info'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
const handleSelectionChange = (rows: any[]) => {
|
|
|
|
const handleSelectionChange = (rows: any[]) => {
|
|
|
|
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
|
|
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 查询列表 */
|
|
|
|
/** 查询列表 */
|
|
|
|
const getList = async () => {
|
|
|
|
const getList = async (showLoading = true) => {
|
|
|
|
loading.value = true
|
|
|
|
if (showLoading) {
|
|
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const data = await DeviceApi.getDevicePage(queryParams)
|
|
|
|
const data = await DeviceApi.getDevicePage(queryParams)
|
|
|
|
list.value = data.list
|
|
|
|
list.value = data.list
|
|
|
|
total.value = data.total
|
|
|
|
total.value = data.total
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
loading.value = false
|
|
|
|
if (showLoading) {
|
|
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -948,9 +985,36 @@ const handleToggleConnect = async (row: DeviceVO) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
let deviceTimer: number | undefined
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const startDeviceTimer = () => {
|
|
|
|
|
|
|
|
if (deviceTimer) return
|
|
|
|
|
|
|
|
deviceTimer = window.setInterval(() => {
|
|
|
|
|
|
|
|
getList(false)
|
|
|
|
|
|
|
|
}, 5000)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const stopDeviceTimer = () => {
|
|
|
|
|
|
|
|
if (!deviceTimer) return
|
|
|
|
|
|
|
|
window.clearInterval(deviceTimer)
|
|
|
|
|
|
|
|
deviceTimer = undefined
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
getList()
|
|
|
|
getList()
|
|
|
|
|
|
|
|
startDeviceTimer()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onActivated(() => {
|
|
|
|
|
|
|
|
startDeviceTimer()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onDeactivated(() => {
|
|
|
|
|
|
|
|
stopDeviceTimer()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
|
|
|
stopDeviceTimer()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|