openatc-components 0.0.12 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/.babelrc +18 -18
  2. package/.editorconfig +9 -9
  3. package/.eslintignore +5 -5
  4. package/.eslintrc.js +29 -29
  5. package/.postcssrc.js +10 -10
  6. package/README.md +30 -30
  7. package/build/build.js +41 -41
  8. package/build/check-versions.js +54 -54
  9. package/build/package.config.js +58 -58
  10. package/build/package.dev.config.js +107 -107
  11. package/build/package.prod.config.js +160 -160
  12. package/build/utils.js +101 -101
  13. package/build/vue-loader.conf.js +22 -22
  14. package/build/webpack.base.conf.js +114 -114
  15. package/build/webpack.dev.conf.js +95 -95
  16. package/build/webpack.prod.conf.js +149 -149
  17. package/config/dev.env.js +8 -8
  18. package/config/index.js +90 -90
  19. package/config/prod.env.js +5 -5
  20. package/config/test.env.js +7 -7
  21. package/index.html +12 -12
  22. package/package/kisscomps/components/CommonKanban/CommonKanban.vue +119 -106
  23. package/package/kisscomps/components/CommonKanban/index.js +2 -2
  24. package/package/kisscomps/components/FaultDetailModal/FaultDetailModal.vue +170 -170
  25. package/package/kisscomps/components/FaultDetailModal/index.js +2 -2
  26. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/CrossRoadsSvg.vue +497 -497
  27. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue +46 -46
  28. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PatternWalkSvg.vue +295 -295
  29. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionEWSvg.vue +300 -300
  30. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionSNSvg.vue +288 -288
  31. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampEastSvg.vue +391 -391
  32. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampNorthSvg.vue +336 -336
  33. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampSouthSvg.vue +345 -345
  34. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampWestSvg.vue +389 -389
  35. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/SidewalkSvg.vue +1179 -1179
  36. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg.vue +402 -402
  37. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue +361 -361
  38. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue +368 -368
  39. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue +475 -475
  40. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg.vue +494 -494
  41. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg.vue +401 -401
  42. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue +360 -360
  43. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue +367 -367
  44. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue +476 -476
  45. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/refreshSvg.vue +63 -63
  46. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/busMapSvg.vue +50 -50
  47. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/eastBusSvg.vue +167 -167
  48. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/northBusSvg.vue +168 -168
  49. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/southBusSvg.vue +168 -168
  50. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/westBusSvg.vue +169 -169
  51. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +856 -853
  52. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg.vue +112 -112
  53. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +112 -112
  54. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg.vue +111 -111
  55. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.json +196 -196
  56. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.left.json +196 -196
  57. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.json +99 -99
  58. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.left.json +99 -99
  59. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/rampPos.json +52 -52
  60. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/sidePos.json +99 -99
  61. package/package/kisscomps/components/IntersectionMap/crossDirection/utils.js +78 -77
  62. package/package/kisscomps/components/IntersectionMap/index.js +2 -2
  63. package/package/kisscomps/components/IntersectionMap/intersectionmap.vue +144 -139
  64. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +273 -268
  65. package/package/kisscomps/components/IntersectionWithInterface/index.js +2 -2
  66. package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +772 -740
  67. package/package/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +195 -191
  68. package/package/kisscomps/components/SchemeConfig/index.js +2 -2
  69. package/package/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +198 -214
  70. package/package/kisscomps/components/SchemeConfig/manualControlModal/index.vue +177 -184
  71. package/package/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +298 -294
  72. package/package/kisscomps/components/SvgIcon/SvgIcon.vue +53 -53
  73. package/package/kisscomps/components/SvgIcon/index.js +2 -2
  74. package/package/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +522 -517
  75. package/package/kisscomps/components/XRDDirSelector/index.js +2 -2
  76. package/package/kisscomps/index.js +59 -47
  77. package/package/kissui.min.js +1 -1
  78. package/package.json +122 -122
  79. package/src/App.vue +24 -24
  80. package/src/EdgeMgr/EdgeModelBase.js +16 -16
  81. package/src/EdgeMgr/controller/crossDiagramMgr.js +120 -120
  82. package/src/api/authapi.js +31 -31
  83. package/src/api/config.js +21 -21
  84. package/src/api/control.js +76 -76
  85. package/src/api/fault.js +66 -66
  86. package/src/api/index.js +24 -24
  87. package/src/api/login.js +46 -46
  88. package/src/api/optimize.js +72 -72
  89. package/src/api/param.js +154 -154
  90. package/src/api/passwdAssest.js +101 -101
  91. package/src/api/template.js +27 -27
  92. package/src/i18n/index.js +26 -26
  93. package/src/i18n/language/en.js +1108 -1108
  94. package/src/i18n/language/index.js +25 -25
  95. package/src/i18n/language/zh.js +1107 -1107
  96. package/src/icons/index.js +20 -20
  97. package/src/icons/svg/bendi.svg +110 -110
  98. package/src/icons/svg/bujin.svg +36 -36
  99. package/src/icons/svg/connectBlue.svg +7 -7
  100. package/src/icons/svg/currentvolume.svg +0 -0
  101. package/src/icons/svg/cutRed.svg +7 -7
  102. package/src/icons/svg/cycle.svg +0 -0
  103. package/src/icons/svg/dingzhouqi.svg +34 -34
  104. package/src/icons/svg/ganyingkongzhi.svg +30 -30
  105. package/src/icons/svg/guandeng.svg +81 -81
  106. package/src/icons/svg/huangshan.svg +71 -71
  107. package/src/icons/svg/maincontrol.svg +0 -0
  108. package/src/icons/svg/manualcontrolbackground.svg +51 -51
  109. package/src/icons/svg/manualcontrolbackground1.svg +62 -62
  110. package/src/icons/svg/manualcontrolbackgrounden.svg +62 -62
  111. package/src/icons/svg/model.svg +0 -0
  112. package/src/icons/svg/phasediff.svg +0 -0
  113. package/src/icons/svg/quanhong.svg +86 -86
  114. package/src/icons/svg/shanghe.svg +11 -11
  115. package/src/icons/svg/shoudong.svg +103 -103
  116. package/src/icons/svg/time.svg +0 -0
  117. package/src/icons/svg/wuxianlan.svg +46 -46
  118. package/src/icons/svg/xiala.svg +11 -11
  119. package/src/icons/svg/xingrenguojie.svg +33 -33
  120. package/src/icons/svg/xitong.svg +89 -89
  121. package/src/icons/svg/youxian.svg +41 -41
  122. package/src/icons/svg/zizhukongzhi.svg +43 -43
  123. package/src/kisscomps/components/CommonKanban/CommonKanban.vue +119 -106
  124. package/src/kisscomps/components/CommonKanban/index.js +2 -2
  125. package/src/kisscomps/components/FaultDetailModal/FaultDetailModal.vue +170 -170
  126. package/src/kisscomps/components/FaultDetailModal/index.js +2 -2
  127. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/CrossRoadsSvg.vue +497 -497
  128. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue +46 -46
  129. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PatternWalkSvg.vue +295 -295
  130. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionEWSvg.vue +300 -300
  131. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionSNSvg.vue +288 -288
  132. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampEastSvg.vue +391 -391
  133. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampNorthSvg.vue +336 -336
  134. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampSouthSvg.vue +345 -345
  135. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampWestSvg.vue +389 -389
  136. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/SidewalkSvg.vue +1179 -1179
  137. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg.vue +402 -402
  138. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue +361 -361
  139. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue +368 -368
  140. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue +475 -475
  141. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg.vue +494 -494
  142. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg.vue +401 -401
  143. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue +360 -360
  144. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue +367 -367
  145. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue +476 -476
  146. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/refreshSvg.vue +63 -63
  147. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/busMapSvg.vue +50 -50
  148. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/eastBusSvg.vue +167 -167
  149. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/northBusSvg.vue +168 -168
  150. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/southBusSvg.vue +168 -168
  151. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/westBusSvg.vue +169 -169
  152. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +856 -853
  153. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg.vue +112 -112
  154. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +112 -112
  155. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg.vue +111 -111
  156. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.json +196 -196
  157. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.left.json +196 -196
  158. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.json +99 -99
  159. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.left.json +99 -99
  160. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/rampPos.json +52 -52
  161. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/sidePos.json +99 -99
  162. package/src/kisscomps/components/IntersectionMap/crossDirection/utils.js +78 -77
  163. package/src/kisscomps/components/IntersectionMap/index.js +2 -2
  164. package/src/kisscomps/components/IntersectionMap/intersectionmap.vue +144 -139
  165. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +273 -268
  166. package/src/kisscomps/components/IntersectionWithInterface/index.js +2 -2
  167. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +772 -740
  168. package/src/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +195 -191
  169. package/src/kisscomps/components/SchemeConfig/index.js +2 -2
  170. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +198 -214
  171. package/src/kisscomps/components/SchemeConfig/manualControlModal/index.vue +177 -184
  172. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +298 -294
  173. package/src/kisscomps/components/SvgIcon/SvgIcon.vue +53 -53
  174. package/src/kisscomps/components/SvgIcon/index.js +2 -2
  175. package/src/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +522 -517
  176. package/src/kisscomps/components/XRDDirSelector/index.js +2 -2
  177. package/src/kisscomps/index.js +59 -47
  178. package/src/lib/publicjs/ArryListUtil.js +38 -38
  179. package/src/lib/publicjs/HttpurlMgr.js +45 -45
  180. package/src/lib/publicjs/KissApi.js +156 -156
  181. package/src/lib/publicjs/KissWSSub/Heartcheck.js +128 -128
  182. package/src/lib/publicjs/KissWSSub/KissWsSub.js +91 -91
  183. package/src/lib/publicjs/KissWSSub/KissWsSubByType.js +152 -152
  184. package/src/lib/publicjs/KissWSSub/SimuWsSubByType.js +44 -44
  185. package/src/lib/publicjs/KissWSSub/Sub.js +51 -51
  186. package/src/lib/publicjs/KissWSSub/SubChannel.js +119 -119
  187. package/src/lib/publicjs/basecomponents.js +65 -65
  188. package/src/lib/publicjs/localStorage.js +112 -112
  189. package/src/lib/publicjs/objdeepcopy.js +32 -32
  190. package/src/lib/publicjs/pageScroll.js +30 -30
  191. package/src/lib/publicjs/passwdAssest.js +101 -101
  192. package/src/lib/publicjs/styleclassfactory.js +32 -32
  193. package/src/main.js +44 -44
  194. package/src/router/index.js +29 -29
  195. package/src/store/getters.js +16 -16
  196. package/src/store/index.js +26 -26
  197. package/src/store/modules/globalParam.js +27 -27
  198. package/src/utils/RingDataModel.js +98 -0
  199. package/src/utils/auth.js +102 -102
  200. package/src/utils/dateFormat.js +41 -41
  201. package/src/utils/errorcode.js +224 -224
  202. package/src/utils/fault.js +195 -195
  203. package/src/utils/faultcode.js +209 -209
  204. package/src/utils/index.js +69 -69
  205. package/src/utils/pedphasedesc.js +119 -119
  206. package/src/utils/phasedesc.js +124 -124
  207. package/src/utils/responseMessage.js +21 -21
  208. package/src/utils/validate.js +43 -43
  209. package/src/views/home.1.vue +479 -479
  210. package/src/views/home.vue +63 -63
  211. package/src/views/intersection.vue +86 -84
  212. package/src/views/schemeconfig.vue +146 -130
  213. package/static/apiconfig.json +336 -336
  214. package/static/styles/common.scss +17 -17
  215. package/static/styles/commonkanban.scss +87 -87
  216. package/static/styles/dark/index.scss +2 -2
  217. package/static/styles/dark/theme/element-dark.scss +42 -42
  218. package/static/styles/index.scss +84 -84
  219. package/static/styles/intersection.scss +143 -143
  220. package/static/styles/light/index.scss +2 -2
  221. package/static/styles/light/theme/element-light.scss +42 -42
  222. package/static/styles/schemeconfig.scss +298 -298
  223. package/static/token.json +2 -2
  224. package/test/e2e/custom-assertions/elementCount.js +27 -27
  225. package/test/e2e/nightwatch.conf.js +46 -46
  226. package/test/e2e/runner.js +48 -48
  227. package/test/e2e/specs/test.js +19 -19
  228. package/test/unit/.eslintrc +7 -7
  229. package/test/unit/jest.conf.js +30 -30
  230. package/test/unit/setup.js +3 -3
  231. package/test/unit/specs/HelloWorld.spec.js +11 -11
@@ -1,2 +1,2 @@
1
- import XRDDirSelector from './XRDDirSelector.vue'
2
- export default XRDDirSelector
1
+ import XRDDirSelector from './XRDDirSelector.vue'
2
+ export default XRDDirSelector
@@ -1,47 +1,59 @@
1
-
2
- import XRDDirSelector from './components/XRDDirSelector/index'
3
- import IntersectionWithInterface from './components/IntersectionWithInterface/index'
4
- import IntersectionMap from './components/IntersectionMap/index'
5
- import SchemeConfig from './components/SchemeConfig/index'
6
- import FaultDetailModal from './components/FaultDetailModal/index'
7
- import CommonKanban from './components/CommonKanban/index'
8
-
9
- import en from '../i18n/language/en'
10
- import zh from '../i18n/language/zh'
11
- // 第三方插件
12
- import VTooltip from 'v-tooltip'
13
-
14
- const components = {
15
- XRDDirSelector,
16
- IntersectionWithInterface,
17
- IntersectionMap,
18
- SchemeConfig,
19
- FaultDetailModal,
20
- CommonKanban
21
- }
22
-
23
- const language = {
24
- en,
25
- zh
26
- }
27
-
28
- const install = function (Vue) {
29
- if (install.installed) return
30
- Vue.use(VTooltip)
31
- // components.map(component => Vue.component(component.name, component))
32
- Object.keys(components).forEach(key => {
33
- Vue.component(components[key].name, components[key])
34
- })
35
- }
36
-
37
- if (typeof window !== 'undefined' && window.Vue) {
38
- install(window.Vue)
39
- }
40
-
41
- const API = {
42
- install,
43
- ...components,
44
- language
45
- }
46
-
47
- export default API
1
+
2
+ import XRDDirSelector from './components/XRDDirSelector/index'
3
+ import IntersectionWithInterface from './components/IntersectionWithInterface/index'
4
+ import IntersectionMap from './components/IntersectionMap/index'
5
+ import SchemeConfig from './components/SchemeConfig/index'
6
+ import lockingPhaselControlModal from './components/SchemeConfig/lockingPhaselControlModal/index'
7
+ import FaultDetailModal from './components/FaultDetailModal/index'
8
+ import CommonKanban from './components/CommonKanban/index'
9
+
10
+ import en from '../i18n/language/en'
11
+ import zh from '../i18n/language/zh'
12
+ // 第三方插件
13
+ import VTooltip from 'v-tooltip'
14
+
15
+ const components = {
16
+ XRDDirSelector,
17
+ IntersectionWithInterface,
18
+ IntersectionMap,
19
+ SchemeConfig,
20
+ lockingPhaselControlModal,
21
+ FaultDetailModal,
22
+ CommonKanban
23
+ }
24
+
25
+ const language = {
26
+ en,
27
+ zh
28
+ }
29
+
30
+ const requireAll = requireContext => requireContext.keys().map(requireContext)
31
+ const install = function (Vue) {
32
+ if (install.installed) return
33
+ Vue.use(VTooltip)
34
+ // components.map(component => Vue.component(component.name, component))
35
+ Object.keys(components).forEach(key => {
36
+ Vue.component(components[key].name, components[key])
37
+ })
38
+
39
+ const req = require.context('../icons/svg', false, /\.svg$/)
40
+ requireAll(req)
41
+
42
+ const urlMgr = require('../lib/publicjs/HttpurlMgr')
43
+ if (urlMgr.HttpUrlMgr.urlMap === undefined) {
44
+ let data = require('../../static/apiconfig.json')
45
+ urlMgr.HttpUrlMgr.init(data)
46
+ }
47
+ }
48
+
49
+ if (typeof window !== 'undefined' && window.Vue) {
50
+ install(window.Vue)
51
+ }
52
+
53
+ const API = {
54
+ install,
55
+ ...components,
56
+ language
57
+ }
58
+
59
+ export default API
@@ -1,38 +1,38 @@
1
- /**
2
- * Copyright (c) 2020 kedacom
3
- * OpenATC is licensed under Mulan PSL v2.
4
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
- * You may obtain a copy of Mulan PSL v2 at:
6
- * http://license.coscl.org.cn/MulanPSL2
7
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
- * See the Mulan PSL v2 for more details.
11
- **/
12
- /**
13
- * 数组去重
14
- * @param {*} array
15
- */
16
- export function kdistinct (array) {
17
- return Array.from(new Set(array))
18
- }
19
- /**
20
- * 求数组并集
21
- * @param {*} array1
22
- * @param {*} array2
23
- */
24
- export function kconcat (array1, array2) {
25
- return array1.concat(array2.filter(v => !array1.includes(v)))
26
- }
27
-
28
- /**
29
- * 求交集
30
- */
31
- export function kintersection (array1, array2) {
32
- return array1.filter(v => array2.includes(v))
33
- }
34
-
35
- // 差集
36
- export function kdiff (array1, array2) {
37
- return array1.concat(array2).filter(v => array1.includes(v) && !array2.includes(v))
38
- }
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ /**
13
+ * 数组去重
14
+ * @param {*} array
15
+ */
16
+ export function kdistinct (array) {
17
+ return Array.from(new Set(array))
18
+ }
19
+ /**
20
+ * 求数组并集
21
+ * @param {*} array1
22
+ * @param {*} array2
23
+ */
24
+ export function kconcat (array1, array2) {
25
+ return array1.concat(array2.filter(v => !array1.includes(v)))
26
+ }
27
+
28
+ /**
29
+ * 求交集
30
+ */
31
+ export function kintersection (array1, array2) {
32
+ return array1.filter(v => array2.includes(v))
33
+ }
34
+
35
+ // 差集
36
+ export function kdiff (array1, array2) {
37
+ return array1.concat(array2).filter(v => array1.includes(v) && !array2.includes(v))
38
+ }
@@ -1,45 +1,45 @@
1
- /**
2
- * Copyright (c) 2020 kedacom
3
- * OpenATC is licensed under Mulan PSL v2.
4
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
- * You may obtain a copy of Mulan PSL v2 at:
6
- * http://license.coscl.org.cn/MulanPSL2
7
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
- * See the Mulan PSL v2 for more details.
11
- **/
12
- export class UrlMgr {
13
- init (data) {
14
- if (data === undefined) {
15
- return
16
- }
17
-
18
- if (this.urlMap === undefined) {
19
- this.urlMap = new Map()
20
- }
21
-
22
- for (let sJson in data) {
23
- let sObj = data[sJson]
24
- this.urlMap.set(sObj.key, sObj)
25
- }
26
- }
27
-
28
- /*
29
- @brief 获取路径信息,key不存在返回undefine
30
- @return {
31
- key ///<对应key
32
- url ///<接口地址
33
- method ///<接口方法
34
- }
35
- */
36
- GetUrlInfo (key) {
37
- if (this.urlMap.has(key)) {
38
- return this.urlMap.get(key)
39
- }
40
- console.log(`can not find key:${key}`)
41
- return undefined
42
- }
43
- }
44
-
45
- export const HttpUrlMgr = new UrlMgr()
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ export class UrlMgr {
13
+ init (data) {
14
+ if (data === undefined) {
15
+ return
16
+ }
17
+
18
+ if (this.urlMap === undefined) {
19
+ this.urlMap = new Map()
20
+ }
21
+
22
+ for (let sJson in data) {
23
+ let sObj = data[sJson]
24
+ this.urlMap.set(sObj.key, sObj)
25
+ }
26
+ }
27
+
28
+ /*
29
+ @brief 获取路径信息,key不存在返回undefine
30
+ @return {
31
+ key ///<对应key
32
+ url ///<接口地址
33
+ method ///<接口方法
34
+ }
35
+ */
36
+ GetUrlInfo (key) {
37
+ if (this.urlMap.has(key)) {
38
+ return this.urlMap.get(key)
39
+ }
40
+ console.log(`can not find key:${key}`)
41
+ return undefined
42
+ }
43
+ }
44
+
45
+ export const HttpUrlMgr = new UrlMgr()
@@ -1,156 +1,156 @@
1
- /**
2
- * Copyright (c) 2020 kedacom
3
- * OpenATC is licensed under Mulan PSL v2.
4
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
- * You may obtain a copy of Mulan PSL v2 at:
6
- * http://license.coscl.org.cn/MulanPSL2
7
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
- * See the Mulan PSL v2 for more details.
11
- **/
12
- import {
13
- HttpUrlMgr
14
- } from './HttpurlMgr'
15
- import axios from 'axios'
16
- import * as localStorge from './localStorage'
17
- import { removeToken } from '../../utils/auth'
18
-
19
- export const getAxios = () => {
20
- return axios
21
- }
22
-
23
- export class KissApi {
24
- constructor (key) {
25
- this.key = key
26
- this.urlMgr = HttpUrlMgr
27
- this.headerInfo = {}
28
- this.defaultParam = JSON.parse('{}')
29
- }
30
- /*
31
- 获取服务器地址 需要在storage中设置 key=host的value
32
- */
33
- GetHost () {
34
- return localStorge.getStorage('host')
35
- }
36
-
37
- /*
38
- 获取token 需要在storage中设置 key=token的value
39
- */
40
- GetToken () {
41
- return localStorge.getStorage('token')
42
- }
43
-
44
- /*
45
- 获取username 需要在storage中设置 key=user_name的value
46
- */
47
- GetSimuUserKey () {
48
- return localStorge.getStorage('simu_key')
49
- }
50
-
51
- createAxios () {
52
- // 创建axios实例
53
- const service = axios.create()
54
- return service
55
- }
56
-
57
- /*
58
- @brief 发送http请求
59
- @param[in] param 添加到url中的参数json
60
- @param[in] data 添加到body中的参数json
61
- @param[in] urlParamList 添加在url中的动态参数 ['1', 'states'] 则 host/url/1/states?params...
62
- @param[in, out] 回调函数 是否成功及返回的数据 function(bool, json)
63
- @param[in] hasToken 是否使用token
64
- @param[in] isFile 是否为文件格式
65
- @return 成功调用 返回promise对象可以用.then关联回调 失败返回undefine
66
- */
67
- Send (param, data, urlParamList = [], hasToken = true, isFile = false) {
68
- let host = this.GetHost()
69
- if (host === undefined) {
70
- console.log('host is empty')
71
- return undefined
72
- }
73
- if (hasToken) {
74
- let token = this.GetToken()
75
- if (token === undefined) {
76
- console.log('token is empty')
77
- return undefined
78
- }
79
- this.headerInfo.Authorization = token
80
- if (isFile) {
81
- this.headerInfo['Content-Type'] = 'multipart/form-data'
82
- }
83
- }
84
-
85
- // headerInfo['Simukey'] = this.GetSimuUserKey()
86
-
87
- let urlInfo = this.urlMgr.GetUrlInfo(this.key)
88
- if (urlInfo === undefined) {
89
- console.log('urlinfo is empty')
90
- return undefined
91
- }
92
- let apiUrl = urlInfo.url
93
- for (let item of urlParamList) {
94
- apiUrl += '/'
95
- apiUrl += item
96
- }
97
- const config = {
98
- baseURL: host,
99
- url: apiUrl,
100
- method: urlInfo.method,
101
- headers: this.headerInfo,
102
- timeout: 1000 * 60,
103
- data: data,
104
- params: this._assingJson(param, this.defaultParam)
105
- }
106
- const service = this.createAxios()
107
- // 响应错误拦截
108
- if (apiUrl !== '/auth/login') {
109
- this.responseInterception(service)
110
- }
111
- return service({...config})
112
- }
113
-
114
- responseInterception (service) {
115
- // respone拦截器
116
- service.interceptors.response.use(
117
- response => {
118
- /**
119
- * success === false就抛错
120
- */
121
- const res = response.data
122
- if (!res.success) {
123
- this.handleErrorMechanism(res)
124
- return response
125
- } else {
126
- return response
127
- }
128
- },
129
- error => {
130
- console.log(error)
131
- }
132
- )
133
- }
134
-
135
- handleErrorMechanism (res) {
136
- // 全局api错误拦截机制
137
- if (res.code === '3013' || res.code === '3015') {
138
- removeToken()
139
- location.reload()
140
- }
141
- }
142
-
143
- _assingJson (json1, json2) {
144
- if (JSON.stringify(json1) === '{}') return json2
145
- if (JSON.stringify(json2) === '{}') return json1
146
- return JSON.parse((JSON.stringify(json1) + JSON.stringify(json2)).replace(/}{/, ','))
147
- }
148
- }
149
-
150
- export class SimuApi extends KissApi {
151
- constructor (key, simuId) {
152
- super(key)
153
- this.defaultParam['scenestype'] = 'simu'
154
- this.defaultParam['scenesid'] = simuId
155
- }
156
- }
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ import {
13
+ HttpUrlMgr
14
+ } from './HttpurlMgr'
15
+ import axios from 'axios'
16
+ import * as localStorge from './localStorage'
17
+ import { removeToken } from '../../utils/auth'
18
+
19
+ export const getAxios = () => {
20
+ return axios
21
+ }
22
+
23
+ export class KissApi {
24
+ constructor (key) {
25
+ this.key = key
26
+ this.urlMgr = HttpUrlMgr
27
+ this.headerInfo = {}
28
+ this.defaultParam = JSON.parse('{}')
29
+ }
30
+ /*
31
+ 获取服务器地址 需要在storage中设置 key=host的value
32
+ */
33
+ GetHost () {
34
+ return localStorge.getStorage('host')
35
+ }
36
+
37
+ /*
38
+ 获取token 需要在storage中设置 key=token的value
39
+ */
40
+ GetToken () {
41
+ return localStorge.getStorage('token')
42
+ }
43
+
44
+ /*
45
+ 获取username 需要在storage中设置 key=user_name的value
46
+ */
47
+ GetSimuUserKey () {
48
+ return localStorge.getStorage('simu_key')
49
+ }
50
+
51
+ createAxios () {
52
+ // 创建axios实例
53
+ const service = axios.create()
54
+ return service
55
+ }
56
+
57
+ /*
58
+ @brief 发送http请求
59
+ @param[in] param 添加到url中的参数json
60
+ @param[in] data 添加到body中的参数json
61
+ @param[in] urlParamList 添加在url中的动态参数 ['1', 'states'] 则 host/url/1/states?params...
62
+ @param[in, out] 回调函数 是否成功及返回的数据 function(bool, json)
63
+ @param[in] hasToken 是否使用token
64
+ @param[in] isFile 是否为文件格式
65
+ @return 成功调用 返回promise对象可以用.then关联回调 失败返回undefine
66
+ */
67
+ Send (param, data, urlParamList = [], hasToken = true, isFile = false) {
68
+ let host = this.GetHost()
69
+ if (host === undefined) {
70
+ console.log('host is empty')
71
+ return undefined
72
+ }
73
+ if (hasToken) {
74
+ let token = this.GetToken()
75
+ if (token === undefined) {
76
+ console.log('token is empty')
77
+ return undefined
78
+ }
79
+ this.headerInfo.Authorization = token
80
+ if (isFile) {
81
+ this.headerInfo['Content-Type'] = 'multipart/form-data'
82
+ }
83
+ }
84
+
85
+ // headerInfo['Simukey'] = this.GetSimuUserKey()
86
+
87
+ let urlInfo = this.urlMgr.GetUrlInfo(this.key)
88
+ if (urlInfo === undefined) {
89
+ console.log('urlinfo is empty')
90
+ return undefined
91
+ }
92
+ let apiUrl = urlInfo.url
93
+ for (let item of urlParamList) {
94
+ apiUrl += '/'
95
+ apiUrl += item
96
+ }
97
+ const config = {
98
+ baseURL: host,
99
+ url: apiUrl,
100
+ method: urlInfo.method,
101
+ headers: this.headerInfo,
102
+ timeout: 1000 * 60,
103
+ data: data,
104
+ params: this._assingJson(param, this.defaultParam)
105
+ }
106
+ const service = this.createAxios()
107
+ // 响应错误拦截
108
+ if (apiUrl !== '/auth/login') {
109
+ this.responseInterception(service)
110
+ }
111
+ return service({...config})
112
+ }
113
+
114
+ responseInterception (service) {
115
+ // respone拦截器
116
+ service.interceptors.response.use(
117
+ response => {
118
+ /**
119
+ * success === false就抛错
120
+ */
121
+ const res = response.data
122
+ if (!res.success) {
123
+ this.handleErrorMechanism(res)
124
+ return response
125
+ } else {
126
+ return response
127
+ }
128
+ },
129
+ error => {
130
+ console.log(error)
131
+ }
132
+ )
133
+ }
134
+
135
+ handleErrorMechanism (res) {
136
+ // 全局api错误拦截机制
137
+ if (res.code === '3013' || res.code === '3015') {
138
+ removeToken()
139
+ location.reload()
140
+ }
141
+ }
142
+
143
+ _assingJson (json1, json2) {
144
+ if (JSON.stringify(json1) === '{}') return json2
145
+ if (JSON.stringify(json2) === '{}') return json1
146
+ return JSON.parse((JSON.stringify(json1) + JSON.stringify(json2)).replace(/}{/, ','))
147
+ }
148
+ }
149
+
150
+ export class SimuApi extends KissApi {
151
+ constructor (key, simuId) {
152
+ super(key)
153
+ this.defaultParam['scenestype'] = 'simu'
154
+ this.defaultParam['scenesid'] = simuId
155
+ }
156
+ }