openatc-components 0.5.12 → 0.5.14

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.
@@ -18,6 +18,27 @@
18
18
  :height="Height"
19
19
  :style="{position: 'absolute', left: '310px', top: '198px', zIndex: '10'}"
20
20
  >
21
+ <defs>
22
+ <filter id="shadow-effect-side"
23
+ x="-10%"
24
+ y="-10%"
25
+ width="200%"
26
+ height="200%">
27
+ <feFlood flood-color="#10B800" flood-opacity="1" result="glowColor" />
28
+ <feComposite in="glowColor"
29
+ in2="SourceGraphic"
30
+ operator="in"
31
+ result="glowMask" />
32
+ <feGaussianBlur in="glowMask" stdDeviation="2" result="blurredGlow" />
33
+ <feComponentTransfer in="blurredGlow" result="brightGlow">
34
+ <feFuncA type="linear" slope="2" />
35
+ </feComponentTransfer>
36
+ <feMerge>
37
+ <feMergeNode in="brightGlow" />
38
+ <feMergeNode in="SourceGraphic" />
39
+ </feMerge>
40
+ </filter>
41
+ </defs>
21
42
  <g
22
43
  id="西行人"
23
44
  direction="2"
@@ -1151,7 +1172,7 @@ export default {
1151
1172
  GreenColor: '#77fb65',
1152
1173
  YellowColor: '#f7b500',
1153
1174
  lastType: '',
1154
- clickedColor: '#299bcc',
1175
+ clickedColor: '#18ff00',
1155
1176
  disabledColor: '#828282',
1156
1177
  sidewalkData: [],
1157
1178
  sidewalkDir: []
@@ -1203,6 +1224,7 @@ export default {
1203
1224
  }
1204
1225
  }
1205
1226
  clickedPath.setAttribute('fill', '#fff')
1227
+ clickedPath.removeAttribute('filter')
1206
1228
  } else {
1207
1229
  // 点击
1208
1230
  for (let i = 0; i < this.sidewalkData.length; i++) {
@@ -1212,6 +1234,7 @@ export default {
1212
1234
  }
1213
1235
  }
1214
1236
  clickedPath.setAttribute('fill', this.clickedColor)
1237
+ clickedPath.setAttribute('filter', 'url(#shadow-effect-side)')
1215
1238
  }
1216
1239
  this.$emit('handleClickSidewalkIcon', this.sidewalkData, curChoosePed)
1217
1240
  }
@@ -1226,14 +1249,17 @@ export default {
1226
1249
  let data = this.sidewalkData.filter(ele => ele.id === side.id)[0]
1227
1250
  if (data && data.clicked === true) {
1228
1251
  dom.setAttribute('fill', this.clickedColor)
1252
+ dom.setAttribute('filter', 'url(#shadow-effect-side)')
1229
1253
  }
1230
1254
  if (this.clickMode && data && data.disabled === true) {
1231
1255
  dom.setAttribute('fill', this.disabledColor)
1232
1256
  dom.setAttribute('disabled', 'true')
1257
+ dom.removeAttribute('filter')
1233
1258
  }
1234
1259
  if (data && data.disabled === undefined && data.clicked === undefined) {
1235
1260
  dom.setAttribute('fill', this.defaultColor)
1236
1261
  dom.removeAttribute('disabled')
1262
+ dom.removeAttribute('filter')
1237
1263
  }
1238
1264
  }
1239
1265
  }
@@ -96,7 +96,7 @@
96
96
  </div>
97
97
  <!-- 车道相位 -->
98
98
  <div v-if="resetflag" class="phaseIcon">
99
- <PhaseIconSvg v-for="(item, index) in compLanePhaseData" :key="item.key + '-' + index" :Data="item" :isVipRoute="isVipRoute" :clickMode="clickMode" @handleClickPhaseIcon="handleClickPhaseIcon" />
99
+ <PhaseIconSvg v-for="(item, index) in compLanePhaseData" :key="item.key + '-' + index" :Data="item" :isVipRoute="isVipRoute" :clickMode="clickMode" :beforeSelect="beforeClickPhaseIcon" @handleClickPhaseIcon="handleClickPhaseIcon" />
100
100
  </div>
101
101
  <!-- 公交相位 -->
102
102
  <div v-if="resetflag && !isVipRoute" class="busIcon">
@@ -167,7 +167,7 @@
167
167
  </div>
168
168
  <!-- 车道相位 -->
169
169
  <div v-if="resetflag" class="phaseIcon">
170
- <LPhaseIconSvg v-for="item in compLanePhaseData" :key="item.key" :Data="item" :isVipRoute="isVipRoute" :clickMode="clickMode" @handleClickPhaseIcon="handleClickPhaseIcon"/>
170
+ <LPhaseIconSvg v-for="item in compLanePhaseData" :key="item.key" :Data="item" :isVipRoute="isVipRoute" :clickMode="clickMode" :beforeSelect="beforeClickPhaseIcon" @handleClickPhaseIcon="handleClickPhaseIcon"/>
171
171
  </div>
172
172
  <!-- 公交相位 -->
173
173
  <div v-if="resetflag" class="busIcon">
@@ -1400,6 +1400,65 @@ export default {
1400
1400
  }
1401
1401
  },
1402
1402
 
1403
+ async handleClickDirection (direction) {
1404
+ const id = direction.id
1405
+ // console.log(id)
1406
+ // console.log(this.inneChoosedDirection)
1407
+ const isSelected = this.inneChoosedDirection.includes(id)
1408
+ let nextSelected
1409
+ if (!isSelected) {
1410
+ nextSelected = [...this.inneChoosedDirection, id]
1411
+ } else {
1412
+ nextSelected = this.inneChoosedDirection.filter(d => d !== id)
1413
+ }
1414
+ // 检查是否冲突,冲突提示是否确定
1415
+ if (this.checkConflict(nextSelected)) {
1416
+ try {
1417
+ await this.$confirm(this.$t('openatccomponents.overview.conflictdirectionstips'), this.$t('openatccomponents.common.tipsmodaltitle'), {
1418
+ confirmButtonText: this.$t('openatccomponents.button.OK'),
1419
+ cancelButtonText: this.$t('openatccomponents.button.Cancel'),
1420
+ type: 'warning'
1421
+ })
1422
+ // 用户点击确定
1423
+ return {
1424
+ ok: true,
1425
+ nextSelected
1426
+ }
1427
+ } catch (e) {
1428
+ // 用户点击取消
1429
+ return {
1430
+ ok: false
1431
+ }
1432
+ }
1433
+ }
1434
+ // 无冲突,正常选中
1435
+ return {
1436
+ ok: true,
1437
+ nextSelected
1438
+ }
1439
+ },
1440
+
1441
+ checkConflict (list) {
1442
+ // 默认冲突规则: 东直 东左 西直 西左 其中 任意一个 ,与 南直 南左 北直 北左 其中任意一个,同时选中,则提示冲突
1443
+ const groupA = [1, 2, 5, 6]
1444
+ const groupB = [9, 10, 13, 14]
1445
+
1446
+ const hasA = list.some(id => groupA.includes(id))
1447
+ const hasB = list.some(id => groupB.includes(id))
1448
+
1449
+ return hasA && hasB
1450
+ },
1451
+ beforeClickPhaseIcon (key) {
1452
+ // 进入冲突判断
1453
+ return new Promise(async (resolve) => {
1454
+ for (let element of this.LanePhaseData) {
1455
+ if (element.key === key) {
1456
+ const result = await this.handleClickDirection(element)
1457
+ resolve(result.ok) // ok: true / false
1458
+ }
1459
+ }
1460
+ })
1461
+ },
1403
1462
  handleClickPhaseIcon (key, action) {
1404
1463
  let curClickedPhase = {}
1405
1464
  if (action === 'clicked') {
@@ -17,6 +17,27 @@
17
17
  <path id="西掉头" :class="Data.name === '西掉头' ? '' : 'invisible'" d="M13.124,3.036H9.5V0.008L1.93,4.264,9.589,8.52V5.492h3.619c1.262,0,2.357,1.391,2.357,3.028s-1.094,3.028-2.357,3.028H-0.006V14H13.124c2.693,0,4.881-2.455,4.881-5.483S15.817,3.036,13.124,3.036Z" :fill="this.FlashColor ? this.FlashColor : (Data.color ? Data.color : defaultColor)"/>
18
18
  </svg> -->
19
19
  <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 36 26" :width="IconLengh" :height="IconWdith">
20
+ <defs>
21
+ <filter id="shadow-effect"
22
+ x="-10%"
23
+ y="-10%"
24
+ width="200%"
25
+ height="200%">
26
+ <feFlood flood-color="#10B800" flood-opacity="1" result="glowColor" />
27
+ <feComposite in="glowColor"
28
+ in2="SourceGraphic"
29
+ operator="in"
30
+ result="glowMask" />
31
+ <feGaussianBlur in="glowMask" stdDeviation="2" result="blurredGlow" />
32
+ <feComponentTransfer in="blurredGlow" result="brightGlow">
33
+ <feFuncA type="linear" slope="2" />
34
+ </feComponentTransfer>
35
+ <feMerge>
36
+ <feMergeNode in="brightGlow" />
37
+ <feMergeNode in="SourceGraphic" />
38
+ </feMerge>
39
+ </filter>
40
+ </defs>
20
41
  <!-- 东相位 -->
21
42
  <path id="东左转" :class="Data.name === '东左转' ? '' : 'invisible'" d="M11,7.1h24v-3H10.9c-3.1,0-5.7,2.6-5.8,5.7l-0.4,2.9L1,12.2l3.9,9.7l6.5-8.2l-3.7-0.5l0.5-3.3
22
43
  C8.2,8.4,9.4,7.1,11,7.1L11,7.1z" :fill="this.FlashColor ? this.FlashColor : (Data.color ? Data.color : defaultColor)"/>
@@ -68,7 +89,7 @@ export default {
68
89
  GreenColor: '#77fb65',
69
90
  YellowColor: '#f7b500',
70
91
  lastStatus: '',
71
- clickedColor: '#299bcc',
92
+ clickedColor: '#18ff00',
72
93
  disabledColor: '#828282'
73
94
  }
74
95
  },
@@ -135,10 +156,13 @@ export default {
135
156
  customClick: { // 自定义点击事件,跳过特勤限制
136
157
  type: Boolean,
137
158
  default: false
159
+ },
160
+ beforeSelect: {
161
+ type: Function
138
162
  }
139
163
  },
140
164
  methods: {
141
- handleClick (e) {
165
+ async handleClick (e) {
142
166
  let clickedSvg = e.currentTarget
143
167
  // console.log(clickedSvg)
144
168
  let clickedPath = clickedSvg.querySelector(`#${this.Data.name}`)
@@ -149,9 +173,18 @@ export default {
149
173
  }
150
174
  if (clickedPath.getAttribute('fill') === this.clickedColor) {
151
175
  clickedPath.setAttribute('fill', '#fff')
176
+ clickedPath.removeAttribute('filter')
152
177
  this.$emit('handleClickPhaseIcon', this.Data.key, 'cancle')
153
178
  } else {
179
+ // 选中前:向父组件请求是否允许
180
+ const ok = await this.beforeSelect(this.Data.key)
181
+ if (!ok) {
182
+ // 父组件不允许选中 → 什么都不做
183
+ return
184
+ }
185
+ // 父组件允许 → 原选中逻辑高亮
154
186
  clickedPath.setAttribute('fill', this.clickedColor)
187
+ clickedPath.setAttribute('filter', 'url(#shadow-effect)')
155
188
  this.$emit('handleClickPhaseIcon', this.Data.key, 'clicked')
156
189
  }
157
190
  }
@@ -161,14 +194,17 @@ export default {
161
194
  let DirDom = IconDom.querySelector(`#${this.Data.name}`)
162
195
  if (this.Data.clicked === true) {
163
196
  DirDom.setAttribute('fill', this.clickedColor)
197
+ DirDom.setAttribute('filter', 'url(#shadow-effect)')
164
198
  }
165
199
  if (this.clickMode && this.Data.disabled === true) {
166
200
  DirDom.setAttribute('fill', this.disabledColor)
167
201
  DirDom.setAttribute('disabled', 'true')
202
+ DirDom.removeAttribute('filter')
168
203
  }
169
204
  if (this.Data.disabled === undefined && this.Data.clicked === undefined) {
170
205
  DirDom.setAttribute('fill', this.defaultColor)
171
206
  DirDom.removeAttribute('disabled')
207
+ DirDom.removeAttribute('filter')
172
208
  }
173
209
  },
174
210
  IconAddEvent () {