添加牌位-快捷绑定牌位信息

This commit is contained in:
WindowBird 2025-10-17 10:26:33 +08:00
parent 153631ffe0
commit fd1e851daf

View File

@ -84,10 +84,42 @@
</view>
</view>
<!-- 列表渲染 -->
<view v-for="(item, index) in winB_List" :key="index">
<view>{{ item.mac }}</view>
<view>{{ item.sn }}</view>
<!-- 未绑定设备列表 -->
<view class="device-list-section">
<view class="section-title">
<text>未绑定牌位的设备列表</text>
<view v-if="winB_Pagination.total" class="count-badge">
{{ winB_Pagination.total }}
</view>
</view>
<!-- 空状态 -->
<view v-if="winB_List.length === 0" class="empty-state">
<view class="empty-icon">📱</view>
<view class="empty-text">暂无未绑定设备</view>
<view class="empty-tip">请先扫码添加设备</view>
</view>
<!-- 设备列表 -->
<view v-else class="device-list">
<view
v-for="(item, index) in winB_List"
:key="index"
class="device-item"
@click="selectDevice(item)"
>
<view class="device-header">
<view class="device-sn">SN:{{ item.sn || "未知SN" }}</view>
<view class="select-hint">点击选择</view>
</view>
<view class="device-sn">MAC:{{ item.mac || "未知MAC" }}</view>
<view v-if="item.code" class="device-sn"
>MAC:{{ item.code || "未知code" }}
</view>
</view>
</view>
</view>
</view>
@ -111,7 +143,7 @@ export default {
createPagination({
fetchData: getMemorialList,
mode: "loadMore", // "pager"
pageSize: 5,
pageSize: 2,
autoLoad: false, // false
}),
],
@ -464,6 +496,37 @@ export default {
return true;
},
//
selectDevice(item) {
console.log("选择设备:", item);
//
this.deviceInfo = {
sn: item.sn || "",
mac: item.mac || "",
code: item.code || "",
id: item.id || "",
};
//
if (item.code) {
this.formData.code = item.code;
}
//
uni.showToast({
title: "设备信息已填充",
icon: "success",
duration: 1500,
});
//
uni.pageScrollTo({
scrollTop: 0,
duration: 300,
});
},
},
};
</script>
@ -487,6 +550,20 @@ export default {
margin-bottom: 20rpx;
padding-left: 10rpx;
border-left: 6rpx solid #4a90e2;
display: flex;
align-items: center;
justify-content: space-between;
}
.count-badge {
background: #4a90e2;
color: #fff;
font-size: 20rpx;
padding: 4rpx 12rpx;
border-radius: 20rpx;
min-width: 32rpx;
text-align: center;
line-height: 1.2;
}
.scan-section {
@ -502,11 +579,12 @@ export default {
}
.scan-btn {
padding: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 200rpx;
//height: 200rpx;
border: 3rpx dashed #4a90e2;
border-radius: 16rpx;
background: #f8fbff;
@ -703,4 +781,154 @@ export default {
}
}
}
//
.device-list-section {
background: #fff;
border-radius: 16rpx;
padding: 30rpx;
margin: 30rpx 0;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}
.empty-state {
text-align: center;
padding: 60rpx 20rpx;
color: #999;
}
.empty-icon {
font-size: 80rpx;
margin-bottom: 20rpx;
}
.empty-text {
font-size: 28rpx;
color: #666;
margin-bottom: 10rpx;
}
.empty-tip {
font-size: 24rpx;
color: #999;
}
.device-list {
//
}
.device-item {
background: #f8f9fa;
border: 2rpx solid #e9ecef;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 20rpx;
transition: all 0.3s ease;
cursor: pointer;
&:last-child {
margin-bottom: 0;
}
&:hover {
border-color: #4a90e2;
background: #f0f7ff;
transform: translateY(-2rpx);
box-shadow: 0 6rpx 20rpx rgba(74, 144, 226, 0.15);
}
&:active {
transform: translateY(0);
box-shadow: 0 2rpx 8rpx rgba(74, 144, 226, 0.2);
}
}
.device-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
}
.device-sn {
font-size: 28rpx;
font-weight: bold;
color: #333;
background: #e3f2fd;
padding: 6rpx 12rpx;
border-radius: 6rpx;
border-left: 4rpx solid #4a90e2;
}
.select-hint {
font-size: 22rpx;
color: #4a90e2;
background: #e8f4ff;
padding: 4rpx 8rpx;
border-radius: 4rpx;
}
.device-info {
margin-bottom: 15rpx;
}
.info-row {
display: flex;
align-items: center;
margin-bottom: 8rpx;
&:last-child {
margin-bottom: 0;
}
}
.info-label {
font-size: 24rpx;
color: #666;
width: 120rpx;
flex-shrink: 0;
}
.info-value {
font-size: 24rpx;
color: #333;
font-weight: 500;
flex: 1;
background: #fff;
padding: 4rpx 8rpx;
border-radius: 4rpx;
border-left: 3rpx solid #4a90e2;
word-break: break-all;
}
.device-actions {
display: flex;
justify-content: flex-end;
}
.action-btn {
padding: 8rpx 16rpx;
border-radius: 6rpx;
font-size: 24rpx;
transition: all 0.3s ease;
}
.select-btn {
background: #4a90e2;
color: #fff;
&:hover {
background: #357abd;
transform: scale(1.05);
}
&:active {
transform: scale(0.95);
}
}
.btn-text {
font-size: 24rpx;
font-weight: 500;
}
</style>