SmartStorage/pages/codeReceive/codeReceive.vue

304 lines
6.5 KiB
Vue
Raw Normal View History

2023-12-23 23:21:42 +08:00
<template>
<view>
<view class="form-area">
<view class="upper-ipt">
2024-03-13 17:55:34 +08:00
<uni-easyinput suffixIcon="search" v-model="transCode" placeholder="请输入编码"
2023-12-24 16:28:36 +08:00
@iconClick="searchCode"></uni-easyinput>
2023-12-23 23:21:42 +08:00
</view>
2024-03-13 17:55:34 +08:00
<view
class="info-area"
v-for="(item, index) in infoList"
:key="index"
v-show="infoList.length != 0"
@click="actionSheetFn(item)"
>
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>
2023-12-23 23:21:42 +08:00
</view>
2023-12-24 16:28:36 +08:00
<view>
<h4>设备状态</h4>
<span>{{ item.sdStatus }}</span>
2023-12-23 23:21:42 +08:00
</view>
2024-03-13 17:55:34 +08:00
<!-- <uni-data-checkbox v-model="item.selectStatus" :localdata="fixRange"></uni-data-checkbox> -->
2023-12-24 16:28:36 +08:00
<!-- <view>
2023-12-23 23:21:42 +08:00
<h4>设备状态</h4>
<span>{{ item.maStatusName }}</span>
</view>
<view>
<h4>机具编码</h4>
<span>{{ item.maCode }}</span>
</view>
<view>
<h4>出库数量</h4>
<span>1</span>
</view> -->
</view>
2024-03-13 17:55:34 +08:00
<!-- <view
style="width: 90%; margin: 15rpx auto;"
v-show="infoList.length != 0"
>
<uni-data-checkbox v-model="fixVal" :localdata="fixRange"></uni-data-checkbox>
</view> -->
<!-- <view
class="sub-btn"
v-show="infoList.length != 0"
@click="outStore"
>
2023-12-23 23:21:42 +08:00
接收
2023-12-24 19:12:27 +08:00
</view> -->
2023-12-23 23:21:42 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
return {
typeId: '',
num: '',
parentId: '',
2024-03-13 17:55:34 +08:00
fixVal: '',
fixRange: [{
text: '合格',
value: '1'
},
{
text: '待修',
value: '2'
},
{
text: '待报废',
value: '3'
}
],
infoList: [],
2023-12-23 23:21:42 +08:00
subList: {},
2023-12-24 16:28:36 +08:00
manageType:'',
2024-03-13 17:55:34 +08:00
createBy:'',
updatedSubList: '',
transCode: ''
2023-12-23 23:21:42 +08:00
}
},
methods: {
2023-12-24 16:28:36 +08:00
searchCode() {
2023-12-23 23:21:42 +08:00
let that = this
that.infoList = []
2024-03-13 17:55:34 +08:00
console.log(that.transCode);
2023-12-23 23:21:42 +08:00
// 根据maId获取设备详情
2023-12-24 16:28:36 +08:00
that.$api.backMaterialReceive.backReceiveCodeQuery({
2024-03-13 17:55:34 +08:00
maCode: that.transCode
}).then(res => {
2023-12-23 23:21:42 +08:00
console.log(res);
2023-12-24 16:28:36 +08:00
if (res.data.data.length == 0) {
2023-12-23 23:21:42 +08:00
uni.showToast({
icon: 'none',
title: '未查询到设备数据!'
})
} else {
2024-03-13 17:55:34 +08:00
for (let i = 0; i < res.data.data.length; i++) {
res.data.data[i].selectStatus = ''
}
2023-12-24 16:28:36 +08:00
that.infoList = res.data.data
2024-03-13 17:55:34 +08:00
console.log(that.infoList);
2023-12-23 23:21:42 +08:00
}
}).catch(err => {
console.log(err);
})
},
2023-12-24 16:28:36 +08:00
outStore() {
2023-12-23 23:21:42 +08:00
let that = this
2024-03-13 17:55:34 +08:00
console.log(that.infoList[0].typeId, this.typeId);
that.updatedSubList = that.infoList.filter(item => {
return item.selectStatus != ''
}).map(subItem => {
return {
parentId: that.parentId,
typeId: that.typeId,
backNum: '1',
backStatus: subItem['selectStatus'],
manageType: that.manageType,
createBy: that.createBy,
maId: subItem['maId']
}
})
console.log(that.updatedSubList);
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 {
that.subList = {
taskId: that.taskId,
arr: that.updatedSubList
/* parentId: that.parentId,
typeId: that.typeId,
maId: that.infoList[0].maId,
outNum: 1,
companyId: uni.getStorageSync('userInfo').sysUser.companyId */
2023-12-23 23:21:42 +08:00
}
2024-03-13 17:55:34 +08:00
console.log(that.subList);
// 提交编码出库申请
/* that.$api.fetchMaterialOutStore.subOutStore(that.subList, null).then(res => {
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-24 16:28:36 +08:00
},
actionSheetFn(item) {
const that = this
2024-03-13 17:55:34 +08:00
console.log(item);
2023-12-24 16:28:36 +08:00
uni.showActionSheet({
itemList: ['合格', '待修', '待报废'],
itemColor: '#333',
success: function(res) {
// console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
let type = res.tapIndex + 1
const arrList = [{
"parentId": that.parentId,
"typeId": that.typeId,
"backNum": "1",
"backStatus": type,
"manageType": that.manageType,
"createBy": that.createBy,
"maId": item.maId
}]
const params = {
taskId: that.taskId,
arr: arrList
}
2023-12-24 19:21:16 +08:00
console.log("backMaterialReceiveparams",params)
2023-12-24 16:28:36 +08:00
// 提交编码出库申请
2024-03-13 17:55:34 +08:00
that.$api.backMaterialReceive.backMaterialSetCodeBack(params).then(res => {
2023-12-24 16:28:36 +08:00
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
2024-03-21 15:42:08 +08:00
success: () => {
2024-04-08 17:28:48 +08:00
uni.navigateBack()
2024-03-21 15:42:08 +08:00
}
2023-12-24 16:28:36 +08:00
})
2024-03-21 15:42:08 +08:00
// that.searchCode()
2023-12-24 16:28:36 +08:00
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
},
fail: function(res) {
console.log(res.errMsg);
}
});
2023-12-23 23:21:42 +08:00
}
},
onLoad(params) {
2023-12-24 16:28:36 +08:00
console.log("init",params);
2024-03-13 17:55:34 +08:00
this.transCode = params.maCode
2024-04-08 17:28:48 +08:00
this.typeId = params.modelId
2023-12-23 23:21:42 +08:00
this.num = params.num
2023-12-24 19:21:16 +08:00
this.parentId = params.id
2023-12-24 16:28:36 +08:00
this.manageType = params.manageType
this.createBy=params.userId
this.taskId = params.taskId
2023-12-23 23:21:42 +08:00
}
}
</script>
<style lang="scss">
2023-12-24 16:28:36 +08:00
.form-area {
width: 100%;
2024-03-13 17:55:34 +08:00
margin: 20rpx auto;
2023-12-24 16:28:36 +08:00
.upper-ipt {
width: 90%;
2023-12-23 23:21:42 +08:00
display: flex;
align-items: center;
margin-bottom: 30rpx;
2023-12-24 16:28:36 +08:00
margin: 0 auto;
2023-12-23 23:21:42 +08:00
}
2023-12-24 16:28:36 +08:00
.info-area {
2023-12-23 23:21:42 +08:00
display: flex;
flex-direction: column;
2023-12-24 16:28:36 +08:00
width: 90%;
2024-03-13 17:55:34 +08:00
margin: 20rpx auto;
// border-bottom: 1px solid #BFC9E7;
2023-12-24 16:28:36 +08:00
view {
2023-12-23 23:21:42 +08:00
display: flex;
align-items: center;
2024-03-13 17:55:34 +08:00
box-sizing: border-box;
padding: 10rpx;
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;
}
}
2023-12-24 16:28:36 +08:00
&::after{
display: block;
content: "";
width: 750rpx;
height: 1px;
background-color: #d2d2d2;
margin-left: -5%;
margin-bottom: 12px;
}
2023-12-23 23:21:42 +08:00
}
2024-03-13 17:55:34 +08:00
.info-area:last-child{
border-bottom: none;
}
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>