refactor: delete task

master
xiaojunnuo 2021-02-05 18:20:33 +08:00
parent 560519894c
commit b9d5d33aaa
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,5 @@
<template>
<a-drawer
title="编辑任务"
placement="right"
:closable="true"
width="600px"
@ -8,6 +7,12 @@
:after-visible-change="taskDrawerOnAfterVisibleChange"
>
<template #title>
编辑任务
<a-button @click="taskDelete()">
<template #icon><DeleteOutlined /></template>
</a-button>
</template>
<template v-if="currentTask">
<d-container v-if="currentTask._isAdd" class="task-edit-form">
<a-row :gutter="10">
@ -169,6 +174,13 @@ function useTaskForm (context) {
taskDrawerClose()
}
const taskDelete = () => {
if (currentTaskIndex.value != null) {
currentDeploy.value.tasks.splice(currentTaskIndex.value)
}
taskDrawerClose()
}
return {
taskTypeSelected,
taskTypeSave,
@ -183,6 +195,7 @@ function useTaskForm (context) {
currentTaskIndex,
currentPlugin,
taskSave,
taskDelete,
rules
}
}

View File

@ -126,7 +126,7 @@
</template>
<template #extra>
<a-button type="danger">
<a-button type="danger" @click="deployDelete(deploy,index)">
<template #icon><DeleteOutlined /></template>
</a-button>
</template>
@ -203,8 +203,13 @@ function useDeploy (options) {
const deployOpenEditMode = (deploy) => {
deploy._isEdit = true
}
const deployDelete = (deploy, index) => {
options.deploy.splice(index, 1)
}
return {
deployAdd, deployCloseEditMode, deployOpenEditMode
deployAdd, deployCloseEditMode, deployOpenEditMode, deployDelete
}
}