1
wangyi
2026-03-12 f5bcbefaf9bbaa1d4d2ff3b8805d751c1ed3939a
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
<template>
    <view class="content">
        <view class="header">
            <view class="switch-button">
                <uni-icons type="loop" @click="switchIconsModeHandler"></uni-icons>
            </view>
        </view>
        <view class="mains">
            <view v-if="!canEdit" :hidden="item.hidden||!item.id" class="box" v-for="(item,index) in itemData"
                :key="index" @tap="toUrl(item)">
                <template v-if="item.corner">
                    <uni-badge :text="item.cornerCount" style="z-index: 99 !important;" type="error" :max-num="99" size="normal"
                        absolute="rightTop"
                        :offset="[7, 7]">
                        <image :src="item.img" mode=""></image>
                    </uni-badge>
                </template>
                <template v-else>
                    <image :src="item.img" mode=""></image>
                </template>
                <view class="texts">
                    {{item.text}}
                </view>
            </view>
            <view :enable-hidden="item.hidden" :hidden="!item.id" v-if="canEdit" class="box edit"
                v-for="(item,index) in itemData" :key="index" @tap="switchHidden(index)">
                <uni-icons class="edit-mark" color="red" type="closeempty"></uni-icons>
                <image :src="item.img" mode=""></image>
                <view class="texts">
                    {{item.text}}
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import {
        CommonUtils
    } from '../../utils/common'
    import {
        getMenuList,
        setMenuList
    } from '../../utils/menuListApp'
    import {
        getUserInfo
    } from '../../utils/auth'
    export default {
        data() {
            return {
                updateCount: 0,
                menuListName: 'tab3',
                canEdit: false,
                initFinished: false,
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                itemData: [{
                        img: '../../static/icon/icon8.png',
                        text: '模具档案查询',
                        url: `/pages/MJGL/Gy_MouldFile/Gy_MouldFileList`,
                        id: 1,
                        hidden: false,
                    },
                    {
                        img: '../../static/icon/icon6.png',
                        text: '模具状态分析',
                        tip: '查看详情',
                        url: '/pages/mujvzhuangtai/mujvzhuangtai',
                        id: 2,
                        hidden: false,
 
                    },
                    {
                        img: '../../static/icon/icon16.png',
                        text: '模具寿命',
                        url: '/pages/shoujishouming/table',
                        id: 3,
                        hidden: false,
                    },
                    // {
                    //     "img": "../../static/icon/icon13.png",
                    //     "text": "模具故障登记单",
                    //     "url": "/pages/MJGL/Sc_MouldConkBookBill/Sc_MouldConkBookBill?operationType=1",
                    //     "id": 4,
                    //     "hidden": false
                    // },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备保养任务",
                        "url": "/pages/MJGL/SBMJReport/Sb_EquipMaintainTaskReport",
                        "id": 24,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具保养任务",
                        "url": "/pages/MJGL/SBMJReport/Sc_MouldMaintainTaskReport",
                        "id": 25,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备维修任务",
                        "url": "/pages/MJGL/Sb_EquipRepairTaskReport/Sb_EquipRepairTaskReport",
                        "id": 26,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具维修任务",
                        "url": "/pages/MJGL/Sc_MouldRepairTaskReport/Sc_MouldRepairTaskReport",
                        "id": 27,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备待点检任务",
                        "url": "/pages/MJGL/Sb_EquipDotCheckTaskReport/Sb_EquipDotCheckTaskReport",
                        "id": 29,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具待点检任务",
                        "url": "/pages/MJGL/Sc_MouldDotCheckTaskReport/Sc_MouldDotCheckTaskReport",
                        "id": 30,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具维修派工单",
                        "url": "/pages/MJGL/Sc_MouldRepairSendWork/Sc_MouldRepairSendWorkBill",
                        "id": 5,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon13.png",
                        "text": "模具维修记录单",
                        "url": "/pages/MJGL/Sc_MouldRepairWorkBill/Sc_MouldRepairWorkBill",
                        "id": 6,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具维修验收单",
                        "url": "/pages/MJGL/SC_MouldRepairCheck/Sc_MouldRepairCheckBill",
                        "id": 7,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具点检记录单",
                        "url": "/pages/MJGL/mujudianjianjiludan/Sc_MouldDotCheckBill",
                        "id": 8,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具保养记录单",
                        "url": "/pages/MJGL/mujubaoyangjiludan/Sc_MouldMaintainBill",
                        "id": 9,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具领用出库单",
                        "url": "/pages/MJGL/mujulingliaochukudan/MouldProdOutBill",
                        "id": 10,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具领用退库单",
                        "url": "/pages/MJGL/mujulingliaotuikudan/Sc_MouldProdBackBill",
                        "id": 11,
                        "hidden": false
                    },
                    // {
                    //     img: '../../static/icon/icon8.png',
                    //     text: '上模单',
                    //     url: `/pages/MJGL/shangmudan/MouldUpperBill`,
                    //     id: 12,
                    //     hidden: false,
                    // },
                    // {
                    //     img: '../../static/icon/icon8.png',
                    //     text: '下模单',
                    //     url: `/pages/MJGL/xiamodan/MouldLowerBill`,
                    //     id: 13,
                    //     hidden: false,
                    // },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具报废出库单",
                        "url": "/pages/MJGL/MouldScrapOutBill/MouldScrapOutBill",
                        "id": 14,
                        "hidden": false
                    },
                    {
                        img: '../../static/icon/icon1.png',
                        text: '设备档案查询',
                        tip: '查看详情',
                        url: '/pages/shebeidangan/Gy_EquipFileMainBillList',
                        id: 15,
                        hidden: true,
                    },
                    {
                        img: '../../static/icon/icon8.png',
                        text: '设备履历查询',
                        tip: '查看详情',
                        url: '/pages/shebeilvli/EquipFileBillResume',
                        id: 16,
                        hidden: true,
                    },
                    {
                        img: '../../static/icon/icon32.png',
                        text: '设备运行状态',
                        tip: '查看详情',
                        url: '/pages/shebeiyunxingzhuangtai/shebeiyunxingzhuangtai',
                        id: 17,
                        hidden: true,
                    },
                    // {
                    //     "img": "../../static/icon/icon8.png",
                    //     "text": "设备点检记录单",
                    //     "url": "/pages/MJGL/Sb_EquipDotCheckBill/Sb_EquipDotCheckBill",
                    //     "id": 18,
                    //     "hidden": false
                    // },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备保养记录单",
                        "url": "/pages/MJGL/Sb_EquipMaintainBill/Sb_EquipMaintainBill",
                        "id": 19,
                        "hidden": false
                    },
                    // {
                    //     "img": "../../static/icon/icon8.png",
                    //     "text": "设备故障登记单",
                    //     "url": "/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill?operationType=1",
                    //     "id": 20,
                    //     "hidden": false
                    // },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备维修派工单",
                        "url": "/pages/MJGL/Sb_EquipRepairSendWork/Sb_EquipRepairSendWorkBill",
                        "id": 21,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备维修记录单",
                        "url": "/pages/MJGL/Sb_EqpMaintenance/Sb_EqpMaintenanceBill",
                        "id": 22,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备维修验收单",
                        "url": "/pages/MJGL/Sb_EquipRepairCheckBill/Sb_EquipRepairCheckBill",
                        "id": 28,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备故障登记跟踪",
                        "url": "/pages/MJGL/Sb_EquipRepairCheckTaskReport/Sb_EquipRepairCheckTaskReport",
                        "id": 31,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具故障登记跟踪",
                        "url": "/pages/MJGL/Sc_MouldRepairCheckTaskReport/Sc_MouldRepairCheckTaskReport",
                        "id": 32,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "待上模查询",
                        "url": "/pages/MJGL/Sc_MouldUpperAwaitQuery/Sc_MouldUpperAwaitQuery",
                        "id": 33,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "待开工查询",
                        "url": "/pages/Cj_StationInBillAwaitQuery/Cj_StationInBillAwaitQuery",
                        "id": 34,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "待下模查询",
                        "url": "/pages/MJGL/Sc_MouldLowerBillAwaitQuery/Sc_MouldLowerBillAwaitQuery",
                        "id": 35,
                        "hidden": false
                    }
                ]
            }
        },
        onLoad() {
            this.getHiddenItem()
        },
        async onShow() {
            if (this.initFinished) {
                let MessageIdentifier = await this.getMessageIdentifierCount(this.menuListName)
                if (MessageIdentifier.code == 0) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: MessageIdentifier.msg
                    })
 
                    return
                }
                this.itemData.forEach((e, index) => {
                    if (MessageIdentifier.data[e.text] != undefined) {
                        this.itemData[index]["corner"] = true
                        this.itemData[index]["cornerCount"] = MessageIdentifier.data[e.text]
                    }
                })
 
                this.$forceUpdate()
            }
        },
        methods: {
            judgeHidden() {
                return process.env.NODE_ENV === 'development'
            },
            async getHiddenItem() {
                let data = await getMenuList({
                    menuName: this.menuListName
                })
 
                Array.from(data).forEach((e, index) => {
                    if (index < this.itemData.length) {
                        this.itemData[e["HIndex"]]["hidden"] = !CommonUtils.stringToBoolean(e[
                            "HShowMode"] || false)
                        this.itemData[e["HIndex"]].id = e["HEntryID"]; //id为0强制隐藏
                    }
                })
 
                let MessageIdentifier = await this.getMessageIdentifierCount(this.menuListName)
                if (MessageIdentifier.code == 0) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: MessageIdentifier.msg
                    })
 
                    return
                }
 
                Array.from(data).forEach((e, index) => {
                    if (index < this.itemData.length) {
                        if (MessageIdentifier.data[this.itemData[e["HIndex"]].text]) {
                            // 使用$set 添加响应式数据
                            this.$set(this.itemData[e["HIndex"]], "corner", true)
                            this.$set(this.itemData[e["HIndex"]], "cornerCount", MessageIdentifier.data[this.itemData[e["HIndex"]].text])
                            
                        }
                    }
                })
                this.initFinished = true
                this.$forceUpdate()
            },
            // 根据模块获取未处理消息条数
            async getMessageIdentifierCount(menuListName) {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Web/getMessageIdentified',
                        data: {
                            user: getUserInfo()["HEmpName"],
                            moduleName: menuListName
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        let retVal = Array.from(data).reduce((acc, item) => {
                            acc[item['moduleName']] = item.count
                            return acc
                        }, {})
 
                        return {
                            code: 1,
                            msg: Message,
                            data: retVal
                        }
                    } else {
                        return {
                            code: 0,
                            msg: Message,
                            data: []
                        }
                    }
                } catch (err) {
 
                }
            },
            switchHidden(index) {
                this.updateCount++;
                this.itemData[index].hidden = !this.itemData[index].hidden
 
            },
            switchIconsModeHandler() {
                this.canEdit = !this.canEdit
                if (this.canEdit == false && this.updateCount > 0) {
                    this.$nextTick(() => {
                        // uni.setStorageSync("HIndexItemData", this.itemData)
                        setMenuList({
                            menuName: this.menuListName,
                            payload: this.itemData
                        })
 
                        this.updateCount = 0
                    })
                }
                this.$forceUpdate()
            },
            toUrl(item) {
                if (item.url) {
                    uni.navigateTo({
                        url: item.url
                    })
                } else {
                    uni.showToast({
                        title: '功能开发中。。。',
                        icon: 'none'
                    })
                }
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    // .mains{
    //     width: 720rpx;
    //     margin: 0 auto;
    //     display: flex;
    //     flex-wrap: wrap;
    //     margin-top: 10rpx;
    //     padding-bottom: 80rpx;
    //     .box{
    //         width: 100%;
    //         margin: 26rpx 26rpx 0 26rpx;
    //         padding: 0 0 16rpx 10rpx;
    //         display: flex;
    //         align-items: center;
    //         border-bottom: 1px solid #f0f0f0;
    //         image{
    //             width: 52rpx;
    //             height: 52rpx;
    //         }
    //         .texts{
    //             font-size: 30rpx;
    //             color: #333333;
    //             margin-left: 30rpx;
    //         }
    //     }
    // }
 
    .header {
        width: 100%;
        height: 2em;
        position: relative;
 
        .switch-button {
            position: absolute;
            right: 10rpx;
            bottom: 0;
        }
    }
 
    .mains {
        width: 720rpx;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        padding-bottom: 80rpx;
 
        .box {
            width: 25%;
            margin-top: 2.5vh;
            text-align: center;
 
            image {
                width: 18vw;
                height: 18vw;
            }
 
            .texts {
                width: 120rpx;
                margin: 0 auto;
                font-size: 29rpx;
                font-weight: normal;
                color: #333333;
                margin-top: .2vh;
            }
        }
 
        .edit {
            position: relative;
        }
 
        .edit-mark {
            position: absolute;
            top: 0;
            right: 0;
        }
 
        view[enable-hidden] {
            opacity: .4 !important;
        }
 
        view[hidden] {
            display: none;
        }
    }
</style>