yangan
2024-09-12 75811022288e2c4832974a1586f442608706c30a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<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>