|
|
|
|
@ -2,6 +2,11 @@ |
|
|
|
|
<ifrm> |
|
|
|
|
<uni-forms ref="wrForm" class="formBox" label-position="top"> |
|
|
|
|
<uni-forms-item label="扫描模式:" label-width="100px" class="label-left"> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
<text>扫描模式:</text> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<view class="mode-switch"> |
|
|
|
|
<view |
|
|
|
|
class="switch-btn" |
|
|
|
|
@ -20,6 +25,11 @@ |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="物料箱条码:" label-width="100px"> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
<text>物料箱条码:</text> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<view class="bottom-input-row"> |
|
|
|
|
<view class="weight-input-wrapper"> |
|
|
|
|
<view class="input-box"> |
|
|
|
|
@ -64,6 +74,12 @@ |
|
|
|
|
label-width="100px" |
|
|
|
|
v-if="scanMode === 'bind'" |
|
|
|
|
> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
<text class="required-mark">*</text> |
|
|
|
|
<text>起点区域:</text> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<input |
|
|
|
|
type="text" |
|
|
|
|
v-model="startCode" |
|
|
|
|
@ -79,6 +95,12 @@ |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="起点区域:" label-width="100px" v-else> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
<text class="required-mark">*</text> |
|
|
|
|
<text>起点区域:</text> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<picker |
|
|
|
|
mode="selector" |
|
|
|
|
:range="startAreas" |
|
|
|
|
@ -110,6 +132,12 @@ |
|
|
|
|
</picker> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="终点区域:" label-width="150px"> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
<text class="required-mark">*</text> |
|
|
|
|
<text>终点区域:</text> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<picker |
|
|
|
|
mode="selector" |
|
|
|
|
:range="workCenters" |
|
|
|
|
@ -125,6 +153,7 @@ |
|
|
|
|
</view> |
|
|
|
|
</picker> |
|
|
|
|
<picker |
|
|
|
|
v-if="endAreas && endAreas.length > 0" |
|
|
|
|
mode="selector" |
|
|
|
|
:range="endAreas" |
|
|
|
|
range-key="name" |
|
|
|
|
@ -139,6 +168,10 @@ |
|
|
|
|
</text> |
|
|
|
|
</view> |
|
|
|
|
</picker> |
|
|
|
|
<!-- 终点区域选择 - 无数据时显示提示 --> |
|
|
|
|
<view v-else class="empty-tip-picker"> |
|
|
|
|
<text class="empty-text">暂无数据</text> |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</uni-forms> |
|
|
|
|
<view class="footer-action"> |
|
|
|
|
@ -151,33 +184,6 @@ |
|
|
|
|
配送 |
|
|
|
|
</button> |
|
|
|
|
</view> |
|
|
|
|
<view v-if="showDetails" class="popup-overlay" @click="showDetails = false"> |
|
|
|
|
<view class="popup-content" @click.stop> |
|
|
|
|
<view class="popup-header"> |
|
|
|
|
<text class="popup-title">箱 {{ boxData.boxBarcode }} 明细</text> |
|
|
|
|
</view> |
|
|
|
|
<scroll-view class="popup-scroll" scroll-y> |
|
|
|
|
<view class="popup-orders"> |
|
|
|
|
<view |
|
|
|
|
v-for="(order, index) in yieldOrderList" |
|
|
|
|
:key="index" |
|
|
|
|
class="popup-order-item" |
|
|
|
|
> |
|
|
|
|
<view class="popup-order-header"> |
|
|
|
|
<text class="popup-order-no">{{ order.partCode }}</text> |
|
|
|
|
<text class="popup-order-qty">{{ order.actualWeighing }}g</text> |
|
|
|
|
</view> |
|
|
|
|
<text class="popup-order-name">{{ order.partName }}</text> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</scroll-view> |
|
|
|
|
<view class="popup-footer"> |
|
|
|
|
<button @click="showDetails = false" class="popup-close-btn"> |
|
|
|
|
关闭 |
|
|
|
|
</button> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</ifrm> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
@ -221,15 +227,7 @@ export default { |
|
|
|
|
startStationIndex: 0, // 起点站点选中索引 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
endCenterIndex() { |
|
|
|
|
if (!this.endCenter) return 0; |
|
|
|
|
|
|
|
|
|
const index = this.workCenters.find((c) => c.name === this.endCenter); |
|
|
|
|
console.log(9999, this.endCenter, index.id); |
|
|
|
|
return index.id; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
computed: {}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getWorkCenterList(); |
|
|
|
|
}, |
|
|
|
|
@ -238,11 +236,13 @@ export default { |
|
|
|
|
handleStartAreaChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
this.startArea = this.startAreas[index].name; |
|
|
|
|
this.startAreaIndex = this.startAreas[index].id; |
|
|
|
|
this.startAreaIndex = index; |
|
|
|
|
|
|
|
|
|
// 清空起点站点 |
|
|
|
|
this.startStation = ""; |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
// 获取对应站点列表 |
|
|
|
|
|
|
|
|
|
// 获取对应站点列表(从 stationCodeList 读取) |
|
|
|
|
this.getStartStationsList(this.startAreas[index].id); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
@ -250,17 +250,37 @@ export default { |
|
|
|
|
handleStartStationChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
this.startStation = this.startStations[index].name; |
|
|
|
|
this.startStationIndex = this.startStations[index].id; |
|
|
|
|
this.startStationIndex = index; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取起点区域列表 |
|
|
|
|
getStartAreasList() { |
|
|
|
|
this.$u.api.getStartAreas().then((res) => { |
|
|
|
|
this.startAreas = res.data.map((area) => ({ |
|
|
|
|
id: area.id, |
|
|
|
|
name: area.areaName, |
|
|
|
|
})); |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "加载中...", |
|
|
|
|
mask: true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.$u.api |
|
|
|
|
.getStationRegion() |
|
|
|
|
.then((res) => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
|
|
|
|
|
console.log("起点区域列表:", res.data); |
|
|
|
|
|
|
|
|
|
this.startAreas = res.data.map((area) => ({ |
|
|
|
|
id: area.stationRegion, |
|
|
|
|
name: area.stationRegion, |
|
|
|
|
stationCodeList: area.stationCodeList || [], |
|
|
|
|
})); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
console.error("获取区域列表失败:", err); |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "加载区域列表失败", |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取起点站点列表(根据区域 ID) |
|
|
|
|
@ -269,27 +289,78 @@ export default { |
|
|
|
|
this.startStations = []; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.$u.api.getStartStations({ areaId }).then((res) => { |
|
|
|
|
this.startStations = res.data.map((station) => ({ |
|
|
|
|
id: station.id, |
|
|
|
|
name: station.stationName, |
|
|
|
|
|
|
|
|
|
// 从 startAreas 中找到对应区域,获取 stationCodeList |
|
|
|
|
const area = this.startAreas.find((item) => item.id === areaId); |
|
|
|
|
|
|
|
|
|
if (area && area.stationCodeList && area.stationCodeList.length > 0) { |
|
|
|
|
// 将 stationCodeList 转换为 picker 需要的格式 |
|
|
|
|
this.startStations = area.stationCodeList.map((code, index) => ({ |
|
|
|
|
id: code, |
|
|
|
|
name: code, |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
// 默认选中第一个站点 |
|
|
|
|
if (this.startStations.length > 0) { |
|
|
|
|
this.startStation = this.startStations[0].name; |
|
|
|
|
this.startStationIndex = this.startStations[0].id; |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.startStations = []; |
|
|
|
|
this.startStation = ""; |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 作业中心选择变化 |
|
|
|
|
handleEndChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
this.endCenter = this.workCenters[index].name; |
|
|
|
|
this.endCenterIndex = index; |
|
|
|
|
// 清空终点区域,并获取对应区域列表 |
|
|
|
|
const selectedWorkCenter = this.workCenters[index]; |
|
|
|
|
|
|
|
|
|
this.endCenter = selectedWorkCenter.name; |
|
|
|
|
this.endCenterIndex = selectedWorkCenter.id; |
|
|
|
|
|
|
|
|
|
// 清空终点区域 |
|
|
|
|
this.endArea = ""; |
|
|
|
|
this.endAreaIndex = 0; |
|
|
|
|
this.getEndAreaList(this.workCenters[index].id); |
|
|
|
|
|
|
|
|
|
console.log("选中的作业中心:", selectedWorkCenter); |
|
|
|
|
console.log("stationRegionList:", selectedWorkCenter.stationRegionList); |
|
|
|
|
|
|
|
|
|
// 从作业中心获取 stationRegionList 作为区域列表 |
|
|
|
|
if ( |
|
|
|
|
selectedWorkCenter.stationRegionList && |
|
|
|
|
selectedWorkCenter.stationRegionList.length > 0 |
|
|
|
|
) { |
|
|
|
|
// 判断 stationRegionList 是对象数组还是字符串数组 |
|
|
|
|
const firstItem = selectedWorkCenter.stationRegionList[0]; |
|
|
|
|
|
|
|
|
|
if (typeof firstItem === "object") { |
|
|
|
|
// 对象数组 |
|
|
|
|
this.endAreas = selectedWorkCenter.stationRegionList.map( |
|
|
|
|
(region) => ({ |
|
|
|
|
id: region.id, |
|
|
|
|
name: region.regionName || region.name || region.areaName, |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
// 字符串数组 |
|
|
|
|
this.endAreas = selectedWorkCenter.stationRegionList.map( |
|
|
|
|
(region, idx) => ({ |
|
|
|
|
id: idx, |
|
|
|
|
name: region, |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 默认选中第一个区域 |
|
|
|
|
if (this.endAreas.length > 0) { |
|
|
|
|
this.endArea = this.endAreas[0].name; |
|
|
|
|
this.endAreaIndex = this.endAreas[0].id; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.endAreas = []; |
|
|
|
|
console.log("stationRegionList 为空或不存在"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 终点区域选择变化 |
|
|
|
|
@ -355,6 +426,10 @@ export default { |
|
|
|
|
if (mode === "unbind") { |
|
|
|
|
this.getStartAreasList(); |
|
|
|
|
} |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: `已切换到${mode === "bind" ? "送料" : "叫料"}模式`, |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 获取订单明细 |
|
|
|
|
detailsFn() { |
|
|
|
|
@ -411,11 +486,6 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleEndChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
this.endCenter = this.workCenters[index].name; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取作业中心列表 |
|
|
|
|
getWorkCenterList() { |
|
|
|
|
this.$u.api.getWorkCenter().then((res) => { |
|
|
|
|
@ -423,6 +493,7 @@ export default { |
|
|
|
|
this.workCenters = res.data.map((c) => ({ |
|
|
|
|
id: c.id, |
|
|
|
|
name: c.wcName, |
|
|
|
|
stationRegionList: c.stationRegionList, |
|
|
|
|
})); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
@ -880,6 +951,37 @@ export default { |
|
|
|
|
opacity: 0.5; |
|
|
|
|
background-color: #f1f5f9; |
|
|
|
|
} |
|
|
|
|
.uni-input-border { |
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
} |
|
|
|
|
.required-label { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.required-mark { |
|
|
|
|
color: #ff0000; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
font-weight: bold; |
|
|
|
|
margin-right: 4rpx; |
|
|
|
|
} |
|
|
|
|
/* 空数据提示样式 */ |
|
|
|
|
.empty-tip-picker { |
|
|
|
|
width: 100%; |
|
|
|
|
padding: 16rpx; |
|
|
|
|
background-color: #f8fafc; |
|
|
|
|
border: 2rpx solid #e2e8f0; |
|
|
|
|
border-radius: 4rpx; |
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.empty-text { |
|
|
|
|
color: #94a3b8; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
text-align: center; |
|
|
|
|
display: block; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.uni-input-border { |
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
} |
|
|
|
|
|