小小儁爺
2024-05-28 11ac3666423de5c03da72c388e38d869f04d9af7
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<template>
    <view>
        <page-nav title="个人计件工资产量"></page-nav>
        <view class="mainContent" :style="{maxHeight:'1600rpx',overflow: 'scroll'}">
            <view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head" :style="{height:'80rpx'}">
                    <view class="head_block">
                        <view class="head_left marginLeft20">
                            <!-- <view class="head_bar"></view> -->
                            <view class="head_title" style="font-weight: 600;">
                                姓名:{{username}}
                            </view>
 
                        </view>
 
                        <view class="">
                            <view class="head_title" style="font-weight: 600;">
                                工号:{{usercode}}
                            </view>
                        </view>
 
 
 
                        <view class="marginRight20">
                            <view class="head_title" style="font-weight: 600;display: flex;align-items: center;">
                                <view style="margin-right: 10rpx;"> 按{{compute?'末道':'逐道'}}</view>
                                <u-switch v-model="compute" size="20" @change="switchChange"></u-switch>
                            </view>
                        </view>
                    </view>
 
                    <!--         <view v-if="detailOrderArray.find(i=>i.unprice===0)" class="marginLeft20 marginTop10"
                        style="color: red;font-size: 30rpx;display: flex;">
                        <u-icon name="error-circle" style="margin: 0 10rpx;" color="red"></u-icon>
                        <view>节拍工价未设置全,请联系管理员!</view>
                    </view> -->
                    <!-- <u-alert v-if="detailOrderArray.find(i=>i.unprice===0)" type="info" :show-icon="true" description='1111'></u-alert> -->
 
 
                </view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block" style="height: 120rpx; display: flex;justify-content: space-around;">
                        <u-button :plain='today' @click="dateChange('today')" type="primary" shape="circle" text="今日">
                        </u-button>
                        <u-button :plain='month' @click="dateChange('month')" type="primary" shape="circle" text="本月">
                        </u-button>
                        <u-button :plain='custom' @click="dateChange('custom')" type="primary" shape="circle"
                            text="自定义"></u-button>
                    </view>
                </view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block flex_column" :style="{minHeight:!custom?'210rpx':'130rpx'}">
                        <view v-if="!custom" class="flex_column"
                            style="display: flex;justify-content: space-around;width: 100%;">
                            <view class="" style="display: flex;justify-content: center;width: 100%;">
                                <view class="titleFont">开始日期</view>
                                <view class="titleFont">~</view>
                                <view class="titleFont">结束日期</view>
                            </view>
                            <!--     <view class='inputClass' style="margin:10rpx auto 0;">
                                    <u--input placeholder="请选择" border="surround" v-model="startDate"></u--input>
                                </view> -->
                            <!-- icon='calendar' -->
                            <u-button type="info" iconColor="#0659FF" size="" @click="calendarClick"
                                :text="calendarRange">
                            </u-button>
 
                        </view>
                        <view style="display: flex;justify-content: space-around;width: 100%;">
                            <view class="head_block_item flex_column">
                                <view class="titleFont">报工数量</view>
                                <view class="number">{{ parseFloat(form.report_qty)}}</view>
                            </view>
                            <view class="head_block_item flex_column">
                                <view class="titleFont">不良数量</view>
                                <view class="number">{{ parseFloat(form.userngbadqty)}}</view>
                            </view>
                            <view class="head_block_item flex_column">
                                <view class="titleFont">工资收入(元)</view>
                                <view class="number">{{parseFloat(form.usermoney)}}</view>
                            </view>
                        </view>
                    </view>
                </view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view :style="{maxHeight:!custom?'830rpx':'960rpx',overflow: 'scroll'}">
                    <view v-for="(item,index) in detailOrderArray" :key="item.wo_code">
                        <view class="head">
                            <view
                                style="min-height: 100rpx; display: flex;justify-content: space-between; margin: 20rpx;">
                                <view class="flex_column" style="width: 65%;">
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            工单:
                                        </view>
                                        <view class="contentFont">
                                            {{item.wo_code}}
                                        </view>
                                    </view>
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            产品:
                                        </view>
                                        <view class="contentFont">
                                            {{item.partname}}
                                        </view>
                                    </view>
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            合格:
                                        </view>
                                        <view class="contentFont">
                                            {{item.report_qty}}
                                        </view>
                                    </view>
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            工废:
                                        </view>
                                        <view class="contentFont">
                                            {{item.laborbad_qty}}
                                        </view>
                                    </view>
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            单价:
                                        </view>
                                        <view class="contentFont">
                                            {{item.unprice}}
                                        </view>
                                    </view>
                                </view>
                                <view class="flex_column" style="width: 35%;">
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            数量:
                                        </view>
                                        <view class="contentFont">
                                            {{item.task_qty}}
                                        </view>
                                    </view>
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            工序:
                                        </view>
                                        <view class="contentFont">
                                            {{item.stepname}}
                                        </view>
                                    </view>
                                    <view class="lineH50">
                                        <view class="titleFont">
                                            不良:
                                        </view>
                                        <view class="contentFont">
                                            {{item.ng_qty}}
                                        </view>
                                    </view>
                                    <view class="lineH50" :style="{color:item.unprice===0?'red':''}">
                                        <view class="titleFont">
                                            料废:
                                        </view>
                                        <view class="contentFont">
                                            {{item.materielbad_qty}}
                                        </view>
                                    </view>
                                    <!--         <view class="lineH50">
                                        <view class="titleFont">
                                            人数:
                                        </view>
                                        <view class="contentFont">
                                            {{item.colum}}
                                        </view>
                                    </view> -->
                                </view>
                            </view>
                        </view>
                        <u-gap height="10" v-if="index!==detailOrderArray.length" bgColor="#eff0f1"></u-gap>
                    </view>
                </view>
            </view>
        </view>
 
 
 
        <uni-calendar ref="calendar" :range='true' :insert="false" @confirm="calendarConfirm" />
 
    </view>
</template>
 
 
<script>
    import {
        PieceRateWage
    } from '../../config/api.js';
 
    export default {
        onLoad(option) {},
 
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
 
        data() {
            return {
                topRightMessageCount: '',
 
                today: true,
                month: false,
                custom: true,
 
                username: uni.getStorageSync('username'),
                usercode: uni.getStorageSync('usercode'),
                group_name: uni.getStorageSync('group_name'),
 
                form: {
                    report_qty: 0,
                    userngbadmoney: 0,
                    usermoney: 0
                },
 
                calendarRange: new Date().getFullYear() + '-' + (new Date().getMonth() + 1).toString().padStart(
                    2, '0') + '-01' + '~' + new Date().toISOString().slice(0, 10),
 
                detailOrderArray: [],
 
 
                compute: true, // last 是末道   contin  每道
 
 
                key: new Date().getTime()
 
            }
        },
        created() {
 
        },
        mounted() {
            this.init()
 
            // uni.getSystemInfo({
            //     success: (res) => {
            //         console.log(res);
            //     }
            // })
            this.getData()
        },
        methods: {
            init() {
                uni.stopPullDownRefresh();
            },
            // 获取安灯消息列表长度
            getTopRightMessageCountIsChange(val) {
                this.topRightMessageCount = val
            },
            switchChange() {
                this.getData()
            },
            // 请求数据
            async getData() {
                const data = {
                    compute: this.compute ? 'last' : 'contin',
                    Ratetime: this.calendarRange
                }
                const res = await PieceRateWage(data)
                if (res.code === '200') {
                    this.form = res.data.dt0[0]
                    this.detailOrderArray = res.data.dt1
                    this.key = new Date().getTime()
                }
            },
            // 按钮切换
            dateChange(val) {
                if (val === 'today') {
                    this.today = false
                    this.month = true
                    this.custom = true
                    this.calendarRange = new Date().toISOString().slice(0, 10) + '~' + new Date().toISOString().slice(0,
                        10)
                } else if (val === 'month') {
                    this.today = true
                    this.month = false
                    this.custom = true
 
                    this.calendarRange = new Date().getFullYear() + '-' + (new Date().getMonth() + 1).toString().padStart(
                        2, '0') + '-01' + '~' + new Date().toISOString().slice(0, 10)
 
                } else if (val === 'custom') {
                    this.today = true
                    this.month = true
                    this.custom = false
                    this.calendarRange = new Date().getFullYear() + '-' + (new Date().getMonth() + 1).toString().padStart(
                        2, '0') + '-01' + '~' + new Date().toISOString().slice(0, 10)
                }
                this.getData()
            },
            calendarConfirm(val) {
                if (val.range.before < val.range.after) {
                    this.calendarRange = val.range.before + '~' + val.range.after
                } else {
                    this.calendarRange = val.range.after + '~' + val.range.before
                }
 
                if (val.range.before === '') {
                    this.calendarRange = new Date().toISOString().slice(0, 10) + '~' + val.range.after
                }
                if (val.range.after === '') {
                    this.calendarRange = val.range.before + '~' + new Date().toISOString().slice(0, 10)
                }
                if (val.range.before === '' && val.range.after === '') {
                    this.calendarRange = new Date().toISOString().slice(0, 10) + '~' + new Date().toISOString().slice(0,
                        10)
                }
                this.getData()
            },
            calendarClick() {
                this.$refs.calendar.open();
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
 
    .u-button--circle {
        margin: 0;
        width: 180rpx;
        border-radius: 20rpx;
    }
 
    .head_block_item {
        text-align: center;
 
        .number {
            font-weight: bolder;
            color: red;
        }
    }
 
    .u-button--info {
        width: 50%;
        height: 40rpx;
        border: 1px solid #0659FF;
        border-radius: 10rpx;
    }
 
    ::v-deep .uicon-calendar {
        font-size: 20rpx !important;
    }
 
    .lineH50 {
        line-height: 50rpx;
        display: flex;
    }
</style>