whyczyk
2021-11-01 016ee05e4d7f8e6b4d9e145ac3c4a5213267ee61
界面类别处理
3个文件已修改
43 ■■■■ 已修改文件
src/layout/components/PageMenu.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmWork/list.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/routes.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/PageMenu.vue
@@ -31,8 +31,12 @@
                        name: '新建工单',
                    }, {
                        id: '1-2',
                        url: 'workList',
                        url: 'pending',
                        name: '待处理',
                    }, {
                        id: '1-3',
                        url: 'processed',
                        name: '已处理',
                    },
                ]
            },],
@@ -41,6 +45,7 @@
    },
    methods: {
        select(data, parent) {
            console.log(this.$router)
            this.id = data.id;
            if (data.url) {
                this.$router.push({
src/pages/alarmWork/list.vue
@@ -1,16 +1,32 @@
<template>
    <div class="">
        工单列表
        <div v-if="unitType==1">
            待处理工单
        </div>
        <div v-if="unitType==2">
            已处理工单
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            unitType: 1
        }
    },
    watch: {
        '$route'() {
            // 监听路由变化,获取unitType
            this.unitType = this.$route.meta.unitType
        },
    },
    mounted() {
        this.unitType = this.$route.meta.unitType
    }
}
</script>
src/router/routes.js
@@ -11,20 +11,26 @@
                title: '告警工单',
            },
            component: (resolve) => require(['@/pages/alarmWork/index.vue'], resolve),
            redirect: '/alarmWork/workList',
            redirect: '/alarmWork/pending',
            children: [
                {
                    path: 'addWork',
                    name: 'addWork',
                    meta: {
                        title: '新建工单',
                    },
                    component: (resolve) => require(['@/pages/alarmWork/addWork.vue'], resolve),
                }, {
                    path: 'workList',
                    name: 'workList',
                    path: 'pending',
                    meta: {
                        title: '工单列表',
                        title: '待处理列表',
                        unitType: 1
                    },
                    component: (resolve) => require(['@/pages/alarmWork/list.vue'], resolve),
                }, {
                    path: 'processed',
                    meta: {
                        title: '已处理列表',
                        unitType: 2
                    },
                    component: (resolve) => require(['@/pages/alarmWork/list.vue'], resolve),
                },