fix buttons

This commit is contained in:
jxxghp
2024-06-20 17:40:51 +08:00
parent e8256b4e1a
commit 18f3dc2d44
2 changed files with 33 additions and 10 deletions

View File

@@ -13,6 +13,10 @@ const display = useDisplay()
// 输入参数
const props = defineProps({
storage: {
type: String,
default: () => 'local',
},
paths: Array<string>,
target: String,
logids: Array<number>,
@@ -63,6 +67,7 @@ const dialogTitle = computed(() => {
// 表单
const transferForm = reactive({
storage: props.storage,
logid: 0,
path: '',
target: props.target ?? null,
@@ -210,7 +215,7 @@ onMounted(() => {
<VCardText>
<VForm @submit.prevent="() => {}">
<VRow>
<VCol cols="12" md="8">
<VCol v-if="props.storage == 'local'" cols="12" md="8">
<VCombobox
v-model="transferForm.target"
:items="targetDirectories"
@@ -220,7 +225,7 @@ onMounted(() => {
persistent-hint
/>
</VCol>
<VCol cols="12" md="4">
<VCol v-if="props.storage == 'local'" cols="12" md="4">
<VSelect
v-model="transferForm.transfer_type"
label="整理方式"
@@ -338,7 +343,7 @@ onMounted(() => {
</VCol>
</VRow>
<VRow>
<VCol cols="12" md="6">
<VCol cols="12" md="6" v-if="props.storage == 'local'">
<VSwitch
v-model="transferForm.scrape"
label="刮削元数据"

View File

@@ -392,7 +392,7 @@ watch(
{
title: '刮削',
value: 2,
show: inProps.storage == 'local',
show: true,
props: {
prependIcon: 'mdi-auto-fix',
click: (_item: FileItem) => {
@@ -412,7 +412,7 @@ watch(
{
title: '整理',
value: 4,
show: inProps.storage == 'local',
show: true,
props: {
prependIcon: 'mdi-folder-arrow-right',
click: showTransfer,
@@ -456,20 +456,30 @@ async function recognize(path: string) {
}
// 调用API刮削
async function scrape(path: string) {
async function scrape(path: string, confirm: boolean = true) {
try {
if (confirm) {
// 确认
const confirmed = await createConfirm({
title: '确认',
content: `是否确认刮削 ${path}`,
})
if (!confirmed) return
}
// 显示进度条
progressDialog.value = true
progressText.value = `正在刮削 ${path} ...`
const result: { [key: string]: any } = await api.get('media/scrape', {
params: {
path,
storage: inProps.storage,
},
})
// 关闭进度条
progressDialog.value = false
if (!result.success) $toast.error(result.message)
else $toast.success(`${path}削刮完成!`)
else $toast.success(`${path} 削刮完成!`)
} catch (error) {
console.error(error)
}
@@ -477,8 +487,15 @@ async function scrape(path: string) {
// 批量刮削
async function batchScrape() {
// 确认
const confirmed = await createConfirm({
title: '确认',
content: `是否确认刮削选中的 ${selected.value.length} 项?`,
})
if (!confirmed) return
selected.value.map(item => {
scrape(item.path || '')
scrape(item.path || '', false)
})
}
@@ -627,7 +644,7 @@ onMounted(() => {
</IconBtn>
</template>
</VTooltip>
<VTooltip text="刮削" v-if="storage == 'local'">
<VTooltip text="刮削">
<template #activator="{ props }">
<IconBtn v-bind="props" @click.stop="scrape(item.path)">
<VIcon icon="mdi-auto-fix" />
@@ -641,7 +658,7 @@ onMounted(() => {
</IconBtn>
</template>
</VTooltip>
<VTooltip text="整理" v-if="storage == 'local'">
<VTooltip text="整理">
<template #activator="{ props }">
<IconBtn v-bind="props" @click.stop="showTransfer(item)">
<VIcon icon="mdi-folder-arrow-right" />
@@ -698,6 +715,7 @@ onMounted(() => {
<ReorganizeDialog
v-if="transferPopper"
v-model="transferPopper"
:storage="inProps.storage"
:paths="transferPaths"
@done="transferDone"
@close="transferPopper = false"