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

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