<template>
|
<view class="page">
|
<view class="finishProductIn-locno-bg" />
|
<u-navbar title="投料列表" :background="background" :border-bottom="false" :title-bold="true" title-color="#000"
|
back-icon-color="#000" />
|
<view class="finishProductIn-locno-search">
|
<u-search v-model="keywords" shape="square" bg-color="rgba(250,252,255,0.36)" :show-action="false"
|
placeholder="可以输入批次号进行投料" @clear="search" @custom="search" @search="search" @input="search" @focus="showRecommendations">
|
</u-search>
|
|
<!-- 模糊查询推荐列表 -->
|
<view v-if="recommendations.length > 0" class="recommendation-list">
|
<view class="recommendation-item" v-for="item in recommendations" :key="item.ifsBatchNo"
|
@click="selectRecommendation(item)">
|
<view class="recommendation-line">
|
<text class="recommendation-label">批号:</text>
|
<text class="recommendation-value">{{ item.ifsBatchNo }}</text>
|
</view>
|
<!-- <view class="recommendation-line">
|
<text class="recommendation-label">零件描述:</text>
|
<text class="recommendation-value">{{ item.partName }}</text>
|
</view>
|
<view class="recommendation-line">
|
<text class="recommendation-label">数量:</text>
|
<text class="recommendation-value">{{ item.suppliedQuantity }}</text>
|
</view> -->
|
</view>
|
</view>
|
</view>
|
<view class="wrap">
|
<scroll-view class="finishProductIn-locno-scroll-list" scroll-y="true">
|
<u-cell-group class="finishProductIn-locno-scroll-list-group" :border="false">
|
<view class="content" v-for="(item, index) in list" :key="item.moNo" :index="index">
|
<view class="content-header">
|
<view class="content-header-title">{{ index + 1 }}</view>
|
</view>
|
<view class="content-body">
|
<view class="row-list">
|
<view class="_label">
|
<view class="_label-icon-1"> </view>
|
<view class="_label-name">批号:</view>
|
</view>
|
<view class="_content">
|
{{ item.ifsBatchNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
<view class="_label-icon-2"> </view>
|
<view class="_label-name">零件描述:</view>
|
</view>
|
<view class="_content">
|
{{ item.partName }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
<view class="_label-icon-3"> </view>
|
<view class="_label-name">数量:</view>
|
</view>
|
<view class="_content">
|
{{ item.suppliedQuantity }}
|
</view>
|
</view>
|
</view>
|
</view>
|
</u-cell-group>
|
</scroll-view>
|
<u-modal v-model="showModal" title="" :show-cancel-button="true" :show-confirm-button="true"
|
@confirm="confirmTl" @cancel="cancelTl">
|
<view class="packing-registration-param">
|
<view class="packing-registration-param-view">
|
<view class="packing-registration-param-item param-extra">
|
<view class="packing-registration-param-item-left">
|
<text class="item-one">批号</text>
|
</view>
|
<view class="packing-registration-param-item-right">
|
<text class="item-one item-two">{{
|
detailedList.ifsBatchNo
|
}}</text>
|
</view>
|
</view>
|
<view class="packing-registration-param-item param-extra">
|
<view class="packing-registration-param-item-left">
|
<text class="item-one">零件描述</text>
|
</view>
|
<view class="packing-registration-param-item-right">
|
<text class="item-one item-two">{{ detailedList.partName }}</text>
|
</view>
|
</view>
|
<view class="packing-registration-param-item param-extra">
|
<view class="packing-registration-param-item-left">
|
<text class="item-one">数量</text>
|
</view>
|
<view class="packing-registration-param-item-right">
|
<u-input class="item-one item-two" v-model="detailedList.suppliedQuantity" />
|
</view>
|
</view>
|
</view>
|
</view>
|
</u-modal>
|
</view>
|
<view class="finishProductIn-locno-search">
|
<u-button type="primary" class="bottom-button" @click="selectNo">提交</u-button>
|
</view>
|
</view>
|
</template>
|
<script>
|
import content_bg from "@/static/custom/finishProductIn/locNoBg.png";
|
export default {
|
data() {
|
return {
|
background: {
|
backgroundImage: `url(${content_bg})`,
|
backgroundAttachment: "fixed",
|
backgroundSize: "100% auto",
|
backgroundRepeat: "no-repeat",
|
},
|
keywords: "",
|
list: [],
|
detailedList: {},
|
showModal: false,
|
ifsBatchNo: [],
|
productInputList: [],
|
recommendations: [], // 推荐列表数据
|
moOn: "",
|
workstationId: "",
|
};
|
},
|
onLoad() {
|
// this.getlist();
|
},
|
onShow() {
|
let that = this;
|
uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器
|
uni.$on("scan", function(data) {
|
//扫码成功后的回调,你可以写自己的逻辑代码在这里
|
if (data.code) {
|
let codeInfo = JSON.parse(data.code);
|
if (codeInfo) {
|
that.codeInfoId = codeInfo.id;
|
// 扫描报工单二维码
|
that.saveForm(codeInfo);
|
}
|
}
|
});
|
},
|
onLoad(option) {
|
console.log(option.moOn); // 输出: value1
|
this.moOn = option.moOn;
|
this.workstationId = option.workstationId;
|
},
|
methods: {
|
// 显示推荐列表
|
showRecommendations() {
|
// 当输入框获得焦点且为空时,显示默认推荐
|
// if (!this.keywords.trim()) {
|
// this.loadDefaultRecommendations();
|
// }
|
},
|
|
// // 加载默认推荐
|
// loadDefaultRecommendations() {
|
// // 调用API获取默认推荐数据
|
// this.$u.api.cancelReporting
|
// .fuzzyQuery()
|
// .then((res) => {
|
// console.log('默认推荐结果:', res.data);
|
// this.recommendations = res.data || [];
|
// })
|
// .catch((err) => {
|
// console.error('获取默认推荐失败:', err);
|
// this.recommendations = [];
|
// });
|
// },
|
|
// 选择推荐项
|
selectRecommendation(item) {
|
console.log('选择推荐项:', item);
|
console.log('选择推荐项:', this.moOn);
|
this.$u.api.cancelReporting
|
.selInputPartInfoPDA({
|
outBatchNo: item.ifsBatchNo,
|
partNo: item.partNo,
|
moOn: this.moOn,
|
})
|
.then((res) => {
|
const list = {
|
suppliedQuantity: res.data.suppliedQuantity,
|
ifsBatchNo: res.data.ifsBatchNo,
|
partNo: res.data.partNo,
|
partName: res.data.partName,
|
locationNo: res.data.locationNo,
|
ifsLineItemNo: res.data.ifsLineItemNo,
|
serialNo: res.data.serialNo,
|
engChgLevel: res.data.engChgLevel,
|
ifsWdr: res.data.waivDevRejNo,
|
activitySeq: res.data.activitySeq,
|
};
|
this.detailedList = list;
|
this.showModal = true;
|
// 清空输入框和推荐列表
|
this.keywords = '';
|
this.recommendations = [];
|
});
|
// this.detailedList = item;
|
// this.detailedList.suppliedQuantity = item.availableStockQuantity;
|
// this.showModal = true;
|
// // 清空输入框和推荐列表
|
// this.keywords = '';
|
// this.recommendations = [];
|
},
|
|
updateArray(arr, newObj) {
|
// 查找数组中是否有相同的 id
|
let index = arr.findIndex(item => item.ifsBatchNo === newObj.ifsBatchNo);
|
|
if (index !== -1) {
|
// 如果找到相同 id 的对象,替换原有对象
|
arr[index] = newObj;
|
} else {
|
// 如果没有找到相同 id 的对象,直接推入新对象
|
arr.push(newObj);
|
}
|
return arr;
|
},
|
confirmTl() {
|
let updatedArrayList = this.updateArray(this.list, this.detailedList);
|
this.list =updatedArrayList;
|
this.showModal = false;
|
this.detailedList = {};
|
},
|
cancelTl() {
|
this.showModal = false;
|
this.detailedList = {};
|
},
|
search(value) {
|
if (value) {
|
this.$u.api.cancelReporting
|
.getStockNoPageByWorkstationId({
|
ifsBatchNo: value,
|
workstationId: this.workstationId,
|
})
|
.then((res) => {
|
console.log('模糊查询结果:', res.data);
|
// 如果返回的是数组,则作为推荐列表
|
if (Array.isArray(res.data)) {
|
this.recommendations = res.data;
|
// 如果只有一个结果,直接选中
|
if (res.data.length === 1) {
|
this.selectRecommendation(res.data[0]);
|
}
|
} else {
|
// 如果返回的是单个对象,添加到推荐列表
|
this.recommendations = [res.data];
|
// this.selectRecommendation(res.data);
|
}
|
});
|
} else {
|
// 清空推荐列表
|
this.recommendations = [];
|
}
|
},
|
// 回显扫码的信息-报工单
|
saveForm(val) {
|
this.$u.api.cancelReporting
|
.selInputPartInfoPDA({
|
outBatchNo: val.BN,
|
partNo: val.PN,
|
moOn: this.moOn,
|
})
|
.then((res) => {
|
const list = {
|
suppliedQuantity: res.data.suppliedQuantity,
|
ifsBatchNo: res.data.ifsBatchNo,
|
partNo: res.data.partNo,
|
partName: res.data.partName,
|
locationNo: res.data.locationNo,
|
ifsLineItemNo: res.data.ifsLineItemNo,
|
serialNo: res.data.serialNo,
|
engChgLevel: res.data.engChgLevel,
|
ifsWdr: res.data.waivDevRejNo,
|
activitySeq: res.data.activitySeq,
|
};
|
this.detailedList = list;
|
this.showModal = true;
|
});
|
},
|
selectNo() {
|
this.refreshLastPage(this.list);
|
},
|
|
//刷新上一个页面
|
refreshLastPage(no) {
|
// 告知 A.vue 更新数据
|
// 获取页面栈
|
let pages = getCurrentPages();
|
|
// 获取上一页栈
|
let prevPage = pages[pages.length - 2];
|
|
// 触发上一页 upData 函数(并携带参数)
|
prevPage.$vm.setFeedInputProductionVolume(no);
|
|
// 返回上一页
|
uni.navigateBack({
|
delta: 1,
|
});
|
},
|
},
|
};
|
</script>
|
<style lang="scss">
|
.packing-registration-param {
|
padding: 40rpx 30rpx 10rpx 30rpx;
|
height: 350px;
|
overflow: hidden;
|
|
.packing-registration-param-title {
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
margin-bottom: 30rpx;
|
|
.title-label {
|
margin-left: 14rpx;
|
font-size: 34rpx;
|
font-weight: bold;
|
color: #283e65;
|
}
|
}
|
|
.packing-registration-param-view {
|
height: 177rpx;
|
background-color: #fff;
|
border-radius: 10rpx;
|
padding: 0rpx 23rpx;
|
margin-bottom: 30rpx;
|
|
.packing-registration-param-item {
|
height: 90rpx;
|
border: 1px solid #adc8e4;
|
line-height: 90rpx;
|
display: flex;
|
justify-content: space-between;
|
border: none;
|
|
.packing-registration-param-item-left {
|
.item-one {
|
word-break: break-all;
|
font-size: small;
|
color: #060505;
|
}
|
}
|
|
.packing-registration-param-item-right {
|
display: flex;
|
justify-content: space-between;
|
|
.item-one {
|
font-size: small;
|
color: #060505;
|
margin-right: 6rpx;
|
word-break: break-all;
|
}
|
|
.item-two {
|
font-size: small;
|
color: #060505;
|
margin-right: 6rpx;
|
}
|
|
.item-three {
|
font-size: 30rpx;
|
color: #214ded;
|
margin-right: 6rpx;
|
}
|
}
|
}
|
|
.param-extra {
|
border-bottom: 1px solid #ededed;
|
}
|
}
|
}
|
.finishProductIn-locno-bg {
|
background-color: #f6f9ff;
|
background-image: url("~@/static/custom/finishProductIn/locNoBg.png");
|
// background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0));
|
padding: 0 20rpx;
|
background-attachment: fixed;
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
position: fixed;
|
top: 0;
|
bottom: 0;
|
width: 100%;
|
z-index: -1;
|
}
|
|
/* 推荐列表样式 */
|
.recommendation-list {
|
margin: 10rpx 30rpx;
|
background-color: #ffffff;
|
border-radius: 10rpx;
|
padding: 10rpx;
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
z-index: 999;
|
position: relative;
|
}
|
|
.recommendation-item {
|
padding: 20rpx;
|
margin-bottom: 10rpx;
|
background-color: #f5f9ff;
|
border-radius: 8rpx;
|
cursor: pointer;
|
transition: background-color 0.3s;
|
}
|
|
.recommendation-item:hover {
|
background-color: #e6f0ff;
|
}
|
|
.recommendation-line {
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 8rpx;
|
}
|
|
.recommendation-label {
|
font-size: 28rpx;
|
color: #666666;
|
}
|
|
.recommendation-value {
|
font-size: 28rpx;
|
color: #333333;
|
text-align: right;
|
}
|
|
.finishProductIn-locno-search {
|
padding: 40rpx 30rpx 20rpx 30rpx;
|
}
|
|
.wrap .finishProductIn-locno-scroll-list {
|
height: calc(100vh - var(--window-top) - var(--window-bottom) - 242rpx);
|
width: 100%;
|
}
|
|
.finishProductIn-locno-scroll-list-group {
|
::v-deep .u-cell-item-box {
|
background-color: rgba(250, 252, 255, 0.36) !important;
|
padding: 0rpx 30rpx;
|
}
|
|
.content {
|
font-size: 12px;
|
background-color: #ffffff;
|
box-sizing: border-box;
|
border-radius: 10rpx;
|
margin: 0rpx 0rpx 16rpx;
|
padding: 20rpx 8rpx;
|
box-shadow: none;
|
display: flex;
|
align-items: center;
|
|
white-space: normal;
|
|
.content-header {
|
width: 40rpx;
|
height: 90rpx;
|
display: flex;
|
align-items: center;
|
overflow-wrap: break-word;
|
|
.content-header-icon {
|
background-image: url("~@/static/custom/moveWareHouse/header_icon.png");
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height: 28rpx;
|
width: 28rpx;
|
}
|
|
.content-header-title {
|
width: 40rpx;
|
// margin-left: 11rpx;
|
font-size: 26rpx;
|
color: #333333;
|
}
|
}
|
|
.content-body {
|
flex: 1;
|
background: #f5f9ff;
|
border-radius: 10rpx;
|
padding: 0rpx 23rpx;
|
|
.row-list {
|
height: 60rpx;
|
display: flex;
|
flex-direction: row;
|
padding: 0px;
|
align-items: center;
|
}
|
|
.row-list ._label {
|
display: flex;
|
flex: 0.8;
|
color: #909399;
|
align-items: center;
|
|
._label-icon-1 {
|
background-image: url("~@/static/custom/moveWareHouse/label-icon-1.png");
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height: 26rpx;
|
width: 26rpx;
|
}
|
|
._label-icon-2 {
|
background-image: url("~@/static/custom/moveWareHouse/label-icon-2.png");
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height: 26rpx;
|
width: 26rpx;
|
}
|
|
._label-icon-3 {
|
background-image: url("~@/static/custom/moveWareHouse/label-icon-3.png");
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height: 26rpx;
|
width: 26rpx;
|
}
|
|
._label-name {
|
margin-left: 11rpx;
|
font-size: small;
|
font-weight: 500;
|
color: #666666;
|
}
|
}
|
|
.row-list ._content {
|
flex: 1.5;
|
text-align: right;
|
color: #909399;
|
font-size: small;
|
}
|
|
.row-list .s1 {
|
color: #d35651;
|
}
|
}
|
}
|
}
|
</style>
|