|
@@ -123,6 +123,9 @@
|
|
>
|
|
>
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+ <el-button type="warning" plain @click="handleImport" v-hasPermi="['iot:device:import']">
|
|
|
|
+ <Icon icon="ep:upload" /> 导入
|
|
|
|
+ </el-button>
|
|
<el-button
|
|
<el-button
|
|
type="primary"
|
|
type="primary"
|
|
plain
|
|
plain
|
|
@@ -150,14 +153,45 @@
|
|
<template v-if="viewMode === 'card'">
|
|
<template v-if="viewMode === 'card'">
|
|
<el-row :gutter="16">
|
|
<el-row :gutter="16">
|
|
<el-col v-for="item in list" :key="item.id" :xs="24" :sm="12" :md="12" :lg="6" class="mb-4">
|
|
<el-col v-for="item in list" :key="item.id" :xs="24" :sm="12" :md="12" :lg="6" class="mb-4">
|
|
- <el-card class="h-full transition-colors" :body-style="{ padding: '0' }">
|
|
|
|
- <div class="p-4">
|
|
|
|
|
|
+ <el-card
|
|
|
|
+ class="h-full transition-colors relative overflow-hidden"
|
|
|
|
+ :body-style="{ padding: '0' }"
|
|
|
|
+ >
|
|
|
|
+ <!-- 添加渐变背景层 -->
|
|
|
|
+ <div
|
|
|
|
+ class="absolute top-0 left-0 right-0 h-[50px] pointer-events-none"
|
|
|
|
+ :class="[
|
|
|
|
+ item.status === DeviceStatusEnum.ONLINE
|
|
|
|
+ ? 'bg-gradient-to-b from-[#eefaff] to-transparent'
|
|
|
|
+ : 'bg-gradient-to-b from-[#fff1f1] to-transparent'
|
|
|
|
+ ]"
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <div class="p-4 relative">
|
|
<!-- 标题区域 -->
|
|
<!-- 标题区域 -->
|
|
<div class="flex items-center mb-3">
|
|
<div class="flex items-center mb-3">
|
|
<div class="mr-2.5 flex items-center">
|
|
<div class="mr-2.5 flex items-center">
|
|
<el-image :src="defaultIconUrl" class="w-[18px] h-[18px]" />
|
|
<el-image :src="defaultIconUrl" class="w-[18px] h-[18px]" />
|
|
</div>
|
|
</div>
|
|
- <div class="text-[16px] font-600">{{ item.deviceName }}</div>
|
|
|
|
|
|
+ <div class="text-[16px] font-600 flex-1">{{ item.deviceName }}</div>
|
|
|
|
+ <!-- 添加设备状态标签 -->
|
|
|
|
+ <div class="inline-flex items-center">
|
|
|
|
+ <div
|
|
|
|
+ class="w-1 h-1 rounded-full mr-1.5"
|
|
|
|
+ :class="
|
|
|
|
+ item.status === DeviceStatusEnum.ONLINE
|
|
|
|
+ ? 'bg-[var(--el-color-success)]'
|
|
|
|
+ : 'bg-[var(--el-color-danger)]'
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <el-text
|
|
|
|
+ class="!text-xs font-bold"
|
|
|
|
+ :type="item.status === DeviceStatusEnum.ONLINE ? 'success' : 'danger'"
|
|
|
|
+ >
|
|
|
|
+ {{ getDictLabel(DICT_TYPE.IOT_DEVICE_STATUS, item.status) }}
|
|
|
|
+ </el-text>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 信息区域 -->
|
|
<!-- 信息区域 -->
|
|
@@ -186,7 +220,7 @@
|
|
<!-- 分隔线 -->
|
|
<!-- 分隔线 -->
|
|
<el-divider class="!my-3" />
|
|
<el-divider class="!my-3" />
|
|
|
|
|
|
- <!-- 按钮组 -->
|
|
|
|
|
|
+ <!-- 按钮 -->
|
|
<div class="flex items-center px-0">
|
|
<div class="flex items-center px-0">
|
|
<el-button
|
|
<el-button
|
|
class="flex-1 !px-2 !h-[32px] text-[13px]"
|
|
class="flex-1 !px-2 !h-[32px] text-[13px]"
|
|
@@ -211,10 +245,10 @@
|
|
class="flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
|
|
class="flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
|
|
type="info"
|
|
type="info"
|
|
plain
|
|
plain
|
|
- @click="openLog(item.id)"
|
|
|
|
|
|
+ @click="openModel(item.id)"
|
|
>
|
|
>
|
|
<Icon icon="ep:tickets" class="mr-1" />
|
|
<Icon icon="ep:tickets" class="mr-1" />
|
|
- 日志
|
|
|
|
|
|
+ 数据
|
|
</el-button>
|
|
</el-button>
|
|
<div class="mx-[10px] h-[20px] w-[1px] bg-[#dcdfe6]"></div>
|
|
<div class="mx-[10px] h-[20px] w-[1px] bg-[#dcdfe6]"></div>
|
|
<el-button
|
|
<el-button
|
|
@@ -290,7 +324,7 @@
|
|
>
|
|
>
|
|
查看
|
|
查看
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button link type="primary" @click="openLog(scope.row.id)"> 日志 </el-button>
|
|
|
|
|
|
+ <el-button link type="primary" @click="openModel(scope.row.id)"> 日志 </el-button>
|
|
<el-button
|
|
<el-button
|
|
link
|
|
link
|
|
type="primary"
|
|
type="primary"
|
|
@@ -324,17 +358,20 @@
|
|
<DeviceForm ref="formRef" @success="getList" />
|
|
<DeviceForm ref="formRef" @success="getList" />
|
|
<!-- 分组表单组件 -->
|
|
<!-- 分组表单组件 -->
|
|
<DeviceGroupForm ref="groupFormRef" @success="getList" />
|
|
<DeviceGroupForm ref="groupFormRef" @success="getList" />
|
|
|
|
+ <!-- 导入表单组件 -->
|
|
|
|
+ <DeviceImportForm ref="importFormRef" @success="getList" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
|
|
|
|
+import { DICT_TYPE, getIntDictOptions, getDictLabel } from '@/utils/dict'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
-import { DeviceApi, DeviceVO } from '@/api/iot/device'
|
|
|
|
|
|
+import { DeviceApi, DeviceVO, DeviceStatusEnum } from '@/api/iot/device/device'
|
|
import DeviceForm from './DeviceForm.vue'
|
|
import DeviceForm from './DeviceForm.vue'
|
|
import { ProductApi, ProductVO } from '@/api/iot/product/product'
|
|
import { ProductApi, ProductVO } from '@/api/iot/product/product'
|
|
import { DeviceGroupApi, DeviceGroupVO } from '@/api/iot/device/group'
|
|
import { DeviceGroupApi, DeviceGroupVO } from '@/api/iot/device/group'
|
|
import download from '@/utils/download'
|
|
import download from '@/utils/download'
|
|
import DeviceGroupForm from './DeviceGroupForm.vue'
|
|
import DeviceGroupForm from './DeviceGroupForm.vue'
|
|
|
|
+import DeviceImportForm from './DeviceImportForm.vue'
|
|
|
|
|
|
/** IoT 设备列表 */
|
|
/** IoT 设备列表 */
|
|
defineOptions({ name: 'IoTDevice' })
|
|
defineOptions({ name: 'IoTDevice' })
|
|
@@ -342,7 +379,7 @@ defineOptions({ name: 'IoTDevice' })
|
|
const message = useMessage() // 消息弹窗
|
|
const message = useMessage() // 消息弹窗
|
|
const { t } = useI18n() // 国际化
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
-const loading = ref(true) // 列表的加载中
|
|
|
|
|
|
+const loading = ref(true) // 列表加载中
|
|
const list = ref<DeviceVO[]>([]) // 列表的数据
|
|
const list = ref<DeviceVO[]>([]) // 列表的数据
|
|
const total = ref(0) // 列表的总页数
|
|
const total = ref(0) // 列表的总页数
|
|
const queryParams = reactive({
|
|
const queryParams = reactive({
|
|
@@ -452,9 +489,15 @@ const openGroupForm = () => {
|
|
groupFormRef.value.open(selectedIds.value)
|
|
groupFormRef.value.open(selectedIds.value)
|
|
}
|
|
}
|
|
|
|
|
|
-/** 打开日志 */
|
|
|
|
-const openLog = (id: number) => {
|
|
|
|
- push({ name: 'IoTDeviceDetail', params: { id }, query: { tab: 'log' } })
|
|
|
|
|
|
+/** 打开物模型数据 */
|
|
|
|
+const openModel = (id: number) => {
|
|
|
|
+ push({ name: 'IoTDeviceDetail', params: { id }, query: { tab: 'model' } })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 设备导入 */
|
|
|
|
+const importFormRef = ref()
|
|
|
|
+const handleImport = () => {
|
|
|
|
+ importFormRef.value.open()
|
|
}
|
|
}
|
|
|
|
|
|
/** 初始化 **/
|
|
/** 初始化 **/
|