<template>
|
<view class="warp">
|
|
<view
|
class="notice-bar">
|
<u-notice-bar :text="text"
|
style="font-size:30rpx"
|
:fontSize="20"></u-notice-bar>
|
<view class="notice-icon"
|
style="background: url('https://wrzs.czjlchem.com:9090/appimg/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;">
|
</view>
|
</view>
|
<view>
|
<u-empty mode="data"
|
icon="http://cdn.uviewui.com/uview/empty/data.png"
|
textSize="30"
|
iconSize="1000"
|
text="暂无数据"
|
v-if="!pageList.length"
|
></u-empty>
|
</view>
|
<view class="tableCon" v-if="pageList.length">
|
<uni-table border
|
stripe
|
emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center">车队</uni-th>
|
<uni-th align="center">产品名称</uni-th>
|
<uni-th align="center">产品等级</uni-th>
|
<uni-th align="center">吨数</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in pageList"
|
:key="item.id">
|
<uni-td align="center">{{item.fleetName}}</uni-td>
|
<uni-td align="center">{{ item.productName}}</uni-td>
|
<uni-td align="center">{{ item.productGrade}}</uni-td>
|
<uni-td align="center">
|
<u--input
|
placeholder="请输入吨数"
|
border="surround"
|
type='number'
|
@change="(val)=>inpChange(val,item.planMeasure)"
|
v-model="item.planMeasure"
|
></u--input>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
|
</view>
|
<view class="footer">
|
<view
|
class="forwardBtn"><u-button text="提交"
|
:hairline="false"
|
type="warning"
|
v-if="pageList.length"
|
@click.stop="submitForm"
|
:loading='loading'></u-button></view>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
pageList:[],
|
orderPlanId:'',
|
customerId:'',
|
status:'',
|
fleetId:'',
|
pvcPlanMeasure:''
|
}
|
},
|
computed:{
|
text() {
|
return `日计划总吨数${this.pvcPlanMeasure}吨`;
|
},
|
},
|
onLoad(params){
|
console.log(params,'参数')
|
this.orderPlanId = params.orderPlanId;
|
this.customerId = params.customerId;
|
this.pvcPlanMeasure = params.pvcPlanMeasure
|
|
if(params.status === '1'){
|
this.status = params.status
|
}else{
|
this.status = '';
|
}
|
if(params.fleetId){
|
this.fleetId = params.fleetId
|
}
|
|
|
|
|
},
|
onShow(){
|
this.getBuild();
|
},
|
methods: {
|
getBuild(){
|
console.log(this.productName,'opr')
|
this.$reqGet('getBuildList',{orderPlanId:this.orderPlanId,customerId:this.customerId,status:this.status,fleetId:this.fleetId}).then(res=>{
|
console.log(res,'resss')
|
this.pageList = res.data;
|
})
|
|
|
},
|
submitForm(){
|
if(this.pageList.find(item=>!item.planMeasure)){
|
this.$u.toast('请检查是否遗漏输入吨数')
|
}else{
|
this.$reqPut('allocation',this.pageList,'json').then(res=>{
|
console.log(res,'122')
|
if(res.code === 0){
|
this.$u.toast('操作成功');
|
setTimeout(()=>{
|
uni.navigateBack({
|
delta: 2
|
});
|
},500)
|
}else{
|
this.$u.toast(res.msg ? res.msg :'操作成功');
|
}
|
}).catch((err) => {
|
this.$u.toast( err ? err : '操作成功');
|
})
|
}
|
|
},
|
inpChange(val,item){
|
console.log(item,'item')
|
let temp = val.replace(/^\d*(\.?\d{0,2})/g, '');
|
this.$nextTick(() => {
|
item = temp;
|
})
|
|
}
|
},
|
|
|
|
}
|
</script>
|
|
<style lang='scss' scoped>
|
.notice-bar {
|
width: 688rpx;
|
height: 56rpx;
|
margin: 0 auto;
|
position: relative;
|
// top: -200rpx;
|
background: transparent;
|
|
.notice-icon {
|
position: absolute;
|
top: 21rpx;
|
left: 7rpx;
|
}
|
}
|
.warp{
|
width: 100%;
|
height: calc(100vh - 75rpx)
|
}
|
.tableCon{
|
|
.uni-table{
|
min-width: 0!important;
|
}
|
}
|
.footer{
|
.forwardBtn {
|
::v-deep .u-button {
|
height: 74rpx;
|
color: #ffffff;
|
background: rgba(73, 123, 251, 1)!important;
|
border: 0;
|
border-radius: 37rpx 37rpx 37rpx 37rpx!important;
|
}
|
|
}
|
|
|
}
|
|
|
|
</style>
|
|
<style lang="scss">
|
.uni-table{
|
min-width: 0!important;
|
}
|
|
</style>
|