付延余
2022-08-23 a88092021b14abc67c2f2e53ce722d609632aeb5
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
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
 
// 请求相关
import { reqAll, reqGet, reqPost } from '../utils/index.js';
 
const store = new Vuex.Store({
    state: {
        shenqingMenu: uni.getStorageSync('shenqingMenu') || false, //申请菜单
        rijihuaMenu: uni.getStorageSync('rijihuaMenu') || false, //日计划菜单
    },
    mutations: {
        ISHAS_SHENQING: (state, data) => {
            let labelArry = []
            let newObj = data.filter(e => e.label == '工作审批')
            newObj && newObj.forEach(e => {
                if(e.children.length > 0) {
                    e.children.forEach(item => {
                        labelArry.push(item.label)
                    })
                }else{
                    state.shenqingMenu = false
                    uni.setStorageSync('shenqingMenu',state.shenqingMenu)
                }
            })
            if(labelArry.indexOf('我的申请') > -1) {
                state.shenqingMenu = true
                uni.setStorageSync('shenqingMenu',state.shenqingMenu)
            }else {
                state.shenqingMenu = false
                uni.setStorageSync('shenqingMenu',state.shenqingMenu)
            }
            
        },
        ISHAS_RIJIHUA: (state, data) => {
            let labelArry = []
            let newObj = data.filter(e => e.label == '地销计量')
            newObj && newObj.forEach(e => {
                if(e.children.length > 0) {
                    e.children.forEach(item => {
                        labelArry.push(item.label)
                    })
                }else{
                    state.rijihuaMenu = false
                    uni.setStorageSync('rijihuaMenu',state.rijihuaMenu)
                }
            })
            if(labelArry.indexOf('汽车日发运计划管理') > -1) {
                state.rijihuaMenu = true
                uni.setStorageSync('rijihuaMenu',state.rijihuaMenu)
            }else {
                state.rijihuaMenu = false
                uni.setStorageSync('rijihuaMenu',state.rijihuaMenu)
            }
        }
    },
    actions: {
        menus({commit}) {
            reqGet('menu').then(response => {
                console.log(response,'response=====response----')
                commit('ISHAS_SHENQING',response.data)
                commit('ISHAS_RIJIHUA',response.data)
            })
        }
    }
})
 
export default store