openatc-components 0.5.12 → 0.5.13

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,17 @@
18
18
  :height="Height"
19
19
  :style="{position: 'absolute', left: '310px', top: '198px', zIndex: '10'}"
20
20
  >
21
+ <defs>
22
+ <filter id="shadow-effect" x="-50%" y="-50%" width="200%" height="200%">
23
+ <!-- 对应 box-shadow: 0 0 6px 6px #10B800 -->
24
+ <feDropShadow
25
+ dx="0"
26
+ dy="0"
27
+ stdDeviation="4"
28
+ flood-color="#10B800"
29
+ flood-opacity="1"/>
30
+ </filter>
31
+ </defs>
21
32
  <g
22
33
  id="西行人"
23
34
  direction="2"
@@ -1151,7 +1162,7 @@ export default {
1151
1162
  GreenColor: '#77fb65',
1152
1163
  YellowColor: '#f7b500',
1153
1164
  lastType: '',
1154
- clickedColor: '#299bcc',
1165
+ clickedColor: '#18ff00',
1155
1166
  disabledColor: '#828282',
1156
1167
  sidewalkData: [],
1157
1168
  sidewalkDir: []
@@ -1203,6 +1214,7 @@ export default {
1203
1214
  }
1204
1215
  }
1205
1216
  clickedPath.setAttribute('fill', '#fff')
1217
+ clickedPath.removeAttribute('filter')
1206
1218
  } else {
1207
1219
  // 点击
1208
1220
  for (let i = 0; i < this.sidewalkData.length; i++) {
@@ -1212,6 +1224,7 @@ export default {
1212
1224
  }
1213
1225
  }
1214
1226
  clickedPath.setAttribute('fill', this.clickedColor)
1227
+ clickedPath.setAttribute('filter', 'url(#shadow-effect)')
1215
1228
  }
1216
1229
  this.$emit('handleClickSidewalkIcon', this.sidewalkData, curChoosePed)
1217
1230
  }
@@ -1226,14 +1239,17 @@ export default {
1226
1239
  let data = this.sidewalkData.filter(ele => ele.id === side.id)[0]
1227
1240
  if (data && data.clicked === true) {
1228
1241
  dom.setAttribute('fill', this.clickedColor)
1242
+ dom.setAttribute('filter', 'url(#shadow-effect)')
1229
1243
  }
1230
1244
  if (this.clickMode && data && data.disabled === true) {
1231
1245
  dom.setAttribute('fill', this.disabledColor)
1232
1246
  dom.setAttribute('disabled', 'true')
1247
+ dom.removeAttribute('filter')
1233
1248
  }
1234
1249
  if (data && data.disabled === undefined && data.clicked === undefined) {
1235
1250
  dom.setAttribute('fill', this.defaultColor)
1236
1251
  dom.removeAttribute('disabled')
1252
+ dom.removeAttribute('filter')
1237
1253
  }
1238
1254
  }
1239
1255
  }
@@ -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.isThirdSignal && 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,17 @@
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" x="-50%" y="-50%" width="200%" height="200%">
22
+ <!-- 对应 box-shadow: 0 0 6px 6px #10B800 -->
23
+ <feDropShadow
24
+ dx="0"
25
+ dy="0"
26
+ stdDeviation="4"
27
+ flood-color="#10B800"
28
+ flood-opacity="1"/>
29
+ </filter>
30
+ </defs>
20
31
  <!-- 东相位 -->
21
32
  <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
33
  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 +79,7 @@ export default {
68
79
  GreenColor: '#77fb65',
69
80
  YellowColor: '#f7b500',
70
81
  lastStatus: '',
71
- clickedColor: '#299bcc',
82
+ clickedColor: '#18ff00',
72
83
  disabledColor: '#828282'
73
84
  }
74
85
  },
@@ -135,10 +146,14 @@ export default {
135
146
  customClick: { // 自定义点击事件,跳过特勤限制
136
147
  type: Boolean,
137
148
  default: false
149
+ },
150
+ beforeSelect: {
151
+ type: Function,
152
+ required: true
138
153
  }
139
154
  },
140
155
  methods: {
141
- handleClick (e) {
156
+ async handleClick (e) {
142
157
  let clickedSvg = e.currentTarget
143
158
  // console.log(clickedSvg)
144
159
  let clickedPath = clickedSvg.querySelector(`#${this.Data.name}`)
@@ -149,9 +164,18 @@ export default {
149
164
  }
150
165
  if (clickedPath.getAttribute('fill') === this.clickedColor) {
151
166
  clickedPath.setAttribute('fill', '#fff')
167
+ clickedPath.removeAttribute('filter')
152
168
  this.$emit('handleClickPhaseIcon', this.Data.key, 'cancle')
153
169
  } else {
170
+ // 选中前:向父组件请求是否允许
171
+ const ok = await this.beforeSelect(this.Data.key)
172
+ if (!ok) {
173
+ // 父组件不允许选中 → 什么都不做
174
+ return
175
+ }
176
+ // 父组件允许 → 原选中逻辑高亮
154
177
  clickedPath.setAttribute('fill', this.clickedColor)
178
+ clickedPath.setAttribute('filter', 'url(#shadow-effect)')
155
179
  this.$emit('handleClickPhaseIcon', this.Data.key, 'clicked')
156
180
  }
157
181
  }
@@ -161,14 +185,17 @@ export default {
161
185
  let DirDom = IconDom.querySelector(`#${this.Data.name}`)
162
186
  if (this.Data.clicked === true) {
163
187
  DirDom.setAttribute('fill', this.clickedColor)
188
+ DirDom.setAttribute('filter', 'url(#shadow-effect)')
164
189
  }
165
190
  if (this.clickMode && this.Data.disabled === true) {
166
191
  DirDom.setAttribute('fill', this.disabledColor)
167
192
  DirDom.setAttribute('disabled', 'true')
193
+ DirDom.removeAttribute('filter')
168
194
  }
169
195
  if (this.Data.disabled === undefined && this.Data.clicked === undefined) {
170
196
  DirDom.setAttribute('fill', this.defaultColor)
171
197
  DirDom.removeAttribute('disabled')
198
+ DirDom.removeAttribute('filter')
172
199
  }
173
200
  },
174
201
  IconAddEvent () {