Compare commits

...

2 Commits

2 changed files with 34 additions and 5 deletions

View File

@ -30,7 +30,7 @@ import { computed, inject, type InjectionKey, ref, type ShallowRef } from 'vue';
import type { MapPen } from '../apis/map';
import type { EditorService } from '../services/editor.service';
import BatchEditModal from './modal/batch-edit-modal.vue';
// import BatchEditModal from './modal/batch-edit-modal.vue';
type Props = {
token: InjectionKey<ShallowRef<EditorService>>;

View File

@ -76,10 +76,10 @@
<span class="item-name">{{ getItemName(item) }}</span>
<span class="item-type">{{ getItemType(item) }}</span>
<div class="changes">
<a-tag v-if="getPointChanges(item).length" color="blue">
<a-tag v-if="getPointChanges(item).length" color="blue" class="change-tag">
点位: {{ getPointChanges(item).join(', ') }}
</a-tag>
<a-tag v-if="getRouteChanges(item).length" color="green">
<a-tag v-if="getRouteChanges(item).length" color="green" class="change-tag">
路线: {{ getRouteChanges(item).join(', ') }}
</a-tag>
</div>
@ -182,6 +182,9 @@ const selectionDescription = computed(() => {
//
const getItemName = (item: MapPen) => {
if(item.tags?.includes('route')){
return item.desc||item.label || item.id || '未命名';
}
return item.label || item.id || '未命名';
};
@ -205,10 +208,14 @@ const getPointChanges = (item: MapPen) => {
const currentType = item.point?.type;
if (currentType === pointType.value) return [];
const currentTypeName = Object.keys(MapPointType).find(
key => MapPointType[key as keyof typeof MapPointType] === currentType
);
const newTypeName = Object.keys(MapPointType).find(
key => MapPointType[key as keyof typeof MapPointType] === pointType.value
);
return [`类型: ${newTypeName}`];
return [`类型: ${currentTypeName || '未知'}${newTypeName}`];
};
// 线
@ -218,10 +225,13 @@ const getRouteChanges = (item: MapPen) => {
const changes: string[] = [];
if (routePassType.value !== undefined && item.route?.pass !== routePassType.value) {
const currentPassName = Object.keys(MapRoutePassType).find(
key => MapRoutePassType[key as keyof typeof MapRoutePassType] === item.route?.pass
);
const newPassName = Object.keys(MapRoutePassType).find(
key => MapRoutePassType[key as keyof typeof MapRoutePassType] === routePassType.value
);
changes.push(`通行: ${newPassName}`);
changes.push(`通行: ${currentPassName || '未知'}${newPassName}`);
}
return changes;
@ -354,6 +364,25 @@ defineOptions({
margin-bottom: 2px;
font-size: 11px;
}
.change-tag {
font-weight: 500;
border: 1px solid currentColor;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
//
&::before {
content: '';
display: inline-block;
width: 0;
height: 0;
margin-right: 4px;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 4px solid currentColor;
vertical-align: middle;
}
}
}
}
}