| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <template>
- <ui-group-option class="sign-tagging" :class="{active: selected}" @click="!disabledFly && emit('select')">
- <div class="info">
- <img :src="getResource(getFileUrl(tagging.images.length ? tagging.images[0] : style.icon))" v-if="style">
- <div>
- <p>{{ tagging.title }}</p>
- <span>放置:{{ positions.length }}</span>
- </div>
- </div>
- <div class="actions" @click.stop>
- <ui-icon type="pin1" ctrl @click.stop="$emit('fixed')" />
- <ui-more
- :options="menus"
- style="margin-left: 20px"
- @click="(action: keyof typeof actions) => actions[action]()"
- />
- </div>
- </ui-group-option>
- </template>
- <script setup lang="ts">
- import { getFileUrl } from '@/utils'
- import { computed } from 'vue';
- import { getResource } from '@/env'
- import {
- getTaggingStyle,
- getTaggingPositions,
- getFuseModel,
- getFuseModelShowVariable
- } from '@/store'
- import type { Tagging } from '@/store'
- const props = defineProps<{ tagging: Tagging, selected?: boolean }>()
- const style = computed(() => getTaggingStyle(props.tagging.styleId))
- const positions = computed(() => getTaggingPositions(props.tagging))
- const disabledFly = computed(() =>
- positions.value
- .map(position => getFuseModel(position.modelId))
- .every(model => !model || !getFuseModelShowVariable(model).value)
- )
- const emit = defineEmits<{
- (e: 'delete'): void
- (e: 'edit'): void
- (e: 'select'): void
- (e: 'fixed'): void
- }>()
- const menus = [
- { label: '编辑', value: 'edit' },
- { label: '删除', value: 'delete' },
- ]
- const actions = {
- edit: () => emit('edit'),
- delete: () => emit('delete')
- }
- </script>
- <style lang="scss" scoped src="./style.scss"></style>
|