openatc-components 0.0.1 → 0.0.2

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 (154) 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 +25 -25
  11. package/build/package.prod.config.js +60 -60
  12. package/build/utils.js +101 -101
  13. package/build/vue-loader.conf.js +22 -22
  14. package/build/webpack.base.conf.js +109 -109
  15. package/build/webpack.dev.conf.js +95 -95
  16. package/build/webpack.prod.conf.js +149 -149
  17. package/config/dev.env.js +7 -7
  18. package/config/index.js +76 -76
  19. package/config/prod.env.js +4 -4
  20. package/config/test.env.js +7 -7
  21. package/index.html +12 -12
  22. package/package/kisscomps/components/CircleMenu/KissCircleMenu.vue +398 -398
  23. package/package/kisscomps/components/CircleMenu/index.js +2 -2
  24. package/package/kisscomps/components/DashBoard/MakeGradientColor.js +84 -84
  25. package/package/kisscomps/components/DashBoard/dashboard.js +471 -471
  26. package/package/kisscomps/components/DashBoard/dashboard.vue +57 -57
  27. package/package/kisscomps/components/DashBoard/index.js +2 -2
  28. package/package/kisscomps/components/Horizontal/KissHorizontal.vue +146 -146
  29. package/package/kisscomps/components/Horizontal/index.js +2 -2
  30. package/package/kisscomps/components/HorizontalChildren/KissHorizontalChildren.vue +196 -196
  31. package/package/kisscomps/components/HorizontalChildren/index.js +2 -2
  32. package/package/kisscomps/components/KissCircleMenu/CircleMenu.vue +113 -113
  33. package/package/kisscomps/components/KissCircleMenu/index.js +2 -2
  34. package/package/kisscomps/components/KissCircleMenu/style/index.less +1 -1
  35. package/package/kisscomps/components/KissCircleMenu/style/main/core.less +161 -161
  36. package/package/kisscomps/components/KissCircleMenu/style/main/other.less +94 -94
  37. package/package/kisscomps/components/KissCircleMenu/style/mixin/mixin.less +36 -36
  38. package/package/kisscomps/components/KissCircleMenu/style/var/var.less +21 -21
  39. package/package/kisscomps/components/KissCircleMenu/utils/colorRE.js +5 -5
  40. package/package/kisscomps/components/KissMessageBox/KissMessageBox.vue +108 -108
  41. package/package/kisscomps/components/KissMessageBox/index.js +2 -2
  42. package/package/kisscomps/components/KissSearchInput/index.js +2 -2
  43. package/package/kisscomps/components/KissSearchInput/kisssearchinput.vue +77 -77
  44. package/package/kisscomps/components/KissSimulationProgress/KissSimulationProgress.vue +294 -294
  45. package/package/kisscomps/components/KissSimulationProgress/index.js +2 -2
  46. package/package/kisscomps/components/StatusBar/StatusBar.vue +222 -222
  47. package/package/kisscomps/components/StatusBar/index.js +2 -2
  48. package/package/kisscomps/components/TragResize/index.js +2 -2
  49. package/package/kisscomps/components/TragResize/kissdragresize.vue +536 -536
  50. package/package/kisscomps/components/TragResize/util/dom.js +23 -23
  51. package/package/kisscomps/components/TragResize/util/fns.js +3 -3
  52. package/package/kisscomps/components/XRDDirSelector/XRDDirSelector.1.vue +320 -320
  53. package/package/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +345 -345
  54. package/package/kisscomps/components/XRDDirSelector/index.js +2 -2
  55. package/package/kisscomps/components/button/index.js +2 -2
  56. package/package/kisscomps/components/button/kissbutton.vue +168 -168
  57. package/package/kisscomps/components/compass3D/compass.vue +180 -180
  58. package/package/kisscomps/components/compass3D/index.js +2 -2
  59. package/package/kisscomps/components/header/index.js +2 -2
  60. package/package/kisscomps/components/header/kissHead.vue +83 -83
  61. package/package/kisscomps/components/horizontalMenu/index.js +2 -2
  62. package/package/kisscomps/components/horizontalMenu/kissHorizontalMenu.vue +254 -254
  63. package/package/kisscomps/components/input/index.js +2 -2
  64. package/package/kisscomps/components/input/kissinput.vue +57 -57
  65. package/package/kisscomps/components/menu/index.js +2 -2
  66. package/package/kisscomps/components/menu/kissmenu.vue +324 -324
  67. package/package/kisscomps/components/mutipletips/Tdrag.js +585 -585
  68. package/package/kisscomps/components/mutipletips/index.js +2 -2
  69. package/package/kisscomps/components/mutipletips/kissmutipletips.vue +192 -192
  70. package/package/kisscomps/components/panel/index.js +2 -2
  71. package/package/kisscomps/components/panel/kissPanel.vue +151 -151
  72. package/package/kisscomps/components/select/chosen.jquery.min.js +3 -3
  73. package/package/kisscomps/components/select/index.js +2 -2
  74. package/package/kisscomps/components/select/kissselect.vue +527 -527
  75. package/package/kisscomps/components/tablebutton/index.js +2 -2
  76. package/package/kisscomps/components/tablebutton/tablebutton.vue +97 -97
  77. package/package/kisscomps/components/timectrl/KissTimeCtrl.vue +67 -67
  78. package/package/kisscomps/components/timectrl/index.js +2 -2
  79. package/package/kisscomps/components/timectrl/timectrl.css +851 -851
  80. package/package/kisscomps/components/tip/Tdrag.js +585 -585
  81. package/package/kisscomps/components/tip/index.js +2 -2
  82. package/package/kisscomps/components/tip/kisstips.1.vue +154 -154
  83. package/package/kisscomps/components/tip/kisstips.vue +154 -154
  84. package/package/kisscomps/components/tip/kisstips.vue.bak +211 -211
  85. package/package/kisscomps/index.js +71 -71
  86. package/package/kissui.js +203 -203
  87. package/package/kissui.min.js +203 -203
  88. package/package.json +1 -1
  89. package/src/App.vue +25 -25
  90. package/src/kisscomps/components/CircleMenu/KissCircleMenu.vue +398 -398
  91. package/src/kisscomps/components/CircleMenu/index.js +2 -2
  92. package/src/kisscomps/components/DashBoard/MakeGradientColor.js +84 -84
  93. package/src/kisscomps/components/DashBoard/dashboard.js +471 -471
  94. package/src/kisscomps/components/DashBoard/dashboard.vue +57 -57
  95. package/src/kisscomps/components/DashBoard/index.js +2 -2
  96. package/src/kisscomps/components/KissCircleMenu/CircleMenu.vue +113 -113
  97. package/src/kisscomps/components/KissCircleMenu/index.js +2 -2
  98. package/src/kisscomps/components/KissCircleMenu/style/index.less +1 -1
  99. package/src/kisscomps/components/KissCircleMenu/style/main/core.less +161 -161
  100. package/src/kisscomps/components/KissCircleMenu/style/main/other.less +94 -94
  101. package/src/kisscomps/components/KissCircleMenu/style/mixin/mixin.less +36 -36
  102. package/src/kisscomps/components/KissCircleMenu/style/var/var.less +21 -21
  103. package/src/kisscomps/components/KissCircleMenu/utils/colorRE.js +5 -5
  104. package/src/kisscomps/components/KissSearchInput/index.js +2 -2
  105. package/src/kisscomps/components/KissSearchInput/kisssearchinput.vue +77 -77
  106. package/src/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +193 -0
  107. package/src/kisscomps/components/SchemeConfig/index.js +2 -0
  108. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +214 -0
  109. package/src/kisscomps/components/SchemeConfig/manualControlModal/index.vue +176 -0
  110. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +294 -0
  111. package/src/kisscomps/components/SchemeConfig/schemeconfig.vue +711 -0
  112. package/src/kisscomps/components/StatusBar/StatusBar.vue +222 -222
  113. package/src/kisscomps/components/StatusBar/index.js +2 -2
  114. package/src/kisscomps/components/TragResize/index.js +2 -2
  115. package/src/kisscomps/components/TragResize/kissdragresize.vue +536 -536
  116. package/src/kisscomps/components/XRDDirSelector/XRDDirSelector.1.vue +320 -320
  117. package/src/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +345 -345
  118. package/src/kisscomps/components/XRDDirSelector/index.js +2 -2
  119. package/src/kisscomps/components/button/index.js +2 -2
  120. package/src/kisscomps/components/button/kissbutton.vue +168 -168
  121. package/src/kisscomps/components/compass3D/compass.vue +180 -180
  122. package/src/kisscomps/components/compass3D/index.js +2 -2
  123. package/src/kisscomps/components/horizontalMenu/index.js +2 -2
  124. package/src/kisscomps/components/horizontalMenu/kissHorizontalMenu.vue +254 -254
  125. package/src/kisscomps/components/input/index.js +2 -2
  126. package/src/kisscomps/components/input/kissinput.vue +57 -57
  127. package/src/kisscomps/components/menu/index.js +2 -2
  128. package/src/kisscomps/components/menu/kissmenu.vue +324 -324
  129. package/src/kisscomps/components/mutipletips/Tdrag.js +585 -585
  130. package/src/kisscomps/components/mutipletips/index.js +2 -2
  131. package/src/kisscomps/components/mutipletips/kissmutipletips.vue +192 -192
  132. package/src/kisscomps/components/select/chosen.jquery.min.js +3 -3
  133. package/src/kisscomps/components/select/index.js +2 -2
  134. package/src/kisscomps/components/select/kissselect.vue +527 -527
  135. package/src/kisscomps/components/timectrl/KissTimeCtrl.vue +67 -67
  136. package/src/kisscomps/components/timectrl/index.js +2 -2
  137. package/src/kisscomps/components/tip/Tdrag.js +585 -585
  138. package/src/kisscomps/components/tip/index.js +2 -2
  139. package/src/kisscomps/components/tip/kisstips.1.vue +154 -154
  140. package/src/kisscomps/components/tip/kisstips.vue +154 -154
  141. package/src/kisscomps/components/tip/kisstips.vue.bak +211 -211
  142. package/src/kisscomps/index.js +73 -71
  143. package/src/main.js +23 -23
  144. package/src/router/index.js +15 -15
  145. package/src/views/home.1.vue +479 -479
  146. package/src/views/home.vue +196 -196
  147. package/test/e2e/custom-assertions/elementCount.js +27 -27
  148. package/test/e2e/nightwatch.conf.js +46 -46
  149. package/test/e2e/runner.js +48 -48
  150. package/test/e2e/specs/test.js +19 -19
  151. package/test/unit/.eslintrc +7 -7
  152. package/test/unit/jest.conf.js +30 -30
  153. package/test/unit/setup.js +3 -3
  154. package/test/unit/specs/HelloWorld.spec.js +11 -11
@@ -0,0 +1,711 @@
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
+ <template>
13
+ <div class="scheme-config" style="height: 100%;">
14
+ <FaultDetailModal ref="faultDetail" :agentId="agentId" @refreshFault="getFaultById"></FaultDetailModal>
15
+ <div style="height: 100%;">
16
+ <transition name="fade-right" mode="out-in"
17
+ :enter-active-class="toPage === 1 ? 'animated fadeInRight' : 'animated fadeInLeft'"
18
+ :leave-active-class="toPage === 1 ? 'animated fadeOutRight' : 'animated fadeOutLeft' ">
19
+ <div style="position: absolute;width: 100%;" v-show="(isOperation && !isClosePhase)">
20
+ <ManualControlModal
21
+ :controlData="controlData"
22
+ :modelList="modelList"
23
+ :stagesList="stagesList"
24
+ :specialcontrolList="specialcontrolList"
25
+ :currModel="currModel"
26
+ :preselectModel="preselectModel"
27
+ :currentStage="currentStage"
28
+ :preselectStages="preselectStages"
29
+ :realtimeStatusModalvisible="realtimeStatusModalvisible"
30
+ @closeManualModal="closeManualModal"
31
+ @selectModel="selectModel"
32
+ @selectStages="selectStages"
33
+ @patternCommit="patternCommit"
34
+ @selectSpecialModel="selectSpecialModel" />
35
+ </div>
36
+ </transition>
37
+ <transition name="fade-left" mode="out-in"
38
+ enter-active-class="animated fadeInRight"
39
+ leave-active-class="animated fadeOutRight">
40
+ <div style="position: absolute;width: 100%;" v-show="(isOperation && isClosePhase)">
41
+ <ClosePhaseControlModal
42
+ v-if="specialPage === 'closephase'"
43
+ :controlData="controlData"
44
+ :closePhaseRings="phaseRings"
45
+ :realtimeStatusModalvisible="realtimeStatusModalvisible"
46
+ @closePhaseBack="closePhaseBack"
47
+ @closePhaseControl= "closePhaseControl" />
48
+ <LockingPhaseControlModal
49
+ v-if="specialPage === 'lockingphase'"
50
+ :controlData="controlData"
51
+ :closePhaseRings="phaseRings"
52
+ :realtimeStatusModalvisible="realtimeStatusModalvisible"
53
+ @closePhaseBack="closePhaseBack"
54
+ @closePhaseControl= "closePhaseControl" />
55
+ </div>
56
+ </transition>
57
+
58
+ <transition name="fade-left" mode="out-in"
59
+ enter-active-class="animated fadeInLeft"
60
+ leave-active-class="animated fadeOutLeft">
61
+ <div class="right-control-part" style="position: absolute;width: 100%;" v-show="!isOperation">
62
+ <RealtimeStatusModal
63
+ :controlData="controlData"
64
+ :currModel="currModel"
65
+ :ip="ip"
66
+ :platform="platform"
67
+ :responseTime="responseTime"
68
+ :curFaultList="curFaultList"
69
+ :confirmedFault="confirmedFault"
70
+ :ignoredFault="ignoredFault"
71
+ :untreatedFault="untreatedFault"
72
+ :currentStage="currentStage"
73
+ :closePhas="closePhase"
74
+ :agentName="agentName"
75
+ :devStatus="devStatus"
76
+ :agentId="agentId"
77
+ :stagesList="stagesList"
78
+ :sidewalkPhaseData="sidewalkPhaseData"
79
+ @changeStatus="changeStatus"
80
+ @showFaultDetail="showFaultDetail"/>
81
+ </div>
82
+ </transition>
83
+ </div>
84
+ </div>
85
+ </template>
86
+
87
+ <script>
88
+ import { putTscControl } from '@/api/control'
89
+ import { uploadSingleTscParam } from '@/api/param'
90
+ import RealtimeStatusModal from './realtimeStatusModal'
91
+ import ManualControlModal from './manualControlModal'
92
+ import ClosePhaseControlModal from './closePhaselControlModal'
93
+ import LockingPhaseControlModal from './lockingPhaselControlModal'
94
+ // import { getFaultMesZh, getFaultMesEn } from '../../utils/faultcode.js'
95
+ import { getMessageByCode } from '../../utils/responseMessage'
96
+ import { GetAllFaultRange } from '@/api/fault'
97
+ import FaultDetailModal from '@/components/FaultDetailModal'
98
+ import PhaseDataModel from '@/views/overView/crossDirection/utils'
99
+ import CrossDiagramMgr from '@/EdgeMgr/controller/crossDiagramMgr'
100
+ export default {
101
+ name: 'schemeConfig',
102
+ components: {
103
+ RealtimeStatusModal,
104
+ ManualControlModal,
105
+ ClosePhaseControlModal,
106
+ LockingPhaseControlModal,
107
+ FaultDetailModal
108
+ },
109
+ props: {
110
+ responseTime: {
111
+ type: Number,
112
+ default: 0
113
+ },
114
+ statusData: {
115
+ type: Object,
116
+ required: true
117
+ },
118
+ agentName: {
119
+ type: String,
120
+ default: ''
121
+ },
122
+ devStatus: {
123
+ type: Number,
124
+ default: 0
125
+ },
126
+ agentId: {
127
+ type: String,
128
+ default: '0'
129
+ },
130
+ ip: {
131
+ type: String
132
+ },
133
+ platform: {
134
+ type: String
135
+ },
136
+ realtimeStatusModalvisible: {
137
+ type: Boolean,
138
+ default: true
139
+ }
140
+ },
141
+ data () {
142
+ return {
143
+ crossStatusData: null,
144
+ controlData: {},
145
+ control: '',
146
+ sidewalkPhaseData: [],
147
+ stagesList: [],
148
+ currentStage: 0,
149
+ list: [{
150
+ iconClass: 'model',
151
+ name: '控制模式',
152
+ value: '--'
153
+ }, {
154
+ iconClass: 'cycle',
155
+ name: '周期',
156
+ value: '--'
157
+ }, {
158
+ iconClass: 'time',
159
+ name: '当前时间',
160
+ value: '--'
161
+ }, {
162
+ iconClass: 'maincontrol',
163
+ name: '控制方式',
164
+ value: '--'
165
+ }, {
166
+ iconClass: 'phasediff',
167
+ name: '相位差',
168
+ value: '--'
169
+ }, {
170
+ iconClass: 'time',
171
+ name: '剩余时间',
172
+ value: '--'
173
+ }],
174
+ faultTimer: null, // 当前故障定时器
175
+ ParamsMode: new Map([[0, '自主控制'], [1, '本地手动'], [2, '平台控制'], [3, '配置软件控制'], [4, '遥控器控制'], [5, '黄闪器控制'], [6, '降级控制'], [7, '脚本控制'], [8, '算法控制']]),
176
+ ParamsModeEn: new Map([[0, 'Autonomous Control'], [1, 'Local Manual'], [2, 'Platform Control'], [3, 'Configuration Software Control'], [4, 'Remote Control'], [5, 'Yellow Flasher Control'], [6, 'Degradation Control'], [7, 'Script Control'], [8, 'Algorithm Control']]),
177
+ ParamsControl: new Map([[0, '多时段'], [1, '黄闪'], [2, '全红'], [3, '关灯'], [4, '步进'], [5, '定周期控制'], [6, '单点感应控制'], [7, '协调感应控制'], [8, '方案选择控制'], [9, '自适应控制'], [10, '无电缆控制'], [11, '有电缆控制'], [12, '行人过街控制'], [13, '方案恢复过渡'], [14, '相位驻留'], [15, '通道检测'], [16, '方向锁定'], [17, '韦伯斯特单点控制'], [18, '预留18'], [19, '感应式行人过街'], [20, '方案干预'], [100, '方案干预'], [21, '预留21'], [22, '相位锁定'], [23, '相位放行控制'], [24, '紧急控制'], [99, '设备维护']]),
178
+ ParamsControlEn: new Map([[0, 'Multi Period'], [1, 'Yellow Flash Control'], [2, 'Red Control'], [3, 'Dark Control'], [4, 'Step'], [5, 'Fixed_Cycle Control'], [6, 'Free Control'], [7, 'Coordinated Induction Control'], [8, 'Pattern Selection Control'], [9, 'Adaptive Control'], [10, 'Wireless Control'], [11, 'Cable Control'], [12, 'Pedestrian Crossing Control'], [13, 'Pattern recovery'], [14, 'Phase dwell'], [15, 'Channel Detection'], [16, 'Direction lock'], [17, 'Webster Single Point Coordination'], [18, 'Reserving18'], [19, 'Inductive Pedestrian Crossing Control'], [20, 'Program Intervention'], [100, 'Program Intervention'], [21, 'Reserving21'], [22, 'Priority Control'], [23, 'Close Phase'], [24, 'Emergency Control'], [99, 'Device Mantenance']]),
179
+ phaseType: new Map([[1, '红'], [2, '黄'], [3, '绿']]), // phaseType表示红,黄,绿
180
+ phaseTypeEn: new Map([[1, 'Red'], [2, 'Yellow'], [3, 'Green']]), // phaseType表示红,黄,绿
181
+ mode: '2',
182
+ loading: {},
183
+ modelList: [{
184
+ id: 1,
185
+ iconClass: 'huangshan',
186
+ iconName: '黄闪'
187
+ }, {
188
+ id: 2,
189
+ iconClass: 'quanhong',
190
+ iconName: '全红'
191
+ }, {
192
+ id: 3,
193
+ iconClass: 'guandeng',
194
+ iconName: '关灯'
195
+ }, {
196
+ id: 4,
197
+ iconClass: 'bujin',
198
+ iconName: '步进'
199
+ }, {
200
+ id: 5,
201
+ iconClass: 'dingzhouqi',
202
+ iconName: '定周期'
203
+ }, {
204
+ id: 6,
205
+ iconClass: 'ganyingkongzhi',
206
+ iconName: '感应控制'
207
+ }, {
208
+ id: 9,
209
+ iconClass: 'zishiying',
210
+ iconName: '自适应控制'
211
+ }, {
212
+ id: 10,
213
+ iconClass: 'wuxianlan',
214
+ iconName: '无电缆协调'
215
+ }, {
216
+ id: 12,
217
+ iconClass: 'xingrenguojie',
218
+ iconName: '行人过街'
219
+ }, {
220
+ id: 19,
221
+ iconClass: 'ganyingshixingrenguojie',
222
+ iconName: '感应式行人过街控制'
223
+ }],
224
+ currModel: -1,
225
+ preselectModel: -1, // 预选方案
226
+ preselectStages: -1, // 预选阶段
227
+ closePhase: [],
228
+ isOperation: false, // 是否为手动可操作状态
229
+ tempPatternid: 0, // 控制方式手动操作的情况下的控制编号的临时值。
230
+ tempDelay: 0, // 控制方式手动操作的情况下的延迟时间的临时值。
231
+ tempDuration: 0, // 控制方式手动操作的情况下的持续时间的临时值。
232
+ phaseList: [], // 当前相位集合
233
+ faultvisible: false,
234
+ isClosePhase: false, // 是否在相位关断
235
+ toPage: 1, // 与哪一个页面交互,1 代表路口信息页面,3代表 相位关断页面
236
+ specialcontrolList: [{ // 特殊控制
237
+ id: 23,
238
+ iconClass: 'closephase'
239
+ }, {
240
+ id: 22,
241
+ iconClass: 'lockingphase'
242
+ }],
243
+ phaseRings: [],
244
+ curFaultList: [],
245
+ confirmedFault: [],
246
+ ignoredFault: [],
247
+ untreatedFault: [],
248
+ specialPage: '' // 哪一个特殊控制页面
249
+ }
250
+ },
251
+ watch: {
252
+ statusData: {
253
+ handler: function (val) {
254
+ this.initData()
255
+ },
256
+ // 深度观察监听
257
+ deep: true
258
+ },
259
+ phaseList: {
260
+ handler: function (val, oldVal) {
261
+ this.getPedPhasePos()
262
+ },
263
+ // 深度观察监听
264
+ deep: true
265
+ }
266
+ },
267
+ created () {
268
+ this.PhaseDataModel = new PhaseDataModel()
269
+ this.CrossDiagramMgr = new CrossDiagramMgr()
270
+ if (this.realtimeStatusModalvisible === false) {
271
+ this.changeStatus()
272
+ }
273
+ },
274
+ async mounted () {
275
+ await this.getPhase()
276
+ this.getFault()
277
+ this.initData()
278
+ },
279
+ methods: {
280
+ getFault () {
281
+ this.getFaultById()
282
+ this.faultTimer = setInterval(() => {
283
+ this.getFaultById()
284
+ }, 30000)
285
+ },
286
+ getPedPhasePos () {
287
+ // 行人相位信息
288
+ this.sidewalkPhaseData = []
289
+ this.phaseList.forEach((ele, i) => {
290
+ if (ele.peddirection) {
291
+ ele.peddirection.forEach((dir, index) => {
292
+ // 行人相位
293
+ if (this.PhaseDataModel.getSidePos(dir)) {
294
+ this.sidewalkPhaseData.push({
295
+ key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
296
+ phaseid: ele.id, // 相位id,用于对应相位状态
297
+ id: dir,
298
+ name: this.PhaseDataModel.getSidePos(dir).name
299
+ })
300
+ }
301
+ })
302
+ }
303
+ })
304
+ },
305
+ clearFaultInterval () {
306
+ if (this.faultTimer !== null) {
307
+ clearInterval(this.faultTimer) // 清除流量定时器
308
+ this.faultTimer = null
309
+ }
310
+ },
311
+ initData () {
312
+ this.crossStatusData = JSON.parse(JSON.stringify(this.statusData))
313
+ let TscData = JSON.parse(JSON.stringify(this.crossStatusData))
314
+ this.currModel = TscData.control
315
+ this.handleStageData(TscData) // 处理阶段(驻留)stage数据
316
+ this.controlData = this.handleGetData(TscData)
317
+ this.handleGetPhaseClose()
318
+ },
319
+ getBusPos () {
320
+ // 公交相位信息
321
+ this.busPhaseData = []
322
+ this.phaseList.forEach((ele, i) => {
323
+ if (ele.controltype >= 3 && ele.controltype <= 5) {
324
+ ele.direction.forEach((dir, index) => {
325
+ // 车道相位
326
+ this.busPhaseData.push({
327
+ // key: this.CrossDiagramMgr.getUniqueKey('busphase'),
328
+ phaseid: ele.id, // 相位id,用于对应相位状态
329
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
330
+ name: this.PhaseDataModel.getBusPhasePos(dir).name,
331
+ controltype: ele.controltype
332
+ })
333
+ })
334
+ }
335
+ })
336
+ let result = []
337
+ let obj = {}
338
+ for (var i = 0; i < this.busPhaseData.length; i++) {
339
+ if (!obj[this.busPhaseData[i].phaseid]) {
340
+ result.push(this.busPhaseData[i])
341
+ obj[this.busPhaseData[i].phaseid] = true
342
+ }
343
+ }
344
+ this.busPhaseData = result
345
+ },
346
+ handleStageData (data) {
347
+ this.getBusPos()
348
+ this.stagesList = []
349
+ let busPhaseData = this.busPhaseData
350
+ this.currentStage = data.current_stage
351
+ let stages = data.stages
352
+ if (!stages) return
353
+ let stagesTemp = []
354
+ for (let stage of stages) {
355
+ let tempList = []
356
+ let directionList = []
357
+ let stageControType = 0
358
+ let peddirections = []
359
+ for (let stg of stage) {
360
+ let currPhase = this.phaseList.filter((item) => {
361
+ return item.id === stg
362
+ })[0]
363
+ if (currPhase !== undefined) {
364
+ directionList = [...currPhase.direction, ...directionList]
365
+ }
366
+ for (let walk of this.sidewalkPhaseData) {
367
+ if (stg === walk.phaseid) {
368
+ peddirections.push(...currPhase.peddirection)
369
+ peddirections = Array.from(new Set(peddirections))
370
+ }
371
+ }
372
+ for (let busPhase of busPhaseData) {
373
+ if (stg === busPhase.phaseid) {
374
+ stageControType = busPhase.controltype
375
+ }
376
+ }
377
+ }
378
+ directionList = [...new Set(directionList)]
379
+ if (directionList.length === 0) return
380
+ tempList = directionList.map(dir => ({
381
+ id: dir,
382
+ color: '#606266',
383
+ controltype: stageControType,
384
+ peddirection: peddirections
385
+ }))
386
+ stagesTemp.push(tempList)
387
+ this.stagesList = JSON.parse(JSON.stringify(stagesTemp))
388
+ }
389
+ },
390
+ lockScreen () {
391
+ this.loading = this.$loading({
392
+ lock: true,
393
+ text: 'Loading',
394
+ spinner: 'el-icon-loading',
395
+ background: 'rgba(0, 0, 0, 0.5)'
396
+ })
397
+ },
398
+ unlockScreen () {
399
+ this.loading.close()
400
+ },
401
+ selectModel (value) {
402
+ if (!this.isOperation) return
403
+ this.preselectStages = -1
404
+ this.preselectModel = value
405
+ },
406
+ selectStages (value) {
407
+ if (!this.isOperation) return
408
+ if (this.preselectStages !== -1) {
409
+ if (this.preselectStages === value) {
410
+ this.preselectStages = -1
411
+ } else {
412
+ this.preselectStages = value
413
+ this.preselectModel = 4 // 如果选了阶段,默认控制方式为步进
414
+ }
415
+ } else {
416
+ this.preselectStages = value
417
+ this.preselectModel = 4 // 如果选了阶段,默认控制方式为步进
418
+ }
419
+ },
420
+ changeStatus () {
421
+ this.toPage = 1
422
+ this.isOperation = true
423
+ if (this.modelList.filter(ele => ele.id === 0).length === 0) {
424
+ let autonomyControl = {
425
+ id: 0,
426
+ iconClass: 'zizhukongzhi',
427
+ iconName: '自主控制'
428
+ }
429
+ this.modelList.push(autonomyControl)
430
+ }
431
+ },
432
+ handleGetData (data) {
433
+ let that = this
434
+ if (data.name === '') {
435
+ if (that.$i18n.locale === 'en') {
436
+ data.name = 'Pattern' + data.patternid
437
+ } else if (that.$i18n.locale === 'zh') {
438
+ data.name = '方案' + data.patternid
439
+ }
440
+ }
441
+ Object.keys(data).forEach(function (key) {
442
+ if (that.$i18n.locale === 'en') {
443
+ if (key === 'mode') {
444
+ if (data[key] > 0 && data[key] < 6) {
445
+ data[key] = that.ParamsModeEn.get(data[key])
446
+ } else {
447
+ data[key] = that.ParamsModeEn.get(0)
448
+ }
449
+ }
450
+ if (key === 'control') {
451
+ data[key] = that.ParamsControlEn.get(data[key])
452
+ }
453
+ if (key === 'phase') {
454
+ for (let val of data[key]) {
455
+ val.type = that.phaseTypeEn.get(val.type)
456
+ }
457
+ }
458
+ } else if (that.$i18n.locale === 'zh') {
459
+ if (key === 'mode') {
460
+ if (data[key] > 0 && data[key] < 6) {
461
+ data[key] = that.ParamsMode.get(data[key])
462
+ } else {
463
+ data[key] = that.ParamsMode.get(0)
464
+ }
465
+ }
466
+ if (key === 'control') {
467
+ data[key] = that.ParamsControl.get(data[key])
468
+ }
469
+ if (key === 'phase') {
470
+ for (let val of data[key]) {
471
+ val.type = that.phaseType.get(val.type)
472
+ }
473
+ }
474
+ }
475
+ })
476
+ return data
477
+ },
478
+ closeManualModal () {
479
+ this.isOperation = false
480
+ this.preselectModel = -1
481
+ this.preselectStages = -1
482
+ this.tempPatternid = 0
483
+ this.tempDelay = 0
484
+ this.tempDuration = 0
485
+ this.modelList = this.modelList.filter((item) => {
486
+ return item.id !== 0
487
+ })
488
+ this.toPage = 1
489
+ },
490
+ patternCommit (manualInfo) {
491
+ let that = this
492
+ let control = {}
493
+ that.ParamsMode.forEach(function (value, key, map) {
494
+ if (that.controlData.mode === value) {
495
+ control.mode = key
496
+ }
497
+ })
498
+ control.control = that.preselectModel === -1 ? that.currModel : that.preselectModel
499
+ control.terminal = Number(manualInfo.tempPatternid)
500
+ control.delay = Number(manualInfo.tempDelay)
501
+ control.duration = Number(manualInfo.tempDuration)
502
+ control.value = that.preselectStages === -1 ? 0 : that.preselectStages
503
+ if (control.control === 0) {
504
+ // 恢复自主控制(多时段)时,value为当前控制方式
505
+ control.value = this.currModel
506
+ }
507
+ if (!this.realtimeStatusModalvisible) {
508
+ console.log(control)
509
+ return
510
+ }
511
+ this.lockScreen()
512
+ putTscControl(control).then(data => {
513
+ that.unlockScreen()
514
+ let success = 0
515
+ if (!data.data.success) {
516
+ that.$message.error(getMessageByCode(data.data.code, that.$i18n.locale))
517
+ return
518
+ }
519
+ if (data.data.data && data.data.data.data) {
520
+ success = data.data.data.data.success
521
+ if (success !== 0) {
522
+ let errormsg = 'edge.overview.putTscControlError' + success
523
+ that.$message.error(this.$t(errormsg))
524
+ return
525
+ }
526
+ }
527
+ // this.closeManualModal()
528
+ if ((that.currModel === 5 || that.currModel === 6 || that.currModel === 10 || that.currModel === 12) && (that.preselectModel === 6 || that.preselectModel === 10 || that.preselectModel === 12)) {
529
+ that.$message.success(this.$t('edge.overview.nextcycleeffic'))
530
+ return
531
+ }
532
+ if (that.preselectModel === 4) {
533
+ that.$message.success(this.$t('edge.overview.transitioneffic'))
534
+ return
535
+ }
536
+ if (success === 0) {
537
+ that.$message.success(this.$t('edge.common.download'))
538
+ }
539
+ }).catch(error => {
540
+ that.unlockScreen()
541
+ that.$message.error(error)
542
+ console.log(error)
543
+ })
544
+ },
545
+ getPhase () {
546
+ let _this = this
547
+ return new Promise(function (resolve, reject) {
548
+ uploadSingleTscParam('phase').then(data => {
549
+ let res = data.data
550
+ if (!res.success) {
551
+ if (res.code === '4003') {
552
+ _this.$message.error(_this.$t('edge.errorTip.devicenotonline'))
553
+ return
554
+ }
555
+ _this.$message.error(getMessageByCode(data.data.code, _this.$i18n.locale))
556
+ return
557
+ }
558
+ _this.phaseList = res.data.data.phaseList
559
+ resolve()
560
+ })
561
+ })
562
+ },
563
+ handleFaultsVisible () {
564
+ this.faultvisible = !this.faultvisible
565
+ },
566
+ handleGetPhaseClose () {
567
+ if (this.crossStatusData.phase) {
568
+ this.crossStatusData.phase = this.crossStatusData.phase.map(ele => {
569
+ return {
570
+ ...ele,
571
+ close: ele.close || 0,
572
+ locktype: 0 // 默认所有相位显示解锁状态
573
+ }
574
+ })
575
+ // 相位关断标签
576
+ this.closePhase = []
577
+ this.crossStatusData.phase.forEach(phase => {
578
+ if (phase.close !== undefined && phase.close !== 0) {
579
+ let typename
580
+ switch (phase.close) {
581
+ case 1: typename = ''
582
+ break
583
+ case 2: typename = this.$t('edge.overview.vehicle')
584
+ break
585
+ case 3: typename = this.$t('edge.overview.pedestrian')
586
+ break
587
+ default:typename = ''
588
+ }
589
+ this.closePhase.push({
590
+ id: phase.id,
591
+ typename: typename
592
+ })
593
+ }
594
+ })
595
+ }
596
+ },
597
+ selectSpecialModel (id) {
598
+ if (id === 23) {
599
+ this.toPage = 3
600
+ this.isClosePhase = true
601
+ this.initRingPhaseData()
602
+ this.specialPage = 'closephase'
603
+ } else if (id === 22) {
604
+ this.toPage = 3
605
+ this.isClosePhase = true
606
+ this.initRingPhaseData()
607
+ this.specialPage = 'lockingphase'
608
+ } else {
609
+ this.isClosePhase = false
610
+ this.specialPage = ''
611
+ }
612
+ },
613
+ closePhaseBack () {
614
+ this.toPage = 3
615
+ this.isClosePhase = false
616
+ },
617
+ closePhaseControl (controldata) {
618
+ if (!this.realtimeStatusModalvisible) {
619
+ console.log(controldata)
620
+ return
621
+ }
622
+ this.lockScreen()
623
+ putTscControl(controldata).then(data => {
624
+ this.unlockScreen()
625
+ if (!data.data.success) {
626
+ this.$message.error(data.data.message)
627
+ return
628
+ }
629
+ this.$alert(this.$t('edge.common.download'), { type: 'success' })
630
+ }).catch(error => {
631
+ this.unlockScreen()
632
+ this.$message.error(error)
633
+ console.log(error)
634
+ })
635
+ },
636
+ initRingPhaseData () {
637
+ // 环信息从单独上载相位信息里获取,以免相位锁定后,方案状态数据里没有rings,导致相位锁定控制列表无法显示
638
+ this.phaseRings = []
639
+ let map = {}
640
+ let dest = []
641
+ for (let i = 0; i < this.phaseList.length; i++) {
642
+ let ai = this.phaseList[i]
643
+ if (!map[ai.ring]) {
644
+ let addphse = this.addPhaseInfo(ai)
645
+ dest.push({
646
+ num: ai.ring,
647
+ phases: [{...ai, ...addphse}]
648
+ })
649
+ map[ai.ring] = ai
650
+ } else {
651
+ for (var j = 0; j < dest.length; j++) {
652
+ var dj = dest[j]
653
+ if (dj.num === ai.ring) {
654
+ let addphse = this.addPhaseInfo(ai)
655
+ dj.phases.push({...ai, ...addphse})
656
+ break
657
+ }
658
+ }
659
+ }
660
+ }
661
+ this.phaseRings = JSON.parse(JSON.stringify(dest))
662
+ },
663
+ addPhaseInfo (phase) {
664
+ let addphse = {}
665
+ addphse.name = this.$t('edge.overview.phase') + phase.id
666
+ addphse.desc = this.getPhaseDescription(phase.direction)
667
+ // 相位锁定选项默认都按照解锁状态显示
668
+ addphse.locktype = 0
669
+ addphse.close = 0
670
+ if (this.crossStatusData !== null && this.crossStatusData.phase) {
671
+ // 如果方案状态相位有close字段,这边就需要对应close状态进相位关断控制的选项里
672
+ let phaseStatus = this.crossStatusData.phase.filter(ele => ele.id === phase.id)[0]
673
+ addphse = {...addphse, ...phaseStatus}
674
+ }
675
+ return addphse
676
+ },
677
+ getPhaseDescription (phaseList) {
678
+ let list = []
679
+ for (let id of phaseList) {
680
+ let obj = {}
681
+ obj.id = id
682
+ obj.color = '#454545'
683
+ list.push(obj)
684
+ }
685
+ return list
686
+ },
687
+ getFaultById () {
688
+ let param = {
689
+ agentId: this.agentId,
690
+ isCurrentFault: true
691
+ }
692
+ GetAllFaultRange(param).then(res => {
693
+ if (res.data.success !== true) {
694
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
695
+ return
696
+ }
697
+ this.curFaultList = res.data.data.content
698
+ this.confirmedFault = this.curFaultList.filter(ele => ele.enumerate === '2')
699
+ this.ignoredFault = this.curFaultList.filter(ele => ele.enumerate === '1')
700
+ this.untreatedFault = this.curFaultList.filter(ele => ele.enumerate === '0')
701
+ })
702
+ },
703
+ showFaultDetail () {
704
+ this.$refs.faultDetail.onViewFaultClick()
705
+ }
706
+ },
707
+ destroyed () {
708
+ this.clearFaultInterval()
709
+ }
710
+ }
711
+ </script>