index.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. lawSourceType: "",
  36. // 底图切换距离右侧的位置
  37. baseMapRight: 23,
  38. // 我的标记中的疑点数据
  39. myLabelPointsArr: [],
  40. treeDataCollection: new Map(),
  41. // 用户信息(登录成功后保存)
  42. userInfo: {},
  43. // 综合分析疑点属性弹窗
  44. attrTableShow: false,
  45. // 综合分析修改标记弹窗
  46. updateCasePopupShow: false,
  47. // 首页所属街道全局暂存变量
  48. homeSpecialTown: "全部",
  49. // 全局类型变量
  50. selectSelectDataMap: {},
  51. },
  52. getters: {
  53. customModelsArr: (state) => state.customModelsArr,
  54. myLabelPointsArr: (state) => state.myLabelPointsArr,
  55. treeDataCollection: (state) => state.treeDataCollection,
  56. },
  57. mutations: {
  58. changeHomeSpecialTown(state, homeSpecialTown) {
  59. state.homeSpecialTown = homeSpecialTown;
  60. },
  61. changeBackMenu(state, backMenu) {
  62. state.backMenu = backMenu;
  63. },
  64. changeJlActiveState(state, jlActiveState) {
  65. state.jlActiveState = jlActiveState;
  66. },
  67. // 用户信息修改(登录或退出时操作)
  68. changeUserInfo(state, userInfo) {
  69. state.userInfo = userInfo;
  70. },
  71. baseMapRight(state, position) {
  72. state.baseMapRight = position;
  73. },
  74. // 用户点击头部菜单,更新暂存对象
  75. changeNavSelect(state, navSelect) {
  76. state.navSelect = navSelect;
  77. window.localStorage.setItem("navSelect", JSON.stringify(state.navSelect));
  78. },
  79. // 用户点击左侧菜单,更新暂存对象(当menus为true时,点击相同的菜单会取消选中)
  80. changeLeftMenuTitle(state, leftMenuTitle) {
  81. state.leftMenuTitle = leftMenuTitle;
  82. },
  83. // 用户点击底部菜单,更新暂存对象(当menus为true时,点击相同的菜单会取消选中)
  84. changeBottomMenu(state, bottomMenuIndex) {
  85. if (
  86. bottomMenuIndex.index == state.bottomMenuIndexs.index &&
  87. bottomMenuIndex.subIndex == state.bottomMenuIndexs.subIndex &&
  88. menus
  89. ) {
  90. state.bottomMenuIndexs = { index: -1, subIndex: -1 };
  91. } else {
  92. state.bottomMenuIndexs = bottomMenuIndex;
  93. }
  94. },
  95. changeWindowsSize(state, windowWidth, windowHeight) {
  96. state.windowsSize = { width: windowWidth, height: windowHeight };
  97. },
  98. mapMethods: (state, options) => {
  99. state.mapMethodsCollection.set(options.name, options.value);
  100. },
  101. changeCustomModelsArr: (state, data) => {
  102. state.customModelsArr = data;
  103. },
  104. changeModelStatus: (state, data) => {
  105. state.modelStatus = data;
  106. },
  107. changeMyLabelData: (state, data) => {
  108. state.myLabelPointsArr = data;
  109. },
  110. //
  111. changeTreeData: (state, option) => {
  112. state.treeDataCollection.set(option.name, option.value);
  113. },
  114. },
  115. actions: {},
  116. modules: {},
  117. });