lijuncheng
5 months ago
9 changed files with 358 additions and 110 deletions
@ -0,0 +1,281 @@ |
|||
<template> |
|||
<view class="page-wraper" @touchstart="touchScreen"> |
|||
<view class="page-header flex" |
|||
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> |
|||
</view> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view style="padding-bottom: 80rpx;width: 100%;"> |
|||
<view class="uni-flex uni-column " style="margin: 10rpx;"> |
|||
<uni-section title="计划单号" subTitle="选择计划单号" subTitleFontSize="26rpx" titleFontSize="35rpx" |
|||
type="line"> |
|||
</uni-section> |
|||
|
|||
<view class="uni-flex space-between"> |
|||
<view class="" style="width: 75%; "> |
|||
<uni-easyinput disabled style="margin-left: 10rpx; margin-right: 10rpx;" trim="all" |
|||
v-model="planNumber"></uni-easyinput> |
|||
</view> |
|||
<view class="uni-flex" style="width: 25%; align-items: center;"> |
|||
<button type="primary" size="mini" @click="showPlanSelect">单号</button> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="uni-flex uni-column " style="margin: 10rpx;"> |
|||
<uni-section title="扫描产品码" subTitle="产品码" subTitleFontSize="26rpx" titleFontSize="35rpx" |
|||
type="line"> |
|||
</uni-section> |
|||
|
|||
<view class="uni-flex space-between"> |
|||
<view class="" style="width: 75%; "> |
|||
<uni-easyinput style="margin-left: 10rpx; margin-right: 10rpx;" trim="all" |
|||
v-model="scanCode" @clear="clearCode" |
|||
ref="inputScan" |
|||
@confirm="onConfirm"></uni-easyinput> |
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<!-- <button class="btn_single_reset" hover-class="btn_single_after" @click="reset">重置</button> --> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<selectClickList ref="selectPopup" title="选择计划单号" @select="selectPlan"></selectClickList> |
|||
|
|||
</view> |
|||
|
|||
|
|||
</template> |
|||
<script module="render" lang="renderjs"> |
|||
export default { |
|||
methods: { |
|||
_inputFocus(event) { |
|||
document.querySelector('#inputSelect input').select() |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<script> |
|||
import { |
|||
getPlasticsGoodPlaneNumberList, |
|||
upLickSubmit, |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
showConfirmMsg |
|||
} from "@/common/utils.js" |
|||
|
|||
import { |
|||
getCurrDateTime, |
|||
} from "@/common/basic.js" |
|||
import selectClickList from "@/mycomponents/popup/selectClickList.vue" |
|||
import config from '@/static/config.js' |
|||
|
|||
export default { |
|||
components: { |
|||
selectClickList |
|||
}, |
|||
data() { |
|||
return { |
|||
dateTime: "", |
|||
planNumber: "", |
|||
dataList: [], |
|||
userForm: { |
|||
names: [], |
|||
values: [], |
|||
origin: [] |
|||
}, |
|||
materialList: [], |
|||
planList: [], |
|||
scanCode: "", |
|||
scanCheckCode:"", |
|||
lastTime: null, // 最后一次点击的时间 |
|||
currentTime: null, // 当前点击的时间 |
|||
timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 |
|||
|
|||
} |
|||
}, |
|||
computed: {}, |
|||
onShow(){ |
|||
this.lastTime = new Date().getTime() |
|||
}, |
|||
|
|||
methods: { |
|||
touchScreen() { |
|||
this.currentTime = new Date().getTime() // 记录这次点击的时间 |
|||
console.log("当前时间", this.currentTime) |
|||
if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 |
|||
console.log("当前时间跳转") |
|||
uni.reLaunch({ |
|||
url: "../login/index" |
|||
}) |
|||
} else { |
|||
this.lastTime = new Date().getTime() // 如果在30分钟内点击,则把这次点击的时间记录覆盖掉之前存的最后一次点击的时间 |
|||
console.log("当前时间跳转赋值,没跳转" + this.lastTime) |
|||
} |
|||
}, |
|||
submit() { |
|||
if (this.planNumber == "") { |
|||
this.showMessage("请选择计划单号") |
|||
return |
|||
} |
|||
if (this.scanCheckCode == "") { |
|||
this.scanCheckCode="" |
|||
this.showMessage("请先校验产品码") |
|||
return |
|||
} |
|||
|
|||
uni.showLoading({ |
|||
title: "加载中", |
|||
mask: true |
|||
}) |
|||
var param = { |
|||
PlanID : this.planNumber, |
|||
id: this.$store.state.user.id, |
|||
createTime: getCurrDateTime(), |
|||
ProductCode :this.scanCheckCode, |
|||
Type:2, |
|||
State:1, |
|||
User: this.$store.state.user.name |
|||
|
|||
} |
|||
console.log("提交", JSON.stringify(param)) |
|||
|
|||
upLickSubmit(param).then(res => { |
|||
uni.hideLoading() |
|||
uni.showToast({ |
|||
title: '提交成功', |
|||
}); |
|||
this.resetData() |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
showMessage(hint) { |
|||
showConfirmMsg("提示", hint, false, callBack => { |
|||
|
|||
}) |
|||
}, |
|||
resetData() { |
|||
this.scanCode ="" |
|||
this.scanCheckCode="" |
|||
this.$refs.inputScan.focused = true |
|||
}, |
|||
clearCode() { |
|||
this.scanCode = ""; |
|||
this.scanCheckCode="" |
|||
}, |
|||
onConfirm(data){ |
|||
if(!data){ |
|||
this.showMessage("扫描数据不能为空") |
|||
return; |
|||
} |
|||
this.scanCode = data; |
|||
this.scanCheckCode=data |
|||
this.submit(); |
|||
|
|||
}, |
|||
showPlanSelect() { |
|||
uni.showLoading({ |
|||
title: "加载中", |
|||
mask: true |
|||
}) |
|||
getPlasticsGoodPlaneNumberList().then(res => { |
|||
uni.hideLoading() |
|||
if (res.Result.length > 0) { |
|||
var list = []; |
|||
list = res.Result; |
|||
list.forEach(res => { |
|||
res.label = res.PLAN_NO; |
|||
res.value = res.SHIFT_CODE |
|||
}) |
|||
this.$refs.selectPopup.openScanPopup(list) |
|||
} else { |
|||
this.showMessage("列表为0") |
|||
} |
|||
|
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
selectPlan(data) { |
|||
this.planNumber = data.label |
|||
this.scanCode = ""; |
|||
this.scanCheckCode = ""; |
|||
this.$refs.inputScan.focused = true |
|||
console.log(data) |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
|
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
}, |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.example { |
|||
padding: 15px; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.segmented-control { |
|||
margin-bottom: 15px; |
|||
} |
|||
|
|||
.button-group { |
|||
margin-top: 15px; |
|||
display: flex; |
|||
justify-content: space-around; |
|||
} |
|||
|
|||
.form-item { |
|||
display: flex; |
|||
align-items: center; |
|||
flex: 1; |
|||
} |
|||
|
|||
.button { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 35px; |
|||
line-height: 35px; |
|||
margin-left: 10px; |
|||
} |
|||
|
|||
.input { |
|||
padding: 10rpx; |
|||
height: 65rpx; |
|||
text-align: left; |
|||
margin: 5rpx; |
|||
font-size: 28rpx; |
|||
color: #333; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
outline: none; |
|||
border-radius: 10rpx; |
|||
border: 1rpx solid lightgrey; |
|||
} |
|||
</style> |
Loading…
Reference in new issue