150
150
<template v-if =" viewMode === ' card' " >
151
151
<el-row :gutter =" 16" >
152
152
<el-col v-for =" item in list" :key =" item.id" :xs =" 24" :sm =" 12" :md =" 12" :lg =" 6" class =" mb-4" >
153
- <el-card class =" h-full transition-colors" :body-style =" { padding: '0' }" >
154
- <div class =" p-4" >
153
+ <el-card
154
+ class =" h-full transition-colors relative overflow-hidden"
155
+ :body-style =" { padding: '0' }"
156
+ >
157
+ <!-- 添加渐变背景层 -->
158
+ <div
159
+ class =" absolute top-0 left-0 right-0 h-[50px] pointer-events-none"
160
+ :class =" [
161
+ item.status === DeviceStatusEnum.ONLINE
162
+ ? 'bg-gradient-to-b from-[#eefaff] to-transparent'
163
+ : 'bg-gradient-to-b from-[#fff1f1] to-transparent'
164
+ ]"
165
+ >
166
+ </div >
167
+ <div class =" p-4 relative" >
155
168
<!-- 标题区域 -->
156
169
<div class =" flex items-center mb-3" >
157
170
<div class =" mr-2.5 flex items-center" >
158
171
<el-image :src =" defaultIconUrl" class =" w-[18px] h-[18px]" />
159
172
</div >
160
- <div class =" text-[16px] font-600" >{{ item.deviceName }}</div >
173
+ <div class =" text-[16px] font-600 flex-1" >{{ item.deviceName }}</div >
174
+ <!-- 添加设备状态标签 -->
175
+ <div class =" inline-flex items-center" >
176
+ <div
177
+ class =" w-1 h-1 rounded-full mr-1.5"
178
+ :class ="
179
+ item.status === DeviceStatusEnum.ONLINE
180
+ ? 'bg-[var(--el-color-success)]'
181
+ : 'bg-[var(--el-color-danger)]'
182
+ "
183
+ >
184
+ </div >
185
+ <el-text
186
+ class =" !text-xs font-bold"
187
+ :type =" item.status === DeviceStatusEnum.ONLINE ? 'success' : 'danger'"
188
+ >
189
+ {{ getDictLabel(DICT_TYPE.IOT_DEVICE_STATUS, item.status) }}
190
+ </el-text >
191
+ </div >
161
192
</div >
162
193
163
194
<!-- 信息区域 -->
186
217
<!-- 分隔线 -->
187
218
<el-divider class =" !my-3" />
188
219
189
- <!-- 按钮组 -->
220
+ <!-- 按钮 -->
190
221
<div class =" flex items-center px-0" >
191
222
<el-button
192
223
class =" flex-1 !px-2 !h-[32px] text-[13px]"
327
358
</template >
328
359
329
360
<script setup lang="ts">
330
- import { DICT_TYPE , getIntDictOptions } from ' @/utils/dict'
361
+ import { DICT_TYPE , getIntDictOptions , getDictLabel } from ' @/utils/dict'
331
362
import { dateFormatter } from ' @/utils/formatTime'
332
- import { DeviceApi , DeviceVO } from ' @/api/iot/device'
363
+ import { DeviceApi , DeviceVO , DeviceStatusEnum } from ' @/api/iot/device'
333
364
import DeviceForm from ' ./DeviceForm.vue'
334
365
import { ProductApi , ProductVO } from ' @/api/iot/product/product'
335
366
import { DeviceGroupApi , DeviceGroupVO } from ' @/api/iot/device/group'
@@ -342,7 +373,7 @@ defineOptions({ name: 'IoTDevice' })
342
373
const message = useMessage () // 消息弹窗
343
374
const { t } = useI18n () // 国际化
344
375
345
- const loading = ref (true ) // 列表的加载中
376
+ const loading = ref (true ) // 列表���加载中
346
377
const list = ref <DeviceVO []>([]) // 列表的数据
347
378
const total = ref (0 ) // 列表的总页数
348
379
const queryParams = reactive ({
@@ -389,7 +420,7 @@ const resetQuery = () => {
389
420
handleQuery ()
390
421
}
391
422
392
- /** 添加 /修改操作 */
423
+ /** ���加 /修改操作 */
393
424
const formRef = ref ()
394
425
const openForm = (type : string , id ? : number ) => {
395
426
formRef .value .open (type , id )
0 commit comments