llj
2026-03-19 6dd20db9d23ae470004586ae9e76c3502f93085c
pages/index/tab3.vue
@@ -8,7 +8,16 @@
        <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)">
                <image :src="item.img" mode=""></image>
                <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>
@@ -42,22 +51,23 @@
                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: 1,
                        hidden: false,
                    },
                    {
                        img: '../../static/icon/icon8.png',
                        text: '模具档案查询',
                        url: `/pages/MJGL/Gy_MouldFile/Gy_MouldFileList`,
                        id: 2,
                        hidden: false,
                    },
                    {
                        img: '../../static/icon/icon16.png',
@@ -66,11 +76,53 @@
                        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/icon13.png",
                        "text": "模具故障登记单",
                        "url": "/pages/qijvguzhangdengji/mouldMistakeBill?operationType=1",
                        "id": 4,
                        "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
                    },
                    {
@@ -83,7 +135,7 @@
                    {
                        "img": "../../static/icon/icon13.png",
                        "text": "模具维修记录单",
                        "url": "/pages/weixiujilu/mouldRepairRecordBill",
                        "url": "/pages/MJGL/Sc_MouldRepairWorkBill/Sc_MouldRepairWorkBill",
                        "id": 6,
                        "hidden": false
                    },
@@ -122,20 +174,20 @@
                        "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/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": "模具报废出库单",
@@ -167,13 +219,13 @@
                        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_EquipDotCheckBill/Sb_EquipDotCheckBill",
                    //     "id": 18,
                    //     "hidden": false
                    // },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备保养记录单",
@@ -181,6 +233,13 @@
                        "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": "设备维修派工单",
@@ -190,44 +249,99 @@
                    },
                    {
                        "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": 23,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备保养任务",
                        "url": "/pages/MJGL/SBMJReport/Sb_EquipMaintainTaskReport",
                        "id": 24,
                        "id": 28,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具保养任务",
                        "url": "/pages/MJGL/SBMJReport/Sc_MouldMaintainTaskReport",
                        "id": 25,
                        "text": "设备故障登记跟踪",
                        "url": "/pages/MJGL/Sb_EquipRepairCheckTaskReport/Sb_EquipRepairCheckTaskReport",
                        "id": 31,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备维修任务",
                        "url": "/pages/MJGL/Sb_EquipRepairTaskReport/Sb_EquipRepairTaskReport",
                        "id": 26,
                        "text": "模具故障登记跟踪",
                        "url": "/pages/MJGL/Sc_MouldRepairCheckTaskReport/Sc_MouldRepairCheckTaskReport",
                        "id": 32,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具维修任务",
                        "url": "/pages/MJGL/Sc_MouldRepairTaskReport/Sc_MouldRepairTaskReport",
                        "id": 27,
                        "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()
            }
        },
        async onReady() {
            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() {
@@ -237,10 +351,74 @@
                let data = await getMenuList({
                    menuName: this.menuListName
                })
                Array.from(data).forEach(e => {
                    this.itemData[e["HIndex"]].hidden = !CommonUtils.stringToBoolean(e["HShowMode"])
                    this.itemData[e["HIndex"]].id = e["HEntryID"]; //id为0强制隐藏
                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++;