Skip to content

Commit

Permalink
feat: add delete task api
Browse files Browse the repository at this point in the history
  • Loading branch information
DDDDanny committed Feb 2, 2021
1 parent 85b9291 commit a9afcea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/api/modules/task.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ export default ({ request }) => ({
// 获取任务信息列表
listTask (params = {}) { return request({ url: '/task/list', method: 'get', params }) },
// 新增任务信息
addTask (data = {}) { return request({ url: '/task/add', method: 'post', data }) }
addTask (data = {}) { return request({ url: '/task/add', method: 'post', data }) },
// 删除任务信息
delTask (data = {}) { return request({ url: '/task/del', method: 'post', data }) },
})
18 changes: 11 additions & 7 deletions src/views/apiTest/apiTestTask/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<el-table-column label="创建时间" width="200" prop="createTime"></el-table-column>
<el-table-column label="创建人" min-width="50" prop="creator"></el-table-column>
<el-table-column label="操作" width="250" fixed="right">
<template slot-scope="">
<template slot-scope="scope">
<el-button type="success" icon="el-icon-view" size="medium" circle></el-button>
<el-button type="primary" icon="el-icon-edit" size="medium" circle></el-button>
<el-button type="info" icon="el-icon-switch-button" size="medium" circle></el-button>
<el-button type="warning" icon="el-icon-caret-right" size="medium" circle></el-button>
<el-button type="danger" icon="el-icon-delete" size="medium" circle @click="delTestTask"></el-button>
<el-button type="danger" icon="el-icon-delete" size="medium" circle @click="delTestTask(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -129,15 +129,19 @@ export default {
this.caseTaskInfo = res.data
},
// 删除测试任务
delTestTask () {
delTestTask (taskRow) {
this.$confirm('此操作将永久删除该测试任务, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 这里写删除测试集的逻辑
// ---
// ---
}).then(async () => {
const res = await this.$api.delTask({ taskID: taskRow.taskID })
if (res.status.code !== 0) {
this.$message.error('删除测试任务失败!')
return
}
// 刷新任务列表
this.getTaskList()
this.$message.success('删除成功!')
}).catch(() => {
this.$message.info('您已取消删除~')
Expand Down

0 comments on commit a9afcea

Please sign in to comment.