Compare commits

...

2 Commits

Author SHA1 Message Date
zx
6904f960b7 调整传感器页面 2026-04-23 16:01:13 +08:00
zx
63d1a62a06 修改配置文件 2026-04-23 14:39:22 +08:00
3 changed files with 129 additions and 84 deletions

View File

@@ -33,7 +33,6 @@
"style": { "navigationBarTitleText": "我的" } "style": { "navigationBarTitleText": "我的" }
}, },
// 仓储 - 唯一码
{ {
"path": "pages/warehousing/uniqueCode/issueUniqueCode/index", "path": "pages/warehousing/uniqueCode/issueUniqueCode/index",
"style": { "style": {
@@ -73,12 +72,6 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
// {
// "path": "pages/uniqueCode/bindRfid",
// "style": { "navigationBarTitleText": "绑定RFID" }
// },
// ========== 库存信息模块 ==========
{ {
"path": "pages/warehousing/InventoryInfo/checkUniqueCode", "path": "pages/warehousing/InventoryInfo/checkUniqueCode",
"style": { "navigationBarTitleText": "唯一码盘点" } "style": { "navigationBarTitleText": "唯一码盘点" }
@@ -101,8 +94,6 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
// ========== 报表模块 ==========
{ {
"path": "pages/warehousing/report/daily", "path": "pages/warehousing/report/daily",
"style": { "navigationBarTitleText": "库存日报" } "style": { "navigationBarTitleText": "库存日报" }
@@ -141,7 +132,6 @@
} }
}, },
// ========== 申报单模块 ==========
{ {
"path": "pages/warehousing/Declaration/materialQuery", "path": "pages/warehousing/Declaration/materialQuery",
"style": { "navigationBarTitleText": "物资查询" } "style": { "navigationBarTitleText": "物资查询" }
@@ -171,8 +161,6 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
// ========== 入库单模块 ==========
{ {
"path": "pages/warehousing/stockIn/create", "path": "pages/warehousing/stockIn/create",
"style": { "style": {
@@ -209,7 +197,6 @@
"path": "pages/warehousing/stockIn/components/inbound", "path": "pages/warehousing/stockIn/components/inbound",
"style": { "navigationBarTitleText": "入库", "navigationStyle": "custom" } "style": { "navigationBarTitleText": "入库", "navigationStyle": "custom" }
}, },
// ========== 出库单模块 ==========
{ {
"path": "pages/warehousing/stockOut/create", "path": "pages/warehousing/stockOut/create",
"style": { "style": {
@@ -305,6 +292,5 @@
"selectedIconPath": "static/icon/my-active.png" "selectedIconPath": "static/icon/my-active.png"
} }
] ]
}, }
"uniIdRouter": {}
} }

View File

@@ -25,9 +25,6 @@
</view> </view>
<view class="report"> 最近上报:{{ latestReportTime || '--' }} </view> <view class="report"> 最近上报:{{ latestReportTime || '--' }} </view>
</view> </view>
</view> </view>
<view class="sensor-grid"> <view class="sensor-grid">
@@ -40,30 +37,38 @@
<view v-for="item in sensorCards" :key="item.cardKey" :class="['sensor-card', item.statusClass]"> <view v-for="item in sensorCards" :key="item.cardKey" :class="['sensor-card', item.statusClass]">
<view class="sensor-content"> <view class="sensor-content">
<view class="sensor-main"> <view class="sensor-main">
<view class="sensor-top"> <view class="sensor-top flex">
<view :class="['sensor-icon', item.type]"> <view :class="['sensor-icon', item.type]">
<text>{{ item.icon }}</text> <text>{{ item.icon }}</text>
</view> </view>
<view class="sensor-state"> <view v-if="isSocketControlType(item.type)" class="socket-actions">
<uv-switch v-model="controlLoadingMap[item.cardKey]" active-color="#165D46"
@change="(e) => handleSocketControl(e, item)" />
</view>
<!-- <view class="sensor-state">
<text class="dot"></text> <text class="dot"></text>
{{ item.onlineText }} {{ item.onlineText }}
</view> </view> -->
</view> </view>
<view class="sensor-body"> <view class="sensor-body">
<text class="location">{{ item.locationName }}</text> <view class="flex justify-between align-center">
<view class="type-name">{{ item.typeName }}</view> <view class="type-name mb-4">{{ item.typeName }} </view>
<text class="summary">{{ item.summary }}</text> </view>
<view>
<text class="mr-4"> {{ item.summary }}</text>|
<text :class="['sensor-state', item.statusClass, 'ml-4']"> {{ item.onlineText }}</text>
</view>
<view v-if="isSocketControlType(item.type)" class="socket-actions"> <view v-if="isSocketControlType(item.type)" class="socket-actions">
<button class="control-btn on" :disabled="!!controlLoadingMap[item.cardKey]"
<!-- <text class="control-btn on" :disabled="!!controlLoadingMap[item.cardKey]"
@tap="handleSocketControl(item, 'on')"> @tap="handleSocketControl(item, 'on')">
{{ getSocketActionText(item.type, 'on', !!controlLoadingMap[item.cardKey]) }} {{ getSocketActionText(item.type, 'on', !!controlLoadingMap[item.cardKey]) }}
</button> </text>
<button class="control-btn off" :disabled="!!controlLoadingMap[item.cardKey]" <text class="control-btn off" :disabled="!!controlLoadingMap[item.cardKey]"
@tap="handleSocketControl(item, 'off')"> @tap="handleSocketControl(item, 'off')">
{{ getSocketActionText(item.type, 'off', !!controlLoadingMap[item.cardKey]) }} {{ getSocketActionText(item.type, 'off', !!controlLoadingMap[item.cardKey]) }}
</button> </text> -->
</view> </view>
<view v-else-if="item.type === 'switch'" class="switch-actions"> <view v-else-if="item.type === 'switch'" class="switch-actions">
@@ -84,7 +89,7 @@
</view> </view>
</view> </view>
<view class="metric-panel"> <!-- <view class="metric-panel">
<text class="panel-title">实时指标</text> <text class="panel-title">实时指标</text>
<view class="metric-list"> <view class="metric-list">
<view v-for="metric in item.metrics" :key="metric.label" class="metric-item"> <view v-for="metric in item.metrics" :key="metric.label" class="metric-item">
@@ -96,15 +101,18 @@
<text class="value">等待数据</text> <text class="value">等待数据</text>
</view> </view>
</view> </view>
</view> </view> -->
</view> </view>
<view class="sensor-footer"> <!-- <view class="sensor-footer">
<text>DevEUI{{ item.devEui || '--' }}</text> <text>DevEUI{{ item.devEui || '--' }}</text>
<text>{{ item.reportTime || '暂无上报' }}</text> <text>{{ item.reportTime || '暂无上报' }}</text>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
</template> </template>
@@ -228,21 +236,31 @@ function patchRealtimeState(prev, next) {
return res return res
} }
async function handleSocketControl(item, action) { async function handleSocketControl(e, item) {
const deviceId = item.id || item.deviceId console.log(e, item, '111');
const devEui = item.devEui || item.devEUI || item.dev_eui const action = e ? 'on' : 'off'
if (!devEui) return uni.showToast({ title: '未找到设备', icon: 'none' }) console.log(action, '111');
const k = item.cardKey || String(deviceId) if (action) {
if (controlLoadingMap[k]) return const deviceId = item.id || item.deviceId
controlLoadingMap[k] = true const devEui = item.devEui || item.devEUI || item.dev_eui
try { console.log('devEui', devEui);
const status = action === 'on' ? 1 : 0
await controlSocket({ devEui, deviceId, status }) if (!devEui) return uni.showToast({ title: '未找到设备', icon: 'none' })
syncSocketLocalState(item, status) const k = item.cardKey || String(deviceId)
uni.showToast({ title: '指令已发送', icon: 'success' }) if (controlLoadingMap[k]) return
} finally { controlLoadingMap[k] = true
controlLoadingMap[k] = false 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 handleLightSwitchControl(item, ch, action) { async function handleLightSwitchControl(item, ch, action) {
@@ -574,24 +592,52 @@ onBeforeUnmount(() => {
color: #999; color: #999;
} }
/* 父容器:网格布局 → 2个一行 */
.sensor-grid {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
/* 两个卡片之间的间距 */
padding: 10rpx;
}
/* loading / 空状态 占满整行 */
.loading-view,
.empty-state {
width: 100%;
text-align: center;
padding: 40rpx 0;
font-size: 28rpx;
color: #666;
}
.sensor-card { .sensor-card {
// background: #fff;
// border-radius: 24rpx;
// padding: 24rpx;
// margin-bottom: 20rpx;
// position: relative;
// overflow: hidden;
width: calc(50% - 10rpx);
box-sizing: border-box;
border-radius: 16rpx;
background: #fff; background: #fff;
border-radius: 24rpx;
padding: 24rpx;
margin-bottom: 20rpx;
position: relative;
overflow: hidden; overflow: hidden;
} }
.sensor-card::before { // .sensor-card::before {
content: ''; // content: '';
position: absolute; // position: absolute;
left: 0; // left: 0;
top: 0; // top: 0;
bottom: 0; // bottom: 0;
width: 8rpx; // width: 8rpx;
background: #08a089; // background: #08a089;
} // }
.sensor-card.offline { .sensor-card.offline {
opacity: 0.6; opacity: 0.6;
@@ -601,11 +647,11 @@ onBeforeUnmount(() => {
.sensor-content { .sensor-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20rpx; gap: 8px;
} }
.sensor-main { .sensor-main {
background: #f9f9f9; background: #fff;
border-radius: 20rpx; border-radius: 20rpx;
padding: 20rpx; padding: 20rpx;
} }
@@ -629,14 +675,24 @@ onBeforeUnmount(() => {
color: #088a77; color: #088a77;
} }
.sensor-state { .sensor-state.offline {
font-size: 24rpx; opacity: 0.6;
padding: 8rpx 16rpx; color: grey;
background: #e6f7f5; filter: grayscale(0.5);
}
.sensor-state.online {
color: #088a77; color: #088a77;
border-radius: 100rpx; }
display: flex;
align-items: center; .sensor-state {
font-size: 14px;
// padding: 8rpx 16rpx;
// background: #e6f7f5;
// color: #088a77;
// border-radius: 100rpx;
// display: flex;
// align-items: center;
} }
.dot { .dot {
@@ -649,21 +705,22 @@ onBeforeUnmount(() => {
.sensor-body { .sensor-body {
margin-top: 20rpx; margin-top: 20rpx;
} }
.location { .location {
font-size: 24rpx; font-size: 16px;
color: #666; color: #666;
} }
.type-name { .type-name {
font-size: 32rpx; font-size: 16px;
font-weight: bold; font-weight: 600;
margin: 8rpx 0; // margin: 8rpx 0;
} }
.summary { .summary {
font-size: 26rpx; font-size: 14px;
background: #f0f0f0; background: #f0f0f0;
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
border-radius: 100rpx; border-radius: 100rpx;
@@ -673,8 +730,9 @@ onBeforeUnmount(() => {
.socket-actions { .socket-actions {
display: flex; display: flex;
justify-content: space-between;
gap: 16rpx; gap: 16rpx;
margin-top: 20rpx; margin-top: 10px;
} }
.switch-actions { .switch-actions {
@@ -690,13 +748,13 @@ onBeforeUnmount(() => {
.ch-label { .ch-label {
width: 80rpx; width: 80rpx;
font-size: 24rpx; font-size: 12px;
} }
.control-btn { .control-btn {
padding: 12rpx 24rpx; padding: 12rpx 24rpx;
border-radius: 100rpx; border-radius: 100rpx;
font-size: 24rpx; font-size: 12px;
font-weight: bold; font-weight: bold;
border: none; border: none;
} }
@@ -714,11 +772,11 @@ onBeforeUnmount(() => {
.metric-panel { .metric-panel {
background: #f9f9f9; background: #f9f9f9;
border-radius: 20rpx; border-radius: 20rpx;
padding: 20rpx; padding: 10rpx;
} }
.panel-title { .panel-title {
font-size: 26rpx; font-size: 14px;
color: #666; color: #666;
margin-bottom: 16rpx; margin-bottom: 16rpx;
display: block; display: block;
@@ -739,13 +797,13 @@ onBeforeUnmount(() => {
} }
.label { .label {
font-size: 22rpx; font-size: 14px;
color: #666; color: #666;
display: block; display: block;
} }
.value { .value {
font-size: 28rpx; font-size: 14px;
font-weight: bold; font-weight: bold;
color: #088a77; color: #088a77;
margin-top: 4rpx; margin-top: 4rpx;

View File

@@ -1,12 +1,13 @@
<!--点击入库单入库后的入库页面 --> <!--点击入库单入库后的入库页面 -->
<template> <template>
<view class="page"> <navigation title="入库" :back-url="backUrl"></navigation>
<navigation title="入库" :back-url="backUrl"></navigation> <view class="page contentBox">
<!-- 仓库信息 - 仓库存储区 --> <!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" <warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo"
:pathParams="{ ...pathParams, back: 'stockIn' }" /> :pathParams="{ ...pathParams, back: 'stockIn' }" />
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" isEdit="5" :pathParams="pathParams":extendData="{ selectMaterialList }" /> <material-list ref="materialRef" :formData="formData" isEdit="5" :pathParams="pathParams"
:extendData="{ selectMaterialList }" />
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
<view class="bottom"> <view class="bottom">
<uv-button type="primary" @tap="submitForm">入库</uv-button> <uv-button type="primary" @tap="submitForm">入库</uv-button>