fix: 修整通用用户额外脚本样式
This commit is contained in:
@@ -135,84 +135,91 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-card title="脚本配置" class="form-card">
|
<a-card title="额外脚本" class="form-card">
|
||||||
<a-row :gutter="24">
|
<a-form-item name="scriptBeforeTask">
|
||||||
<a-col :span="12">
|
<template #label>
|
||||||
<a-form-item name="ifScriptBeforeTask">
|
<a-tooltip title="在任务执行前运行自定义脚本">
|
||||||
<template #label>
|
<span class="form-label">
|
||||||
<a-tooltip title="是否在任务执行前运行自定义脚本">
|
任务前执行脚本
|
||||||
<span class="form-label">
|
<QuestionCircleOutlined class="help-icon" />
|
||||||
任务前执行脚本
|
</span>
|
||||||
<QuestionCircleOutlined class="help-icon" />
|
</a-tooltip>
|
||||||
</span>
|
</template>
|
||||||
</a-tooltip>
|
<a-row :gutter="24" align="middle">
|
||||||
</template>
|
<a-col :span="4">
|
||||||
<a-switch
|
<a-switch
|
||||||
v-model:checked="formData.Info.IfScriptBeforeTask"
|
v-model:checked="formData.Info.IfScriptBeforeTask"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
size="default"
|
size="default"
|
||||||
/>
|
/>
|
||||||
<span class="switch-description">启用后将在任务执行前运行指定脚本</span>
|
</a-col>
|
||||||
</a-form-item>
|
<a-col :span="20">
|
||||||
</a-col>
|
<a-input-group compact class="path-input-group">
|
||||||
<a-col :span="12">
|
<a-input
|
||||||
<a-form-item name="ifScriptAfterTask">
|
v-model:value="formData.Info.ScriptBeforeTask"
|
||||||
<template #label>
|
placeholder="请选择脚本文件"
|
||||||
<a-tooltip title="是否在任务执行后运行自定义脚本">
|
:disabled="loading || !formData.Info.IfScriptBeforeTask"
|
||||||
<span class="form-label">
|
size="large"
|
||||||
任务后执行脚本
|
class="path-input"
|
||||||
<QuestionCircleOutlined class="help-icon" />
|
readonly
|
||||||
</span>
|
/>
|
||||||
</a-tooltip>
|
<a-button
|
||||||
</template>
|
size="large"
|
||||||
|
@click="selectScriptBeforeTask"
|
||||||
|
:disabled="loading || !formData.Info.IfScriptBeforeTask"
|
||||||
|
class="path-button"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<FileOutlined />
|
||||||
|
</template>
|
||||||
|
选择文件
|
||||||
|
</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item name="scriptAfterTask">
|
||||||
|
<template #label>
|
||||||
|
<a-tooltip title="在任务执行后运行自定义脚本">
|
||||||
|
<span class="form-label">
|
||||||
|
任务后执行脚本
|
||||||
|
<QuestionCircleOutlined class="help-icon" />
|
||||||
|
</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<a-row :gutter="24" align="middle">
|
||||||
|
<a-col :span="4">
|
||||||
<a-switch
|
<a-switch
|
||||||
v-model:checked="formData.Info.IfScriptAfterTask"
|
v-model:checked="formData.Info.IfScriptAfterTask"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
size="default"
|
size="default"
|
||||||
/>
|
/>
|
||||||
<span class="switch-description">启用后将在任务执行后运行指定脚本</span>
|
</a-col>
|
||||||
</a-form-item>
|
<a-col :span="20">
|
||||||
</a-col>
|
<a-input-group compact class="path-input-group">
|
||||||
</a-row>
|
<a-input
|
||||||
|
v-model:value="formData.Info.ScriptAfterTask"
|
||||||
<a-row :gutter="24">
|
placeholder="请选择脚本文件"
|
||||||
<a-col :span="12">
|
:disabled="loading || !formData.Info.IfScriptAfterTask"
|
||||||
<a-form-item name="scriptBeforeTask">
|
size="large"
|
||||||
<template #label>
|
class="path-input"
|
||||||
<a-tooltip title="任务执行前要运行的脚本路径">
|
readonly
|
||||||
<span class="form-label">
|
/>
|
||||||
任务前脚本
|
<a-button
|
||||||
<QuestionCircleOutlined class="help-icon" />
|
size="large"
|
||||||
</span>
|
@click="selectScriptAfterTask"
|
||||||
</a-tooltip>
|
:disabled="loading || !formData.Info.IfScriptAfterTask"
|
||||||
</template>
|
class="path-button"
|
||||||
<a-input
|
>
|
||||||
v-model:value="formData.Info.ScriptBeforeTask"
|
<template #icon>
|
||||||
placeholder="请输入脚本路径"
|
<FileOutlined />
|
||||||
:disabled="loading || !formData.Info.IfScriptBeforeTask"
|
</template>
|
||||||
size="large"
|
选择文件
|
||||||
/>
|
</a-button>
|
||||||
</a-form-item>
|
</a-input-group>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
</a-row>
|
||||||
<a-form-item name="scriptAfterTask">
|
</a-form-item>
|
||||||
<template #label>
|
|
||||||
<a-tooltip title="任务执行后要运行的脚本路径">
|
|
||||||
<span class="form-label">
|
|
||||||
任务后脚本
|
|
||||||
<QuestionCircleOutlined class="help-icon" />
|
|
||||||
</span>
|
|
||||||
</a-tooltip>
|
|
||||||
</template>
|
|
||||||
<a-input
|
|
||||||
v-model:value="formData.Info.ScriptAfterTask"
|
|
||||||
placeholder="请输入脚本路径"
|
|
||||||
:disabled="loading || !formData.Info.IfScriptAfterTask"
|
|
||||||
size="large"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-card title="通知配置" class="form-card">
|
<a-card title="通知配置" class="form-card">
|
||||||
@@ -325,6 +332,7 @@ import { useRoute, useRouter } from 'vue-router'
|
|||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import {
|
import {
|
||||||
ArrowLeftOutlined,
|
ArrowLeftOutlined,
|
||||||
|
FileOutlined,
|
||||||
QuestionCircleOutlined,
|
QuestionCircleOutlined,
|
||||||
SaveOutlined,
|
SaveOutlined,
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
@@ -590,6 +598,43 @@ const handleGeneralConfig = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 文件选择方法
|
||||||
|
const selectScriptBeforeTask = async () => {
|
||||||
|
try {
|
||||||
|
const path = await (window.electronAPI as any)?.selectFile([
|
||||||
|
{ name: '可执行文件', extensions: ['exe', 'bat', 'cmd', 'ps1'] },
|
||||||
|
{ name: '脚本文件', extensions: ['py', 'js', 'sh'] },
|
||||||
|
{ name: '所有文件', extensions: ['*'] },
|
||||||
|
])
|
||||||
|
|
||||||
|
if (path && path.length > 0) {
|
||||||
|
formData.Info.ScriptBeforeTask = path[0]
|
||||||
|
message.success('任务前脚本路径选择成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('选择任务前脚本失败:', error)
|
||||||
|
message.error('选择文件失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectScriptAfterTask = async () => {
|
||||||
|
try {
|
||||||
|
const path = await (window.electronAPI as any)?.selectFile([
|
||||||
|
{ name: '可执行文件', extensions: ['exe', 'bat', 'cmd', 'ps1'] },
|
||||||
|
{ name: '脚本文件', extensions: ['py', 'js', 'sh'] },
|
||||||
|
{ name: '所有文件', extensions: ['*'] },
|
||||||
|
])
|
||||||
|
|
||||||
|
if (path && path.length > 0) {
|
||||||
|
formData.Info.ScriptAfterTask = path[0]
|
||||||
|
message.success('任务后脚本路径选择成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('选择任务后脚本失败:', error)
|
||||||
|
message.error('选择文件失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
// 清理WebSocket连接
|
// 清理WebSocket连接
|
||||||
if (generalWebsocketId.value) {
|
if (generalWebsocketId.value) {
|
||||||
@@ -755,4 +800,56 @@ onMounted(() => {
|
|||||||
width: 60px;
|
width: 60px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 路径输入组样式 */
|
||||||
|
.path-input-group {
|
||||||
|
display: flex;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 2px solid var(--ant-color-border);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-input-group:hover {
|
||||||
|
border-color: var(--ant-color-primary-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-input-group:focus-within {
|
||||||
|
border-color: var(--ant-color-primary);
|
||||||
|
box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-input {
|
||||||
|
flex: 1;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
background: var(--ant-color-bg-container) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-input:focus {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-button {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
background: var(--ant-color-primary-bg);
|
||||||
|
color: var(--ant-color-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 0 20px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border-left: 1px solid var(--ant-color-border-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-button:hover {
|
||||||
|
background: var(--ant-color-primary);
|
||||||
|
color: white;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-button:disabled {
|
||||||
|
background: var(--ant-color-bg-container-disabled);
|
||||||
|
color: var(--ant-color-text-disabled);
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user