Houjie
22 小时以前 eacff2ef7312ff9ecfc098a508bac36329e96f14
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
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
<template>
    <view class="container">
        <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
            <block slot="backText">返回</block>
            <block slot="content">热处理入库</block>
            <block slot="right">
                <!-- 搜索按钮 -->
                <view @click="search" class="nav-btn">
                    <image src="/static/icon/sear.png" style="width: 25px; height: 25px;" alt="搜索" />
                </view>
            </block>
        </cu-custom>
 
        <!-- 筛选弹窗 -->
        <view style="width: 100%;">
            <uni-popup ref="popup" background-color="#fff" :type="type">
                <view class="popupView">
                    <!-- 基础表单校验 -->
                    <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext">
                        <uni-group title="" top="0">
                            <uni-forms-item name="type" :labelWidth="80" label="入库类型:">
                                <uni-data-select v-model="formData.type" :localdata="typeList" @change="changetypeList"
                                    placeholder="请选择入库类型" />
                            </uni-forms-item>
                            <uni-forms-item name="materialNumber" :labelWidth="80" label="物料编码:">
                                <view class="input-with-scan">
                                    <uni-easyinput v-model="formData.materialNumber" placeholder="请输入物料编码" />
                                </view>
                            </uni-forms-item>
                        </uni-group>
                        <uni-forms-item>
                            <view class="flex">
                                <view
                                    class="cuIcon-search flex-sub bg-blue radius padding-sm margin-xs margin-left-lg margin-right-lg text-sm text-center"
                                    @click="getSera">查询
                                </view>
                                <view
                                    class="cuIcon-refresh flex-sub bg-white solids padding-sm margin-xs radius text-sm text-center margin-left-lg margin-right-lg"
                                    @click="resetTask">重置</view>
                            </view>
                        </uni-forms-item>
                    </uni-forms>
                </view>
            </uni-popup>
        </view>
 
        
 
        <!-- 列表顶部:批量操作+状态筛选 -->
        <view class="industrial-list-header" style="margin-top: 10px;">
            <!-- 批量选择 -->
            <!-- 状态快捷筛选 -->
            <view class="status-filter">
                <view 
                    class="filter-item" 
                    :class="{active: currentFilterStatus === ''}"
                    @click="filterByStatus('')"
                >
                    全部
                </view>
                <view 
                    class="filter-item" 
                    :class="{active: currentFilterStatus === 'MATERIAL_TRANSFER_REQUEST'}"
                    @click="filterByStatus('MATERIAL_TRANSFER_REQUEST')"
                >
                    物料拉动
                </view>
                <view 
                    class="filter-item" 
                    :class="{active: currentFilterStatus === 'PRODUCTION_INBOUND'}"
                    @click="filterByStatus('PRODUCTION_INBOUND')"
                >
                    生产下线
                </view>
                <view 
                    class="filter-item" 
                    :class="{active: currentFilterStatus === 'HEAT_TREATMENT_INBOUND'}"
                    @click="filterByStatus('HEAT_TREATMENT_INBOUND')"
                >
                    热处理
                </view>
                
                <view
                    class="filter-item" 
                    :class="{active: currentFilterStatus === 'SMALL_INNER_RING'}"
                    @click="filterByStatus('SMALL_INNER_RING')"
                >
                    小内圈
                </view>
                <view
                    class="filter-item" 
                    :class="{active: currentFilterStatus === 'MATERIAL_INNER_TRANSFER'}"
                    @click="filterByStatus('MATERIAL_INNER_TRANSFER')"
                >
                    内部调拨
                </view>
                
                <view
                    class="filter-item" 
                    :class="{active: currentFilterStatus === 'PRODUCTION_UNLOADING'}"
                    @click="filterByStatus('PRODUCTION_UNLOADING')"
                >
                    下料
                </view>
            </view>
        </view>
 
        <!-- 列表内容 -->
        <view class="container">
            <mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="top" @down="downCallback" @up="upCallback">
                <!-- 列表信息开始 -->
                <view class="content">
                    <uni-card 
                        margin="10px" 
                        spacing="1px" 
                        v-for="(item,index) in msgList" 
                        :key="index"
                        class="industrial-card"
                        @click="onClickProductionTask(item)"
                    >
                        <!-- 核心信息区(默认展示) -->
                        <view class="core-info">    
                            <!-- 物料编码+名称 -->
                            <view class="material-info">
                                <text class="label">物料:</text>
                                <text class="code">{{ item.materialNumber }}</text>
                                <text class="name">{{ item.materialName }}</text>
                            </view>
                            
                            <!-- 批次号+入库数量 -->
                            <view class="batch-qty">
                                <text class="label">批次:</text>
                                <text class="batch">{{ item.batchNumber }}</text>
                                <text class="label qty-label">数量:</text>
                                <text class="qty">{{ item.quantity }}</text>
                            </view>
                        </view>
                        
                        <!-- 次要信息区(折叠展开) -->
                        <view class="expand-info" @click.stop="item.showExpand = !item.showExpand">
                            <text class="expand-btn">{{ item.showExpand ? '收起详情' : '展开详情' }}</text>
                            <uni-icons 
                                :type="item.showExpand ? 'up' : 'down'" 
                                size="14" 
                                class="expand-icon"
                            />
                        </view>
                        <view class="detail-info" v-if="item.showExpand">
                            <view class="detail-row">
                                <text class="detail-label">来源编码:</text>
                                <text class="detail-value">{{ item.originalCode }}</text>
                            </view>
                            <view class="detail-row">
                                <text class="detail-label">来源名称:</text>
                                <text class="detail-value">{{ item.originalName }}</text>
                            </view>
                            <view class="detail-row">
                                <text class="detail-label">线边库:</text>
                                <text class="detail-value">{{ item.warehouseId_dictText }}</text>
                            </view>
                            <view class="detail-row" >
                                <text class="detail-label">入库类型:</text>
                                <text class="detail-value">{{ item.inboundCategory_dictText }}</text>
                            </view>
                            <view class="detail-row">
                                <text class="detail-label">入库人:</text>
                                <text class="detail-value">{{ item.receiver_dictText }}</text>
                            </view>
                            <view class="detail-row">
                                <text class="detail-label">入库时间:</text>
                                <text class="detail-value">{{ formatTime(item.receiveTime) }}</text>
                            </view>
                        </view>
                    </uni-card>
                </view>
            </mescroll-uni>
        </view>
    </view>
</template>
 
<script>
    import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
    import { mapGetters } from "vuex";
    
    export default {
        mixins: [MescrollMixin], // 使用mixin
        data() {
            return {
                type: 'top',
                showAddMenu: false, // 新增下拉菜单显示状态
                selectAll: false, // 全选状态
                currentFilterStatus: '', // 当前筛选的状态
                scrollLeft: 0,
                formData: {
                    materialNumber: '',
                    type: ''
                },
                NavBarColor: this.NavBarColor,
                activeColor: '#5277A6',
                url: {
                    inboundTypeDict: "/sys/dict/getDictItems/base_line_side_warehouse,warehouse_name,id,del_flag=0%20and%20warehouse_status='1'",
                    heatTreatmentInboundList: "/lsw/materialInbound/list",
                    exportInbound: "/lsw/materialInbound/export"
                },
 
                upOption: {
                    page: {
                        num: 1, // 当前页码,从1开始
                        size: 10 // 每页数据的数量
                    },
                    noMoreSize: 4, // 如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据
                    empty: {
                        tip: '~ 暂无热处理入库记录 ~', // 提示
                    },
                    loading: '',
                    text: '全部',
                    isShowNoMore: false,
                    textNoMore: '已加载全部数据'
                },
                styles: {
                    color: '#2979FF',
                    borderColor: '#2979FF'
                },
                typeList: [],
                msgList: [], // 列表数据
                currentFilter: { // 当前筛选条件
                    type: '',
                    materialNumber: '',
                    status: ''
                },
                announcement1: [],
                msg1Count: 0,
                msg2Count: 0,
                msg1Title: ""
            }
        },
        computed: {
            ...mapGetters(["currentLineName", "username", "currentLineId"]),
            top() {
                return this.CustomBar * 2 + 180
            },
            style() {
                var StatusBar = this.StatusBar;
                var CustomBar = this.CustomBar;
                var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
                return style
            },
        },
 
 
        onShow() {
            if (this.mescroll) {
                this.mescroll.resetUpScroll()
            }
        },
    
        created() {
            this.getTypeList()
        },
        methods: {
            /**
             * 流程分类列表事件
             */
            getTypeList() {
                this.$http.get(this.url.inboundTypeDict).then(res => {
                    // 设置列表数据
                    if (res.data.success) {
                        // 确保返回格式为[{value: '编码', text: '名称'}]
                        this.typeList = res.data.result.map(item => ({
                            value: item.value,
                            text: item.text
                        }));
                    }
                }).catch(err => {
                    console.error('获取入库类型失败:', err);
                    uni.showToast({
                        title: '获取入库类型失败',
                        icon: 'none',
                        duration: 2000
                    });
                })
            },
            
            // 处理入库类型选择变化
            changetypeList(e) {
                this.formData.type = e;
            },
            
 
            
            /**
             * 查看入库详情
             */
            onClickProductionTask(item) {
                uni.navigateTo({
                    url: `/pages/heatTreatmentInbound/detailInbound?id=${item.id}`
                });
            },
 
            // 打开搜索弹窗
            search() {
                this.$refs.popup.open();
            },
 
            // 上拉加载回调
            upCallback(page) {
                // 携带当前筛选条件和分页参数
                const params = {
                    pageNo: page.num,
                    pageSize: page.size,
                    order: 'desc',
                    column: 'createTime',
                    warehouseId: this.formData.type,
                    materialNumber: this.currentFilter.materialNumber,
                    inboundCategory: this.currentFilter.status
                };
 
                this.$http.get(this.url.heatTreatmentInboundList, { params })
                    .then(res => {
                        if (res.data.success) {
                            const newData = res.data.result.records || [];
                            // 为每条数据添加选中状态和展开状态
                            const formattedData = newData.map(item => ({
                                ...item,
                                selected: false,
                                showExpand: false
                            }));
                            
                            // 分页逻辑:第一页覆盖数据,后续页追加
                            if (page.num === 1) {
                                this.msgList = formattedData;
                            } else {
                                this.msgList = this.msgList.concat(formattedData);
                            }
                            
                            // 告诉mescroll加载结果
                            this.mescroll.endSuccess(formattedData.length, res.data.result.total);
                            // 更新统计信息
                            this.msg1Count = res.data.result.total;
                            this.msg1Title = `通知(${this.msg1Count})`;
                        } else {
                            uni.showToast({ 
                                title: res.data.message || '获取数据失败', 
                                icon: 'none',
                                duration: 2000
                            });
                            this.mescroll.endErr();
                        }
                    })
                    .catch(err => {
                        console.error('分页加载失败:', err);
                        uni.showToast({ 
                            title: '加载失败,请重试', 
                            icon: 'none',
                            duration: 2000
                        });
                        this.mescroll.endErr();
                    });
            },
 
            // 下拉刷新回调
            downCallback() {
                // 重置页码并重新加载数据
                this.mescroll.resetUpScroll();
            },
 
            // 重置筛选条件
            resetTask() {
                this.formData = {
                    materialNumber: '',
                    type: ''
                };
                this.currentFilter = {
                    type: '',
                    materialNumber: '',
                    inboundCategory: this.currentFilterStatus // 保留状态筛选
                };
                this.$refs.popup.close();
                this.mescroll.resetUpScroll();
            },
            
            // 执行筛选
            getSera() {
                this.$refs.popup.close();
                // 保存当前筛选条件
                this.currentFilter = {
                    ...this.currentFilter,
                    warehouseId: this.formData.type,
                    materialNumber: this.formData.materialNumber
                };
                // 重置列表到第一页
                this.mescroll.resetUpScroll();
            },
 
            // 按状态筛选
            filterByStatus(status) {
                this.currentFilterStatus = status;
                // 同步筛选条件
                this.currentFilter = {
                    ...this.currentFilter,
                    status: status
                };
                // 重置列表并加载数据
                this.mescroll.resetUpScroll();
            },
            // 初始化mescroll
            mescrollInit(mescroll) {
                console.log('mescroll初始化完成');
                this.mescroll = mescroll;
            },
            
            // 格式化时间
            formatTime(timeStr) {
                if (!timeStr) return '';
                // 简单的时间格式化示例,可根据实际需求调整
                const date = new Date(timeStr);
                return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
            },
            
            // 状态样式映射(工业标准色)
            getStatusClass(status) {
                const statusMap = {
                    'HEAT_TREATMENT_INBOUND': 'status-completed', // 深绿:正常完成
                    'SMALL_INNER_RING': 'status-pending',     // 黄色:待审核
                    'MATERIAL_INNER_TRANSFER': 'status-rework',       // 橙色:返工
                    'PRODUCTION_UNLOADING': 'status-abnormal'    // 红色:异常
                };
                return statusMap[status] || 'status-default';
            }
        },
    }
</script>
 
<style>
    .is-hover {
        color: rgba(255, 255, 255, 0.6);
        background-color: #55aaff;
        border-color: #55aaff;
    }
 
    .content {
        margin-top: 5px;
    }
 
    .content scroll-view {
        scrollIndicator: "none"
    }
 
    .popupView {
        margin-top: 45px;
        height: auto;
    }
 
    /* 新增按钮下拉菜单样式 */
    .industrial-add-menu {
        background: #fff;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        padding: 8px 0;
    }
    .menu-item {
        display: flex;
        align-items: center;
        padding: 10px 16px;
        font-size: 14px;
        color: #333;
    }
    .menu-item uni-icons {
        margin-right: 8px;
    }
    .menu-item:active {
        background: #f5f7fa;
    }
 
    /* 列表上方操作栏 */
    .industrial-operation-bar {
        display: flex;
        align-items: center;
        background: #fff;
        border-radius: 4px;
        padding: 8px 16px;
        margin: 10px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    .operation-btn {
        display: flex;
        align-items: center;
        margin-right: 20px;
        color: #333;
        font-size: 13px;
    }
    .operation-btn uni-icons {
        margin-right: 4px;
    }
    .operation-btn:active {
        color: #009688; /* 工业场景常用主色(深绿,代表生产/合格) */
    }
 
    /* 导航栏按钮间距 */
    .nav-btn {
        margin-left: 15px;
    }
    .add-icon-down {
        margin-left: 3px;
    }
 
    /* 列表顶部样式 */
    .industrial-list-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 10px;
        margin-bottom: 10px;
    }
    .batch-select {
        display: flex;
        align-items: center;
        color: #333;
        font-size: 13px;
    }
    .batch-text {
        margin-left: 5px;
    }
    .status-filter {
        display: flex;
        align-items: center;
        overflow-x: auto;
        padding: 5px 0;
    }
    .filter-item {
        padding: 4px 10px;
        margin-left: 8px;
        font-size: 10px;
        border-radius: 12px;
        background: #f5f5f5;
        color: #666;
        white-space: nowrap;
    }
    .filter-item:first-child {
        margin-left: 0;
    }
    .filter-item.active {
        background: #009688;
        color: #fff;
    }
    .filter-item:active {
        opacity: 0.8;
    }
 
    /* 列表卡片样式(工业风:简洁、硬朗) */
    .industrial-card {
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        border-radius: 4px;
        border: none;
    }
 
    /* 状态标签样式(工业标准色) */
    .status-tag {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 2px;
        font-size: 12px;
        color: #fff;
        margin-right: 10px;
    }
    .status-completed {
        background: #009688; /* 工业合格色:深绿 */
    }
    .status-pending {
        background: #FFC107; /* 待处理色:黄色 */
        color: #333; /* 黄色背景配深色文字,提升可读性 */
    }
    .status-rework {
        background: #FF9800; /* 返工色:橙色 */
    }
    .status-abnormal {
        background: #F44336; /* 异常色:红色 */
    }
    .status-default {
        background: #9E9E9E; /* 默认色:灰色 */
    }
 
    /* 核心信息区布局 */
    .core-info {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #f5f5f5;
    }
    .item-checkbox {
        margin-right: 10px;
    }
    .material-info {
        flex: 1;
        min-width: 200px;
        margin: 5px 0;
    }
    .label {
        font-size: 12px;
        color: #666;
        margin-right: 4px;
    }
    .code {
        font-weight: bold;
        color: #333;
        margin-right: 8px;
    }
    .name {
        font-size: 13px;
        color: #333;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    .batch-qty {
        flex: 1;
        min-width: 200px;
        margin: 5px 0;
        display: flex;
        align-items: center;
    }
    .batch {
        font-size: 13px;
        color: #333;
        margin-right: 15px;
    }
    .qty-label {
        margin-left: 10px;
    }
    .qty {
        font-weight: bold;
        color: #009688; /* 数量用主色突出 */
        font-size: 14px;
    }
 
    /* 快捷操作区 */
    .quick-ops {
        display: flex;
        align-items: center;
        margin-left: auto;
    }
    .op-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-left: 15px;
        font-size: 12px;
        color: #666;
    }
    .op-btn uni-icons {
        margin-bottom: 2px;
    }
    .op-btn:active {
        color: #009688;
    }
 
    /* 展开详情区 */
    .expand-info {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 0;
        color: #009688;
        font-size: 12px;
        cursor: pointer;
    }
    .expand-btn {
        margin-right: 5px;
    }
    .detail-info {
        padding: 10px 15px;
        background: #fafafa;
        border-radius: 4px;
        margin-top: 8px;
    }
    .detail-row {
        display: flex;
        align-items: center;
        margin-bottom: 6px;
        font-size: 12px;
    }
    .detail-label {
        width: 80px;
        color: #666;
    }
    .detail-value {
        color: #333;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
 
    /* 带扫码图标的输入框 */
    .input-with-scan {
        position: relative;
    }
    .scan-icon {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
    }
</style>