chenhaozhe
2025-08-06 00a363f1ef1e2ded9f7a8e933cd89d863458a3b4
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
<template>
    <view class="content">
        <view class="form">
            <view class="form-item">
                <view class="title">状态:</view>
                <view class="right">
                    <picker :range="arrayStatus" :value="hform.HStatus" @change="HStatusChange">
                        <input name="HStatus" disabled :value="hform.HStatus" placeholder="请选择状态" />
                    </picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">开始时间:</view>
                <view class="right">
                    <picker mode="date" :value="hform.HBeginDate" @change="HBeginDateChange">
                        <input name="HBeginDate" disabled :value="hform.HBeginDate" placeholder="请选择" />
                    </picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">结束时间:</view>
                <view class="right">
                    <picker mode="date" :value="hform.HEndDate" @change="HEndDateChange">
                        <input name="HEndDate" disabled :value="hform.HEndDate" placeholder="请选择" />
                    </picker>
                </view>
            </view>
            <view v-if="showmore">
                <view class="form-item">
                    <view class="title">任务单号:</view>
                    <view class="right">
                        <input v-model="hform.HWorkBillNo" placeholder="请输入任务单号" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="right">
                        <input v-model="hform.HBillNo" placeholder="请输入单据号" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">流转卡号:</view>
                    <view class="right">
                        <input v-model="hform.HProcExchBillNo" placeholder="请输入工序流转卡号" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">产品代码:</view>
                    <view class="right">
                        <input v-model="hform.HNumber" placeholder="请输入产品代码" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">当前工序:</view>
                    <view class="right">
                        <input v-model="hform.HName" placeholder="请输入当前工序" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">过滤:</view>
                    <view class="right">
                        <picker :range="arrayColName" :value="hform.ColName" @change="ColNameChange">
                            <input name="ColName" disabled :value="hform.ColName" placeholder="请选择项目" />
                        </picker>
                    </view>
                </view>
                <view class="form-item" v-if="hform.ColName">
                    <picker :range="arrayComparator" :value="hform.Comparator" @change="ComparatorChange">
                        <view class="left">{{hform.Comparator?hform.Comparator:'选择条件'}}</view>
                    </picker>
                    <view class="right">
                        <input v-model="hform.ColContent" placeholder="输入内容" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="choose" @tap="hform.checkHWasterQty = hform.checkHWasterQty==1?'':1">
                        <radio value="1" :checked="hform.checkHWasterQty == 1" style="transform:scale(0.8);"/>报废数量不为0
                    </view>
                </view>
            </view>
            <view class="other">
                <view v-if="!showmore" @tap="showmore = true">
                    展开其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
                </view>
                <view v-if="showmore" @tap="showmore = false">
                    折叠其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
                </view>
            </view>
            
            <view class="buttons">
                <button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
                <button class="btn-b" size="mini" type="default" @tap="creat">新增</button>
                <button class="btn-c" size="mini" type="default" @tap="search">查询</button>
            </view>
        </view>
        
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        
        <view class="list" v-for="(item,index) in showList" :key="index">
            <uni-card :title="item.任务单" :extra="item.单据号" style="margin: 10px;" @tap="showDetail = showDetail==index?-1:index">
                <view class="card-detail">
                    <view class="detail" v-if="item.工序流转卡号">
                        <text>流转卡号:</text>{{item.工序流转卡号}}
                    </view>
                    <view class="detail" v-if="item.产品名称">
                        <text>产品名称:</text>{{item.产品名称}}
                    </view>
                    <view class="detail" v-if="item.产品代码">
                        <text>产品代码:</text>{{item.产品代码}}
                    </view>
                    <view class="detail" v-if="item.当前工序">
                        <text>当前工序:</text>{{item.当前工序}}
                    </view>
                    <view class="detail" v-if="item.当前工序代码">
                        <text>工序代码:</text>{{item.当前工序代码}}
                    </view>
                    <view class="detail" v-if="item.日期">
                        <text>日期:</text>{{item.日期.substr(0,10)}}
                    </view>
                </view>
                <view class="card-detail" v-if="showDetail == index">
                    <view class="detail" v-if="item.规格型号">
                        <text>规格型号:</text>{{item.规格型号}}
                    </view>
                    <view class="detail" v-if="item.流水号">
                        <text>流水号:</text>{{item.流水号}}
                    </view>
                    <view class="detail" v-if="item.出站数量">
                        <text>出站数量:</text>{{item.出站数量}}
                    </view>
                    <view class="detail" v-if="item.不良数量">
                        <text>不良数量:</text>{{item.不良数量}}
                    </view>
                    <view class="detail" v-if="item.报废数量">
                        <text>报废数量:</text>{{item.报废数量}}
                    </view>
                    <view class="detail" v-if="item.包装标识">
                        <text>包装标识:</text>{{item.包装标识}}
                    </view>
                    <view class="detail" v-if="item.包装标识代码">
                        <text>包装标识代码:</text>{{item.包装标识代码}}
                    </view>
                    <view class="detail" v-if="item.出站时间">
                        <text>出站时间:</text>{{item.出站时间.substr(0,19)}}
                    </view>
                    
                    <view class="detail" v-if="item.操作员">
                        <text>操作员:</text>{{item.操作员}}
                    </view>
                    <view class="detail" v-if="item.操作员代码">
                        <text>操作员代码:</text>{{item.操作员代码}}
                    </view>
                    <view class="detail" v-if="item.生产资源">
                        <text>生产资源:</text>{{item.生产资源}}
                    </view>
                    <view class="detail" v-if="item.生产资源代码">
                        <text>生产资源代码:</text>{{item.生产资源代码}}
                    </view>
                    <view class="detail" v-if="item.生产班组">
                        <text>生产班组:</text>{{item.生产班组}}
                    </view>
                    <view class="detail" v-if="item.生产班组代码">
                        <text>生产班组代码:</text>{{item.生产班组代码}}
                    </view>
                    <view class="detail" v-if="item.LOT数量">
                        <text>LOT数量:</text>{{item.LOT数量}}
                    </view>
                    <view class="detail" v-if="item.制单人">
                        <text>制单人:</text>{{item.制单人}}
                    </view>
                    <view class="detail" v-if="item.制单日期">
                        <text>制单日期:</text>{{item.制单日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.修改人">
                        <text>修改人:</text>{{item.修改人}}
                    </view>
                    <view class="detail" v-if="item.修改日期">
                        <text>修改日期:</text>{{item.修改日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.审核人">
                        <text>审核人:</text>{{item.审核人}}
                    </view>
                    <view class="detail" v-if="item.审核日期">
                        <text>审核日期:</text>{{item.审核日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.关闭人">
                        <text>关闭人:</text>{{item.关闭人}}
                    </view>
                    <view class="detail" v-if="item.关闭日期">
                        <text>关闭日期:</text>{{item.关闭日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.备注">
                        <text>备注:</text>{{item.备注}}
                    </view>
                </view>
                
                <view class="more" v-if="showDetail == index && operations != index">
                    <view class="part" style="border-right: 1px solid #eee;">
                        <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                    </view>
                    <view class="part" @tap.stop="operations = operations==index?-1:index">
                        <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>操作
                    </view>
                </view>
                <view class="more" v-if="showDetail != index && operations != index">
                    <view class="part" style="border-right: 1px solid #eee;">
                        <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                    </view>
                    <view class="part" @tap.stop="operations = operations==index?-1:index">
                        <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>操作
                    </view>
                </view>
                
                <view class="op" v-if="operations == index">
<!--                     <button class="op1" size="mini" plain @tap.stop="check(item)">审核</button>
                    <button class="op2" size="mini" plain @tap.stop="antiCheck(item)">反审核</button> -->
                    <!-- <button class="op1" size="mini" plain @tap.stop="qcCheck(item)">工序检</button> -->
                    <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button>
                    <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
                    <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
                </view>
            </uni-card>
        </view>
        
        <view class="over" v-if="listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
        <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
    </view>
</template>
 
<script>
    import { getUserInfo } from "@/utils/auth.js";
    export default {
        data() {
            return {
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                showmore:false,
                arrayStatus:['全部','未审核','已审核','已关闭'],
                arrayColName:['任务单','单据号','流转卡号','产品名称','产品代码','当前工序','当前工序代码','日期','规格型号','流水号','出站数量','不良数量','报废数量','包装标识','包装标识代码','出站时间','操作员','操作员代码','生产资源','生产资源代码','生产班组','生产班组代码','LOT数量','制单人'],
                arrayComparator:['=','>=','>','<=','<','<>','包含','左包含','右包含','不包含'],
                hform:{
                    HStatus:'全部',
                    HBeginDate:'',
                    HEndDate:'',
                    HWorkBillNo:'',
                    HBillNo:'',
                    HProcExchBillNo:'',
                    HNumber:'',
                    HName:'',
                    checkHWasterQty:'',
                    
                    ColName:'',
                    Comparator:'',
                    ColContent:'',
                },
                sWhere:'',
                listData:[],
                showList:[],
                showDetail:-1,
                operations:-1,
                
                page:1,
            }
        },
        onLoad() {
            this.getList()
            // console.log(this.userInfo,uni.getStorageSync('HUserName'))
        },
        onReachBottom: function() {
            this.page++
            setTimeout(() => {
                this.showList = this.showList.concat(this.getPage(this.page,this.listData))
            }, 100)
        },
        onPullDownRefresh: function() {
            this.clear()
            setTimeout(()=>{
                uni.stopPullDownRefresh();
            }, 1000);
        },
        methods: {
            getPage(page,list){
                let sindex = (parseInt(page) - 1) * 20
                let eindex = parseInt(page) * 20
                let newList = list.slice(sindex,eindex)
                return newList
            },
            getList(){
                this.sWhere += ` and 制单人 like N'%${this.userInfo.HEmpName}'`
                uni.showLoading({
                    title:'加载中...'
                })
                uni.request({
                    url: this.serverUrl + '/Cj_StationOutBill/get_Display',
                    data:{ 
                        sWhere: this.sWhere,
                        user: uni.getStorageSync('HUserName'),
                        HBillSubType:'',
                    },
                    success: (res) => {
                        // console.log(1,res.data.data);
                        if(res.data.count == 1){
                            this.listData = res.data.data
                            this.showList = this.getPage(this.page,this.listData)
                            setTimeout(()=>{
                                 uni.hideLoading()
                            }, 1000)
                        }else{
                            uni.hideLoading()
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.hideLoading()
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
                this.sWhere = ``
            },
            //状态
            HStatusChange(e){
                console.log(e.detail.value)
                this.hform.HStatus = this.arrayStatus[e.detail.value]
            },
            //选择单据日期
            HBeginDateChange(e){
                console.log(e.detail.value)
                this.hform.HBeginDate = e.detail.value
            },
            //选择单据日期
            HEndDateChange(e){
                console.log(e.detail.value)
                this.hform.HEndDate = e.detail.value
            },
            //选择
            radioChange(e){
                console.log(e)
            },
            //过滤
            ColNameChange(e){
                // console.log(e.detail.value)
                this.hform.ColName = this.arrayColName[e.detail.value]
                console.log(this.hform)
            },
            //条件
            ComparatorChange(e){
                // console.log(e.detail.value)
                this.hform.Comparator = this.arrayComparator[e.detail.value]
                console.log(this.hform)
            },
            //搜索
            search(){
                this.sWhere = ''
                this.listData = []
                this.page = 1
                this.showList = []
                
                console.log(this.hform)
 
                if (this.hform.HStatus) {
                    if(this.hform.HStatus == '全部'){
                        this.sWhere += "";
                    }else if(this.hform.HStatus == '未审核'){
                        this.sWhere += " and 审核人=''";
                    }else if(this.hform.HStatus == '已审核'){
                        this.sWhere += " and 审核人<>''";
                    }else if(this.hform.HStatus == '已关闭'){
                        this.sWhere += " and 关闭人<>''";
                    }
                }
                if (this.hform.BenginHCreateDate) {
                    this.sWhere += " and CONVERT(varchar(100),进站时间, 23) >= '" + this.hform.BenginHCreateDate + "'";
                }
                if (this.hform.EndHCreateDate) {
                    this.sWhere += " and CONVERT(varchar(100),进站时间, 23) >= '" + this.hform.EndHCreateDate + "'";
                }
                if (this.hform.HBillNo) {
                    this.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
                }
                if (this.hform.HNumber) {
                    this.sWhere += " and 产品代码 like '%" + this.hform.HNumber + "%'";
                }
                if (this.hform.HName) {
                    this.sWhere += " and 当前工序 like '%" + this.hform.HName + "%'";
                }
                if (this.hform.HWorkBillNo) {
                    this.sWhere += " and 任务单 like '%" + this.hform.HWorkBillNo + "%'";
                }
                if (this.hform.HProcExchBillNo) {
                    this.sWhere += " and 工序流转卡号 like '%" + this.hform.HProcExchBillNo + "%'";
                }
                if (this.hform.checkHWasterQty) {
                    this.sWhere +=  "  and 报废数量>0 ";
                }
                if (this.hform.ColName && this.hform.Comparator) {
                    var com = "";
                    if(this.hform.Comparator == '包含'){
                        com = "like'%" + this.hform.ColContent + "%'";
                    }else if(this.hform.Comparator == '左包含'){
                        com = "like'%" + this.hform.ColContent + "'";
                    }else if(this.hform.Comparator == '右包含'){
                        com = "like'" + this.hform.ColContent + "%'";
                    }else if(this.hform.Comparator == '不包含'){
                        com = "not like'%" + this.hform.ColContent + "%'";
                    }else{
                        com = "" + this.hform.Comparator + "'" + this.hform.ColContent + "'";
                    }
                    
                    this.sWhere += " and " + this.hform.ColName + " " + com;
                }
                
                this.getList()
            },
            //新增
            creat(){
                uni.navigateTo({
                    url:'/pages/gongxuOut/form'
                })
            },
            //重置
            clear(){
                this.listData = []
                this.page = 1
                this.showList = []
                
                this.showmore = false
                this.sWhere = ''
                this.showDetail = -1,
                this.operations = -1,
                this.hform = {
                    HStatus:'全部',
                    HBeginDate:'',
                    HEndDate:'',
                    HWorkBillNo:'',
                    HBillNo:'',
                    HProcExchBillNo:'',
                    HNumber:'',
                    HName:'',
                    checkHWasterQty:'',
                    
                    ColName:'',
                    Comparator:'',
                    ColContent:'',
                }
                this.getList()
            },
            //工序检
            qcCheck(item){
                console.log(item)
                uni.showToast({
                    title:'暂无资源',
                    icon:"none"
                })
                // uni.navigateTo({
                //     url:'/pages/weiwaigxOut/firstCheck?HSouceBillType=3793&HICMOEntryID=0&linterid=' + item.HInterID
                // })
            },
            //编辑
            edit(item){
                console.log(item)
                uni.navigateTo({
                    url:'/pages/gongxuOut/form?linterid=' + item.hmainid + '&HBillNo=' + item.单据号
                })
            },
            //删除
            del(item){
                console.log(item)
                uni.showModal({
                    title: '提示',
                    content: '确认要删除吗,删除后不能恢复',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.request({
                                url: this.serverUrl + '/Cj_StationOutBill/del_StationOutBill',
                                data:{ 
                                    HInterID: item.hmainid,
                                    HDeleteMan: uni.getStorageSync('HUserName')
                                },
                                success: (res) => {
                                    console.log(1,res);
                                    if(res.data.count == 1){
                                        this.clear()
                                    }
                                    uni.showToast({
                                        title:res.data.Message,
                                        icon:'none'
                                    })
                                },
                                fail: (res) => {
                                    console.log(res);
                                    uni.showToast({
                                        title:'接口请求失败',
                                        icon:'none'
                                    })
                                },
                            });
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            },
            // //审核
            // check(item){
            //     console.log(item)
            //     if (item.HBillStatus > 0) {
            //         uni.showToast({
            //             title:'单据不为未审核状态!'
            //         })
            //     }
            // },
            // //反审核
            // antiCheck(item){
                
            // },
        }
    }
</script>
 
<style lang="scss" scoped>
    .form{
        width: 640rpx;
        margin: 20rpx auto;
    }
    .other{
        margin-top: 8rpx;
        text-align: center;
        font-size: 28rpx;
        padding: 4rpx 18rpx;
        color: #1890FF;
    }
    .form-item{
        display: flex;
        align-items: center;
        font-size: 28rpx;
        padding: 6rpx 0;
        .title{
            width: 180rpx;
            text{
                color: red;
                font-weight: bold;
            }
        }
        .choose{
            padding: 4rpx 16rpx 0 0;
            width: 100%;
            text-align: right;
        }
        .left{
            width: 170rpx;
            padding: 10rpx 0;
            margin-right: 10rpx;
            border: 1px solid #acacac;
            border-radius: 22rpx;
            color: #888;
            text-align: center;
        }
        .right{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input{
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
    }
    .buttons{
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 20rpx;
        button{
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a{
            background-color: #acacac;
            color: #fff;
        }
        .btn-b{
            background-color: #41a863;
            color: #fff;
        }
        .btn-c{
            background-color: #3a78ff;
            color: #fff;
        }
    }
    
    .list{
        width: 100%;
        .card-detail{
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
            .detail{
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
                text{
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
        .more{
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
            .part{
                width: 50%;
                text-align: center;
            }
        }
        .op{
            display: flex;
            justify-content: space-around;
            margin-top: 20rpx;
            button{
                padding: 0;
                width: 150rpx;
                font-size: 25rpx;
            }
            .op1{
                border: 1px solid #41a863;
                color: #41a863;
            }
            .op2{
                border: 1px solid #d98d00;
                color: #d98d00;
            }
            .op3{
                border: 1px solid #3a78ff;
                color: #3a78ff;
            }
            .op4{
                border: 1px solid #da0000;
                color: #da0000;
            }
            .op5{
                border: 1px solid #888;
                color: #888;
            }
        }
    }
 
</style>