bill 3 лет назад
Родитель
Сommit
0676e944f1

+ 7 - 1
src/components/tagging/list.vue

@@ -3,6 +3,7 @@
     <template v-for="(pos, index) in positions" :key="pos.id">
       <Sign 
         v-if="isShowSign(pos.modelId)"
+        @delete="deletePosition(pos)"
         :tagging="tagging"
         :scene-pos="pos"
       />
@@ -13,7 +14,7 @@
 <script lang="ts" setup>
 import { computed } from 'vue'
 import Sign from './sign.vue'
-import { Tagging, getModelShowVariable, getModel, getTaggingPositions } from '@/store';
+import { Tagging, getModelShowVariable, getModel, getTaggingPositions, TaggingPosition, taggingPositions } from '@/store';
 import { custom } from '@/env'
 
 const props = defineProps<{ tagging: Tagging }>()
@@ -28,4 +29,9 @@ const positions = computed(() => {
   return positions
 })
 
+const deletePosition = (pos: TaggingPosition) => {
+  const index = taggingPositions.value.indexOf(pos)
+  taggingPositions.value.splice(index, 1)
+}
+
 </script>

+ 19 - 0
src/components/tagging/sign.vue

@@ -30,6 +30,12 @@
           :in-full="true" 
           @pull="index => (pullIndex = index)" 
         />
+        <div class="edit-hot" v-if="router.currentRoute.value.name === RoutesName.tagging">
+          <span @click="$emit('delete')" class="fun-ctrl">
+            <ui-icon type="del" />
+            删除
+          </span>
+        </div>
       </UIBubble>
 
       <Preview 
@@ -44,6 +50,7 @@
 
 <script lang="ts" setup>
 import { computed, ref, watchEffect, watch } from 'vue'
+import { router, RoutesName } from '@/router'
 import UIBubble from 'bill/components/bubble/index.vue'
 import Images from '@/views/tagging/images.vue'
 import Preview, { MediaType } from '../static-preview/index.vue'
@@ -56,6 +63,7 @@ import type { Tagging, TaggingPosition } from '@/store';
 
 export type SignProps = { tagging: Tagging, scenePos: TaggingPosition, show?: boolean }
 
+defineEmits<{ (e: 'delete'): void }>()
 
 const props = defineProps<SignProps>()
 const posStyle = ref<null | { left: string, top: string}>(null)
@@ -146,4 +154,15 @@ const iconClickHandler = () => {
   }
 }
 
+.edit-hot {
+  margin-top: 20px;
+  text-align: right;
+
+  span {
+    font-size: 14px;
+    color: rgba(255, 255, 255, 0.6);
+    cursor: pointer;
+  }
+}
+
 </style>

+ 11 - 2
src/layout/model-list/index.vue

@@ -5,7 +5,7 @@
       key="id" 
       :data="modelList" 
     >
-      <template #action>
+      <template #action v-if="custom.modelsChangeStore">
         <ui-input
           type="file"
           width="20px"
@@ -14,7 +14,7 @@
           accept=".zip"
           :disable="true"
           :multiple="false"
-          @update:modelValue="addModel"
+          @update:modelValue="addHandler"
         >
           <template v-slot:replace>
             <ui-icon type="add" ctrl/>
@@ -50,6 +50,15 @@ const modelList = computed(() =>
   }))
 )
 
+const addHandler = async (file: File) => {
+  await addModel(file)
+  modelList.value.forEach(model => {
+    if (!custom.showModelsMap.has(model.raw)) {
+      custom.showModelsMap.set(model.raw, model.raw.show)
+    }
+  })
+}
+
 const modelChangeSelect = (model: Model) => {
   if (getModelShowVariable(model).value) {
     if (custom.currentModel !== model) {

+ 2 - 2
src/layout/model-list/sign.vue

@@ -8,7 +8,7 @@
           type="del" 
           ctrl 
           @click="$emit('delete')" 
-          v-if="model.type !== ModelType.SWSS && custom.modelsChangeStore" 
+          v-if="model.type !== ModelType.SWSS" 
         />
       </template>
       <ui-icon 
@@ -22,7 +22,7 @@
   <div class="model-desc" @click="$emit('click')">
     <p><span>数据来源:</span>{{ ModelTypeDesc[model.type] }}</p>
     <p><span>数据大小:</span>{{ model.size }}</p>
-    <p><span>拍摄时间:</span>{{ model.time }}</p>
+    <p v-if="model.type === ModelType.SWSS"><span>拍摄时间:</span>{{ model.time }}</p>
   </div>
 </template>