SmartStorage/pages/scanReceive/scanReceive.vue

240 lines
5.0 KiB
Vue
Raw Normal View History

2023-12-23 23:21:42 +08:00
<template>
<view>
2023-12-24 16:28:36 +08:00
<view class="info-area" v-for="(item, index) in infoList" :key="index" v-show="infoList.length != 0">
2023-12-23 23:21:42 +08:00
<view>
2023-12-24 16:28:36 +08:00
<h4>类型名称</h4>
<span>{{ item.typeName }}</span>
2023-12-23 23:21:42 +08:00
</view>
<view>
2023-12-24 16:28:36 +08:00
<h4>规格型号</h4>
<span>{{ item.typeCode }}</span>
2023-12-23 23:21:42 +08:00
</view>
<view>
2023-12-24 16:28:36 +08:00
<h4>设备编码</h4>
<span>{{ item.maCode }}</span>
</view>
<view>
<h4>设备状态</h4>
<span>{{ item.sdStatus }}</span>
2023-12-23 23:21:42 +08:00
</view>
<!-- <view>
<h4>设备状态</h4>
<span>{{ item.maStatusName }}</span>
</view>
<view>
<h4>机具编码</h4>
<span>{{ item.maCode }}</span>
</view>
<view>
<h4>出库数量</h4>
<span>1</span>
</view> -->
</view>
2024-06-19 15:29:22 +08:00
<view style="width: 90%; margin: 15rpx auto;" v-show="infoList.length != 0">
2024-03-13 17:55:34 +08:00
<uni-data-checkbox v-model="fixVal" :localdata="fixRange"></uni-data-checkbox>
</view>
2023-12-24 16:28:36 +08:00
<view class="sub-btn" v-show="infoList.length != 0" @click="outStore">
2023-12-23 23:21:42 +08:00
接收
</view>
</view>
</template>
<script>
export default {
data() {
return {
typeId: '',
num: '',
parentId: '',
infoList: '',
fixVal: '',
2023-12-24 16:28:36 +08:00
fixRange: [{
text: '合格',
value: '1'
},
{
text: '待修',
value: '2'
},
{
text: '待报废',
value: '3'
}
],
initData: {}
2023-12-23 23:21:42 +08:00
}
},
methods: {
2023-12-24 16:28:36 +08:00
outStore() {
2023-12-23 23:21:42 +08:00
let that = this
2024-06-19 15:29:22 +08:00
console.log(this.infoList);
2024-03-13 17:55:34 +08:00
console.log(this.infoList[0].typeId, this.typeId);
2023-12-24 16:28:36 +08:00
if (!this.fixVal) {
2023-12-23 23:21:42 +08:00
uni.showToast({
icon: 'none',
2023-12-24 16:28:36 +08:00
title: "请选择一种接收状态",
2023-12-23 23:21:42 +08:00
})
2023-12-24 16:28:36 +08:00
return
}
2024-03-13 17:55:34 +08:00
if (this.infoList[0].typeId != this.typeId) {
uni.showToast({
icon: 'none',
2024-04-28 16:54:53 +08:00
title: '机具类型不匹配!'
2024-03-13 17:55:34 +08:00
})
2024-04-20 17:39:08 +08:00
} else if (this.infoList[0].sdId != '16') {
uni.showToast({
icon: 'none',
title: '该机具状态不是在用,无法接受退料!'
})
2024-03-13 17:55:34 +08:00
} else {
const arrList = [{
"parentId": this.initData.parentId,
"typeId": this.initData.typeId,
"backNum": "1",
"backStatus": this.fixVal,
"manageType": this.initData.manageType,
"createBy": this.initData.createBy,
"maId": that.infoList[0].maId
}]
const params = {
taskId: this.initData.taskId,
arr: arrList
2023-12-23 23:21:42 +08:00
}
2024-04-20 17:39:08 +08:00
console.log(params);
2024-03-13 17:55:34 +08:00
// 提交编码出库申请
that.$api.backMaterialReceive.backMaterialSetCodeBack(params).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
setTimeout(() => {
uni.navigateBack()
},200)
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
}
2023-12-24 16:28:36 +08:00
},
2024-03-13 17:55:34 +08:00
/* initFetchInfoByCode(params) {
2023-12-24 16:28:36 +08:00
let that = this
this.typeId = params.typeId
this.num = params.num
this.parentId = params.parentId
// 根据扫出的编码查询设备
that.$api.fetchMaterialOutStore.fetchInfoByCode({
maCode: params.code
}, null).then(res => {
console.log("", res);
2024-03-13 17:55:34 +08:00
if (res) {
2023-12-24 16:28:36 +08:00
}
}).catch(err => {
console.log(err);
})
2024-03-13 17:55:34 +08:00
}, */
2023-12-24 16:28:36 +08:00
iniBackMaterialReceive(params) {
let that = this
this.typeId = params.typeId
this.num = params.num
this.parentId = params.parentId
// 根据扫出的编码查询设备
that.$api.backMaterialReceive.backMaterialQrcodeQuery({
2024-06-19 15:29:22 +08:00
qrCode: params.code,
agreementId: params.agreementId
}).then(res => {
console.log("backMaterialQrcodeQuery", res);
2023-12-24 16:28:36 +08:00
if (res.data.data.length == 0) {
// qrcodeQuery 页面数据
uni.showToast({
icon: 'none',
title: '未查询到设备数据!'
})
} else {
that.infoList = res.data.data
}
}).catch(err => {
console.log(err);
})
},
2023-12-23 23:21:42 +08:00
},
onLoad(params) {
2023-12-24 16:28:36 +08:00
// 测试代码 sjf-note 记得删除
2023-12-24 17:28:53 +08:00
// const testParams = {
// "code": "20231224-0067",
// "typeId": "4",
// "num": "4",
// "parentId": "32",
// "manageType": "0",
// "createBy": "1",
// scanType: 'back',
// taskId: "357"
// }
// params = testParams
2023-12-24 16:28:36 +08:00
this.initData = params
console.log("paramsinitFetchInfoByCode",params)
2023-12-24 19:12:27 +08:00
// this.initFetchInfoByCode(params)
2023-12-24 16:28:36 +08:00
this.iniBackMaterialReceive(params)
2023-12-23 23:21:42 +08:00
}
}
</script>
<style lang="scss">
2023-12-24 16:28:36 +08:00
.info-area {
2023-12-23 23:21:42 +08:00
width: 90%;
margin: 40rpx auto;
display: flex;
flex-direction: column;
2023-12-24 16:28:36 +08:00
view {
2023-12-23 23:21:42 +08:00
margin-bottom: 25rpx;
display: flex;
align-items: center;
2023-12-24 16:28:36 +08:00
h4 {
2024-03-13 17:55:34 +08:00
width: 25%;
2023-12-23 23:21:42 +08:00
font-weight: normal;
font-size: 14px;
color: #989898;
}
2023-12-24 16:28:36 +08:00
span {
2023-12-23 23:21:42 +08:00
font-size: 14px;
}
}
2024-03-13 17:55:34 +08:00
view:last-child{
margin-bottom: 0;
}
2023-12-23 23:21:42 +08:00
}
2023-12-24 16:28:36 +08:00
.sub-btn {
2023-12-23 23:21:42 +08:00
width: 80%;
margin: 30rpx auto;
box-sizing: border-box;
padding: 15rpx 0;
background-color: #0189FC;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
border-radius: 40rpx;
}
2023-12-24 16:28:36 +08:00
</style>