const app = {
    state: {
        clientHeight: window.innerHeight? window.innerHeight: document.documentElement.clientHeight? document.documentElement.clientHeight: screen.height,
        clientWidth: window.innerWidth? window.innerWidth: document.documentElement.clientWidth? document.documentElement.clientWidth: screen.width,
        mychartColor:{
            pie:['#FF8636','#028154','#FC635B','#FDBA4F','#436EFD','#7ACBBD','#6882FF','#819DE4'],
            bar:['#627AE1','#8CBBFF','#8CE8BB'],
            line:['#01332F','#627AE1','#ED6A4C']
        },
        floorMap:{}
    },
    mutations: {
        /**
         * 修改主窗体高度方法
         *
         * @param {any} obj
         */
        setClientHeight (state) {
            //console.log('变更之前:'+ state.clientHeight);
            state.clientHeight =window.innerHeight? window.innerHeight: document.documentElement.clientHeight? document.documentElement.clientHeight: screen.height;
            //console.log('变更之后:'+ state.clientHeight);
        },
        /**
         * 修改主窗体宽度方法
         *
         * @param {any} obj
         */
        setClientWidth (state) {
            state.clientWidth = window.innerWidth? window.innerWidth: document.documentElement.clientWidth? document.documentElement.clientWidth: screen.width;
        },
        /**
         * 颜色组
         *
         * @param {any} obj
         */
        setMychartColor(state,proName,color) {
            let tempColor = [];
            if (color) {
                color.forEach(element => {
                    if (element) {
                        tempColor.push(element);
                    }
                });
            } 
            state.mychartColor[proName] = tempColor;
        },
        setFloorMap (state,obj) {
            Object.assign(state.floorMap,obj);
        }
    }
};

export default app;
