|
|
@@ -69,6 +69,13 @@
|
|
|
>
|
|
|
设为JSON目录
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ @click="setAsOutputDir"
|
|
|
+ :disabled="!templateStore.currentPath"
|
|
|
+ >
|
|
|
+ 设为输出目录
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
|
|
|
<div class="scan-config" v-if="templateStore.scanConfig.imageDir">
|
|
|
@@ -80,6 +87,27 @@
|
|
|
<label>JSON目录:</label>
|
|
|
<span>{{ templateStore.scanConfig.jsonDir }}</span>
|
|
|
</div>
|
|
|
+ <div class="config-item">
|
|
|
+ <label>输出目录:</label>
|
|
|
+ <el-input
|
|
|
+ v-model="outputDirInput"
|
|
|
+ size="small"
|
|
|
+ placeholder="输入输出目录路径(可不存在)"
|
|
|
+ @keyup.enter.prevent="handleSetOutputDir"
|
|
|
+ @blur="handleSetOutputDir"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <template #append>
|
|
|
+ <el-button
|
|
|
+ @click="handleSetOutputDir"
|
|
|
+ :disabled="!outputDirInput"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ 设置
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
<el-button
|
|
|
type="success"
|
|
|
size="small"
|
|
|
@@ -94,6 +122,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { ref, watch } from 'vue'
|
|
|
import { ArrowUp, Folder, FolderOpened, Search } from '@element-plus/icons-vue'
|
|
|
import { useTemplateStore } from '@/stores'
|
|
|
import { useDirectory } from './composables'
|
|
|
@@ -107,6 +136,8 @@ const {
|
|
|
goToParent,
|
|
|
setAsImageDir,
|
|
|
setAsJsonDir,
|
|
|
+ setAsOutputDir,
|
|
|
+ setOutputDir,
|
|
|
scanFiles
|
|
|
} = useDirectory()
|
|
|
|
|
|
@@ -114,6 +145,23 @@ const emit = defineEmits<{
|
|
|
filesScanned: []
|
|
|
}>()
|
|
|
|
|
|
+// 输出目录输入框
|
|
|
+const outputDirInput = ref('')
|
|
|
+
|
|
|
+// 同步输出目录到输入框
|
|
|
+watch(() => templateStore.scanConfig.outputDir, (newVal) => {
|
|
|
+ if (newVal && newVal !== outputDirInput.value) {
|
|
|
+ outputDirInput.value = newVal
|
|
|
+ }
|
|
|
+}, { immediate: true })
|
|
|
+
|
|
|
+// 处理设置输出目录
|
|
|
+function handleSetOutputDir() {
|
|
|
+ if (outputDirInput.value) {
|
|
|
+ setOutputDir(outputDirInput.value)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
async function handleScanFiles() {
|
|
|
const result = await scanFiles()
|
|
|
if (result) {
|
|
|
@@ -173,16 +221,22 @@ async function handleScanFiles() {
|
|
|
gap: 8px;
|
|
|
margin-bottom: 8px;
|
|
|
font-size: 12px;
|
|
|
+ align-items: center;
|
|
|
|
|
|
label {
|
|
|
color: #909399;
|
|
|
min-width: 70px;
|
|
|
+ flex-shrink: 0;
|
|
|
}
|
|
|
|
|
|
span {
|
|
|
color: #303133;
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
+
|
|
|
+ :deep(.el-input) {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|