增加二期菜单以及综合模式评估页面

This commit is contained in:
zx
2026-04-28 15:47:19 +08:00
parent 6904f960b7
commit e5a0527861
23 changed files with 1013 additions and 46 deletions

View File

@@ -43,12 +43,9 @@
</view>
<view v-if="isSocketControlType(item.type)" class="socket-actions">
<uv-switch v-model="controlLoadingMap[item.cardKey]" active-color="#165D46"
@change="(e) => handleSocketControl(e, item)" />
@change="(e) => handleSocketControl1(item, e)" />
</view>
<!-- <view class="sensor-state">
<text class="dot"></text>
{{ item.onlineText }}
</view> -->
</view>
<view class="sensor-body">
<view class="flex justify-between align-center">
@@ -56,19 +53,20 @@
</view>
<view>
<text class="mr-4"> {{ item.summary }}</text>|
<text class="mr-4 text"> {{ item.summary }}</text>
<text class=" text">|</text>
<text :class="['sensor-state', item.statusClass, 'ml-4']"> {{ item.onlineText }}</text>
</view>
<view v-if="isSocketControlType(item.type)" class="socket-actions">
<!-- <text class="control-btn on" :disabled="!!controlLoadingMap[item.cardKey]"
<text class="control-btn on" :disabled="!!controlLoadingMap[item.cardKey]"
@tap="handleSocketControl(item, 'on')">
{{ getSocketActionText(item.type, 'on', !!controlLoadingMap[item.cardKey]) }}
</text>
<text class="control-btn off" :disabled="!!controlLoadingMap[item.cardKey]"
@tap="handleSocketControl(item, 'off')">
{{ getSocketActionText(item.type, 'off', !!controlLoadingMap[item.cardKey]) }}
</text> -->
</text>
</view>
<view v-else-if="item.type === 'switch'" class="switch-actions">
@@ -235,31 +233,47 @@ function patchRealtimeState(prev, next) {
if (socket != null) res.switchStatus = res.socket_status = res.socketStatus = socket
return res
}
async function handleSocketControl(e, item) {
console.log(e, item, '111');
const action = e ? 'on' : 'off'
console.log(action, '111');
if (action) {
const deviceId = item.id || item.deviceId
const devEui = item.devEui || item.devEUI || item.dev_eui
console.log('devEui', devEui);
if (!devEui) return uni.showToast({ title: '未找到设备', icon: 'none' })
const k = item.cardKey || String(deviceId)
if (controlLoadingMap[k]) return
controlLoadingMap[k] = true
try {
const status = action === 'on' ? 1 : 0
console.log(status, action, 'status');
await controlSocket({ devEui, deviceId, status })
syncSocketLocalState(item, status)
uni.showToast({ title: '指令已发送', icon: 'success' })
} finally {
controlLoadingMap[k] = false
}
async function handleSocketControl(item, action) {
console.log(action, controlLoadingMap, 'action111');
console.log(item, 'item111');
const deviceId = item.id || item.deviceId
const devEui = item.devEui || item.devEUI || item.dev_eui
if (!devEui) return uni.showToast({ title: '未找到设备', icon: 'none' })
const k = item.cardKey || String(deviceId)
console.log('devEui1', controlLoadingMap, k, controlLoadingMap[k]);
if (controlLoadingMap[k]) return
controlLoadingMap[k] = true
try {
const status = action === 'on' ? 1 : 0
await controlSocket({ devEui, deviceId, status })
syncSocketLocalState(item, status)
uni.showToast({ title: '指令已发送', icon: 'success' })
} finally {
controlLoadingMap[k] = false
}
}
async function handleSocketControl1(item, e) {
const action = e ? 'on' : 'off'
console.log(action, controlLoadingMap, 'action11133');
console.log(item, 'item11133');
const deviceId = item.id || item.deviceId
const devEui = item.devEui || item.devEUI || item.dev_eui
if (!devEui) return uni.showToast({ title: '未找到设备', icon: 'none' })
const k = item.cardKey || String(deviceId)
console.log('devEui', controlLoadingMap, k, controlLoadingMap[k]);
if (controlLoadingMap[k]) return
console.log('controlLoadingMap[k]', controlLoadingMap[k]);
controlLoadingMap[k] = true
try {
const status = action === 'on' ? 1 : 0
console.log(status, action, 'status===>');
await controlSocket({ devEui, deviceId, status })
syncSocketLocalState(item, status)
uni.showToast({ title: '指令已发送', icon: 'success' })
} finally {
controlLoadingMap[k] = false
}
}
@@ -709,10 +723,15 @@ onBeforeUnmount(() => {
}
.location {
font-size: 16px;
font-size: 14px;
color: #666;
}
.text {
font-size: 14px;
}
.type-name {
font-size: 16px;
font-weight: 600;
@@ -732,7 +751,7 @@ onBeforeUnmount(() => {
display: flex;
justify-content: space-between;
gap: 16rpx;
margin-top: 10px;
margin-top: 20rpx;
}
.switch-actions {
@@ -833,7 +852,7 @@ onBeforeUnmount(() => {
.summary-card {
padding: 18px 20px;
padding: 36rpx 40rpx;
border-radius: 18px;
position: relative;
overflow: hidden;
@@ -844,7 +863,7 @@ onBeforeUnmount(() => {
font-size: 13px;
font-weight: 500;
color: #334155;
margin-bottom: 6px;
margin-bottom: 12rpx;
}
.value {

View File

@@ -23,7 +23,6 @@ getMyWarehouseList()
</script>
<template>
<uv-list v-for="(item, index) in myWarehouseList" :key="index" class="list">
<view class="title line">{{ item.parentName }}</view>
<uv-list-item v-for="(i, idx) in item.items" :key="idx" link clickable @tap="onChecked(i)"
@@ -50,6 +49,7 @@ getMyWarehouseList()
}
.title {
font-size: 14px;
padding: 8px 30rpx;
}
</style>