SmartStorage/pages/scanOutStore/scanOutStore.vue

175 lines
3.4 KiB
Vue
Raw Normal View History

2023-12-23 23:21:42 +08:00
<template>
<view>
<view
class="info-area"
v-for="(item, index) in infoList"
:key="index"
v-show="infoList.length != 0"
>
<view>
<h4>物品名称</h4>
<span>{{ item.itemType }}</span>
</view>
<view>
<h4>设备名称</h4>
<span>{{ item.deviceType }}</span>
</view>
<view>
<h4>设备规格</h4>
<span>{{ item.specificationType }}</span>
</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>
<view
class="sub-btn"
v-show="infoList.length != 0"
@click="outStore"
>
出库
</view>
</view>
</template>
<script>
export default {
data() {
return {
typeId: '',
num: '',
parentId: '',
2024-03-13 17:55:34 +08:00
infoList: '',
carCode: ''
2023-12-23 23:21:42 +08:00
}
},
methods: {
outStore () {
let that = this
2024-03-13 17:55:34 +08:00
console.log(this.infoList[0].typeId, this.typeId);
if (this.infoList[0].typeId != this.typeId) {
2023-12-23 23:21:42 +08:00
uni.showToast({
icon: 'none',
title: '编码与机具类型不匹配!'
})
2024-03-13 17:55:34 +08:00
} else if (that.num == 0) {
uni.showToast({
icon: 'none',
title: '无法再出库!'
})
} else {
2023-12-23 23:21:42 +08:00
that.subList = {
parentId: that.parentId,
typeId: that.typeId,
maId: that.infoList[0].maId,
2024-03-13 17:55:34 +08:00
carCode: that.carCode,
2023-12-23 23:21:42 +08:00
outNum: 1,
companyId: uni.getStorageSync('userInfo').sysUser.companyId
}
console.log(that.subList);
2024-03-13 17:55:34 +08:00
// 提交编码出库申请
that.$api.fetchMaterialOutStore.subOutStore(that.subList).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
setTimeout(() => {
2024-03-21 15:42:08 +08:00
uni.navigateBack()
}, 200)
/* uni.reLaunch({
2024-03-13 17:55:34 +08:00
url: `/pages/QROut/QROut?typeId=${that.typeId}&num=${that.num}&parentId=${that.parentId}&carCode=${that.carCode}`
2024-03-21 15:42:08 +08:00
}) */
2024-03-13 17:55:34 +08:00
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
}
2023-12-23 23:21:42 +08:00
}
},
onLoad(params) {
let that = this
console.log(params);
2024-03-13 17:55:34 +08:00
let {
typeId,
num,
parentId,
carCode,
code
} = params
this.typeId = typeId
this.num = num
this.parentId = parentId
this.carCode = carCode
2023-12-23 23:21:42 +08:00
// 根据扫出的编码查询设备
2023-12-24 18:44:01 +08:00
that.$api.fetchMaterialOutStore.fetchInfoByQrCode({
2024-03-13 17:55:34 +08:00
qrCode: code
}).then(res => {
2023-12-24 18:44:01 +08:00
console.log('fetchInfoByQrCode =================================',res);
2023-12-23 23:21:42 +08:00
if (res.data.rows.length == 0) {
uni.showToast({
icon: 'none',
title: '未查询到设备数据!'
})
} else {
that.infoList = res.data.rows
}
}).catch(err => {
console.log(err);
})
}
}
</script>
<style lang="scss">
.info-area{
width: 90%;
margin: 40rpx auto;
display: flex;
flex-direction: column;
view{
margin-bottom: 25rpx;
display: flex;
align-items: center;
h4{
width: 35%;
font-weight: normal;
font-size: 14px;
color: #989898;
}
span{
font-size: 14px;
}
}
}
.sub-btn{
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;
}
</style>