You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

399 lines
8.4 KiB
Vue

<template>
<view class='container'>
<!-- <tui-list-cell :lineLeft="false">
<view class="tui-item-box">
<view class="tui-msg-box">
<image src="../../static/stockin.png" class="tui-msg-pic" mode="widthFix"></image>
<view class="tui-msg-item">
<view v-if="info" class="tui-msg-name"></view>
</view>
</view>
</view>
</tui-list-cell>
<tui-list-cell :lineLeft="false">
<view class="tui-item-box">
<view class="tui-msg-box">
<view class="tui-msg-item" style="margin-left: 10px;">
<button v-if="imgList && imgList.length > 0"
@click="pickImage()">已选择{{imgList.length}}张图片</button>
<button v-else @click="pickImage()"></button>
</view>
</view>
</view>
</tui-list-cell> -->
<template v-if="info">
<uni-card :title="info.worktype">
<view class="example">
<uni-forms ref="form" label-position="left">
<uni-forms-item label="预计日期" name="workplandate">
<uni-easyinput type="text" :disabled="true" v-model="info.plandate" />
</uni-forms-item>
<uni-forms-item label="箱号" name="cntrno">
<uni-easyinput type="text" :disabled="true" v-model="info.cntrno" />
</uni-forms-item>
<uni-forms-item label="班列号" name="trainnum">
<uni-easyinput type="text" :disabled="true" v-model="info.trainnum" />
</uni-forms-item>
<uni-forms-item v-if="info.worktype=='班列落箱'" label="库位" name="areacode">
<uni-data-select v-model="info.areacode" :localdata="areaList" @change="change"
label="库位选择">
</uni-data-select>
</uni-forms-item>
<uni-forms-item label="车架号" name="carnuM_1">
<uni-easyinput type="text" :disabled="true" v-model="info.carnuM_1" />
</uni-forms-item>
<uni-forms-item v-if="info.worktype=='班列移位'" label="实际车架号" name="carnuM_2">
<uni-easyinput type="text" v-model="info.carnuM_2" />
</uni-forms-item>
</uni-forms>
<button @click="checkIn()"></button>
</view>
</uni-card>
</template>
</view>
</template>
<script>
export default {
data() {
return {
isshow: false,
isbinding: true,
key: '',
temp: '',
info: null,
loading: false,
areaList: [],
imgList: [],
tempArea: '',
tableData: [],
}
},
onReady() {
// 需要在onReady中设置规则
// this.$refs.form.setRules(this.rules)
},
onLoad: function(option) {
var _this = this
},
onShow: function() {
var _this = this
_this.getInfo()
},
methods: {
change(e) {
// console.log('e:',e);
var _this = this
_this.$set(_this.info, 'areacode', e)
_this.tempArea = e
},
getInfo: function() {
uni.showLoading()
this.tui.request("/App/GetTrainWorkInfo?id=" + uni.getStorageSync("trainWorkId"), "GET", null, false, false,
false)
.then((
res) => {
console.log(res)
if (res.succeeded) {
this.info = res.data[0]
this.areaList = res.data[1]
// console.log(this.list)
uni.hideLoading()
} else {
this.tui.toast(res.message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
uni.hideLoading()
})
},
checkIn: function() {
uni.showLoading()
this.$refs.form.validate().then(res => {
uni.hideLoading()
// console.log('表单数据信息:', res);
let postData = {
GID: this.info.gid,
WORKTYPE: this.info.worktype,
OP:uni.getStorageSync("UserId"),
CARNUM_1: this.info.carnuM_1,
CARNUM_2: this.info.carnuM_2,
// InfoFiles: this.imgList,
AREACODE: this.info.areacode
}
this.tui.request("/App/TrainWorkDeal", "POST", postData, false, false, false)
.then((
res) => {
console.log(res)
if (res.succeeded) {
this.tui.toast(res.message, 2000, 'success')
uni.navigateBack();
} else {
this.tui.toast(res.message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
})
}).catch(err => {
uni.hideLoading()
this.tui.toast('请检查表单!', 2000, 'none')
})
},
pickImage: function() {
console.log('==== picker ====')
uni.chooseImage({
count: 1, //可选择数量默认9
sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //从相册选择或从使用相机
success: (temp) => {
// const tempFilePaths = res.tempFilePaths;
const files = temp.tempFiles;
// console.log(files[0])
var path = files[0].path
var filename = path.replace(/(.*\/)*([^.]+).*/ig,"$2")+".jpg"
uni.showLoading()
uni.uploadFile({
url: this.tui.uploadUrl(), //仅为示例,非真实的接口地址
fileType:"image",//ZFB必填,不然报错
filePath: temp.tempFilePaths[0],//这个就是我们上面拍照返回或者先中照片返回的数组
name: 'files',
success: res => {
console.log(res)
this.imgList.push({name: filename ,url:JSON.parse(res.data).data + filename})
console.log(this.imgList)
uni.hideLoading();
},
fail(err) {
console.log(err)
// this.tui.toast('上传失败', 2000, 'none')
uni.hideLoading();
}
});
}
})
}
}
}
</script>
<style>
/* @import '../../static/style/thorui.css'; */
.tui-msg-box {
display: flex;
align-items: center;
}
.example {
padding: 15px;
background-color: #fff;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
}
.button {
display: flex;
align-items: center;
height: 35px;
margin-left: 10px;
}
.tui-msg-pic {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
display: block;
margin-right: 24rpx;
flex-shrink: 0;
}
.tui-msg-item {
max-width: 500rpx;
/* min-height: 100rpx; */
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.tui-msg-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 45rpx;
line-height: 2;
justify-content: space-between;
color: #262b3a;
}
.tui-item-box {
width: 100%;
display: flex;
align-items: center;
}
.tui-list-cell_name {
padding-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
}
.tui-ml-auto {
margin-left: auto;
}
.tui-right {
margin-left: auto;
margin-right: 34rpx;
font-size: 26rpx;
color: #999;
}
.tui-logo {
height: 52rpx;
width: 52rpx;
flex-shrink: 0;
}
</style>
<style lang='scss'>
.fr-right-blue {
float: right;
font-family: 微软雅黑;
color: #4977E7;
}
.fr-left-blue {
float: left;
font-family: 微软雅黑;
color: #4977E7;
}
.fr-right-green {
float: right;
font-family: 微软雅黑;
color: #11AE11;
}
.color-999 {
color: #999;
}
.color-red {
color: red;
}
.fr-right {
float: right;
font-family: 微软雅黑;
color: #999;
}
.list-card {
margin: 20upx 0;
background-color: #ffffff;
/* font-size: 28upx; */
transform: all 1s;
.card-head {
padding: 20upx;
height: 80upx;
font-size: 35upx;
box-sizing: border-box;
border-bottom: 2upx solid #f5f5f5;
}
.card-body {
padding: 20upx;
display: flex;
flex-wrap: wrap;
text {
width: 50%;
font-size: 32upx;
line-height: 55upx;
}
}
.card-foot {
height: 88upx;
/* margin: 20upx 0; */
padding: 0 20upx;
border-top: 2upx solid #f5f5f5;
border-bottom: none;
line-height: 88upx;
.btn {
height: 60upx;
font-size: 28upx;
line-height: 60upx;
margin: 14upx 0;
}
}
}
.tui-searchbox {
padding: 30rpx 0;
box-sizing: border-box;
display: flex;
align-items: center;
}
.tui-search-input {
width: 100%;
height: 66rpx;
border-radius: 35rpx;
padding: 0 30rpx;
box-sizing: border-box;
background: #f2f2f2;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tui-input {
flex: 1;
color: #333;
padding: 0 16rpx;
font-size: 28rpx;
}
.tui-input-plholder {
font-size: 28rpx;
color: #b2b2b2;
}
.fr-btn {
float: right;
height: 60upx;
font-size: 28upx;
line-height: 60upx;
margin: 14upx 0;
}
;
.uni-group {
display: flex;
align-items: center;
}
</style>
-->