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
+8 -3
View File
@@ -13,6 +13,10 @@ const display = useDisplay()
// 输入参数 // 输入参数
const props = defineProps({ const props = defineProps({
storage: {
type: String,
default: () => 'local',
},
paths: Array<string>, paths: Array<string>,
target: String, target: String,
logids: Array<number>, logids: Array<number>,
@@ -63,6 +67,7 @@ const dialogTitle = computed(() => {
// 表单 // 表单
const transferForm = reactive({ const transferForm = reactive({
storage: props.storage,
logid: 0, logid: 0,
path: '', path: '',
target: props.target ?? null, target: props.target ?? null,
@@ -210,7 +215,7 @@ onMounted(() => {
<VCardText> <VCardText>
<VForm @submit.prevent="() => {}"> <VForm @submit.prevent="() => {}">
<VRow> <VRow>
<VCol cols="12" md="8"> <VCol v-if="props.storage == 'local'" cols="12" md="8">
<VCombobox <VCombobox
v-model="transferForm.target" v-model="transferForm.target"
:items="targetDirectories" :items="targetDirectories"
@@ -220,7 +225,7 @@ onMounted(() => {
persistent-hint persistent-hint
/> />
</VCol> </VCol>
<VCol cols="12" md="4"> <VCol v-if="props.storage == 'local'" cols="12" md="4">
<VSelect <VSelect
v-model="transferForm.transfer_type" v-model="transferForm.transfer_type"
label="整理方式" label="整理方式"
@@ -338,7 +343,7 @@ onMounted(() => {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol cols="12" md="6"> <VCol cols="12" md="6" v-if="props.storage == 'local'">
<VSwitch <VSwitch
v-model="transferForm.scrape" v-model="transferForm.scrape"
label="刮削元数据" label="刮削元数据"
+24 -6
View File
@@ -392,7 +392,7 @@ watch(
{ {
title: '刮削', title: '刮削',
value: 2, value: 2,
show: inProps.storage == 'local', show: true,
props: { props: {
prependIcon: 'mdi-auto-fix', prependIcon: 'mdi-auto-fix',
click: (_item: FileItem) => { click: (_item: FileItem) => {
@@ -412,7 +412,7 @@ watch(
{ {
title: '整理', title: '整理',
value: 4, value: 4,
show: inProps.storage == 'local', show: true,
props: { props: {
prependIcon: 'mdi-folder-arrow-right', prependIcon: 'mdi-folder-arrow-right',
click: showTransfer, click: showTransfer,
@@ -456,14 +456,24 @@ async function recognize(path: string) {
} }
// 调用API刮削 // 调用API刮削
async function scrape(path: string) { async function scrape(path: string, confirm: boolean = true) {
try { try {
if (confirm) {
// 确认
const confirmed = await createConfirm({
title: '确认',
content: `是否确认刮削 ${path}`,
})
if (!confirmed) return
}
// 显示进度条 // 显示进度条
progressDialog.value = true progressDialog.value = true
progressText.value = `正在刮削 ${path} ...` progressText.value = `正在刮削 ${path} ...`
const result: { [key: string]: any } = await api.get('media/scrape', { const result: { [key: string]: any } = await api.get('media/scrape', {
params: { params: {
path, path,
storage: inProps.storage,
}, },
}) })
// 关闭进度条 // 关闭进度条
@@ -477,8 +487,15 @@ async function scrape(path: string) {
// 批量刮削 // 批量刮削
async function batchScrape() { async function batchScrape() {
// 确认
const confirmed = await createConfirm({
title: '确认',
content: `是否确认刮削选中的 ${selected.value.length} 项?`,
})
if (!confirmed) return
selected.value.map(item => { selected.value.map(item => {
scrape(item.path || '') scrape(item.path || '', false)
}) })
} }
@@ -627,7 +644,7 @@ onMounted(() => {
</IconBtn> </IconBtn>
</template> </template>
</VTooltip> </VTooltip>
<VTooltip text="刮削" v-if="storage == 'local'"> <VTooltip text="刮削">
<template #activator="{ props }"> <template #activator="{ props }">
<IconBtn v-bind="props" @click.stop="scrape(item.path)"> <IconBtn v-bind="props" @click.stop="scrape(item.path)">
<VIcon icon="mdi-auto-fix" /> <VIcon icon="mdi-auto-fix" />
@@ -641,7 +658,7 @@ onMounted(() => {
</IconBtn> </IconBtn>
</template> </template>
</VTooltip> </VTooltip>
<VTooltip text="整理" v-if="storage == 'local'"> <VTooltip text="整理">
<template #activator="{ props }"> <template #activator="{ props }">
<IconBtn v-bind="props" @click.stop="showTransfer(item)"> <IconBtn v-bind="props" @click.stop="showTransfer(item)">
<VIcon icon="mdi-folder-arrow-right" /> <VIcon icon="mdi-folder-arrow-right" />
@@ -698,6 +715,7 @@ onMounted(() => {
<ReorganizeDialog <ReorganizeDialog
v-if="transferPopper" v-if="transferPopper"
v-model="transferPopper" v-model="transferPopper"
:storage="inProps.storage"
:paths="transferPaths" :paths="transferPaths"
@done="transferDone" @done="transferDone"
@close="transferPopper = false" @close="transferPopper = false"