10/15
1. 工作人员账号添加 2. 优化打包 3. 日志 4. 用户头像列表
This commit is contained in:
@@ -3,10 +3,12 @@ import cardNav from '@/components/cardNav/index.vue';
|
||||
import {getDevice} from "@/api/system/device";
|
||||
import {DeviceForm} from "@/api/system/device/types";
|
||||
import {useUserStore} from "@/store/modules/user";
|
||||
|
||||
import {DeviceStatus, fanLevel, parkingShutDown, powerMode, runMode} from "@/views/system/device/devicelist/type";
|
||||
// import airPurifier from './component/AirPurifier.vue'
|
||||
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
function backList() {
|
||||
router.replace({
|
||||
@@ -23,32 +25,20 @@ function editDevice() {
|
||||
})
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
const initFormData: DeviceForm = {
|
||||
deviceId: undefined,
|
||||
deviceNo: undefined,
|
||||
imei: undefined,
|
||||
name: undefined,
|
||||
productId: undefined,
|
||||
model: undefined,
|
||||
sn: undefined,
|
||||
hwVersion: undefined,
|
||||
swVersion: undefined,
|
||||
fwVersion: undefined,
|
||||
pkgVersion: undefined,
|
||||
ip: undefined,
|
||||
mac: undefined,
|
||||
wifiSsid: undefined,
|
||||
bluetoothConnected: undefined,
|
||||
status: undefined,
|
||||
bindUserId: undefined,
|
||||
bindTime: undefined,
|
||||
homeId: undefined,
|
||||
locationId: undefined,
|
||||
signalLevel: undefined,
|
||||
lng: undefined,
|
||||
lat: undefined,
|
||||
address: undefined,
|
||||
charging: undefined,
|
||||
deviceBattery: undefined,
|
||||
lastReportTime: undefined,
|
||||
@@ -59,24 +49,8 @@ const initFormData: DeviceForm = {
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
activeDeviceNo: undefined,
|
||||
activeImei: undefined,
|
||||
activeMac: undefined,
|
||||
}
|
||||
|
||||
const form = ref();
|
||||
|
||||
function init() {
|
||||
form.value = {...initFormData};
|
||||
if (route.query.id) {
|
||||
getDevice(route.query.id as string).then(res => {
|
||||
Object.assign(form.value, res.data);
|
||||
refresh()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
const form = ref<DeviceForm>(initFormData);
|
||||
|
||||
|
||||
let timer = ref<NodeJS.Timeout | null>(null);
|
||||
@@ -84,10 +58,16 @@ let timer = ref<NodeJS.Timeout | null>(null);
|
||||
function refresh() {
|
||||
getDevice(route.query.id as string).then(res => {
|
||||
Object.assign(form.value, res.data);
|
||||
timer.value = setTimeout(() => {
|
||||
refresh();
|
||||
}, 30000)
|
||||
}).catch(() => {
|
||||
if (timer.value) {
|
||||
clearTimeout(timer.value);
|
||||
timer.value = null;
|
||||
}
|
||||
});
|
||||
timer.value = setTimeout(() => {
|
||||
refresh();
|
||||
}, 30000)
|
||||
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -96,6 +76,31 @@ onUnmounted(() => {
|
||||
}
|
||||
timer.value = null;
|
||||
})
|
||||
|
||||
function init() {
|
||||
form.value = {...initFormData};
|
||||
if (route.query.id) {
|
||||
refresh()
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
// const compDefine = ref<any>(null)
|
||||
// const compMap: Record<string, () => Promise<typeof import("*.vue")>> = {
|
||||
// airPurifier: () => import('./component/AirPurifier.vue'),
|
||||
// }
|
||||
// const currentComp = computed(() => compDefine.value)
|
||||
// const loadDevice = async () => {
|
||||
// const loader = compMap['airPurifier']
|
||||
// // 动态import组件
|
||||
// const mod = await loader()
|
||||
// compDefine.value = mod.default
|
||||
// }
|
||||
//
|
||||
// onMounted(() => {
|
||||
// loadDevice()
|
||||
// })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -116,10 +121,18 @@ onUnmounted(() => {
|
||||
<div class="info">
|
||||
<div class="nav">
|
||||
<div class="title">{{ form.name }}</div>
|
||||
<div class="tag online">
|
||||
<div v-if="form.status === DeviceStatus.online" class="tag online">
|
||||
<i class="circle"></i>
|
||||
<span>在线</span>
|
||||
</div>
|
||||
<div v-else-if="form.status === DeviceStatus.offline" class="tag online offline">
|
||||
<i class="circle"></i>
|
||||
<span>离线</span>
|
||||
</div>
|
||||
<div v-else-if="form.status === DeviceStatus.unActive" class="tag online unActive">
|
||||
<i class="circle"></i>
|
||||
<span>未激活</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-list">
|
||||
<div class="info-list-item">
|
||||
@@ -150,8 +163,6 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="baseInfo">
|
||||
<cardNav subTitle="静态档案信息,如需修改请前往「编辑设备」页" title="设备基础档案"></cardNav>
|
||||
<div class=" gridBox">
|
||||
@@ -197,8 +208,8 @@ onUnmounted(() => {
|
||||
<span>环境数据</span>
|
||||
</div>
|
||||
<div class="numBox">
|
||||
<div class="num">{{ form.tvoc }}</div>
|
||||
<div class="tag">
|
||||
<div class="num">{{ form.tvoc || '--' }}</div>
|
||||
<div v-if="form.status === DeviceStatus.online" class="tag">
|
||||
<i class="circle"></i>
|
||||
<span>在线</span>
|
||||
</div>
|
||||
@@ -218,29 +229,29 @@ onUnmounted(() => {
|
||||
<div class="footer" style="margin-top: 0">
|
||||
<span>运行模式</span>
|
||||
<div>
|
||||
<span v-if="form.runMode == '2'" style="color: rgba(17, 24, 39, 1);">桌面模式</span>
|
||||
<span v-else-if="form.runMode == '1'" style="color: rgba(17, 24, 39, 1);">车载模式</span>
|
||||
<span v-if="form.runMode == runMode.dask" style="color: rgba(17, 24, 39, 1);">桌面模式</span>
|
||||
<span v-else-if="form.runMode == runMode.car" style="color: rgba(17, 24, 39, 1);">车载模式</span>
|
||||
<span v-else style="color: rgba(17, 24, 39, 1);">自动</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer" style="margin-top: 0">
|
||||
<span>风速挡位</span>
|
||||
<div>
|
||||
<span v-if="form.fanLevel == '1'" style="color: rgba(17, 24, 39, 1);">强力</span>
|
||||
<span v-else-if="form.fanLevel == '2'" style="color: rgba(17, 24, 39, 1);">低档</span>
|
||||
<span v-if="form.fanLevel == fanLevel.power" style="color: rgba(17, 24, 39, 1);">强力</span>
|
||||
<span v-else-if="form.fanLevel == fanLevel.lower" style="color: rgba(17, 24, 39, 1);">低档</span>
|
||||
<span v-else style="color: rgba(17, 24, 39, 1);">标准</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer" style="margin-top: 0">
|
||||
<span>供电模式</span>
|
||||
<div>
|
||||
<span v-if="form.powerMode == '0'" style="color: rgba(17, 24, 39, 1);">USB供电</span>
|
||||
<span v-if="form.powerMode == powerMode.usb" style="color: rgba(17, 24, 39, 1);">USB供电</span>
|
||||
<span v-else style="color: rgba(17, 24, 39, 1);">电池供电</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer" style="margin-top: 0">
|
||||
<span>停车关机模式</span>
|
||||
<el-tag v-if="form.parkingShutdown == '1'" type="success">开启</el-tag>
|
||||
<el-tag v-if="form.parkingShutdown == parkingShutDown.open" type="success">开启</el-tag>
|
||||
<el-tag v-else type="danger">关闭</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
@@ -251,7 +262,7 @@ onUnmounted(() => {
|
||||
<span>耗材与电量</span>
|
||||
</div>
|
||||
<div class="flex-1 flex justify-evenly">
|
||||
<div class="ageBox">
|
||||
<div v-if="form.filterLife !== null" class="ageBox">
|
||||
<div class="title">滤芯寿命</div>
|
||||
<div class="processInfo">
|
||||
<span class="num">{{ form.filterLife }}</span>
|
||||
@@ -259,17 +270,17 @@ onUnmounted(() => {
|
||||
</div>
|
||||
<el-progress :percentage="form.filterLife" :show-text="false"></el-progress>
|
||||
<div class="tip">
|
||||
<span>预计剩余可用{{ form.filterRemainDays }}天</span>
|
||||
<span>预计剩余可用 {{ form.filterRemainDays || '---' }} 天</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="ageBox BatteryBox">
|
||||
<div v-if="form.deviceBattery!==null && form.filterLife !==null" class="line"></div>
|
||||
<div v-if="form.deviceBattery!==null" class="ageBox BatteryBox">
|
||||
<div class="title">电池电量</div>
|
||||
<div class="processInfo">
|
||||
<span class="num">76</span>
|
||||
<span class="num">{{ form.deviceBattery }}</span>
|
||||
<span class="unit">%</span>
|
||||
</div>
|
||||
<el-progress :percentage="30" :show-text="false" color="#22C55E"></el-progress>
|
||||
<el-progress :percentage="form.deviceBattery" :show-text="false" color="#22C55E"></el-progress>
|
||||
<el-tag type="success">充电中</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
@@ -292,6 +303,10 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <component-->
|
||||
<!-- :is="currentComp"-->
|
||||
<!-- v-if="currentComp"-->
|
||||
<!-- />-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -364,6 +379,25 @@ onUnmounted(() => {
|
||||
border-radius: 3px;
|
||||
background-color: rgba(22, 163, 74, 1);
|
||||
}
|
||||
|
||||
|
||||
&.offline {
|
||||
background-color: rgba(237, 56, 34, 0.2);
|
||||
color: rgb(237 56 34);
|
||||
|
||||
.circle {
|
||||
background-color: rgb(237 56 34);
|
||||
}
|
||||
}
|
||||
|
||||
&.unActive {
|
||||
background-color: #ccc;
|
||||
color: #838383;
|
||||
|
||||
.circle {
|
||||
background-color: #838383;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user