301 lines
6.4 KiB
Vue
301 lines
6.4 KiB
Vue
<template>
|
|
<view>
|
|
<view class="form-area">
|
|
<view class="upper-ipt">
|
|
<uni-easyinput suffixIcon="search" v-model="transCode" placeholder="请输入编码"
|
|
@iconClick="searchCode"></uni-easyinput>
|
|
</view>
|
|
<view
|
|
class="info-area"
|
|
v-for="(item, index) in infoList"
|
|
:key="index"
|
|
v-show="infoList.length != 0"
|
|
@click="actionSheetFn(item)"
|
|
>
|
|
<view>
|
|
<h4>类型名称</h4>
|
|
<span>{{ item.typeName }}</span>
|
|
</view>
|
|
<view>
|
|
<h4>规格型号</h4>
|
|
<span>{{ item.typeCode }}</span>
|
|
</view>
|
|
<view>
|
|
<h4>设备编码</h4>
|
|
<span>{{ item.maCode }}</span>
|
|
</view>
|
|
<view>
|
|
<h4>设备状态</h4>
|
|
<span>{{ item.sdStatus }}</span>
|
|
</view>
|
|
<!-- <uni-data-checkbox v-model="item.selectStatus" :localdata="fixRange"></uni-data-checkbox> -->
|
|
<!-- <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
|
|
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"
|
|
>
|
|
接收
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
typeId: '',
|
|
num: '',
|
|
parentId: '',
|
|
fixVal: '',
|
|
fixRange: [{
|
|
text: '合格',
|
|
value: '1'
|
|
},
|
|
{
|
|
text: '待修',
|
|
value: '2'
|
|
},
|
|
{
|
|
text: '待报废',
|
|
value: '3'
|
|
}
|
|
],
|
|
infoList: [],
|
|
subList: {},
|
|
manageType:'',
|
|
createBy:'',
|
|
updatedSubList: '',
|
|
transCode: ''
|
|
}
|
|
},
|
|
methods: {
|
|
searchCode() {
|
|
let that = this
|
|
that.infoList = []
|
|
console.log(that.transCode);
|
|
// 根据maId获取设备详情
|
|
that.$api.backMaterialReceive.backReceiveCodeQuery({
|
|
maCode: that.transCode
|
|
}).then(res => {
|
|
console.log(res);
|
|
if (res.data.data.length == 0) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '未查询到设备数据!'
|
|
})
|
|
} else {
|
|
for (let i = 0; i < res.data.data.length; i++) {
|
|
res.data.data[i].selectStatus = ''
|
|
}
|
|
that.infoList = res.data.data
|
|
console.log(that.infoList);
|
|
}
|
|
}).catch(err => {
|
|
console.log(err);
|
|
})
|
|
},
|
|
outStore() {
|
|
let that = this
|
|
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) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '编码与机具类型不匹配!'
|
|
})
|
|
} 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 */
|
|
}
|
|
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);
|
|
}) */
|
|
}
|
|
},
|
|
actionSheetFn(item) {
|
|
const that = this
|
|
console.log(item);
|
|
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
|
|
}
|
|
console.log("backMaterialReceiveparams",params)
|
|
// 提交编码出库申请
|
|
that.$api.backMaterialReceive.backMaterialSetCodeBack(params).then(res => {
|
|
console.log(res);
|
|
if (res.data.code == 200) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: res.data.msg,
|
|
})
|
|
that.searchCode()
|
|
} else {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: res.data.msg
|
|
})
|
|
}
|
|
}).catch(err => {
|
|
console.log(err);
|
|
})
|
|
|
|
},
|
|
fail: function(res) {
|
|
console.log(res.errMsg);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
onLoad(params) {
|
|
console.log("init",params);
|
|
this.transCode = params.maCode
|
|
this.typeId = params.typeId
|
|
this.num = params.num
|
|
this.parentId = params.id
|
|
this.manageType = params.manageType
|
|
this.createBy=params.userId
|
|
this.taskId = params.taskId
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.form-area {
|
|
width: 100%;
|
|
margin: 20rpx auto;
|
|
|
|
.upper-ipt {
|
|
width: 90%;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 30rpx;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.info-area {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 90%;
|
|
margin: 20rpx auto;
|
|
// border-bottom: 1px solid #BFC9E7;
|
|
|
|
view {
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: border-box;
|
|
padding: 10rpx;
|
|
|
|
h4 {
|
|
width: 25%;
|
|
font-weight: normal;
|
|
font-size: 14px;
|
|
color: #989898;
|
|
}
|
|
|
|
span {
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
&::after{
|
|
display: block;
|
|
content: "";
|
|
width: 750rpx;
|
|
height: 1px;
|
|
background-color: #d2d2d2;
|
|
margin-left: -5%;
|
|
margin-bottom: 12px;
|
|
}
|
|
}
|
|
|
|
.info-area:last-child{
|
|
border-bottom: none;
|
|
}
|
|
|
|
.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> |