index.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import Vue from "vue";
  2. import Vuex from "vuex";
  3. Vue.use(Vuex);
  4. // 定义是否菜单可取消选中(true:可取消选中,false:不可取消选中)【取消选中:当菜单已经为选中状态,再次点击会取消选中状态】
  5. const menus = true;
  6. export default new Vuex.Store({
  7. state: {
  8. baseMapType: 1, //当前的底图类型 0 - 影像图; 1 - 蓝黑图, 2-街道图
  9. // 头部菜单选中菜单对象(主要用于元素判断是否显示)
  10. navSelect: window.localStorage.getItem("navSelect")
  11. ? JSON.parse(window.localStorage.getItem("navSelect"))
  12. : { index: "1", name: "首页", subIndex: "" },
  13. // 左侧菜单选中菜单title(主要用于疑点筛查点击某个子菜单时,跳转到综合分析页面综合分析页面自动选中操作。以及元素判断是否显示)
  14. leftMenuTitle: "",
  15. // 左侧菜单跳转menu变量暂存(主要用于疑点筛查点击某个子菜单时,跳转到综合分析页面综合分析页面显示返回按钮,以及返回菜单的依据)
  16. backMenu: {},
  17. // 底部菜单选中菜单index,subIndex(主要用于元素判断是否高亮)
  18. bottomMenuIndexs: { index: -1, subIndex: -1 },
  19. // 卷帘对比状态同步
  20. jlActiveState: false,
  21. // 当前浏览器窗口的宽高(优化自适应布局)
  22. windowsSize: {
  23. width: document.body.clientWidth,
  24. height: document.body.clientHeight,
  25. },
  26. // 地图常用方法集合
  27. mapMethodsCollection: new Map(),
  28. // 自定义模型数组
  29. customModelsArr: [],
  30. // 自定义模型状态改变 -- 修改或创建
  31. modelStatus: "create",
  32. // 法律法规弹窗
  33. lawPopupShow: false,
  34. // 底图切换距离右侧的位置
  35. baseMapRight: 23,
  36. // 我的标记中的疑点数据
  37. myLabelPointsArr: [],
  38. treeDataCollection: new Map(),
  39. // 用户信息(登录成功后保存)
  40. userInfo: {},
  41. // 综合分析疑点属性弹窗
  42. attrTableShow: false,
  43. // 综合分析修改标记弹窗
  44. updateCasePopupShow:false,
  45. // 首页所属街道全局暂存变量
  46. homeSpecialTown: "全部"
  47. },
  48. getters: {
  49. customModelsArr: (state) => state.customModelsArr,
  50. myLabelPointsArr: (state) => state.myLabelPointsArr,
  51. treeDataCollection: (state) => state.treeDataCollection,
  52. },
  53. mutations: {
  54. changeHomeSpecialTown(state, homeSpecialTown){
  55. state.homeSpecialTown = homeSpecialTown;
  56. },
  57. changeBackMenu(state, backMenu) {
  58. state.backMenu = backMenu;
  59. },
  60. changeJlActiveState(state, jlActiveState) {
  61. state.jlActiveState = jlActiveState;
  62. },
  63. // 用户信息修改(登录或退出时操作)
  64. changeUserInfo(state, userInfo) {
  65. state.userInfo = userInfo;
  66. },
  67. baseMapRight(state, position) {
  68. state.baseMapRight = position;
  69. },
  70. // 用户点击头部菜单,更新暂存对象
  71. changeNavSelect(state, navSelect) {
  72. state.navSelect = navSelect;
  73. window.localStorage.setItem("navSelect", JSON.stringify(state.navSelect));
  74. },
  75. // 用户点击左侧菜单,更新暂存对象(当menus为true时,点击相同的菜单会取消选中)
  76. changeLeftMenuTitle(state, leftMenuTitle) {
  77. state.leftMenuTitle = leftMenuTitle;
  78. },
  79. // 用户点击底部菜单,更新暂存对象(当menus为true时,点击相同的菜单会取消选中)
  80. changeBottomMenu(state, bottomMenuIndex) {
  81. if (
  82. bottomMenuIndex.index == state.bottomMenuIndexs.index &&
  83. bottomMenuIndex.subIndex == state.bottomMenuIndexs.subIndex &&
  84. menus
  85. ) {
  86. state.bottomMenuIndexs = { index: -1, subIndex: -1 };
  87. } else {
  88. state.bottomMenuIndexs = bottomMenuIndex;
  89. }
  90. },
  91. changeWindowsSize(state, windowWidth, windowHeight) {
  92. state.windowsSize = { width: windowWidth, height: windowHeight };
  93. },
  94. mapMethods: (state, options) => {
  95. state.mapMethodsCollection.set(options.name, options.value);
  96. },
  97. changeCustomModelsArr: (state, data) => {
  98. state.customModelsArr = data;
  99. },
  100. changeModelStatus: (state, data) => {
  101. state.modelStatus = data;
  102. },
  103. changeMyLabelData: (state, data) => {
  104. state.myLabelPointsArr = data;
  105. },
  106. //
  107. changeTreeData: (state, option) => {
  108. state.treeDataCollection.set(option.name, option.value);
  109. },
  110. },
  111. actions: {},
  112. modules: {},
  113. });