openatc-components 0.1.189 → 0.1.190

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openatc-components",
3
- "version": "0.1.189",
3
+ "version": "0.1.190",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
package/src/api/param.js CHANGED
@@ -39,6 +39,17 @@ export function uploadTscParam () {
39
39
  return api.Send({}, data)
40
40
  }
41
41
 
42
+ export function uploadTscParams (id) {
43
+ var iframdevid = id
44
+ let api = new Authapi('uploadTscParam')
45
+ let data = {}
46
+ data.agentid = iframdevid
47
+ data.operation = 'get-request'
48
+ data.infotype = 'feature/all'
49
+ // let paramList = [iframdevid, 'param', 'upload']
50
+ return api.Send({}, data)
51
+ }
52
+
42
53
  export function uploadSingleTscParam (type, iframdevid) {
43
54
  // var iframdevid = getIframdevid()
44
55
  let api = new Authapi('uploadSingleTscParam')
@@ -0,0 +1,233 @@
1
+ // import store from '../store'
2
+ import { uploadTscParams } from '../api/param'
3
+ import { Message } from 'element-ui'
4
+ import { getMessageByCode } from '../utils/responseMessage'
5
+ import i18n from '../i18n/index'
6
+ export async function computedRelation (id) {
7
+ let uploadData = await UploadTscParam(id)
8
+ if (!uploadData) return
9
+ let result = []
10
+ let channel = uploadData.channelList
11
+ // let channel = store.getters.globalParamModel.getParamsByType('channelList')
12
+ let tableData = channel.map(item => {
13
+ return {
14
+ id: item.id,
15
+ peddirection: item.realtype && item.realtype === 'peddirection' ? item.realdir : [],
16
+ phasedirection: item.realtype && item.realtype === 'direction' ? item.realdir : []
17
+ }
18
+ })
19
+ let colorArray = getDefaul(uploadData)
20
+ tableData.forEach(itemA => {
21
+ (uploadData.channelGreenConflictInfo.length > 0 ? uploadData.channelGreenConflictInfo : colorArray).forEach(itemB => {
22
+ if (itemA.id === itemB.channelid) {
23
+ // 处理peddirection
24
+ itemA.peddirection.forEach(pedDir => {
25
+ if (pedDir > 0) {
26
+ result.push({
27
+ direction: pedDir,
28
+ type: 'pedphase',
29
+ laneConflictList: [],
30
+ conflictchannel: itemB.greenconflict,
31
+ pedConflictList: []
32
+ })
33
+ }
34
+ })
35
+ // 处理phasedirection
36
+ itemA.phasedirection.forEach(phaseDir => {
37
+ if (phaseDir > 0) {
38
+ result.push({
39
+ direction: phaseDir,
40
+ type: 'phase',
41
+ conflictchannel: itemB.greenconflict,
42
+ laneConflictList: [],
43
+ pedConflictList: []
44
+ })
45
+ }
46
+ })
47
+ }
48
+ })
49
+ })
50
+ result.forEach(item => {
51
+ item.conflictchannel.forEach(aaaValue => {
52
+ channel.forEach(cha => {
53
+ if (cha.id === aaaValue) {
54
+ if (cha.realtype === 'direction') {
55
+ item.laneConflictList.push(...cha.realdir)
56
+ } else if (cha.realtype === 'peddirection') {
57
+ item.pedConflictList.push(...cha.realdir)
58
+ }
59
+ }
60
+ })
61
+ })
62
+ delete item.conflictchannel
63
+ })
64
+ console.log(result, 'result')
65
+ return result
66
+ }
67
+ export function getDefaul (data) {
68
+ let phaseList = data.phaseList
69
+ let overlaplList = data.overlaplList
70
+ let channel = data.channelList
71
+ let newPhase = phaseList.map(item => {
72
+ return {
73
+ id: item.id,
74
+ concurrent: item.concurrent
75
+ }
76
+ })
77
+ let newOverlap = overlaplList.map(item => {
78
+ return {
79
+ id: item.id,
80
+ includedphases: item.includedphases
81
+ }
82
+ })
83
+ let newChannel = channel.map(item => {
84
+ return {
85
+ id: item.id,
86
+ controltype: item.controltype,
87
+ controlsource: item.controlsource
88
+ }
89
+ })
90
+ let defaultList = newChannel.map(cha => {
91
+ if (cha.controltype === 2 || cha.controltype === 3) {
92
+ for (let i = 0; i < newPhase.length; i++) {
93
+ if (cha.controlsource === newPhase[i].id) {
94
+ return {
95
+ id: cha.id,
96
+ controlsource: cha.controlsource,
97
+ newCurren: newPhase[i].concurrent
98
+ }
99
+ }
100
+ }
101
+ } else if (cha.controltype === 4 || cha.controltype === 5) {
102
+ let newLap = newOverlap.map(item => {
103
+ let phaList = []
104
+ if (item.id === cha.controlsource) {
105
+ phaList.push(...item.includedphases)
106
+ }
107
+ // for (let h = 0; h < item.includedphases.length; h++) {
108
+ // for (let k = 0; k < newPhase.length; k++) {
109
+ // if (item.includedphases[h] === newPhase[k].id) {
110
+ // phaList.push(...newPhase[k].concurrent)
111
+ // }
112
+ // }
113
+ // }
114
+ return {
115
+ id: item.id,
116
+ concurrent: Array.from(new Set(phaList))
117
+ }
118
+ })
119
+ for (let i = 0; i < newLap.length; i++) {
120
+ if (cha.controlsource === newLap[i].id) {
121
+ return {
122
+ id: cha.id,
123
+ controlsource: newLap[i].concurrent,
124
+ newCurren: newLap[i].concurrent
125
+ }
126
+ }
127
+ }
128
+ } else {
129
+ return {
130
+ id: cha.id,
131
+ controlsource: cha.controlsource,
132
+ newCurren: []
133
+ }
134
+ }
135
+ })
136
+ // this.colorArray = this.transform(defaultList)
137
+ const ret = defaultList.map((i, idx) => {
138
+ const result = []
139
+ let greenconflict = []
140
+ defaultList.forEach((j, jdx) => {
141
+ if (idx !== jdx) {
142
+ const ic = Array.isArray(i.controlsource) ? i.controlsource : [i.controlsource]
143
+ const jc = Array.isArray(j.controlsource) ? j.controlsource : [j.controlsource]
144
+ let hasDuplicate = false
145
+ for (let i = 0; i < ic.length; i++) {
146
+ for (let j = 0; j < jc.length; j++) {
147
+ if (ic[i] === jc[j]) {
148
+ hasDuplicate = true
149
+ break
150
+ }
151
+ }
152
+ if (hasDuplicate) {
153
+ break
154
+ }
155
+ }
156
+ const isRelation = ic.some(x => jc.some(y => newPhase.find(m => m.id === x && m.concurrent.includes(y))))
157
+ if (isRelation || hasDuplicate) {
158
+ result.push(j.id)
159
+ } else {
160
+ greenconflict.push(j.id)
161
+ }
162
+ }
163
+ })
164
+ i.result = result
165
+ i.greenconflict = greenconflict
166
+ return i
167
+ })
168
+ let newFlict = ret.map(r => {
169
+ return {
170
+ channelid: r.id,
171
+ greenOther: r.result,
172
+ greenconflict: r.greenconflict
173
+ }
174
+ })
175
+ return newFlict
176
+ }
177
+ export function UploadTscParam (id) {
178
+ return uploadTscParams(id).then(data => {
179
+ if (!data.data.success) {
180
+ if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
181
+ let success = data.data.data.content.success
182
+ if (success !== 0) {
183
+ let errormsg = 'openatccomponents.overview.putTscControlError' + success
184
+ Message.error(this.$t(errormsg))
185
+ return
186
+ }
187
+ }
188
+ if (data.data.code === '4002') { // 错误应答
189
+ // 子类型错误
190
+ let childErrorCode = data.data.data.errorCode
191
+ if (childErrorCode) {
192
+ Message.error(getMessageByCode(data.data.data.errorCode, i18n.locale))
193
+ return
194
+ }
195
+ }
196
+ Message.error(getMessageByCode(data.data.code, i18n.locale))
197
+ return
198
+ }
199
+ if (Object.keys(data.data.data.data).length === 0) {
200
+ Message.error(this.$t('edge.errorTip.noSchemeUpload'))
201
+ return
202
+ }
203
+ let {customInfo, ...allTscParam} = data.data.data.data
204
+ if (allTscParam.manualpanel === undefined) {
205
+ allTscParam.manualpanel = {}
206
+ }
207
+ if (allTscParam.channellock === undefined) {
208
+ allTscParam.channellock = []
209
+ }
210
+ if (allTscParam.channelList === undefined) {
211
+ allTscParam.channelList = []
212
+ }
213
+ if (allTscParam.overlaplList === undefined) {
214
+ allTscParam.overlaplList = []
215
+ }
216
+ if (allTscParam.detectorList === undefined) {
217
+ allTscParam.detectorList = []
218
+ }
219
+ if (allTscParam.pedestrainDetectorList === undefined) {
220
+ allTscParam.pedestrainDetectorList = []
221
+ }
222
+ if (allTscParam.preemptList === undefined) {
223
+ allTscParam.preemptList = []
224
+ }
225
+ if (allTscParam.channelGreenConflictInfo === undefined) {
226
+ allTscParam.channelGreenConflictInfo = []
227
+ }
228
+ if (allTscParam.singleoptim === undefined) {
229
+ allTscParam.singleoptim = []
230
+ }
231
+ return allTscParam
232
+ })
233
+ }
@@ -94,10 +94,10 @@ export default {
94
94
  return {
95
95
  roadDirection: 'right',
96
96
  // reqUrl: 'http://192.168.13.103:10003/openatc',
97
- agentId: '12008_835',
97
+ agentId: 'bclgkxl',
98
98
  // agentId: '0351-01',
99
99
  reqUrl: 'http://192.168.13.103:10003/openatc',
100
- Token: 'eyJraWQiOiIxNzA4MzkyMTMyNTIxIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcwODQzNTMzMiwiaWF0IjoxNzA4MzkyMTMyfQ.xAu8PsIwJAc2cMhxxuncVzW5sgxVBRZu0OYep1Q8vFU',
100
+ Token: 'eyJraWQiOiIxNzExMDY5ODQ1OTU3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcxMTExMzA0NiwiaWF0IjoxNzExMDY5ODQ2fQ.El-dGs65l7TANRBdj1hR8dz2xVur8GjeVO8hkcBhRIQ',
101
101
  // agentId: '30003-352',
102
102
  // reqUrl: 'https://kints-dev.devdolphin.com/openatc',
103
103
  // Token: 'eyJraWQiOiIxNjUwNTA5MDI2ODk2IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJ4aWFvbWluZyIsImV4cCI6MTczNjkwOTAyNiwiaWF0IjoxNjUwNTA5MDI2fQ.-s4T-uMRmB2zf9yer87USKQXLY1a12Zq5lCOnqjNmfA',
@@ -1,17 +1,19 @@
1
1
  <template>
2
2
  <div id="test1">
3
3
  <overview
4
- :AgentId="agentId"
5
- :reqUrl="reqUrl"
6
- :modeName="modeName"
7
- :controlName="controlName"
8
- :isShowState="isShowState"
9
- :isShowMode="isShowMode"
10
- :Token="Token"></overview>
4
+ :AgentId="agentId"
5
+ :reqUrl="reqUrl"
6
+ :modeName="modeName"
7
+ :controlName="controlName"
8
+ :isShowState="isShowState"
9
+ :isShowMode="isShowMode"
10
+ :Token="Token"
11
+ ></overview>
11
12
  </div>
12
13
  </template>
13
14
 
14
15
  <script>
16
+ import { computedRelation } from '../utils/conflct'
15
17
  export default {
16
18
  data () {
17
19
  return {
@@ -19,8 +21,8 @@ export default {
19
21
  isShowMode: true,
20
22
  modeName: '交警遥控',
21
23
  controlName: '步进',
22
- agentId: 'jmlxhl',
23
- Token: 'eyJraWQiOiIxNjcwNTUzNTE1MDc3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTc1Njk1MzUxNSwiaWF0IjoxNjcwNTUzNTE1fQ.oR9e2Fn5mVmJ4CjZV6zUOdq_23Y84RkuyhK_WppsD_o',
24
+ agentId: 'bclgkxl',
25
+ Token: 'eyJraWQiOiIxNzExMDY5ODQ1OTU3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcxMTExMzA0NiwiaWF0IjoxNzExMDY5ODQ2fQ.El-dGs65l7TANRBdj1hR8dz2xVur8GjeVO8hkcBhRIQ',
24
26
  reqUrl: 'http://192.168.13.103:10003/openatc'
25
27
  }
26
28
  },
@@ -29,6 +31,7 @@ export default {
29
31
  watch: {
30
32
  },
31
33
  mounted () {
34
+ computedRelation('bclgkxl')
32
35
  }
33
36
  }
34
37
  </script>
@@ -30,10 +30,10 @@ export default {
30
30
  // agentids2: ['15001', '15001', '15003', '15004', '15005'],
31
31
  roadDirection: 'right',
32
32
  // reqUrl: 'http://192.168.13.103:10003/openatc',
33
- agentId: '12008_835',
33
+ agentId: 'bclgkxl',
34
34
  // agentId: '0351-01',
35
35
  reqUrl: 'http://192.168.13.103:10003/openatc',
36
- Token: 'eyJraWQiOiIxNzAwMjAwNDQ4MTA0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTc2NzExMDQwMCwiaWF0IjoxNjk5Mjg2NDAwfQ.AyVJCGmVQVafdWBDQ7TMhVQ5Dvjy13NeuQ8rimTPgtc',
36
+ Token: 'eyJraWQiOiIxNzExMDY5ODQ1OTU3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcxMTExMzA0NiwiaWF0IjoxNzExMDY5ODQ2fQ.El-dGs65l7TANRBdj1hR8dz2xVur8GjeVO8hkcBhRIQ',
37
37
  // reqUrl: 'http://192.168.13.113:10003/openatc',
38
38
  // Token: 'eyJraWQiOiIxNjkxMzcxMTc5ODcxIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcxNDE0NzIwMCwiaWF0IjoxNjkwODE5MjAwfQ.AhUj9taw4_IpP77AmP5bvCE87dDQ4-ZdsEJzrlWXKF8',
39
39
  // agentId: '30003-352',
@@ -55,9 +55,9 @@ export default {
55
55
  showWalk: [ 1, 2 ],
56
56
  sidewalkPhaseData: [{key: 'pedphase1653873194007699', phaseid: 1, id: 1, name: '东人行横道', isshow: false}],
57
57
  lockPhaseBtnName: this.$t('openatccomponents.overview.comfirm'),
58
- agentId: '12004-950',
59
- Token: 'eyJraWQiOiIxNjcwMzc0ODA4MTcyIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTc1Njc3NDgwOCwiaWF0IjoxNjcwMzc0ODA4fQ.xsRoye_tk_Xf60w5Mpigm8vrPgQJCLN-W_IW4U7dafA',
60
- Token103: 'eyJraWQiOiIxNjcwMzc0ODA4MTcyIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTc1Njc3NDgwOCwiaWF0IjoxNjcwMzc0ODA4fQ.xsRoye_tk_Xf60w5Mpigm8vrPgQJCLN-W_IW4U7dafA',
58
+ agentId: 'bclgkxl',
59
+ Token: 'eyJraWQiOiIxNzExMDY5ODQ1OTU3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcxMTExMzA0NiwiaWF0IjoxNzExMDY5ODQ2fQ.El-dGs65l7TANRBdj1hR8dz2xVur8GjeVO8hkcBhRIQ',
60
+ Token103: 'eyJraWQiOiIxNzExMDY5ODQ1OTU3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcxMTExMzA0NiwiaWF0IjoxNzExMDY5ODQ2fQ.El-dGs65l7TANRBdj1hR8dz2xVur8GjeVO8hkcBhRIQ',
61
61
  boxVisible: false,
62
62
  dialogWidth: '80%',
63
63
  crossStatusData: {} // 路口状态数据