SmartStorage/pages/codeOutStore/codeOutStore.vue

190 lines
3.9 KiB
Vue
Raw Normal View History

2023-12-23 11:54:30 +08:00
<template>
<view>
<view class="form-area">
<view class="upper-ipt">
2024-04-28 16:54:53 +08:00
<!-- <uni-easyinput style="margin-bottom: 15rpx;" v-model="carCode" placeholder="请输入车牌号"></uni-easyinput> -->
2023-12-23 11:54:30 +08:00
<uni-easyinput suffixIcon="search" v-model="codeVal" placeholder="请输入编码" @iconClick="searchCode"></uni-easyinput>
</view>
2023-12-23 23:21:42 +08:00
<view
class="info-area"
v-for="(item, index) in infoList"
:key="index"
v-show="infoList.length != 0"
>
<view>
2024-04-20 14:35:37 +08:00
<h4>机具分类</h4>
2023-12-23 23:21:42 +08:00
<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>
2023-12-23 11:54:30 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
return {
2024-03-13 17:55:34 +08:00
carCode: '',
2023-12-23 23:21:42 +08:00
codeVal: '',
typeId: '',
num: '',
parentId: '',
infoList: '',
2024-04-01 09:11:26 +08:00
manageType: '',
taskId: '',
2023-12-23 23:21:42 +08:00
subList: {}
2023-12-23 11:54:30 +08:00
}
},
methods: {
searchCode () {
let that = this
2023-12-23 23:21:42 +08:00
that.infoList = []
2023-12-23 11:54:30 +08:00
console.log(that.codeVal);
2023-12-23 23:21:42 +08:00
// 根据maId获取设备详情
that.$api.fetchMaterialOutStore.fetchInfoByCode({
maCode: that.codeVal
2024-03-13 17:55:34 +08:00
}).then(res => {
2023-12-23 23:21:42 +08:00
console.log(res);
if (res.data.rows.length == 0) {
uni.showToast({
icon: 'none',
2024-05-06 15:54:50 +08:00
title: '请输入正确格式的编码!'
2023-12-23 23:21:42 +08:00
})
} else {
that.infoList = res.data.rows
}
}).catch(err => {
console.log(err);
})
},
outStore () {
let that = this
2024-03-13 17:55:34 +08:00
console.log(that.infoList, this.typeId);
if (this.infoList[0].typeId != this.typeId) {
2023-12-23 23:21:42 +08:00
uni.showToast({
icon: 'none',
2024-04-28 16:54:53 +08:00
title: '机具类型不匹配!'
2023-12-23 23:21:42 +08:00
})
2024-03-13 17:55:34 +08:00
} else {
2023-12-23 23:21:42 +08:00
that.subList = {
parentId: that.parentId,
typeId: that.typeId,
2024-04-01 09:11:26 +08:00
manageType: that.manageType,
taskId: that.taskId,
2023-12-23 23:21:42 +08:00
maId: that.infoList[0].maId,
outNum: 1,
2024-04-28 16:54:53 +08:00
// carCode: that.carCode,
2023-12-23 23:21:42 +08:00
companyId: uni.getStorageSync('userInfo').sysUser.companyId
}
console.log(that.subList);
// 提交编码出库申请
2024-04-01 09:11:26 +08:00
that.$api.fetchMaterialOutStore.subOutStore(that.subList).then(res => {
2024-03-13 17:55:34 +08:00
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
uni.navigateBack()
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
}
2023-12-23 11:54:30 +08:00
}
2023-12-23 23:21:42 +08:00
},
onLoad(params) {
console.log(params);
this.typeId = params.typeId
this.num = params.num
this.parentId = params.parentId
2024-04-01 09:11:26 +08:00
this.manageType = params.manageType
this.taskId = params.taskId
2024-04-30 15:12:07 +08:00
// this.codeVal = params.code
2023-12-23 11:54:30 +08:00
}
}
</script>
<style lang="scss">
.form-area{
width: 90%;
margin: 40rpx auto;
.upper-ipt{
width: 100%;
display: flex;
2024-03-13 17:55:34 +08:00
flex-direction: column;
2023-12-23 11:54:30 +08:00
align-items: center;
2023-12-23 23:21:42 +08:00
margin-bottom: 30rpx;
}
.info-area{
width: 100%;
display: flex;
flex-direction: column;
2024-04-20 14:35:37 +08:00
border-bottom: 1px solid #d7d7d7;
2023-12-23 23:21:42 +08:00
view{
margin-bottom: 25rpx;
display: flex;
align-items: center;
h4{
width: 35%;
font-weight: normal;
font-size: 14px;
color: #989898;
}
span{
font-size: 14px;
}
}
}
2024-04-20 14:35:37 +08:00
.info-area:last-child{
border-bottom: none;
}
2023-12-23 23:21:42 +08:00
.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;
2023-12-23 11:54:30 +08:00
}
}
</style>