feat: 更新批处理模型路径输入功能,增加模型路径管理和验证
This commit is contained in:
parent
3417462710
commit
b7e98af8ba
@ -107,22 +107,26 @@
|
|||||||
<div class="wizard-content">
|
<div class="wizard-content">
|
||||||
<!-- 步骤1:选择模型 -->
|
<!-- 步骤1:选择模型 -->
|
||||||
<div v-show="wizardStep === 0" class="step-panel">
|
<div v-show="wizardStep === 0" class="step-panel">
|
||||||
<p class="step-desc">请从文件库或本地选择需要进行批量处理的模型集合:</p>
|
<p class="step-desc">请输入模型路径并点击“增加模型”,构建本次批处理的模型列表:</p>
|
||||||
<el-upload
|
<div class="model-path-input-row">
|
||||||
class="upload-demo"
|
<el-input
|
||||||
drag
|
v-model="newModelPath"
|
||||||
multiple
|
placeholder="例如:D:\\CAD\\project\\part1.prt"
|
||||||
action="#"
|
@keyup.enter="addModelPath"
|
||||||
:auto-upload="false"
|
/>
|
||||||
>
|
<el-button type="primary" @click="addModelPath">
|
||||||
<el-icon class="el-icon--upload"><i class="fas fa-cloud-upload-alt"></i></el-icon>
|
<i class="fas fa-plus"></i> 增加模型
|
||||||
<div class="el-upload__text">
|
</el-button>
|
||||||
拖拽文件到此处或 <em>点击上传</em>
|
</div>
|
||||||
|
<div class="model-path-list" v-if="taskForm.modelPaths.length > 0">
|
||||||
|
<div class="model-path-item" v-for="(path, index) in taskForm.modelPaths" :key="path + index">
|
||||||
|
<span class="path-text">{{ path }}</span>
|
||||||
|
<el-button type="danger" size="small" link @click="removeModelPath(index)">移除</el-button>
|
||||||
</div>
|
</div>
|
||||||
<template #tip>
|
</div>
|
||||||
<div class="el-upload__tip">支持多选,目前已选 0 个模型</div>
|
<div class="empty-model-paths" v-else>
|
||||||
</template>
|
尚未添加模型路径
|
||||||
</el-upload>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 步骤2:配置策略 -->
|
<!-- 步骤2:配置策略 -->
|
||||||
@ -187,8 +191,10 @@ const taskForm = ref({
|
|||||||
exportPath: '',
|
exportPath: '',
|
||||||
priority: '普通',
|
priority: '普通',
|
||||||
maxConcurrency: 3,
|
maxConcurrency: 3,
|
||||||
scheduleAt: ''
|
scheduleAt: '',
|
||||||
|
modelPaths: []
|
||||||
})
|
})
|
||||||
|
const newModelPath = ref('')
|
||||||
|
|
||||||
// 模拟列表数据
|
// 模拟列表数据
|
||||||
const jobs = ref([
|
const jobs = ref([
|
||||||
@ -211,12 +217,19 @@ const openWizard = () => {
|
|||||||
exportPath: '',
|
exportPath: '',
|
||||||
priority: '普通',
|
priority: '普通',
|
||||||
maxConcurrency: 3,
|
maxConcurrency: 3,
|
||||||
scheduleAt: ''
|
scheduleAt: '',
|
||||||
|
modelPaths: []
|
||||||
}
|
}
|
||||||
wizardVisible.value = true
|
wizardVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitTask = () => {
|
const submitTask = () => {
|
||||||
|
if (taskForm.value.modelPaths.length === 0) {
|
||||||
|
ElMessage.warning('请先添加至少一个模型路径')
|
||||||
|
wizardStep.value = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ElMessage.success('批量任务已成功加入调度队列!')
|
ElMessage.success('批量任务已成功加入调度队列!')
|
||||||
wizardVisible.value = false
|
wizardVisible.value = false
|
||||||
// 将新任务加入 mock 数据 (实际应调用后端的 create job 接口)
|
// 将新任务加入 mock 数据 (实际应调用后端的 create job 接口)
|
||||||
@ -226,12 +239,27 @@ const submitTask = () => {
|
|||||||
priority: taskForm.value.priority,
|
priority: taskForm.value.priority,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
status: 'queued',
|
status: 'queued',
|
||||||
totalCount: 1, // 模拟数
|
totalCount: taskForm.value.modelPaths.length,
|
||||||
completedCount: 0,
|
completedCount: 0,
|
||||||
createdAt: new Date().toLocaleString()
|
createdAt: new Date().toLocaleString()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const addModelPath = () => {
|
||||||
|
const path = newModelPath.value.trim()
|
||||||
|
if (!path) return
|
||||||
|
if (taskForm.value.modelPaths.includes(path)) {
|
||||||
|
ElMessage.warning('该模型路径已存在')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
taskForm.value.modelPaths.push(path)
|
||||||
|
newModelPath.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeModelPath = (index) => {
|
||||||
|
taskForm.value.modelPaths.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
// 格式辅助
|
// 格式辅助
|
||||||
const getStatusLabel = (status) => {
|
const getStatusLabel = (status) => {
|
||||||
const map = { running: '执行中', completed: '已完成', queued: '排队中', paused: '已暂停', failed: '异常' }
|
const map = { running: '执行中', completed: '已完成', queued: '排队中', paused: '已暂停', failed: '异常' }
|
||||||
@ -389,10 +417,50 @@ const viewDetails = (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.step-desc {
|
.step-desc {
|
||||||
color: var(--color-text-secondary);
|
color: #4b5563;
|
||||||
margin-bottom: var(--spacing-md);
|
margin-bottom: var(--spacing-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.model-path-input-row {
|
||||||
|
display: flex;
|
||||||
|
gap: var(--spacing-md);
|
||||||
|
margin-bottom: var(--spacing-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-path-list {
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: var(--size-border-radius);
|
||||||
|
background: #ffffff;
|
||||||
|
max-height: 260px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-path-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: var(--spacing-md);
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-path-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-text {
|
||||||
|
flex: 1;
|
||||||
|
color: #111827;
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-model-paths {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
|
padding: 10px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.form-tip {
|
.form-tip {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@ -403,10 +471,26 @@ const viewDetails = (row) => {
|
|||||||
:deep(.el-table) {
|
:deep(.el-table) {
|
||||||
--el-table-bg-color: transparent;
|
--el-table-bg-color: transparent;
|
||||||
--el-table-tr-bg-color: transparent;
|
--el-table-tr-bg-color: transparent;
|
||||||
|
--el-table-striped-bg-color: rgba(255, 255, 255, 0.08);
|
||||||
--el-table-header-bg-color: var(--color-bg-primary);
|
--el-table-header-bg-color: var(--color-bg-primary);
|
||||||
--el-table-border-color: var(--color-border-primary);
|
--el-table-border-color: var(--color-border-primary);
|
||||||
--el-table-text-color: var(--color-text-primary);
|
--el-table-text-color: var(--color-text-primary);
|
||||||
--el-table-header-text-color: var(--color-text-primary);
|
--el-table-header-text-color: var(--color-text-primary);
|
||||||
--el-table-row-hover-bg-color: var(--color-white-rgb-05);
|
--el-table-row-hover-bg-color: var(--color-white-rgb-05);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 修复浅色斑马纹导致的文字可读性问题 */
|
||||||
|
:deep(.el-table .el-table__row td.el-table__cell) {
|
||||||
|
color: var(--color-text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell) {
|
||||||
|
background-color: rgba(255, 255, 255, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 固定列默认会有独立背景,保持与行背景一致,避免发白 */
|
||||||
|
:deep(.el-table .el-table-fixed-column--left),
|
||||||
|
:deep(.el-table .el-table-fixed-column--right) {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -50,14 +50,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="setting-group toggle-group">
|
|
||||||
<label>安全设置</label>
|
|
||||||
<div class="toggle-control">
|
|
||||||
<span>操作前备份原始文件?</span>
|
|
||||||
<el-switch v-model="formData.backupOriginal" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="action-bar">
|
<div class="action-bar">
|
||||||
<button class="primary-btn" @click="startTask" :disabled="isStarting">
|
<button class="primary-btn" @click="startTask" :disabled="isStarting">
|
||||||
<i class="fas" :class="isStarting ? 'fa-spinner fa-spin' : 'fa-play'"></i>
|
<i class="fas" :class="isStarting ? 'fa-spinner fa-spin' : 'fa-play'"></i>
|
||||||
@ -158,7 +150,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onUnmounted } from 'vue'
|
import { ref, reactive, onUnmounted } from 'vue'
|
||||||
import { ElNotification, ElSwitch } from 'element-plus'
|
import { ElNotification } from 'element-plus'
|
||||||
import revitApi from '@/services/revitApi'
|
import revitApi from '@/services/revitApi'
|
||||||
|
|
||||||
const emit = defineEmits(['page-change'])
|
const emit = defineEmits(['page-change'])
|
||||||
@ -177,7 +169,7 @@ let pollingTimer = null
|
|||||||
// 单文件常量配置
|
// 单文件常量配置
|
||||||
const DEFAULT_REVIT_CONFIG = {
|
const DEFAULT_REVIT_CONFIG = {
|
||||||
MODE: 'EnvelopeOnly',
|
MODE: 'EnvelopeOnly',
|
||||||
BACKUP_ORIGINAL: true
|
BACKUP_ORIGINAL: false
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表单数据
|
// 表单数据
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user