|
@@ -4,34 +4,43 @@
|
|
|
:key="point.id"
|
|
|
:data="point"
|
|
|
:active="point === customMap.activeFixPoint"
|
|
|
- @change-pos="pos => point.pos = pos"
|
|
|
- @focus="() => customMap.activeFixPoint = point"
|
|
|
- @blur="() => customMap.activeFixPoint = customMap.activeFixPoint === point ? null : customMap.activeFixPoint"
|
|
|
+ @change-pos="(pos) => (point.pos = pos)"
|
|
|
+ @focus="() => (customMap.activeFixPoint = point)"
|
|
|
+ @blur="
|
|
|
+ () =>
|
|
|
+ (customMap.activeFixPoint =
|
|
|
+ customMap.activeFixPoint === point ? null : customMap.activeFixPoint)
|
|
|
+ "
|
|
|
/>
|
|
|
|
|
|
<div ref="menu" @touchstart.stop class="action-menus">
|
|
|
-<!-- <ActionsPanel :menus="activeActionMenus" v-show="customMap.activeFixPoint" />-->
|
|
|
+ <!-- <ActionsPanel :menus="activeActionMenus" v-show="customMap.activeFixPoint" />-->
|
|
|
<ActionMenus
|
|
|
- v-if="customMap.activeFixPoint"
|
|
|
- :menus="activeActionMenus"
|
|
|
- :active-key="edit ? 'edit' : null"
|
|
|
- dire="row"
|
|
|
+ v-if="customMap.activeFixPoint"
|
|
|
+ :menus="activeActionMenus"
|
|
|
+ :active-key="edit ? 'edit' : null"
|
|
|
+ dire="row"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
- <div class="edit-fix-point" v-if="edit" ref="dom" @touchstart.stop>
|
|
|
+ <div class="edit-fix-point" v-if="edit" ref="dom" @touchstart.stop>
|
|
|
<div class="header">
|
|
|
<h3>添加名称</h3>
|
|
|
<ui-icon type="close" ctrl @click="edit = null" />
|
|
|
</div>
|
|
|
- <ui-input type="text" v-model="edit.text" width="100%" maxlength="20" />
|
|
|
+ <ui-input
|
|
|
+ type="text"
|
|
|
+ v-model="edit.text"
|
|
|
+ width="100%"
|
|
|
+ maxlength="20"
|
|
|
+ class="search-fix"
|
|
|
+ />
|
|
|
<div class="select">
|
|
|
<span>常用名称</span>
|
|
|
<p
|
|
|
v-for="option in options"
|
|
|
:key="option"
|
|
|
- class="fun-ctrl"
|
|
|
- :class="{active: option === edit.text}"
|
|
|
+ :class="{ active: option === edit.text }"
|
|
|
@click="edit.text = option"
|
|
|
>
|
|
|
{{ option }}
|
|
@@ -41,15 +50,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { fixPoints, FixPoint } from '@/store/fixPoint'
|
|
|
-import FixPointPanel from './fixPoint.vue'
|
|
|
-import {ref, watch, watchEffect} from "vue";
|
|
|
-import {customMap} from '@/hook'
|
|
|
+import { fixPoints, FixPoint } from "@/store/fixPoint";
|
|
|
+import FixPointPanel from "./fixPoint.vue";
|
|
|
+import { ref, watch, watchEffect } from "vue";
|
|
|
+import { customMap } from "@/hook";
|
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
|
import UiInput from "@/components/base/components/input/index.vue";
|
|
|
import ActionMenus from "@/components/group-button/index.vue";
|
|
|
|
|
|
-const edit = ref<FixPoint>()
|
|
|
+const edit = ref<FixPoint>();
|
|
|
const options = [
|
|
|
"轿车 / 平面",
|
|
|
"客车 / 平面",
|
|
@@ -63,7 +72,7 @@ const options = [
|
|
|
"散落物",
|
|
|
"岗台",
|
|
|
"桥",
|
|
|
-]
|
|
|
+];
|
|
|
const activeActionMenus = [
|
|
|
{
|
|
|
key: "edit",
|
|
@@ -72,8 +81,9 @@ const activeActionMenus = [
|
|
|
color: "#161A1A",
|
|
|
iconColor: "#2F8FFF",
|
|
|
onClick() {
|
|
|
- edit.value = edit.value === customMap.activeFixPoint ? null : customMap.activeFixPoint
|
|
|
- }
|
|
|
+ edit.value =
|
|
|
+ edit.value === customMap.activeFixPoint ? null : customMap.activeFixPoint;
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
key: "delete",
|
|
@@ -82,35 +92,34 @@ const activeActionMenus = [
|
|
|
color: "#FF4D4F",
|
|
|
iconColor: "#fff",
|
|
|
onClick() {
|
|
|
- const index = fixPoints.value.indexOf(customMap.activeFixPoint)
|
|
|
+ const index = fixPoints.value.indexOf(customMap.activeFixPoint);
|
|
|
if (~index) {
|
|
|
- fixPoints.value.splice(index, 1)
|
|
|
- edit.value = null
|
|
|
- customMap.activeFixPoint = null
|
|
|
+ fixPoints.value.splice(index, 1);
|
|
|
+ edit.value = null;
|
|
|
+ customMap.activeFixPoint = null;
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-]
|
|
|
+ },
|
|
|
+ },
|
|
|
+];
|
|
|
|
|
|
-const dom = ref<HTMLDivElement>()
|
|
|
-const menu = ref<HTMLDivElement>()
|
|
|
+const dom = ref<HTMLDivElement>();
|
|
|
+const menu = ref<HTMLDivElement>();
|
|
|
watchEffect((onCleanup) => {
|
|
|
if (edit.value && dom.value) {
|
|
|
const handler = (ev) => {
|
|
|
- console.log(ev.target)
|
|
|
+ console.log(ev.target);
|
|
|
if (!dom.value.contains(ev.target) && !menu.value.contains(ev.target)) {
|
|
|
- edit.value = null
|
|
|
+ edit.value = null;
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
// document.documentElement.addEventListener("click", handler)
|
|
|
- document.documentElement.addEventListener("touchstart", handler)
|
|
|
+ document.documentElement.addEventListener("touchstart", handler);
|
|
|
onCleanup(() => {
|
|
|
// document.documentElement.removeEventListener("click", handler)
|
|
|
- document.documentElement.removeEventListener("touchstart", handler)
|
|
|
- })
|
|
|
+ document.documentElement.removeEventListener("touchstart", handler);
|
|
|
+ });
|
|
|
}
|
|
|
-})
|
|
|
-
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -121,7 +130,7 @@ watchEffect((onCleanup) => {
|
|
|
bottom: 0;
|
|
|
overflow-y: auto;
|
|
|
z-index: 2;
|
|
|
- background-color: #161A1A;
|
|
|
+ background-color: #161a1a;
|
|
|
width: 240px;
|
|
|
padding: 10px;
|
|
|
|
|
@@ -137,12 +146,20 @@ watchEffect((onCleanup) => {
|
|
|
}
|
|
|
|
|
|
.select {
|
|
|
- span, p {
|
|
|
+ span,
|
|
|
+ p {
|
|
|
color: #fff;
|
|
|
}
|
|
|
p {
|
|
|
padding: 14px 6px;
|
|
|
font-size: 14px;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ background: var(--colors-primary-base);
|
|
|
+ margin: 0 -10px;
|
|
|
+ padding: 14px 16px;
|
|
|
+ }
|
|
|
}
|
|
|
span {
|
|
|
display: inline-block;
|
|
@@ -169,4 +186,8 @@ watchEffect((onCleanup) => {
|
|
|
.action-menus .menu.active {
|
|
|
background: none;
|
|
|
}
|
|
|
+
|
|
|
+.search-fix.ui-input .text.suffix input {
|
|
|
+ padding-right: 50px;
|
|
|
+}
|
|
|
</style>
|