import Vue from "vue"; import Vuex from "vuex"; Vue.use(Vuex); // 定义是否菜单可取消选中(true:可取消选中,false:不可取消选中)【取消选中:当菜单已经为选中状态,再次点击会取消选中状态】 const menus = true; export default new Vuex.Store({ state: { baseMapType: 1, //当前的底图类型 0 - 影像图; 1 - 蓝黑图, 2-街道图 // 头部菜单选中菜单对象(主要用于元素判断是否显示) navSelect: window.localStorage.getItem("navSelect") ? JSON.parse(window.localStorage.getItem("navSelect")) : { index: "1", name: "首页", subIndex: "" }, // 左侧菜单选中菜单title(主要用于疑点筛查点击某个子菜单时,跳转到综合分析页面综合分析页面自动选中操作。以及元素判断是否显示) leftMenuTitle: "", // 左侧菜单跳转menu变量暂存(主要用于疑点筛查点击某个子菜单时,跳转到综合分析页面综合分析页面显示返回按钮,以及返回菜单的依据) backMenu: {}, // 底部菜单选中菜单index,subIndex(主要用于元素判断是否高亮) bottomMenuIndexs: { index: -1, subIndex: -1 }, // 卷帘对比状态同步 jlActiveState: false, // 当前浏览器窗口的宽高(优化自适应布局) windowsSize: { width: document.body.clientWidth, height: document.body.clientHeight, }, // 地图常用方法集合 mapMethodsCollection: new Map(), // 自定义模型状态改变 -- 修改或创建 modelStatus: "create", // 法律法规弹窗 lawPopupShow: false, // 法规法规弹窗资源类型 lawSourceType: "", // 底图切换距离右侧的位置 baseMapRight: 23, // 我的标记中的疑点数据 myLabelPointsArr: [], // 存储所有图层中的层级数据结构 -- 方便自定义模型传数据 treeDataCollection: new Map(), // 用户信息(登录成功后保存) userInfo: {}, // 综合分析疑点属性弹窗 attrTableShow: false, // 综合分析修改标记弹窗 updateCasePopupShow: false, // 首页所属街道全局暂存变量 homeSpecialTown: "全部", // 全局类型变量 selectSelectDataMap: {}, preModelLayerMap: [], // 同屏对比中选中图层暂存详细信息 mapMarkInfo: {}, // 综合分析中点击图版cid map2DViewerPolygonsCid: {}, // 卷帘对比右侧map地址 JLControlRightMapUrl: "", }, getters: { myLabelPointsArr: (state) => state.myLabelPointsArr, treeDataCollection: (state) => state.treeDataCollection, }, mutations: { changeHomeSpecialTown(state, homeSpecialTown) { state.homeSpecialTown = homeSpecialTown; }, changeBackMenu(state, backMenu) { state.backMenu = backMenu; }, changeJlActiveState(state, jlActiveState) { state.jlActiveState = jlActiveState; }, // 用户信息修改(登录或退出时操作) changeUserInfo(state, userInfo) { state.userInfo = userInfo; }, baseMapRight(state, position) { state.baseMapRight = position; }, // 用户点击头部菜单,更新暂存对象 changeNavSelect(state, navSelect) { state.navSelect = navSelect; window.localStorage.setItem("navSelect", JSON.stringify(state.navSelect)); }, // 用户点击左侧菜单,更新暂存对象(当menus为true时,点击相同的菜单会取消选中) changeLeftMenuTitle(state, leftMenuTitle) { state.leftMenuTitle = leftMenuTitle; }, // 用户点击底部菜单,更新暂存对象(当menus为true时,点击相同的菜单会取消选中) changeBottomMenu(state, bottomMenuIndex) { if ( bottomMenuIndex.index == state.bottomMenuIndexs.index && bottomMenuIndex.subIndex == state.bottomMenuIndexs.subIndex && menus ) { state.bottomMenuIndexs = { index: -1, subIndex: -1 }; } else { state.bottomMenuIndexs = bottomMenuIndex; } }, changeWindowsSize(state, windowWidth, windowHeight) { state.windowsSize = { width: windowWidth, height: windowHeight }; }, mapMethods: (state, options) => { state.mapMethodsCollection.set(options.name, options.value); }, changeModelStatus: (state, data) => { state.modelStatus = data; }, changeMyLabelData: (state, data) => { state.myLabelPointsArr = data; }, // changeTreeData: (state, option) => { state.treeDataCollection.set(option.name, option.value); }, // 预设模型图层组 changePreModelData: (state, data) => { state.preModelLayerMap = data; }, }, actions: {}, modules: {}, });