展杰
2024-07-03 47e9b5822750378cdaf537e70ab8113355c48335
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
 
<template>
    <view>
        <u-grid :col="3" @click="gotoPage" border>
            <u-grid-item v-for="item in grid" :index="item[0]" class="grid-box">
                <u-icon name="play-right-fill" :size="46" color="#FF8000"></u-icon>
                <view class="grid-text">{{item.name}}</view>
            </u-grid-item>
        </u-grid>
        <u-toast ref="uToast" />
    </view>
 
</template>
 
<script>
    import {
        queryPurview
    } from '../../api'
    import grid from '../../uni_modules/uview-ui/libs/config/props/grid'
    export default {
        data() {
            return {
                grid: [],
                filter: [
                    {
                        name: '巡检检验',
                        src: '/pages/inspection/inspectionList',
                        icon:''
                    },
                    {
                        name: '首检检验',
                        src: '/pages/inspection/firstInspectionList',
                        icon:''
                    },
                    {
                        name :'机台报工',
                        src:'/pages/work_reporting/work_reporting',
                        icon:''
                    },
                    {
                        name :'设备点检计划',
                        src:'/pages/eqSpotCheck/eqSpotCheckList',
                        icon:''
                    },
                ]
            }
        },
        onLoad() {
            queryPurview().then(res => {
                if (!res.result) {
                    this.$refs.uToast.show({
                        message: res.msg,
                        type: 'error'
                    })
                    return
                }
                // 显示需要被代理的
                for (let item of this.filter) {
                    if (res.data.find(t => t[0] == item.name)) {
                        this.grid.push(item)
                    }
                }
                console.log(this.grid);
            })
        },
        methods: {
            gotoPage(e) {
                // console.log(this.grid[e])
                // let name = this.grid[e][0]
                // // 判断该页面是否应该被代理
                // let item = this.filter.find(t => {
                //     if (t.name == name) {
                //         return t;
                //     }
                // })
                // if (typeof(item) == 'undefined') {
                //     uni.navigateTo({
                //         url: '/pages/main/main?name=' + name
                //     })
                //     return
                // }
                uni.navigateTo({
                    url: this.grid[e].src
                })
            }
        }
    }
</script>
 
<style>
    .grid-box{
        border-bottom: 1upx solid #dadbde;
        border-right: 1upx solid #dadbde;
        background-color: #f1f2f4;
        height: 100upx;
    }
</style>