openatc-components 0.0.91 → 0.0.94

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 (117) hide show
  1. package/package/kisscomps/components/KanBan/kanban.vue +1 -1
  2. package/package/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +6 -3
  3. package/package/kisscomps/index.js +1 -11
  4. package/package/kissui.min.js +1 -1
  5. package/package.json +2 -4
  6. package/src/i18n/language/en.js +2 -77
  7. package/src/i18n/language/zh.js +2 -77
  8. package/src/kisscomps/components/KanBan/kanban.vue +1 -1
  9. package/src/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +6 -3
  10. package/src/kisscomps/index.js +1 -11
  11. package/src/main.js +0 -3
  12. package/src/router/index.js +0 -7
  13. package/src/store/index.js +2 -2
  14. package/src/store/modules/globalParam.js +16 -67
  15. package/src/views/intersection.vue +2 -8
  16. package/static/apiconfig.json +0 -15
  17. package/static/styles/common.scss +0 -1
  18. package/package/kisscomps/components/Channelization/Channelization.vue +0 -545
  19. package/package/kisscomps/components/Channelization/index.js +0 -2
  20. package/package/kisscomps/components/ChannelizationWithInterface/ChannelizationWithInterface.vue +0 -498
  21. package/package/kisscomps/components/ChannelizationWithInterface/index.js +0 -2
  22. package/package/kisscomps/components/DrawChannelization/drawsvg/channelizationElements.vue +0 -249
  23. package/package/kisscomps/components/DrawChannelization/drawsvg/detectorAssociatedComponent.vue +0 -152
  24. package/package/kisscomps/components/DrawChannelization/drawsvg/drawElement/TextBox.vue +0 -91
  25. package/package/kisscomps/components/DrawChannelization/drawsvg/drawElement/crossMap.vue +0 -176
  26. package/package/kisscomps/components/DrawChannelization/drawsvg/drawElement/editText.vue +0 -108
  27. package/package/kisscomps/components/DrawChannelization/drawsvg/firstImportCrossmap.vue +0 -48
  28. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/countdownSvg.vue +0 -182
  29. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorChart.vue +0 -222
  30. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorIconSvg.vue +0 -191
  31. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/laneIcon.vue +0 -78
  32. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +0 -433
  33. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/pedroadIconSvg.vue +0 -195
  34. package/package/kisscomps/components/DrawChannelization/drawsvg/importDialog.vue +0 -71
  35. package/package/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +0 -939
  36. package/package/kisscomps/components/DrawChannelization/drawsvg/index.vue +0 -118
  37. package/package/kisscomps/components/DrawChannelization/drawsvg/laneEditPanel.vue +0 -563
  38. package/package/kisscomps/components/DrawChannelization/drawsvg/overlapAssociatedComponent.vue +0 -157
  39. package/package/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.check.vue +0 -191
  40. package/package/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.syncOper.vue +0 -331
  41. package/package/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.vue +0 -157
  42. package/package/kisscomps/components/DrawChannelization/drawsvg/table.vue +0 -99
  43. package/package/kisscomps/components/DrawChannelization/drawsvg/utils/loadutils.js +0 -43
  44. package/package/kisscomps/components/DrawChannelization/drawsvg/utils/phaseDataModel.js +0 -32
  45. package/package/kisscomps/components/DrawChannelization/drawsvg/utils/phasePos.json +0 -20
  46. package/package/kisscomps/components/DrawChannelization/index.js +0 -2
  47. package/package/kisscomps/components/DrawChannelization/phaseDataMgr.js +0 -278
  48. package/package/kisscomps/components/MessageBox/index.vue +0 -96
  49. package/src/api/cross.js +0 -33
  50. package/src/icons/svg/custom-BRTlane.svg +0 -40
  51. package/src/icons/svg/custom-bicyclelane.svg +0 -7
  52. package/src/icons/svg/custom-buslane.svg +0 -40
  53. package/src/icons/svg/custom-detector.svg +0 -12
  54. package/src/icons/svg/custom-east-bottom.svg +0 -32
  55. package/src/icons/svg/custom-east-top.svg +0 -32
  56. package/src/icons/svg/custom-ewped.svg +0 -35
  57. package/src/icons/svg/custom-motorway.svg +0 -7
  58. package/src/icons/svg/custom-nonmotorizedlane.svg +0 -40
  59. package/src/icons/svg/custom-north-left.svg +0 -32
  60. package/src/icons/svg/custom-north-right.svg +0 -32
  61. package/src/icons/svg/custom-pedcrossing.svg +0 -7
  62. package/src/icons/svg/custom-peddetector.svg +0 -17
  63. package/src/icons/svg/custom-pedeastward.svg +0 -9
  64. package/src/icons/svg/custom-pedestrian.svg +0 -7
  65. package/src/icons/svg/custom-pednorthward.svg +0 -9
  66. package/src/icons/svg/custom-pedsouthward.svg +0 -9
  67. package/src/icons/svg/custom-pedwestward.svg +0 -9
  68. package/src/icons/svg/custom-secondcrossing.svg +0 -7
  69. package/src/icons/svg/custom-sectionpedestrian.svg +0 -7
  70. package/src/icons/svg/custom-snped.svg +0 -35
  71. package/src/icons/svg/custom-south-left.svg +0 -32
  72. package/src/icons/svg/custom-south-right.svg +0 -32
  73. package/src/icons/svg/custom-straightahead.svg +0 -7
  74. package/src/icons/svg/custom-tramlane.svg +0 -40
  75. package/src/icons/svg/custom-turnaround.svg +0 -7
  76. package/src/icons/svg/custom-turnleft.svg +0 -7
  77. package/src/icons/svg/custom-turnright.svg +0 -7
  78. package/src/icons/svg/custom-vehiclebranch.svg +0 -40
  79. package/src/icons/svg/custom-vehiclemainroad.svg +0 -41
  80. package/src/icons/svg/custom-west-bottom.svg +0 -32
  81. package/src/icons/svg/custom-west-top.svg +0 -32
  82. package/src/icons/svg/custom-xlped.svg +0 -14
  83. package/src/icons/svg/custom-xpedestrian.svg +0 -7
  84. package/src/icons/svg/custom-xrped.svg +0 -14
  85. package/src/kisscomps/components/Channelization/Channelization.vue +0 -545
  86. package/src/kisscomps/components/Channelization/index.js +0 -2
  87. package/src/kisscomps/components/ChannelizationWithInterface/ChannelizationWithInterface.vue +0 -498
  88. package/src/kisscomps/components/ChannelizationWithInterface/index.js +0 -2
  89. package/src/kisscomps/components/DrawChannelization/drawsvg/channelizationElements.vue +0 -249
  90. package/src/kisscomps/components/DrawChannelization/drawsvg/detectorAssociatedComponent.vue +0 -152
  91. package/src/kisscomps/components/DrawChannelization/drawsvg/drawElement/TextBox.vue +0 -91
  92. package/src/kisscomps/components/DrawChannelization/drawsvg/drawElement/crossMap.vue +0 -176
  93. package/src/kisscomps/components/DrawChannelization/drawsvg/drawElement/editText.vue +0 -108
  94. package/src/kisscomps/components/DrawChannelization/drawsvg/firstImportCrossmap.vue +0 -48
  95. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/countdownSvg.vue +0 -182
  96. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorChart.vue +0 -222
  97. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorIconSvg.vue +0 -191
  98. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/laneIcon.vue +0 -78
  99. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +0 -433
  100. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/pedroadIconSvg.vue +0 -195
  101. package/src/kisscomps/components/DrawChannelization/drawsvg/importDialog.vue +0 -71
  102. package/src/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +0 -939
  103. package/src/kisscomps/components/DrawChannelization/drawsvg/index.vue +0 -118
  104. package/src/kisscomps/components/DrawChannelization/drawsvg/laneEditPanel.vue +0 -563
  105. package/src/kisscomps/components/DrawChannelization/drawsvg/overlapAssociatedComponent.vue +0 -157
  106. package/src/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.check.vue +0 -191
  107. package/src/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.syncOper.vue +0 -331
  108. package/src/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.vue +0 -157
  109. package/src/kisscomps/components/DrawChannelization/drawsvg/table.vue +0 -99
  110. package/src/kisscomps/components/DrawChannelization/drawsvg/utils/loadutils.js +0 -43
  111. package/src/kisscomps/components/DrawChannelization/drawsvg/utils/phaseDataModel.js +0 -32
  112. package/src/kisscomps/components/DrawChannelization/drawsvg/utils/phasePos.json +0 -20
  113. package/src/kisscomps/components/DrawChannelization/index.js +0 -2
  114. package/src/kisscomps/components/DrawChannelization/phaseDataMgr.js +0 -278
  115. package/src/kisscomps/components/MessageBox/index.vue +0 -96
  116. package/src/views/customchannelization.vue +0 -49
  117. package/static/styles/channelizatioon.scss +0 -365
@@ -1,939 +0,0 @@
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="custom-cross" v-if="visible">
14
- <ImportDialog ref="importDialog" @loadSvgString="loadSvgString"/>
15
- <Messagebox :visible="canclesettingvisible" :text="$t('openatccomponents.channelizationmap.canclesetting')" @cancle="cancleSetting" @ok="completeSetting"/>
16
- <div class="custom-main" ref="custommain">
17
- <div class="custom-group drawPanelAnimation" ref="customGroup">
18
- <!-- 绘制功能 -->
19
- <div class="draw-function">
20
- <div class="again-import">
21
- <span class="import-label">{{$t('openatccomponents.channelizationmap.importcrosspicture')}}</span>
22
- <el-button
23
- class="again-import-btn"
24
- type="primary"
25
- :disabled="!isSeletable"
26
- @click="clickOpen"
27
- >{{$t('openatccomponents.channelizationmap.againimport')}}</el-button>
28
- </div>
29
-
30
- <div class="draw-to-sketchpad">
31
- <div class="drawtip">{{$t('openatccomponents.channelizationmap.drawtips')}}</div>
32
- <div class="draw-operation">
33
- <!-- <el-button
34
- type="primary"
35
- :disabled="!isSeletable"
36
- @click="addText"
37
- >添加text</el-button>-->
38
- <el-button
39
- v-for="editbtn in editBtnGroup"
40
- :key="editbtn.type"
41
- class="edit-icon-btn"
42
- @click="handleAddIcon(editbtn)"
43
- >
44
- <LaneIconSvg :laneicon="editbtn"/>
45
- <div
46
- class="btn-label"
47
- :class="{'highlightColor': editbtn.active === true, 'defaultColor': editbtn.active === false}"
48
- >{{editbtn.label}}</div>
49
- </el-button>
50
- </div>
51
- </div>
52
- </div>
53
- <!-- 画板区域 -->
54
- <div class="sketchpad-area" id="sketchpadgroup" ref="sketchpadgroup">
55
- <!-- <drr
56
- id="sketchpadArea"
57
- :resizable="false"
58
- :x="allitem.x"
59
- :y="allitem.y"
60
- :w="allitem.w"
61
- :h="allitem.h"
62
- :angle="allitem.angle"
63
- :selectable="false"
64
- :aspectRatio="true"
65
- > -->
66
- <ChannelizationElements
67
- id="channelizationElements"
68
- :allitem="allitem"
69
- :CrossMapVisible="CrossMapVisible"
70
- :CrossMapData="CrossMapData"
71
- :isSeletable="isSeletable"
72
- :pointchange="pointchange"
73
- @changeCrossMap="changeCrossMap"
74
- :Motorways="Motorways"
75
- :curChooseIconIndex="curChooseIconIndex"
76
- @changeMotorwayItem="changeMotorwayItem"
77
- @handleSelectIcon="handleSelectIcon"
78
- :Countdown="Countdown"
79
- :CountdownList="phaseCountdownMock"
80
- @changeTimeItem="changeTimeItem"
81
- :Pedwalk="Pedwalk"
82
- @changePedItem="changePedItem"
83
- :Detector="Detector"
84
- @changeDetectorItem="changeDetectorItem"
85
- :DetectorChart="DetectorChart"
86
- :CurChooseIcon="curChooseIcon"
87
- @changeDetectorChartItem="changeDetectorChartItem"
88
- />
89
- <!-- </drr> -->
90
- </div>
91
- <div class="draw-end-function">
92
- <el-button type="primary" @click="handleReset()">{{$t('openatccomponents.button.reset')}}</el-button>
93
- <!-- <el-button type="primary" @click="cancledraw()">{{$t('openatccomponents.button.Cancel')}}</el-button> -->
94
- <el-button type="primary" @click="savedraw()">{{$t('openatccomponents.button.save')}}</el-button>
95
- </div>
96
- </div>
97
- <div class="custom-edit" ref="customEdit">
98
- <LaneEditPanel
99
- :Data="curChooseIcon"
100
- :choosedirections="curChooseIcon.direction"
101
- :Motorways="Motorways"
102
- @handleChooseDire="handleChooseDire"
103
- @handleChoosePed="handleChoosePed"
104
- @deleteItem="deleteItem"
105
- @changeIconDataByType="changeIconDataByType"
106
- @handleDisassociatePhase="handleDisassociatePhase"
107
- />
108
- </div>
109
- </div>
110
- <!-- <el-row>
111
- <div class="phase-table">
112
- <PhaseTable
113
- :customlist="customlist"
114
- @changeText="changeText"
115
- @deleteItem="deleteItem"
116
- @changeMotorwayItem="changeMotorwayItem"
117
- @changeIconDataByType="changeIconDataByType"
118
- />
119
- </div>
120
- </el-row> -->
121
- </div>
122
- </template>
123
-
124
- <script>
125
- import ChannelizationElements from './channelizationElements'
126
-
127
- import LaneEditPanel from './laneEditPanel'
128
-
129
- import PhaseTable from './table'
130
- import PhaseDataModel from './utils/phaseDataModel.js'
131
- import LaneIconSvg from './iconSvg/laneIcon'
132
-
133
- import ImportDialog from './importDialog'
134
- import Messagebox from '../../MessageBox/index'
135
-
136
- import { mapState } from 'vuex'
137
- import PhaseDataMgr from '../phaseDataMgr.js'
138
-
139
- // import { getIframdevid } from '../../../../utils/auth.js'
140
- import { saveChannelizatonChart } from '../../../../api/cross'
141
- import { getMessageByCode } from '../../../../utils/responseMessage.js'
142
-
143
- export default {
144
- name: 'draw-channelization',
145
- components: {
146
- Messagebox,
147
- ImportDialog,
148
- ChannelizationElements,
149
- PhaseTable,
150
- LaneIconSvg,
151
- LaneEditPanel
152
- },
153
- computed: {
154
- ...mapState({
155
- phaseList: state => state.globalParam.tscParam.phaseList,
156
- PhaseDataMgr: state => state.globalParam.PhaseDataMgr
157
- // ,curBodyWidth: state => state.globalParam.curBodyWidth
158
- // ,curOpenatcAgentid: state => state.globalParam.curOpenatcAgentid
159
- })
160
- },
161
- props: {
162
- loadedChannelizatonData: {
163
- type: Object
164
- },
165
- AgentId: {
166
- type: String,
167
- default: '0'
168
- }
169
- },
170
- watch: {
171
- // curBodyWidth: {
172
- // handler: function (oldval, newval) {
173
- // if (newval !== oldval) {
174
- // this.resizePanelWidth(newval)
175
- // }
176
- // }
177
- // },
178
- // sidebar: {
179
- // handler: function (oldval, newval) {
180
- // setTimeout(() => {
181
- // this.resizePanelWidth(this.curBodyWidth)
182
- // }, 200)
183
- // },
184
- // deep: true
185
- // },
186
- AgentId: {
187
- handler: function (val) {
188
- // 平台设备切换时,清空上一个渠化配置
189
- this.handleReset()
190
- },
191
- deep: true
192
- },
193
- loadedChannelizatonData: {
194
- handler: function (val) {
195
- // 平台设备切换时,重载当前路口保存的渠化配置
196
- this.load('all')
197
- },
198
- deep: true
199
- }
200
- },
201
- data () {
202
- return {
203
- visible: true,
204
- canclesettingvisible: false,
205
-
206
- isSeletable: true, // 元素是否可以编辑
207
- index: 0,
208
- motorid: 1, // 车道id
209
- pedid: 1, // 人行道id
210
- Motorways: [], // 管理所有自定义机动车图标数据
211
- // Bicyclelanes: [], // 非机动车图标数据
212
- customlist: [], // 所有自定义的图标列表
213
- Texts: [], // 管理所有自定义文字数据
214
- Pedwalk: [], // 管理所有人行横道
215
- Detector: [], // 管理所有检测器
216
- DetectorChart: [], // 管理所有检测器统计图
217
- motorwayicon: '',
218
- IconLengh: 45,
219
- IconWdith: 100,
220
- textareaW: 200,
221
- textareaH: 100,
222
- pedW: 206,
223
- pedH: 22,
224
- MapW: 800,
225
- MapH: 200,
226
- detectorW: 30,
227
- detectorH: 30,
228
- detectorchartW: 70,
229
- detectorchartH: 100,
230
- CrossMapData: {
231
- svgstr: '',
232
- imgfilesrc: ''
233
- }, // 管理底图数据
234
- allitem: {
235
- x: 435,
236
- y: 325,
237
- w: 870,
238
- h: 650,
239
- angle: 0
240
- },
241
- countdownW: 140,
242
- countdownH: 140,
243
- Countdown: [], // 管理倒计时图标
244
- phaseCountdownMock: [
245
- {
246
- id: 2,
247
- phaseCountdown: 59,
248
- phaseCountdownColor: '#fff'
249
- },
250
- {
251
- id: 5,
252
- phaseCountdown: 32,
253
- phaseCountdownColor: '#fff'
254
- }
255
- ], // 倒计时动态数据模拟
256
- svgvisible: false,
257
- pointchange: false, // 控制选中时光标样式
258
- CrossMapVisible: true, // 控制底图显示隐藏
259
-
260
- curChooseIconIndex: -1,
261
- curChooseIcon: {},
262
- editBtnGroup: [
263
- {
264
- label: this.$t('openatccomponents.channelizationmap.motorway'),
265
- type: 'motorway',
266
- active: false,
267
- width: '16px',
268
- height: '16px'
269
- },
270
- // {
271
- // label: this.$t('openatccomponents.channelizationmap.bicyclelane'),
272
- // type: 'bicyclelane',
273
- // active: false,
274
- // width: '7px',
275
- // height: '16px'
276
- // },
277
- {
278
- label: this.$t('openatccomponents.channelizationmap.pedcrossing'),
279
- type: 'pedcrossing',
280
- active: false,
281
- width: '16px',
282
- height: '16px'
283
- },
284
- {
285
- label: this.$t('openatccomponents.channelizationmap.countdown'),
286
- type: 'countdown',
287
- active: false,
288
- width: '16px',
289
- height: '16px'
290
- },
291
- {
292
- label: this.$t('openatccomponents.channelizationmap.detector'),
293
- type: 'detector',
294
- active: false,
295
- width: '16px',
296
- height: '16px'
297
- }
298
- ],
299
- AddType: '', // 正在添加的图标类型
300
-
301
- dirNameMap: new Map([
302
- [1, '直行'],
303
- [2, '左转'],
304
- [3, '右转'],
305
- [4, '掉头']
306
- ]),
307
- phaseAssociatedMap: new Map() // 关联相位Map: key 是相位ID, value 是车道数据包含direction
308
- }
309
- },
310
- methods: {
311
- clickOpen () {
312
- this.$refs.importDialog.clickOpen()
313
- },
314
-
315
- // 改变鼠标样式
316
- changeMouse () {
317
- if (!this.isSeletable) return
318
- // document.getElementById('sketchpadArea').style.cursor = 'url(resource/pic/icons/magnifier3.cur) 12 12,crosshair'
319
- document.getElementById('sketchpadArea').style.cursor =
320
- 'url(resource/pic/icons/magnifier3.cur) 12 12,pointer'
321
- this.pointchange = true
322
- },
323
-
324
- // 根据类型,表格编辑后,修改数据策略
325
- changeIconDataByType (iconObj, changefield) {
326
- this.curChooseIcon = JSON.parse(JSON.stringify(iconObj))
327
- // 根据数据类型改变数据
328
- switch (iconObj.icontype) {
329
- case 'text':
330
- this.changeText(iconObj, changefield)
331
- break
332
- case 'vehile':
333
- this.changeMotorwayItem(iconObj, changefield)
334
- if (changefield.indexOf('phaseid') !== -1) {
335
- // 相位关联成功后,生成最新的相位关联map数据
336
- this.PhaseDataMgr.updateLanePhaseAssociatedMap(this.Motorways)
337
- }
338
- break
339
- case 'ped':
340
- this.changePedItem(iconObj, changefield)
341
- break
342
- case 'countdown':
343
- this.changeTimeItem(iconObj, changefield)
344
- break
345
- case 'detector':
346
- this.changeDetectorItem(iconObj, changefield)
347
- break
348
- }
349
- console.log('this.customlist', this.customlist)
350
- },
351
-
352
- // 被删除的相位所关联的车道,解除相位关联
353
- handleDisassociatePhase (deletePhaseid) {
354
- for (let i = 0; i < this.Motorways.length; i++) {
355
- if (this.Motorways[i].phaseid === deletePhaseid) {
356
- this.Motorways[i].phaseid = undefined
357
- this.Motorways[i].phaselabel = ''
358
- this.Motorways[i].phasetype = undefined
359
- }
360
- }
361
- for (let i = 0; i < this.Pedwalk.length; i++) {
362
- if (this.Pedwalk[i].phaseid === deletePhaseid) {
363
- this.Pedwalk[i].phaseid = undefined
364
- this.Pedwalk[i].phaselabel = ''
365
- this.Pedwalk[i].phasetype = undefined
366
- }
367
- }
368
- // 更新模型内初始相位列表数据
369
- this.PhaseDataMgr.updateLanePhaseAssociatedMap(this.Motorways)
370
- },
371
-
372
- // 添加不同类型的车道图标
373
- handleAddIcon (editbtn) {
374
- // 按钮及图标高亮效果实现
375
- this.editBtnGroup = this.editBtnGroup.map(btn => {
376
- btn.active = false
377
- return btn
378
- })
379
- for (let i = 0; i < this.editBtnGroup.length; i++) {
380
- if (this.editBtnGroup[i].type === editbtn.type) {
381
- this.editBtnGroup[i].active = true
382
- }
383
- }
384
- this.changeMouse()
385
- this.AddType = editbtn.type
386
- },
387
-
388
- addMotorwayIcon () {
389
- this.PhaseDataModel = new PhaseDataModel()
390
- let defaultMotorwayParam = {
391
- x: this.setLeft,
392
- y: this.setTop,
393
- w: this.IconLengh,
394
- h: this.IconWdith,
395
- angle: 0
396
- }
397
- this.IconLengh = 45
398
- this.IconWdith = 100
399
- let Motorwaysitem = {
400
- index: this.index,
401
- id: this.motorid,
402
- icontype: 'vehile',
403
- icondireid: [1], // 前端区分箭头方向的标识
404
- icondirename: [this.PhaseDataModel.getPhase(1).name],
405
- lanePosition: 1,
406
- controltype: 0,
407
- phasetype: undefined,
408
- phaseid: undefined,
409
- phaselabel: '',
410
- direction: [], // 值为1-16,对应16个方向
411
- flip: false, // 车道类型是否翻转显示
412
- ...defaultMotorwayParam
413
- }
414
- this.curChooseIconIndex = Motorwaysitem.index
415
- this.curChooseIcon = JSON.parse(JSON.stringify(Motorwaysitem))
416
- this.Motorways.push(Motorwaysitem)
417
- this.customlist.push(Motorwaysitem)
418
- this.index = this.increaseId(this.customlist, 'index')
419
- this.motorid = this.increaseId(this.Motorways, 'id')
420
- },
421
- changeMotorwayItem (MotorwayItem, fields) {
422
- this.changeItem(MotorwayItem, fields, this.Motorways)
423
- this.changeCustomItem(MotorwayItem, fields)
424
- },
425
-
426
- // 选中图标
427
- handleSelectIcon (iconobj) {
428
- // console.log('选中的图标', iconobj)
429
- this.curChooseIconIndex = iconobj.index
430
- this.curChooseIcon = JSON.parse(JSON.stringify(iconobj))
431
- },
432
- // 根据多选的车道,修改车道图标
433
- handleChooseDire (iconObj) {
434
- this.curChooseIcon = JSON.parse(JSON.stringify(iconObj))
435
- let editDirections = iconObj.icondireid
436
- if (
437
- this.curChooseIcon.icontype === 'vehile'
438
- ) {
439
- this.curChooseIcon.icondireid = editDirections
440
- this.curChooseIcon.icondirename = editDirections.map(dir =>
441
- this.dirNameMap.get(dir)
442
- )
443
- this.changeMotorwayItem(this.curChooseIcon, [
444
- 'icondireid',
445
- 'icondirename'
446
- ])
447
- }
448
- console.log(this.curChooseIcon)
449
- },
450
-
451
- addPedwalkIcon () {
452
- let defaulPedParam = {
453
- x: this.setLeft,
454
- y: this.setTop,
455
- w: this.pedW,
456
- h: this.pedH,
457
- angle: 0,
458
- viewbox: [0, 0, 206, 22]
459
- }
460
- this.pedW = 206
461
- this.pedH = 22
462
- let peditem = {
463
- index: this.index,
464
- id: this.pedid,
465
- icontype: 'ped',
466
- iconpedtypeid: 1,
467
- iconpedposition: 1,
468
- phasetype: undefined,
469
- phaseid: undefined,
470
- phaselabel: '',
471
- ...defaulPedParam
472
- }
473
- this.curChooseIconIndex = peditem.index
474
- this.curChooseIcon = JSON.parse(JSON.stringify(peditem))
475
- this.Pedwalk.push(peditem)
476
- this.customlist.push(peditem)
477
- this.index = this.increaseId(this.customlist, 'index')
478
- this.pedid = this.increaseId(this.Pedwalk, 'id')
479
- },
480
- changePedItem (PedItem, fields) {
481
- this.changeItem(PedItem, fields, this.Pedwalk)
482
- this.changeCustomItem(PedItem, fields)
483
- },
484
-
485
- handleChoosePed (pediconobj) {
486
- this.curChooseIcon = JSON.parse(JSON.stringify(pediconobj))
487
- if (this.curChooseIcon.icontype === 'ped') {
488
- this.curChooseIcon.iconpedtypeid = pediconobj.iconpedtypeid
489
- this.curChooseIcon.iconpedposition = pediconobj.iconpedposition
490
- this.changePedItem(this.curChooseIcon, ['iconpedtypeid', 'iconpedposition'])
491
- }
492
- console.log(this.curChooseIcon)
493
- },
494
-
495
- addTimer () {
496
- let defaultCountParam = {
497
- x: this.setLeft,
498
- y: this.setTop,
499
- w: this.countdownW,
500
- h: this.countdownH,
501
- angle: 0
502
- }
503
- this.countdownW = 140
504
- this.countdownH = 140
505
- let countdownitem = {
506
- index: this.index,
507
- icontype: 'countdown',
508
- ...defaultCountParam
509
- }
510
- this.curChooseIconIndex = countdownitem.index
511
- this.curChooseIcon = JSON.parse(JSON.stringify(countdownitem))
512
- this.Countdown.push(countdownitem)
513
- this.customlist.push(countdownitem)
514
- this.index = this.increaseId(this.customlist, 'index')
515
- },
516
- changeTimeItem (timeItem, fields) {
517
- this.changeItem(timeItem, fields, this.Countdown)
518
- this.changeCustomItem(timeItem, fields)
519
- },
520
-
521
- addAllDetector () {
522
- // 统计图暂留
523
- // this.addDetectorChart()
524
- this.addDetector()
525
- },
526
- addDetector () {
527
- let defaultDetectorParam = {
528
- x: this.setLeft,
529
- y: this.setTop,
530
- w: this.detectorW,
531
- h: this.detectorH,
532
- angle: 0
533
- }
534
- this.detectorW = 30
535
- this.detectorH = 30
536
- let detectoritem = {
537
- index: this.index,
538
- icontype: 'detector',
539
- detailtype: 'detector',
540
- detectortype: 1, // 检测器类型: 1 车辆检测器 2 行人检测器
541
- detectorid: undefined,
542
- occupancythreshold: 80,
543
- flowsaturationthreshold: 20,
544
- ...defaultDetectorParam
545
- }
546
- this.curChooseIconIndex = detectoritem.index
547
- this.curChooseIcon = JSON.parse(JSON.stringify(detectoritem))
548
- this.Detector.push(detectoritem)
549
- this.customlist.push(detectoritem)
550
- this.index = this.increaseId(this.customlist, 'index')
551
- },
552
- changeDetectorItem (detectorItem, fields) {
553
- this.changeItem(detectorItem, fields, this.Detector)
554
- this.changeCustomItem(detectorItem, fields)
555
- },
556
- addDetectorChart () {
557
- let defaultDetectorParam = {
558
- x: this.setLeft,
559
- y: this.setTop - 100, // 偏移到检测器正上方150
560
- w: this.detectorchartW,
561
- h: this.detectorchartH,
562
- angle: 0
563
- }
564
- this.detectorchartW = 70
565
- this.detectorchartH = 100
566
- let detectoritem = {
567
- index: this.index,
568
- icontype: 'detector',
569
- detailtype: 'detectorChart',
570
- ...defaultDetectorParam
571
- }
572
- this.curChooseIconIndex = detectoritem.index
573
- this.curChooseIcon = JSON.parse(JSON.stringify(detectoritem))
574
- this.DetectorChart.push(detectoritem)
575
- this.customlist.push(detectoritem)
576
- this.index = this.increaseId(this.customlist, 'index')
577
- },
578
- changeDetectorChartItem (detectorItem, fields) {
579
- this.changeItem(detectorItem, fields, this.DetectorChart)
580
- this.changeCustomItem(detectorItem, fields)
581
- },
582
-
583
- // 添加文字
584
- addText () {
585
- let defaultTextParam = {
586
- x: this.textareaW / 2,
587
- y: this.textareaH / 2,
588
- w: this.textareaW,
589
- h: this.textareaH,
590
- angle: 0
591
- }
592
- this.textareaW = 200
593
- this.textareaH = 100
594
- let textitem = {
595
- index: this.index,
596
- icontype: 'text',
597
- text: '',
598
- ...defaultTextParam
599
- }
600
- this.Texts.push(textitem)
601
- this.customlist.push(textitem)
602
- this.index = this.increaseId(this.customlist, 'index')
603
- },
604
- changeText (textobj, fields) {
605
- this.changeItem(textobj, fields, this.Texts)
606
- this.changeCustomItem(textobj, fields)
607
- },
608
-
609
- changeCustomItem (row, fields) {
610
- this.changeItem(row, fields, this.customlist)
611
- },
612
- changeItem (row, fieldarr, data) {
613
- for (let item of data) {
614
- if (item.index === row.index) {
615
- for (let field of fieldarr) {
616
- item[field] = row[field]
617
- }
618
- }
619
- }
620
- },
621
- deleteItem (row) {
622
- let index = row.index
623
- this.customlist = this.customlist.filter(ele => ele.index !== index)
624
- switch (row.icontype) {
625
- case 'text':
626
- this.Texts = this.Texts.filter(ele => ele.index !== index)
627
- break
628
- case 'vehile':
629
- this.Motorways = this.Motorways.filter(ele => ele.index !== index)
630
- break
631
- case 'ped':
632
- this.Pedwalk = this.Pedwalk.filter(ele => ele.index !== index)
633
- break
634
- case 'countdown':
635
- this.Countdown = this.Countdown.filter(ele => ele.index !== index)
636
- break
637
- case 'detector':
638
- this.Detector = this.Detector.filter(ele => ele.index !== index)
639
- this.DetectorChart = this.DetectorChart.filter(ele => ele.index !== index)
640
- }
641
- this.curChooseIconIndex = -1
642
- this.curChooseIcon = {}
643
- },
644
-
645
- loadSvgString (type, imgstr) {
646
- // 加载用户上传的底图svg字符串
647
- if (type === 'vectorgraph') {
648
- // 导入矢量图
649
- this.getCrossMapViewbox(imgstr)
650
- let defaultCrossMapParam = {
651
- x: this.MapW / 2,
652
- y: this.MapH / 2,
653
- w: this.MapW,
654
- h: this.MapH,
655
- angle: 0
656
- }
657
- // (由于底图采用定位,导致脱离标准流,父元素高度塌陷,此处需要重新设置父元素高度,以防底图超出弹窗边界)
658
- // this.$refs.crossmap.style.height = this.MapH
659
- // this.$refs.crossmap.style.width = this.MapW
660
- this.CrossMapData = {
661
- type,
662
- svgstr: imgstr,
663
- ...defaultCrossMapParam
664
- }
665
- }
666
- if (type === 'picture') {
667
- // 导入图片
668
- this.CrossMapData = {
669
- type,
670
- imgfilesrc: imgstr
671
- }
672
- }
673
- },
674
- getCrossMapViewbox (svgstr) {
675
- // 获取户上传svg的viewBox属性的大小
676
- let arr = svgstr.split('"')
677
- let index, viewBox
678
- for (let i = 0; i < arr.length - 1; i++) {
679
- if (arr[i].indexOf('viewBox') !== -1) {
680
- index = i
681
- }
682
- }
683
- if (index) {
684
- viewBox = arr[index + 1]
685
- }
686
- this.MapW = Number(viewBox.split(' ')[2])
687
- this.MapH = Number(viewBox.split(' ')[3])
688
- },
689
- changeCrossMap (mapdata, fields) {
690
- this.changeItem(mapdata, fields, [this.CrossMapData])
691
- },
692
-
693
- // 重置
694
- handleReset () {
695
- this.customlist = []
696
- this.Texts = []
697
- this.Motorways = []
698
- this.Countdown = []
699
- this.Pedwalk = []
700
- this.Detector = []
701
- this.DetectorChart = []
702
- this.CrossMapData = {
703
- svgstr: '',
704
- imgfilesrc: ''
705
- }
706
- this.index = 0
707
- this.curChooseIcon = {}
708
- },
709
- // 取消
710
- cancledraw () {
711
- this.canclesettingvisible = true
712
- },
713
- completeSetting () {
714
- this.canclesettingvisible = false
715
- this.$router.push('/overview/index')
716
- },
717
- cancleSetting () {
718
- this.canclesettingvisible = false
719
- },
720
- // 保存
721
- savedraw () {
722
- let temp = {}
723
- console.log(this.customlist)
724
- for (const item of this.customlist) {
725
- if (temp.hasOwnProperty(item.icontype)) {
726
- temp[item.icontype].push(item)
727
- } else {
728
- temp[item.icontype] = [item]
729
- }
730
- }
731
- if (this.CrossMapData.svgstr !== '') {
732
- temp.crossMap = this.CrossMapData
733
- }
734
- this.saveChannelizatonChart(temp)
735
- },
736
- // 加载
737
- load (type) {
738
- this.curChooseIconIndex = -1
739
- // this.getChannelizatonChart().then((channelizatondata) => {
740
- // let savedTemp = JSON.parse(localStorage.getItem('savedTemp'))
741
- let savedTemp = JSON.parse(JSON.stringify(this.loadedChannelizatonData))
742
- let arr = []
743
- for (const [key, value] of Object.entries(savedTemp)) {
744
- if (key === 'vehile') {
745
- this.Motorways = value
746
- }
747
- if (key === 'text') {
748
- this.Texts = value
749
- }
750
- if (key === 'ped') {
751
- this.Pedwalk = value
752
- }
753
- if (key === 'countdown') {
754
- this.Countdown = value
755
- }
756
- if (key === 'detector') {
757
- this.Detector = value.filter(ele => ele.detailtype === 'detector')
758
- this.DetectorChart = value.filter(ele => ele.detailtype === 'detectorChart')
759
- }
760
- if (key === 'crossMap') {
761
- this.CrossMapData = JSON.parse(JSON.stringify(value))
762
- // if (value.type === 'vectorgraph') {
763
- // // svg底图,只加载底图区域870*650范围内的元素
764
- // let { svgstr, ...allitem } = value
765
- // this.allitem = allitem
766
- // }
767
- } else {
768
- if (value.length > 1) {
769
- arr = [...arr, ...value]
770
- } else {
771
- arr.push(value[0])
772
- }
773
- }
774
- }
775
- this.customlist = JSON.parse(JSON.stringify(arr))
776
- this.index = this.increaseId(this.customlist, 'index')
777
- this.motorid = this.increaseId(this.Motorways, 'id')
778
- this.pedid = this.increaseId(this.Pedwalk, 'id')
779
- // if (type === 'all') {
780
- // // 加载整体模版后,默认切换到元素不可编辑状态,但整体可编辑
781
- // this.isSeletable = false
782
- // } else {
783
- // this.isSeletable = true
784
- // }
785
- // })
786
- },
787
- increaseId (arr, field) { // 实现field对应的index或者id, 在arr的基础上寻找最小的
788
- let List = arr.map(ele => ele[field])
789
- let i = List.length - 1
790
- if (i >= 0) {
791
- for (let j = 1; j <= 200; j++) {
792
- if (!List.includes(j)) {
793
- return j
794
- }
795
- }
796
- }
797
- },
798
-
799
- exitEdit () {
800
- this.isSeletable = !this.isSeletable
801
- },
802
-
803
- resetAddParams () {
804
- this.AddType = ''
805
- this.editBtnGroup = this.editBtnGroup.map(btn => {
806
- btn.active = false
807
- return btn
808
- })
809
- },
810
- resizePanelWidth (bodywidth) {
811
- // 根据1920适配,右侧过宽
812
- // this.drawpartWidth = ((1089 / 1980) * bodywidth).toFixed(0)
813
- // this.mainWidth = this.$refs.custommain.offsetWidth
814
- // this.editpartWidth = Number(this.mainWidth) - Number(this.drawpartWidth) - 20
815
- // this.$refs.customGroup.style.width = this.drawpartWidth + 'px'
816
- // this.$refs.customEdit.style.width = this.editpartWidth + 'px'
817
- // this.allitem.w = this.drawpartWidth
818
- // this.allitem.x = this.drawpartWidth / 2
819
- // 编辑面板固定宽度600,左侧适配
820
- this.mainWidth = this.$refs.custommain.offsetWidth
821
- this.drawpartWidth = this.mainWidth - 545
822
- this.$refs.customGroup.style.width = this.drawpartWidth + 'px'
823
- this.$refs.customGroup.style.transition = 'width 0.5s ease-in-out'
824
- if (this.mainWidth && this.drawpartWidth) {
825
- this.allitem.w = this.drawpartWidth
826
- this.allitem.x = this.drawpartWidth / 2
827
- }
828
- },
829
- saveChannelizatonChart (ChannelizatonData) {
830
- // let agentid = getIframdevid()
831
- let params = {
832
- agentid: this.AgentId,
833
- data: ChannelizatonData
834
- }
835
- saveChannelizatonChart(params).then(data => {
836
- this.$emit('saveCallback', data)
837
- if (!data.data.success) {
838
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
839
- if (data.data.data) {
840
- // 子类型错误
841
- let childErrorCode = data.data.data.errorCode
842
- if (childErrorCode) {
843
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
844
- this.$message.error(parrenterror + ',' + childerror)
845
- }
846
- } else {
847
- this.$message.error(parrenterror)
848
- }
849
- return
850
- }
851
- let msg = this.$t('openatccomponents.common.savesucess')
852
- this.$message({
853
- message: msg,
854
- type: 'success',
855
- duration: 1 * 1000
856
- })
857
- })
858
- },
859
- // getChannelizatonChart () {
860
- // let agentid = getIframdevid()
861
- // return new Promise((resolve, reject) => {
862
- // getChannelizatonChart(agentid).then(data => {
863
- // if (!data.data.success) {
864
- // let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
865
- // if (data.data.data) {
866
- // // 子类型错误
867
- // let childErrorCode = data.data.data.errorCode
868
- // if (childErrorCode) {
869
- // let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
870
- // this.$message.error(parrenterror + ',' + childerror)
871
- // }
872
- // } else {
873
- // this.$message.error(parrenterror)
874
- // }
875
- // this.handleReset()
876
- // return
877
- // }
878
- // this.handleReset()
879
- // let channelizatondata = data.data.data
880
- // resolve(channelizatondata)
881
- // })
882
- // })
883
- // },
884
- handleClickSketchpad () {
885
- // 监听画板区域点击事件,改变图标放置的位置
886
- let sketchpadArea = document.getElementById('sketchpadArea')
887
- let _this = this
888
- sketchpadArea.addEventListener('click', function (e) {
889
- if (_this.pointchange) {
890
- document.getElementById('sketchpadArea').style.cursor =
891
- 'url(resource/pic/icons/magnifier3.cur) 12 12,default'
892
- _this.pointchange = false
893
- _this.setLeft =
894
- e.clientX -
895
- document.getElementById('channelizationElements').getBoundingClientRect().left
896
- _this.setTop =
897
- e.clientY -
898
- document.getElementById('channelizationElements').getBoundingClientRect().top
899
- if (_this.AddType === '') return
900
- switch (_this.AddType) {
901
- case 'motorway':
902
- _this.addMotorwayIcon()
903
- break
904
- case 'pedcrossing':
905
- _this.addPedwalkIcon()
906
- break
907
- case 'countdown':
908
- _this.addTimer()
909
- break
910
- case 'detector':
911
- _this.addAllDetector()
912
- }
913
- _this.resetAddParams()
914
- }
915
- })
916
- }
917
- },
918
- created () {},
919
- mounted () {
920
- // this.resizePanelWidth(this.curBodyWidth)
921
- let PhaseData = new PhaseDataMgr(this.phaseList)
922
- this.$store.dispatch('InitPhaseDataMgr', PhaseData)
923
- this.handleClickSketchpad()
924
- // 初始加载已保存的渠化图
925
- // this.load('all')
926
- }
927
- // updated () {
928
- // if (this.$refs.sketchpadgroup.offsetWidth) {
929
- // this.allitem.w = this.$refs.sketchpadgroup.offsetWidth
930
- // this.allitem.x = this.$refs.sketchpadgroup.offsetWidth / 2
931
- // this.allitem.h = this.$refs.sketchpadgroup.offsetHeight
932
- // this.allitem.y = this.$refs.sketchpadgroup.offsetHeight / 2
933
- // }
934
- // }
935
- }
936
- </script>
937
-
938
- <style lang="css" rel="stylesheet/scss">
939
- </style>