You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

store.js 3.0 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * Copyright 2019 Huawei Technologies Co., Ltd.All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import Vue from 'vue';
  17. import Vuex from 'vuex';
  18. Vue.use(Vuex);
  19. export default new Vuex.Store({
  20. state: {
  21. // cancel request token
  22. cancelTokenArr: [],
  23. // reload flag
  24. isReload: false,
  25. // Scheduled reload flag
  26. isTimeReload: localStorage.isTimeReload === 'false' ? false : true,
  27. // reload time
  28. timeReloadValue: localStorage.timeReloadValue
  29. ? localStorage.timeReloadValue
  30. : 10,
  31. // Scheduled hardware reload flag
  32. isHardwareTimeReload: localStorage.isHardwareTimeReload === 'false' ? false : true,
  33. // hardware reload time
  34. hardwareTimeReloadValue: localStorage.hardwareTimeReloadValue
  35. ? localStorage.hardwareTimeReloadValue
  36. : 5,
  37. // multiSelevtGroup component count
  38. multiSelectedGroupCount: 0,
  39. tableId: 0,
  40. componentsCount: 0,
  41. summaryDirList: undefined,
  42. selectedBarList: [],
  43. hidenDirChecked: [],
  44. customizedColumnOptions: [],
  45. },
  46. mutations: {
  47. // set cancelTokenArr
  48. pushToken: (state, src) => {
  49. state.cancelTokenArr.push(src.cancelToken);
  50. },
  51. // clear cancelTokenArr
  52. clearToken: (state) => {
  53. state.cancelTokenArr.forEach((item) => {
  54. item('routeJump');
  55. });
  56. state.cancelTokenArr = [];
  57. },
  58. // set isReload
  59. setIsReload: (state, val) => {
  60. state.isReload = val;
  61. },
  62. setSummaryDirList: (state, val) => {
  63. state.summaryDirList = val;
  64. },
  65. setSelectedBarList: (state, val) => {
  66. state.selectedBarList = val;
  67. },
  68. // hide list of model traceback
  69. setHidenDirChecked: (state, val) => {
  70. state.hidenDirChecked = val;
  71. },
  72. customizedColumnOptions: (state, val) => {
  73. state.customizedColumnOptions = val;
  74. },
  75. // set isTimeReload
  76. setIsTimeReload: (state, val) => {
  77. state.isTimeReload = val;
  78. },
  79. setTimeReloadValue: (state, val) => {
  80. state.timeReloadValue = val;
  81. },
  82. // set isHardwareTimeReload
  83. setIsHardwareTimeReload: (state, val) => {
  84. state.isHardwareTimeReload = val;
  85. },
  86. setHardwareTimeReloadValue: (state, val) => {
  87. state.hardwareTimeReloadValue = val;
  88. },
  89. multiSelectedGroupComponentNum(state) {
  90. state.multiSelectedGroupCount++;
  91. },
  92. increaseTableId(state) {
  93. state.tableId++;
  94. },
  95. componentsNum(state) {
  96. state.componentsCount++;
  97. },
  98. },
  99. actions: {},
  100. });