You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
177 lines
3.9 KiB
177 lines
3.9 KiB
<template>
|
|
<page-meta root-font-size="16px"></page-meta>
|
|
<view class="">
|
|
<win-blank-view @goScan='openScanPopup' v-if="itemList.length==0"></win-blank-view>
|
|
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y">
|
|
<view class="detail-list margin_top" v-for="(item, index) in itemList">
|
|
<uni-swipe-action>
|
|
<uni-swipe-action-item :right-options="options" :auto-close="false"
|
|
@click="swipeClick($event,index)">
|
|
<com-replen :dataContent="item" :editQty="false"></com-replen>
|
|
</uni-swipe-action-item>
|
|
</uni-swipe-action>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
<comMessage ref="comMessage"></comMessage>
|
|
<win-scan-button @goScan='openScanPopup' v-if="itemList.length>0"></win-scan-button>
|
|
<com-scan-replen ref="scanPopup" @confirm='scanConfirm'></com-scan-replen>
|
|
<view class="new_btn_bot" v-if="itemList.length>0">
|
|
<button class="new_save_btn" @click="submit()">提交</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import winScanButton from '@/mycomponents/wincom/winScanButton.vue'
|
|
import comScanReplen from '@/mycomponents/scan/comScanReplen.vue'
|
|
import comReplen from '@/mycomponents/coms/task/comReplen.vue'
|
|
import winBlankView from '@/mycomponents/wincom/winBlankView.vue'
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
import {
|
|
getitems,
|
|
locations,
|
|
materialrequest,
|
|
checkIssueJobExistAsync
|
|
} from '@/api/index.js';
|
|
|
|
import {
|
|
maxPageSize,
|
|
showConfirmMsg,
|
|
goHome,
|
|
getRemoveOption
|
|
} from '@/common/basic.js';
|
|
|
|
export default {
|
|
name: 'replen',
|
|
components: {
|
|
comMessage,
|
|
winScanButton,
|
|
comScanReplen,
|
|
comReplen,
|
|
winBlankView
|
|
},
|
|
data() {
|
|
return {
|
|
options: [],
|
|
prodLine: {},
|
|
itemList: [],
|
|
scrollTop: 0,
|
|
old: {
|
|
scrollTop: 0
|
|
},
|
|
};
|
|
},
|
|
props: {
|
|
datacontent: {
|
|
type: Object,
|
|
value: null
|
|
}
|
|
},
|
|
mounted() {
|
|
this.options = getRemoveOption();
|
|
},
|
|
//返回首页
|
|
onNavigationBarButtonTap(e) {
|
|
if (e.index === 0) {
|
|
goHome();
|
|
}else if(e.index === 1){
|
|
window.location.reload();
|
|
}
|
|
},
|
|
methods: {
|
|
openScanPopup() {
|
|
this.$refs.scanPopup.openScanPopup(this.prodLine, this.itemList);
|
|
},
|
|
//提示是否移除选择的行?
|
|
swipeClick(e, index) {
|
|
let {
|
|
content
|
|
} = e;
|
|
if (content.text === '移除') {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '是否移除选择的行?',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
this.itemList.splice(index, 1);
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
},
|
|
|
|
scanConfirm(prodLine, itemList) {
|
|
this.prodLine = prodLine;
|
|
this.itemList = itemList;
|
|
},
|
|
|
|
submit() {
|
|
let that = this;
|
|
if (that.itemList.length == 0) {
|
|
return;
|
|
}
|
|
uni.showLoading({
|
|
title: '提交中',
|
|
mask: true
|
|
})
|
|
let item = {
|
|
worker: localStorage.userName_CN ==""?localStorage.userName:localStorage.userName_CN,
|
|
company: localStorage.company,
|
|
details: that.itemList
|
|
};
|
|
|
|
let params = JSON.stringify(item);
|
|
console.log(params);
|
|
materialrequest(params)
|
|
.then(res => {
|
|
that.showCommitSuccess();
|
|
that.itemList = [];
|
|
uni.hideLoading();
|
|
})
|
|
.catch(err => {
|
|
this.showMessage(err.message);
|
|
uni.hideLoading();
|
|
});
|
|
},
|
|
|
|
showMessage(message) {
|
|
this.$refs.comMessage.showMessage(message);
|
|
},
|
|
showCommitSuccess() {
|
|
this.$refs.comMessage.showCommitSuccess();
|
|
},
|
|
upper: function(e) {
|
|
// console.log(e)
|
|
},
|
|
lower: function(e) {
|
|
// console.log(e)
|
|
},
|
|
scroll: function(e) {
|
|
// console.log(e)
|
|
this.old.scrollTop = e.detail.scrollTop;
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.scanType {
|
|
padding: 5rpx 30rpx;
|
|
}
|
|
|
|
.myinput {
|
|
display: flex;
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
position: relative;
|
|
flex: 1;
|
|
justify-content: center;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
|
|
font-size: 18px;
|
|
}
|
|
</style>
|
|
|