编码设备新购无法入库问题修复

This commit is contained in:
BianLzhaoMin 2024-08-12 11:30:43 +08:00
parent b1a77db6b9
commit aa91beb649
1 changed files with 575 additions and 525 deletions

View File

@ -1,22 +1,48 @@
<template> <template>
<view> <view>
<view class="dataInfo"> <view class="dataInfo">
<view class="dataList" v-for="(item,index) in list" :key="index"> <view class="dataList" v-for="(item, index) in list" :key="index">
<view class="info-upper"> <view class="info-upper">
<checkbox-group <checkbox-group
@change="checkClick(item)" @change="checkClick(item)"
style="margin-right: 15rpx;" style="margin-right: 15rpx"
v-show="item.status == '0'" v-show="item.status == '0'">
>
<checkbox :checked="item.checked" /> <checkbox :checked="item.checked" />
</checkbox-group> </checkbox-group>
<view class="details"> <view class="details">
<view class="text"> <view class="text">
<text><span style="padding-right: 20rpx; color: #a6a6a6;">类型名称</span>{{item.typeName}}</text> <text
<text><span style="padding-right: 20rpx; color: #a6a6a6;">规格型号</span>{{item.specificationType}}</text> ><span
<text><span style="padding-right: 20rpx; color: #a6a6a6;">待入库数量</span>{{item.checkNum}}</text> style="padding-right: 20rpx; color: #a6a6a6"
<text><span style="padding-right: 20rpx; color: #a6a6a6;">机具编号</span>{{item.maCode == null ? '无' : item.maCode}}</text> >类型名称</span
<text><span style="padding-right: 20rpx; color: #a6a6a6;">机具状态</span>{{item.CNstatus}}</text> >{{ item.typeName }}</text
>
<text
><span
style="padding-right: 20rpx; color: #a6a6a6"
>规格型号</span
>{{ item.specificationType }}</text
>
<text
><span
style="padding-right: 20rpx; color: #a6a6a6"
>待入库数量</span
>{{ item.checkNum }}</text
>
<text
><span
style="padding-right: 20rpx; color: #a6a6a6"
>机具编号</span
>{{
item.maCode == null ? "无" : item.maCode
}}</text
>
<text
><span
style="padding-right: 20rpx; color: #a6a6a6"
>机具状态</span
>{{ item.CNstatus }}</text
>
</view> </view>
</view> </view>
</view> </view>
@ -38,16 +64,14 @@
</view> </view>
</view> </view>
<!-- <button @click="delCart">删除</button> --> <!-- <button @click="delCart">删除</button> -->
<view <view class="buy">
class="buy"
>
<view class="checked"> <view class="checked">
<checkbox-group @tap="checkAll"> <checkbox-group @tap="checkAll">
<checkbox :checked="allChecked" /> <checkbox :checked="allChecked" />
</checkbox-group> </checkbox-group>
<text>全选</text> <text>全选</text>
</view> </view>
<view style="display: flex;"> <view style="display: flex">
<!-- <view class="total" style="margin-right: 15rpx;"> <!-- <view class="total" style="margin-right: 15rpx;">
<view class="bill" @click="bindCode"> <view class="bill" @click="bindCode">
<text>绑定</text> <text>绑定</text>
@ -59,24 +83,26 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<uni-popup <uni-popup ref="popup" type="center" :mask-click="false">
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup"> <view class="popup">
<view class="pop-top"> <view class="pop-top">
<h4>审批</h4> <h4>审批</h4>
<uni-icons <uni-icons
style="color: #AAAAAA; font-weight: bold;" style="color: #aaaaaa; font-weight: bold"
type="closeempty" type="closeempty"
@click="closePopup" @click="closePopup">
>
</uni-icons> </uni-icons>
</view> </view>
<h4 style="width: 85%; margin: 2vh auto; font-weight: normal; text-align: center;">是否通过审批</h4> <h4
style="
width: 85%;
margin: 2vh auto;
font-weight: normal;
text-align: center;
">
是否通过审批
</h4>
<view class="select-area"> <view class="select-area">
<view @click="modalConfirm">通过</view> <view @click="modalConfirm">通过</view>
<view @click="modalReject">驳回</view> <view @click="modalReject">驳回</view>
@ -97,6 +123,10 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<u-loading-page
:loading="showLoading"
color="#000"
loading-text="提交中,请稍后..."></u-loading-page>
</view> </view>
</template> </template>
<script> <script>
@ -106,111 +136,124 @@
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
pageTotal: 0, pageTotal: 0,
taskId: '', showLoading: false,
taskId: "",
allChecked: false, allChecked: false,
inputs: "", inputs: "",
list: [ list: [],
totalFine: "",
],
totalFine: '',
totalGoods: [], totalGoods: [],
scanType: '', scanType: "",
scanRange: [ scanRange: [
{ text: '二维码', value: '1' }, { text: "二维码", value: "1" },
{ text: 'RFID', value: '2' } { text: "RFID", value: "2" },
], ],
subObj: '', subObj: "",
codeList: [] codeList: [],
} };
}, },
methods: { methods: {
// //
checkClick(item) { checkClick(item) {
item.checked = !item.checked item.checked = !item.checked;
if (!item.checked) { if (!item.checked) {
this.allChecked = false this.allChecked = false;
} else { } else {
// //
const goods = this.list.every(item => { const goods = this.list.every((item) => {
return item.checked === true return item.checked === true;
}) });
if (goods) { if (goods) {
this.allChecked = true this.allChecked = true;
} else { } else {
this.allChecked = false this.allChecked = false;
} }
} }
}, },
// //
checkAll() { checkAll() {
this.allChecked = !this.allChecked this.allChecked = !this.allChecked;
console.log(this.list); console.log(this.list, "全选审核----");
if (this.allChecked) { if (this.allChecked) {
this.list.map(item => { this.list.map((item) => {
if (item.status == '0') { if (item.status == "0") {
item.checked = true item.checked = true;
} }
}) });
} else { } else {
this.list.map(item => { this.list.map((item) => {
if (item.status == '0') { if (item.status == "0") {
item.checked = false item.checked = false;
} }
});
}
},
modalConfirm() {
this.subObj = {
taskId: this.taskId,
checkResult: "1",
inputRecordList: this.totalGoods,
};
console.log(this.subObj);
this.subNewBuy(this.subObj);
},
modalReject() {
this.subObj = {
taskId: this.taskId,
checkResult: "2",
inputRecordList: this.totalGoods,
};
console.log(this.subObj);
this.subNewBuy(this.subObj);
},
finishCart() {
let that = this;
that.totalGoods = that.list
.filter((item) => {
return item.checked == true;
}) })
} .map((subItem) => {
},
modalConfirm () {
this.subObj = {
taskId: this.taskId,
checkResult: '1',
inputRecordList: this.totalGoods
}
console.log(this.subObj)
this.subNewBuy(this.subObj)
},
modalReject () {
this.subObj = {
taskId: this.taskId,
checkResult: '2',
inputRecordList: this.totalGoods
}
console.log(this.subObj)
this.subNewBuy(this.subObj)
},
finishCart () {
let that = this
that.totalGoods = that.list.filter(item => {
return item.checked == true
}).map(subItem => {
return { return {
typeId: subItem['typeId'], typeId: subItem["typeId"],
maId: subItem['maId'], maId: subItem["maId"],
maCode: subItem['maCode'], maCode: subItem["maCode"],
inputNum: subItem['checkNum'], inputNum: subItem["checkNum"],
companyId: subItem['companyId'], companyId: subItem["companyId"],
manageType: subItem['manageType'] manageType: subItem["manageType"],
} };
}) });
if (that.totalGoods.length == 0) { if (that.totalGoods.length == 0) {
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: '未选中审核项!' title: "未选中审核项!",
}) });
} else { } else {
const ifManage = that.totalGoods.every(item => item.manageType != 0) const ifManage = that.totalGoods.every(
(item) => item.manageType != 0
);
console.log(ifManage); console.log(ifManage);
if (ifManage) { if (ifManage) {
that.openPopup() that.openPopup();
} else { } else {
console.log(that.totalGoods); console.log(that.totalGoods);
const ifCoded = that.totalGoods.every(item => item.maCode != null)
if (ifCoded) { // const ifCoded = that.totalGoods.every(
that.openPopup() // (item) => item.maCode != null
// );
let ifCoded = false;
that.totalGoods.forEach((e) => {
if (e.manageType == 0 && !e.maCode) {
ifCoded = true;
}
});
if (!ifCoded) {
that.openPopup();
} else { } else {
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: '选中项中存在未编码的机具,无法审核!' title: "选中项中存在未编码的机具,无法审核!",
}) });
} }
} }
/* uni.showModal({ /* uni.showModal({
@ -242,121 +285,134 @@
}) */ }) */
} }
}, },
bindCode () { bindCode() {
let that = this let that = this;
that.codeList = that.list.filter(item => { that.codeList = that.list.filter((item) => {
return item.checked == true return item.checked == true;
}) });
if (that.codeList.length > 1 || that.codeList.length == 0) { if (that.codeList.length > 1 || that.codeList.length == 0) {
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: '一次只可选择一种机具进行绑定!' title: "一次只可选择一种机具进行绑定!",
}) });
} else { } else {
console.log(that.codeList); console.log(that.codeList);
} }
}, },
openPopup () { openPopup() {
this.$refs.popup.open() this.$refs.popup.open();
}, },
closePopup () { closePopup() {
this.$refs.popup.close() this.$refs.popup.close();
}, },
scanChange (e) { scanChange(e) {
let that = this let that = this;
console.log(e); console.log(e);
if (e.detail.value == '1') { if (e.detail.value == "1") {
that.closePopup() that.closePopup();
that.scanType = '' that.scanType = "";
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
console.log(res); console.log(res);
uni.navigateTo({ uni.navigateTo({
url: `/pages/newInAfterScan/newInAfterScan?result=${res.result}` url: `/pages/newInAfterScan/newInAfterScan?result=${res.result}`,
}) });
} },
}) });
} else { } else {
console.log('id'); console.log("id");
} }
}, },
subNewBuy (obj) { subNewBuy(obj) {
let that = this let that = this;
that.$api.newInStore.subNewBuy(obj).then(res => { that.showLoading = true;
that.$api.newInStore
.subNewBuy(obj)
.then((res) => {
console.log(res); console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {
that.showLoading = false;
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg, title: res.data.msg,
success: () => { success: () => {
that.closePopup() that.closePopup();
uni.navigateBack() uni.navigateBack();
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
}, },
fetchNewList () { });
let that = this } else {
that.showLoading = false;
uni.showToast({
icon: "none",
title: res.data.msg,
});
setTimeout(() => {
uni.navigateBack();
}, 500);
}
})
.catch((err) => {
console.log(err);
});
},
fetchNewList() {
let that = this;
// //
that.$api.newInStore.fetchNewBuyDetail({ that.$api.newInStore
.fetchNewBuyDetail({
pageNum: that.pageNum, pageNum: that.pageNum,
pageSize: that.pageSize, pageSize: that.pageSize,
taskId: that.taskId taskId: that.taskId,
}).then(res => { })
.then((res) => {
console.log(res); console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {
that.pageTotal = res.data.total that.pageTotal = res.data.total;
res.data.rows.forEach(item => { res.data.rows.forEach((item) => {
if (item.status == '0') item.checked = false if (item.status == "0") item.checked = false;
switch (item.status) { switch (item.status) {
case '1': case "1":
item.CNstatus = '已入库' item.CNstatus = "已入库";
break; break;
case '2': case "2":
item.CNstatus = '入库驳回' item.CNstatus = "入库驳回";
break; break;
case '0': case "0":
item.CNstatus = '待审核' item.CNstatus = "待审核";
break; break;
} }
}) });
that.list = [...that.list, ...res.data.rows] that.list = [...that.list, ...res.data.rows];
} else { } else {
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg title: res.data.msg,
}) });
} }
}).catch(err => { })
.catch((err) => {
console.log(err); console.log(err);
}) });
} },
}, },
onLoad(params) { onLoad(params) {
let that = this let that = this;
console.log(params.taskId); console.log(params.taskId);
that.taskId = params.taskId that.taskId = params.taskId;
that.fetchNewList() that.list = [];
that.fetchNewList();
}, },
onReachBottom() { onReachBottom() {
if (this.list.length >= this.pageTotal) return; if (this.list.length >= this.pageTotal) return;
this.pageNum++ this.pageNum++;
this.fetchNewList() this.fetchNewList();
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
body{ body {
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 25%; padding-bottom: 25%;
} }
@ -368,7 +424,7 @@
/deep/uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked { /deep/uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
border-color: #ddd; border-color: #ddd;
color: #fff !important; color: #fff !important;
background-color: #2DCF8C !important; background-color: #2dcf8c !important;
} }
/deep/uni-checkbox .uni-checkbox-input { /deep/uni-checkbox .uni-checkbox-input {
@ -407,31 +463,27 @@
height: 34rpx; height: 34rpx;
} }
.dataInfo { .dataInfo {
width: 95%; width: 95%;
margin: 0 auto; margin: 0 auto;
} }
.dataInfo .dataList { .dataInfo .dataList {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
border-bottom: 2px solid #F1F1F1; border-bottom: 2px solid #f1f1f1;
padding: 10rpx 0; padding: 10rpx 0;
} }
.info-upper{ .info-upper {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.lower-btns{ .lower-btns {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx; padding: 20rpx;
@ -440,7 +492,7 @@
align-items: center; align-items: center;
} }
.lower-btns>view{ .lower-btns > view {
box-sizing: border-box; box-sizing: border-box;
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
border-radius: 15rpx; border-radius: 15rpx;
@ -477,7 +529,7 @@
.dataInfo .dataList .action text { .dataInfo .dataList .action text {
font-size: 25rpx; font-size: 25rpx;
color: #000; color: #000;
border: 1px solid #C8C7CC; border: 1px solid #c8c7cc;
display: inline-block; display: inline-block;
line-height: 50rpx; line-height: 50rpx;
width: 60rpx; width: 60rpx;
@ -521,12 +573,11 @@
.buy .total .price { .buy .total .price {
padding-right: 20rpx; padding-right: 20rpx;
} }
.buy .total .price text { .buy .total .price text {
font-size: 27rpx; font-size: 27rpx;
color: #C8C7CC; color: #c8c7cc;
display: inline-block; display: inline-block;
} }
@ -545,16 +596,16 @@
text-align: center; text-align: center;
} }
.popup{ .popup {
width: 80vw; width: 80vw;
height: 20vh; height: 20vh;
background-color: #fff; background-color: #fff;
border-radius: 15rpx; border-radius: 15rpx;
overflow: hidden; overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff); background: linear-gradient(#d9e7fe, #fff, #fff, #fff);
} }
.popup>.pop-top{ .popup > .pop-top {
width: 100%; width: 100%;
height: 5vh; height: 5vh;
box-sizing: border-box; box-sizing: border-box;
@ -564,7 +615,7 @@
align-items: center; align-items: center;
} }
.popup>.select-area{ .popup > .select-area {
width: 85%; width: 85%;
margin: 40rpx auto; margin: 40rpx auto;
display: flex; display: flex;
@ -572,13 +623,12 @@
align-items: center; align-items: center;
} }
.popup>.select-area>view{ .popup > .select-area > view {
box-sizing: border-box; box-sizing: border-box;
font-size: 30rpx; font-size: 30rpx;
padding: 12rpx 24rpx; padding: 12rpx 24rpx;
background-color: #3788FF; background-color: #3788ff;
color: #fff; color: #fff;
border-radius: 20rpx; border-radius: 20rpx;
} }
</style> </style>