import Vuex from 'vuex';
import Vue from "vue";
import evaluateStore from "@/store/evaluate";
import eletricCardStore from "@/store/electricCard";
Vue.use(Vuex)
export default  new Vuex.Store({
    state:{

        matterGuidanceRefresh:true,
        matterGuidance:{
            //事项和指南
            'matterGuidanceFirstLevel':'',  //住建委、房管局
            'matterGuidanceSecondLevel':'',  //行政许可、行政确认、行政奖励...
            'matterGuidanceThirdLevel':'',  //好办、快办、网办...
        },
        handleSituationRefresh:true,
        handleSituation:{
            "handleSituationFirstLevel":'',   //住建委、房管局
            "handleSituationSecondLevel":'', //行政许可、行政确认、行政奖励...
            "handleSituationThirdLevel":'',   //已申请、待受理、待督办
            //详细查询参数
            "handleSituationForthLevel":'',   //事项编码
            "handleSituationFifthLevel":'',   //情形编码
            "handleSituationSixthLevel":'',   //办件状态
            "handleSituationSeventhLevel":'',   //办件类型
            "handleSituationEighthLevel":'',   //排序字段
            "handleSituationSortTime":'',  //时间排序查询
            "handleSituationOptimize":''
        },
        analysisRefresh:true,
        analysis:{
            "analysisFirstLevel":'',
            "analysisSecondLevel":'',
            "analysisThirdLevel":'',
            "analysisForthLevel":'',
            "analysisFifthLevel":'',
            "analysisTimer":'',
            "analysisUnit":'',
            "analysisUrgeType":'', //提醒,督办
            "analysisOptimizeType":'', //提醒,督办
        },

    },
    mutations:{
        matterGuidanceRefresh(state,payload){  //住建委、 房管局
            state.matterGuidanceRefresh = payload;
        },
        matterGuidance(state,payload){  //住建委、 房管局
            let data = Object.assign({},state.matterGuidance,payload);
            state.matterGuidance = data;
        },
        matterGuidanceSingleChange(state,payload){
            for(let i=0;i<payload.length;i++){
                for(let key in state.matterGuidance){
                    if(key==payload[i].name){
                        state.matterGuidance[key] =payload[i].value;
                    }
                }
            }
            let data = Object.assign({},state.matterGuidance);
            state.matterGuidance = data;
        },
        handleSituationRefresh(state,payload){
            state.handleSituationRefresh = payload;
        },
        handleSituation(state,payload){
            let data = Object.assign({},state.handleSituation,payload);
            state.handleSituation = data;
        },
        handleSituationSingleChange(state,payload){
            for(let i=0;i<payload.length;i++){
                for(let key in state.handleSituation){
                    if(key==payload[i].name){
                        state.handleSituation[key] =payload[i].value;
                    }
                }
            }
            let data = Object.assign({},state.handleSituation);
            state.handleSituation = data;
        },


        analysis(state,payload){
            let data = Object.assign({},state.analysis,payload);
            state.analysis = data;
        },
        analysisSingleChange(state,payload){
            for(let i=0;i<payload.length;i++){
                for(let key in state.analysis){
                    if(key==payload[i].name){
                        state.analysis[key] =payload[i].value;
                    }
                }
            }
            let data = Object.assign({},state.analysis);
            state.analysis = data;
        },

        analysisRefresh(state,payload){  //好办、快办、网办...
            state.analysisRefresh = payload;
        },
    },
    actions:{

    },
    modules:{
        evaluate:evaluateStore,
        eletricCard:eletricCardStore

    }
})
