修bug
This commit is contained in:
@@ -197,10 +197,7 @@ import http from '../utils/http';
|
|||||||
* @returns {Promise<Array<PigBatchResponseDTO>>}
|
* @returns {Promise<Array<PigBatchResponseDTO>>}
|
||||||
*/
|
*/
|
||||||
export const getPigBatches = (params) => {
|
export const getPigBatches = (params) => {
|
||||||
const newParams = {
|
return http.get('/api/v1/pig-batches', params);
|
||||||
is_active: params.is_active,
|
|
||||||
};
|
|
||||||
return http.get('/api/v1/pig-batches', { params: newParams });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,9 +20,15 @@
|
|||||||
<span>{{ plan.name }} - 内容</span>
|
<span>{{ plan.name }} - 内容</span>
|
||||||
<div>
|
<div>
|
||||||
<template v-if="!isSubPlan">
|
<template v-if="!isSubPlan">
|
||||||
<el-button class="button" type="primary" @click="savePlanContent" v-if="isEditingContent" :disabled="plan.plan_type === '系统任务'">保存</el-button>
|
<el-button class="button" type="primary" @click="savePlanContent" v-if="isEditingContent"
|
||||||
<el-button class="button" type="danger" @click="cancelEdit" v-if="isEditingContent" :disabled="plan.plan_type === '系统任务'">取消</el-button>
|
:disabled="plan.plan_type === '系统任务'">保存
|
||||||
<el-button class="button" @click="enterEditMode" v-else :disabled="plan.plan_type === '系统任务'">编辑内容</el-button>
|
</el-button>
|
||||||
|
<el-button class="button" type="danger" @click="cancelEdit" v-if="isEditingContent"
|
||||||
|
:disabled="plan.plan_type === '系统任务'">取消
|
||||||
|
</el-button>
|
||||||
|
<el-button class="button" @click="enterEditMode" v-else :disabled="plan.plan_type === '系统任务'">
|
||||||
|
编辑内容
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Dynamic Add Buttons -->
|
<!-- Dynamic Add Buttons -->
|
||||||
@@ -33,14 +39,16 @@
|
|||||||
size="small"
|
size="small"
|
||||||
@click="showAddSubPlanDialog"
|
@click="showAddSubPlanDialog"
|
||||||
:disabled="plan.plan_type === '系统任务'"
|
:disabled="plan.plan_type === '系统任务'"
|
||||||
>增加子计划</el-button>
|
>增加子计划
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="plan.content_type === 'tasks' || !plan.content_type"
|
v-if="plan.content_type === 'tasks' || !plan.content_type"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="showTaskEditorDialog()"
|
@click="showTaskEditorDialog()"
|
||||||
:disabled="plan.plan_type === '系统任务'"
|
:disabled="plan.plan_type === '系统任务'"
|
||||||
>增加子任务</el-button>
|
>增加子任务
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,8 +71,12 @@
|
|||||||
延时: {{ task.parameters.delay_duration }} 秒
|
延时: {{ task.parameters.delay_duration }} 秒
|
||||||
</p>
|
</p>
|
||||||
<el-button-group v-if="isEditingContent">
|
<el-button-group v-if="isEditingContent">
|
||||||
<el-button type="primary" size="small" @click="editTask(task)" :disabled="plan.plan_type === '系统任务'">编辑</el-button>
|
<el-button type="primary" size="small" @click="editTask(task)"
|
||||||
<el-button type="danger" size="small" @click="deleteTask(task)" :disabled="plan.plan_type === '系统任务'">删除</el-button>
|
:disabled="plan.plan_type === '系统任务'">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="danger" size="small" @click="deleteTask(task)"
|
||||||
|
:disabled="plan.plan_type === '系统任务'">删除
|
||||||
|
</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-timeline-item>
|
</el-timeline-item>
|
||||||
@@ -76,13 +88,16 @@
|
|||||||
<div v-else-if="plan.content_type === 'sub_plans'">
|
<div v-else-if="plan.content_type === 'sub_plans'">
|
||||||
<h4>子计划列表</h4>
|
<h4>子计划列表</h4>
|
||||||
<div v-if="plan.sub_plans.length > 0">
|
<div v-if="plan.sub_plans.length > 0">
|
||||||
<div v-for="(subPlan, index) in plan.sub_plans" :key="subPlan.id || 'new-subplan-' + index" class="sub-plan-wrapper">
|
<div v-for="(subPlan, index) in plan.sub_plans" :key="subPlan.id || 'new-subplan-' + index"
|
||||||
|
class="sub-plan-wrapper">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div class="sub-plan-card-content">
|
<div class="sub-plan-card-content">
|
||||||
<!-- Pass child_plan_id to recursive PlanDetail -->
|
<!-- Pass child_plan_id to recursive PlanDetail -->
|
||||||
<plan-detail :plan-id="subPlan.child_plan_id" :is-sub-plan="true"/>
|
<plan-detail :plan-id="subPlan.child_plan_id" :is-sub-plan="true"/>
|
||||||
<el-button-group v-if="isEditingContent" class="sub-plan-actions">
|
<el-button-group v-if="isEditingContent" class="sub-plan-actions">
|
||||||
<el-button type="danger" size="small" @click="deleteSubPlan(subPlan)" :disabled="plan.plan_type === '系统任务'">删除</el-button>
|
<el-button type="danger" size="small" @click="deleteSubPlan(subPlan)"
|
||||||
|
:disabled="plan.plan_type === '系统任务'">删除
|
||||||
|
</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
@@ -137,16 +152,19 @@
|
|||||||
>
|
>
|
||||||
<el-form :model="currentTaskForm" ref="taskFormRef" :rules="taskFormRules" label-width="100px">
|
<el-form :model="currentTaskForm" ref="taskFormRef" :rules="taskFormRules" label-width="100px">
|
||||||
<el-form-item label="任务类型" prop="type">
|
<el-form-item label="任务类型" prop="type">
|
||||||
<el-select v-model="currentTaskForm.type" placeholder="请选择任务类型" style="width: 100%;" :disabled="isEditingTask || plan.plan_type === '系统任务'">
|
<el-select v-model="currentTaskForm.type" placeholder="请选择任务类型" style="width: 100%;"
|
||||||
|
:disabled="isEditingTask || plan.plan_type === '系统任务'">
|
||||||
<!-- Only Delay Task for now -->
|
<!-- Only Delay Task for now -->
|
||||||
<el-option label="延时任务" value="delay_task"></el-option>
|
<el-option label="延时任务" value="delay_task"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="任务名称" prop="name">
|
<el-form-item label="任务名称" prop="name">
|
||||||
<el-input v-model="currentTaskForm.name" placeholder="请输入任务名称" :disabled="plan.plan_type === '系统任务'"></el-input>
|
<el-input v-model="currentTaskForm.name" placeholder="请输入任务名称"
|
||||||
|
:disabled="plan.plan_type === '系统任务'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="任务描述" prop="description">
|
<el-form-item label="任务描述" prop="description">
|
||||||
<el-input type="textarea" v-model="currentTaskForm.description" placeholder="请输入任务描述" :disabled="plan.plan_type === '系统任务'"></el-input>
|
<el-input type="textarea" v-model="currentTaskForm.description" placeholder="请输入任务描述"
|
||||||
|
:disabled="plan.plan_type === '系统任务'"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- Dynamic task component for specific parameters -->
|
<!-- Dynamic task component for specific parameters -->
|
||||||
<template v-if="currentTaskForm.type === 'delay_task'">
|
<template v-if="currentTaskForm.type === 'delay_task'">
|
||||||
@@ -358,7 +376,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async fetchAvailablePlans() {
|
async fetchAvailablePlans() {
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.plans.getPlans({ plan_type: '自定义任务' });
|
const response = await apiClient.plans.getPlans({plan_type: '自定义任务', page: 1, page_size: 1000});
|
||||||
this.availablePlans = response.data.plans.filter(p =>
|
this.availablePlans = response.data.plans.filter(p =>
|
||||||
p.id !== this.planId
|
p.id !== this.planId
|
||||||
);
|
);
|
||||||
@@ -486,8 +504,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
ElMessage.error('未找到要编辑的任务');
|
ElMessage.error('未找到要编辑的任务');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Add a new task
|
// Add a new task
|
||||||
const newTask = {
|
const newTask = {
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
@@ -544,35 +561,43 @@ export default {
|
|||||||
.plan-detail {
|
.plan-detail {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading, .error {
|
.loading, .error {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.retry-btn {
|
.retry-btn {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-plan-wrapper {
|
.sub-plan-wrapper {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-plan-container {
|
.sub-plan-container {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
border-left: 2px solid #ebeef5;
|
border-left: 2px solid #ebeef5;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-plan-card-content {
|
.sub-plan-card-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-plan-actions {
|
.sub-plan-actions {
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 调整子计划卡片内部的header,避免重复样式 */
|
/* 调整子计划卡片内部的header,避免重复样式 */
|
||||||
.sub-plan-container .card-header {
|
.sub-plan-container .card-header {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
@@ -6,12 +6,15 @@
|
|||||||
<div class="title-container">
|
<div class="title-container">
|
||||||
<h2 class="page-title">计划管理</h2>
|
<h2 class="page-title">计划管理</h2>
|
||||||
<el-button type="text" @click="loadPlans" class="refresh-btn" title="刷新计划列表">
|
<el-button type="text" @click="loadPlans" class="refresh-btn" title="刷新计划列表">
|
||||||
<el-icon :size="20"><Refresh /></el-icon>
|
<el-icon :size="20">
|
||||||
|
<Refresh/>
|
||||||
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="filter-and-add">
|
<div class="filter-and-add">
|
||||||
<el-select v-model="planTypeFilter" placeholder="选择计划类型" @change="loadPlans" style="width: 150px; margin-right: 10px;">
|
<el-select v-model="planTypeFilter" placeholder="选择计划类型" @change="loadPlans"
|
||||||
|
style="width: 150px; margin-right: 10px;">
|
||||||
<el-option label="所有任务" value="所有任务"></el-option>
|
<el-option label="所有任务" value="所有任务"></el-option>
|
||||||
<el-option label="自定义任务" value="自定义任务"></el-option>
|
<el-option label="自定义任务" value="自定义任务"></el-option>
|
||||||
<el-option label="系统任务" value="系统任务"></el-option>
|
<el-option label="系统任务" value="系统任务"></el-option>
|
||||||
@@ -73,7 +76,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="280">
|
<el-table-column label="操作" width="280">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" @click="editPlan(scope.row)" :disabled="scope.row.plan_type === '系统任务'">编辑</el-button>
|
<el-button size="small" @click="editPlan(scope.row)" :disabled="scope.row.plan_type === '系统任务'">编辑
|
||||||
|
</el-button>
|
||||||
<el-button size="small" @click="showDetails(scope.row)">详情</el-button>
|
<el-button size="small" @click="showDetails(scope.row)">详情</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
@@ -84,7 +88,9 @@
|
|||||||
>
|
>
|
||||||
{{ scope.row.status === 1 ? '停止' : '启动' }}
|
{{ scope.row.status === 1 ? '停止' : '启动' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" type="danger" @click="deletePlan(scope.row)" :disabled="scope.row.plan_type === '系统任务'">删除</el-button>
|
<el-button size="small" type="danger" @click="deletePlan(scope.row)"
|
||||||
|
:disabled="scope.row.plan_type === '系统任务'">删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -168,7 +174,7 @@ export default {
|
|||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.plans.getPlans({ plan_type: this.planTypeFilter }); // 传递 plan_typeFilter
|
const response = await apiClient.plans.getPlans({plan_type: this.planTypeFilter, page: 1, page_size: 1000}); // 传递 plan_typeFilter
|
||||||
let fetchedPlans = response.data?.plans || [];
|
let fetchedPlans = response.data?.plans || [];
|
||||||
// Default sort by ID ascending
|
// Default sort by ID ascending
|
||||||
fetchedPlans.sort((a, b) => a.id - b.id);
|
fetchedPlans.sort((a, b) => a.id - b.id);
|
||||||
@@ -411,6 +417,7 @@ export default {
|
|||||||
.plan-list {
|
.plan-list {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
|
|||||||
Reference in New Issue
Block a user