更新接口和调用方
This commit is contained in:
@@ -3595,7 +3595,7 @@
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取所有计划的列表",
|
"description": "获取所有计划的列表,支持按类型过滤和分页",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -3603,6 +3603,36 @@
|
|||||||
"计划管理"
|
"计划管理"
|
||||||
],
|
],
|
||||||
"summary": "获取计划列表",
|
"summary": "获取计划列表",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "页码",
|
||||||
|
"name": "page",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "每页大小",
|
||||||
|
"name": "pageSize",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"所有任务",
|
||||||
|
"自定义任务",
|
||||||
|
"系统任务"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"x-enum-varnames": [
|
||||||
|
"PlanTypeFilterAll",
|
||||||
|
"PlanTypeFilterCustom",
|
||||||
|
"PlanTypeFilterSystem"
|
||||||
|
],
|
||||||
|
"description": "计划类型",
|
||||||
|
"name": "planType",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "业务码为200代表成功获取列表",
|
"description": "业务码为200代表成功获取列表",
|
||||||
@@ -3615,10 +3645,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"data": {
|
"data": {
|
||||||
"type": "array",
|
"$ref": "#/definitions/dto.ListPlansResponse"
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/dto.PlanResponse"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3728,7 +3755,7 @@
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "根据计划ID更新计划的详细信息。",
|
"description": "根据计划ID更新计划的详细信息。系统计划不允许修改。",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -3784,7 +3811,7 @@
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "根据计划ID删除计划。(软删除)",
|
"description": "根据计划ID删除计划。(软删除)系统计划不允许删除。",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -3818,7 +3845,7 @@
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "根据计划ID启动一个计划的执行。",
|
"description": "根据计划ID启动一个计划的执行。系统计划不允许手动启动。",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -3852,7 +3879,7 @@
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "根据计划ID停止一个正在执行的计划。",
|
"description": "根据计划ID停止一个正在执行的计划。系统计划不能被停止。",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -4149,6 +4176,7 @@
|
|||||||
2001,
|
2001,
|
||||||
4000,
|
4000,
|
||||||
4001,
|
4001,
|
||||||
|
4003,
|
||||||
4004,
|
4004,
|
||||||
4009,
|
4009,
|
||||||
5000,
|
5000,
|
||||||
@@ -4158,6 +4186,7 @@
|
|||||||
"CodeBadRequest": "请求参数错误",
|
"CodeBadRequest": "请求参数错误",
|
||||||
"CodeConflict": "资源冲突",
|
"CodeConflict": "资源冲突",
|
||||||
"CodeCreated": "创建成功",
|
"CodeCreated": "创建成功",
|
||||||
|
"CodeForbidden": "禁止访问",
|
||||||
"CodeInternalError": "服务器内部错误",
|
"CodeInternalError": "服务器内部错误",
|
||||||
"CodeNotFound": "资源未找到",
|
"CodeNotFound": "资源未找到",
|
||||||
"CodeServiceUnavailable": "服务不可用",
|
"CodeServiceUnavailable": "服务不可用",
|
||||||
@@ -4169,6 +4198,7 @@
|
|||||||
"创建成功",
|
"创建成功",
|
||||||
"请求参数错误",
|
"请求参数错误",
|
||||||
"未授权",
|
"未授权",
|
||||||
|
"禁止访问",
|
||||||
"资源未找到",
|
"资源未找到",
|
||||||
"资源冲突",
|
"资源冲突",
|
||||||
"服务器内部错误",
|
"服务器内部错误",
|
||||||
@@ -4179,6 +4209,7 @@
|
|||||||
"CodeCreated",
|
"CodeCreated",
|
||||||
"CodeBadRequest",
|
"CodeBadRequest",
|
||||||
"CodeUnauthorized",
|
"CodeUnauthorized",
|
||||||
|
"CodeForbidden",
|
||||||
"CodeNotFound",
|
"CodeNotFound",
|
||||||
"CodeConflict",
|
"CodeConflict",
|
||||||
"CodeInternalError",
|
"CodeInternalError",
|
||||||
@@ -4739,6 +4770,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.ListPlansResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"plans": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.PlanResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"total": {
|
||||||
|
"type": "integer",
|
||||||
|
"example": 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ListRawMaterialPurchaseResponse": {
|
"dto.ListRawMaterialPurchaseResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5434,6 +5480,9 @@
|
|||||||
"plan_id": {
|
"plan_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"plan_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"started_at": {
|
"started_at": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -5488,6 +5537,14 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "猪舍温度控制计划"
|
"example": "猪舍温度控制计划"
|
||||||
},
|
},
|
||||||
|
"plan_type": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/models.PlanType"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"example": "自定义任务"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
@@ -6732,6 +6789,17 @@
|
|||||||
"PlanStatusFailed"
|
"PlanStatusFailed"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"models.PlanType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"自定义任务",
|
||||||
|
"系统任务"
|
||||||
|
],
|
||||||
|
"x-enum-varnames": [
|
||||||
|
"PlanTypeCustom",
|
||||||
|
"PlanTypeSystem"
|
||||||
|
]
|
||||||
|
},
|
||||||
"models.SensorType": {
|
"models.SensorType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
@@ -6787,22 +6855,26 @@
|
|||||||
"enum": [
|
"enum": [
|
||||||
"计划分析",
|
"计划分析",
|
||||||
"等待",
|
"等待",
|
||||||
"下料"
|
"下料",
|
||||||
|
"全量采集"
|
||||||
],
|
],
|
||||||
"x-enum-comments": {
|
"x-enum-comments": {
|
||||||
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
|
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||||||
|
"TaskTypeFullCollection": "新增的全量采集任务",
|
||||||
"TaskTypeReleaseFeedWeight": "下料口释放指定重量任务",
|
"TaskTypeReleaseFeedWeight": "下料口释放指定重量任务",
|
||||||
"TaskTypeWaiting": "等待任务"
|
"TaskTypeWaiting": "等待任务"
|
||||||
},
|
},
|
||||||
"x-enum-descriptions": [
|
"x-enum-descriptions": [
|
||||||
"解析Plan的Task列表并添加到待执行队列的特殊任务",
|
"解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||||||
"等待任务",
|
"等待任务",
|
||||||
"下料口释放指定重量任务"
|
"下料口释放指定重量任务",
|
||||||
|
"新增的全量采集任务"
|
||||||
],
|
],
|
||||||
"x-enum-varnames": [
|
"x-enum-varnames": [
|
||||||
"TaskPlanAnalysis",
|
"TaskPlanAnalysis",
|
||||||
"TaskTypeWaiting",
|
"TaskTypeWaiting",
|
||||||
"TaskTypeReleaseFeedWeight"
|
"TaskTypeReleaseFeedWeight",
|
||||||
|
"TaskTypeFullCollection"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"models.ValueDescriptor": {
|
"models.ValueDescriptor": {
|
||||||
@@ -6836,6 +6908,19 @@
|
|||||||
"NotifierTypeLog"
|
"NotifierTypeLog"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"repository.PlanTypeFilter": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"所有任务",
|
||||||
|
"自定义任务",
|
||||||
|
"系统任务"
|
||||||
|
],
|
||||||
|
"x-enum-varnames": [
|
||||||
|
"PlanTypeFilterAll",
|
||||||
|
"PlanTypeFilterCustom",
|
||||||
|
"PlanTypeFilterSystem"
|
||||||
|
]
|
||||||
|
},
|
||||||
"zapcore.Level": {
|
"zapcore.Level": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int32",
|
"format": "int32",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import http from '../utils/http';
|
import http from '../utils/http';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {('计划分析'|'等待'|'下料')} TaskType
|
* @typedef {('计划分析'|'等待'|'下料'|'全量采集')} TaskType
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,6 +67,10 @@ import http from '../utils/http';
|
|||||||
* @typedef {('子计划'|'任务')} PlanContentType
|
* @typedef {('子计划'|'任务')} PlanContentType
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {('自定义任务'|'系统任务')} PlanType
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} PlanResponse
|
* @typedef {object} PlanResponse
|
||||||
* @property {number} id
|
* @property {number} id
|
||||||
@@ -78,17 +82,41 @@ import http from '../utils/http';
|
|||||||
* @property {number} execute_count
|
* @property {number} execute_count
|
||||||
* @property {PlanStatus} status
|
* @property {PlanStatus} status
|
||||||
* @property {PlanContentType} content_type
|
* @property {PlanContentType} content_type
|
||||||
|
* @property {PlanType} plan_type
|
||||||
* @property {Array<TaskResponse>} tasks
|
* @property {Array<TaskResponse>} tasks
|
||||||
* @property {Array<SubPlanResponse>} sub_plans
|
* @property {Array<SubPlanResponse>} sub_plans
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} ListPlansResponse
|
||||||
|
* @property {Array<PlanResponse>} plans
|
||||||
|
* @property {number} total
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} PlanExecutionLogDTO
|
||||||
|
* @property {string} created_at
|
||||||
|
* @property {string} ended_at
|
||||||
|
* @property {string} error
|
||||||
|
* @property {number} id
|
||||||
|
* @property {number} plan_id
|
||||||
|
* @property {string} plan_name
|
||||||
|
* @property {string} started_at
|
||||||
|
* @property {string} status
|
||||||
|
* @property {string} updated_at
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有计划的列表
|
* 获取所有计划的列表
|
||||||
* @returns {Promise<Array<PlanResponse>>}
|
* @param {object} params - 查询参数
|
||||||
|
* @param {number} [params.page] - 页码
|
||||||
|
* @param {number} [params.pageSize] - 每页大小
|
||||||
|
* @param {('所有任务'|'自定义任务'|'系统任务')} [params.planType] - 计划类型
|
||||||
|
* @returns {Promise<ListPlansResponse>}
|
||||||
*/
|
*/
|
||||||
const getPlans = () => {
|
const getPlans = (params) => {
|
||||||
return http.get('/api/v1/plans');
|
return http.get('/api/v1/plans', { params });
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,7 +138,7 @@ const getPlanById = (id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据计划ID更新计划的详细信息
|
* 根据计划ID更新计划的详细信息。系统计划不允许修改。
|
||||||
* @param {number} id - 计划ID
|
* @param {number} id - 计划ID
|
||||||
* @param {UpdatePlanRequest} planData - 更新后的计划信息
|
* @param {UpdatePlanRequest} planData - 更新后的计划信息
|
||||||
* @returns {Promise<PlanResponse>}
|
* @returns {Promise<PlanResponse>}
|
||||||
@@ -120,7 +148,7 @@ const updatePlan = (id, planData) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据计划ID删除计划(软删除)
|
* 根据计划ID删除计划。(软删除)系统计划不允许删除。
|
||||||
* @param {number} id - 计划ID
|
* @param {number} id - 计划ID
|
||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
*/
|
*/
|
||||||
@@ -129,7 +157,7 @@ const deletePlan = (id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据计划ID启动一个计划的执行
|
* 根据计划ID启动一个计划的执行。系统计划不允许手动启动。
|
||||||
* @param {number} id - 计划ID
|
* @param {number} id - 计划ID
|
||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
*/
|
*/
|
||||||
@@ -138,7 +166,7 @@ const startPlan = (id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据计划ID停止一个正在执行的计划
|
* 根据计划ID停止一个正在执行的计划。系统计划不能被停止。
|
||||||
* @param {number} id - 计划ID
|
* @param {number} id - 计划ID
|
||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
<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">保存</el-button>
|
<el-button class="button" type="primary" @click="savePlanContent" v-if="isEditingContent" :disabled="plan.plan_type === '系统任务'">保存</el-button>
|
||||||
<el-button class="button" type="danger" @click="cancelEdit" v-if="isEditingContent">取消</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>编辑内容</el-button>
|
<el-button class="button" @click="enterEditMode" v-else :disabled="plan.plan_type === '系统任务'">编辑内容</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Dynamic Add Buttons -->
|
<!-- Dynamic Add Buttons -->
|
||||||
@@ -32,12 +32,14 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="showAddSubPlanDialog"
|
@click="showAddSubPlanDialog"
|
||||||
|
: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 === '系统任务'"
|
||||||
>增加子任务</el-button>
|
>增加子任务</el-button>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,8 +63,8 @@
|
|||||||
延时: {{ 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)">编辑</el-button>
|
<el-button type="primary" size="small" @click="editTask(task)" :disabled="plan.plan_type === '系统任务'">编辑</el-button>
|
||||||
<el-button type="danger" size="small" @click="deleteTask(task)">删除</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>
|
||||||
@@ -80,7 +82,7 @@
|
|||||||
<!-- 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)">删除</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>
|
||||||
@@ -135,16 +137,16 @@
|
|||||||
>
|
>
|
||||||
<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">
|
<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="请输入任务名称"></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="请输入任务描述"></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'">
|
||||||
@@ -153,6 +155,7 @@
|
|||||||
@update:parameters="val => currentTaskForm.parameters = val"
|
@update:parameters="val => currentTaskForm.parameters = val"
|
||||||
prop-path="parameters.delay_duration"
|
prop-path="parameters.delay_duration"
|
||||||
:is-editing="true"
|
:is-editing="true"
|
||||||
|
:disabled="plan.plan_type === '系统任务'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<!-- More task types can be rendered here -->
|
<!-- More task types can be rendered here -->
|
||||||
@@ -160,7 +163,7 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="taskEditorDialogVisible = false">取消</el-button>
|
<el-button @click="taskEditorDialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="confirmTaskEdit">确定</el-button>
|
<el-button type="primary" @click="confirmTaskEdit" :disabled="plan.plan_type === '系统任务'">确定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -355,7 +358,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async fetchAvailablePlans() {
|
async fetchAvailablePlans() {
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.plans.getPlans(); // 更正此处
|
const response = await apiClient.plans.getPlans({ planType: '自定义任务' });
|
||||||
this.availablePlans = response.data.plans.filter(p =>
|
this.availablePlans = response.data.plans.filter(p =>
|
||||||
p.id !== this.planId
|
p.id !== this.planId
|
||||||
);
|
);
|
||||||
@@ -483,7 +486,8 @@ 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(),
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ const planExecutionLogColumns = [
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '计划名称',
|
||||||
|
dataIndex: 'plan_name',
|
||||||
|
key: 'plan_name',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
|
|||||||
@@ -9,7 +9,15 @@
|
|||||||
<el-icon :size="20"><Refresh /></el-icon>
|
<el-icon :size="20"><Refresh /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-button type="primary" @click="addPlan">添加计划</el-button>
|
|
||||||
|
<div class="filter-and-add">
|
||||||
|
<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-select>
|
||||||
|
<el-button type="primary" @click="addPlan">添加计划</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -65,17 +73,18 @@
|
|||||||
</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)">编辑</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"
|
||||||
:type="scope.row.status === 1 ? 'warning' : 'primary'"
|
:type="scope.row.status === 1 ? 'warning' : 'primary'"
|
||||||
@click="scope.row.status === 1 ? stopPlan(scope.row) : startPlan(scope.row)"
|
@click="scope.row.status === 1 ? stopPlan(scope.row) : startPlan(scope.row)"
|
||||||
:loading="stoppingPlanId === scope.row.id || startingPlanId === scope.row.id"
|
:loading="stoppingPlanId === scope.row.id || startingPlanId === scope.row.id"
|
||||||
|
:disabled="scope.row.plan_type === '系统任务'"
|
||||||
>
|
>
|
||||||
{{ scope.row.status === 1 ? '停止' : '启动' }}
|
{{ scope.row.status === 1 ? '停止' : '启动' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" type="danger" @click="deletePlan(scope.row)">删除</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>
|
||||||
@@ -145,7 +154,8 @@ export default {
|
|||||||
},
|
},
|
||||||
selectedPlanIdForDetails: null, // 当前要查看详情的计划ID
|
selectedPlanIdForDetails: null, // 当前要查看详情的计划ID
|
||||||
startingPlanId: null,
|
startingPlanId: null,
|
||||||
stoppingPlanId: null
|
stoppingPlanId: null,
|
||||||
|
planTypeFilter: '自定义任务', // 新增:计划类型筛选,默认自定义任务
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
@@ -158,7 +168,7 @@ export default {
|
|||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.plans.getPlans(); // 更正此处
|
const response = await apiClient.plans.getPlans({ planType: this.planTypeFilter }); // 传递 planTypeFilter
|
||||||
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);
|
||||||
@@ -326,6 +336,10 @@ export default {
|
|||||||
handlePlanCancel() {
|
handlePlanCancel() {
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听 planTypeFilter 变化,重新加载计划列表
|
||||||
|
planTypeFilter: 'loadPlans'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -388,6 +402,11 @@ export default {
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filter-and-add {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.plan-list {
|
.plan-list {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -397,4 +416,4 @@ export default {
|
|||||||
gap: 15px;
|
gap: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user