Commit ec521995 authored by huangzhenglong's avatar huangzhenglong

feat: 增加loading效果防止重复提交

parent 1e2e1de6
...@@ -79,8 +79,8 @@ ...@@ -79,8 +79,8 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
:type="getStatusType(scope.row.status)" :type="getStatusType(scope.row.status)"
:class="{'clickable-tag': scope.row.status === 4}" :class="{'clickable-tag': scope.row.status === 3 || scope.row.status === 4}"
@click="scope.row.status === 4 && showErrorMessage(scope.row)"> @click="(scope.row.status === 3 || scope.row.status === 4) && showErrorMessage(scope.row)">
{{ getStatusText(scope.row.status) }} {{ getStatusText(scope.row.status) }}
</el-tag> </el-tag>
</template> </template>
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
icon="el-icon-video-play" icon="el-icon-video-play"
circle circle
title="开始" title="开始"
:loading="startLoading"
@click="handleStart(scope.row)"></el-button> @click="handleStart(scope.row)"></el-button>
<el-button <el-button
v-else v-else
...@@ -564,6 +565,7 @@ export default { ...@@ -564,6 +565,7 @@ export default {
const start = end.clone().subtract(7, 'day') const start = end.clone().subtract(7, 'day')
return { return {
loading: false, loading: false,
startLoading: false, // 新增:任务启动loading状态
condition: { condition: {
templateId: null, templateId: null,
status: null, status: null,
...@@ -862,6 +864,10 @@ export default { ...@@ -862,6 +864,10 @@ export default {
}, },
async handleStart(row) { async handleStart(row) {
if (this.startLoading) {
return;
}
this.startLoading = true;
try { try {
const response = await axios.post(process.env.PUTIN_API + `/campaign-tasks/start?campaignTaskId=${row.id}`) const response = await axios.post(process.env.PUTIN_API + `/campaign-tasks/start?campaignTaskId=${row.id}`)
if (response.status == 200) { if (response.status == 200) {
...@@ -876,6 +882,8 @@ export default { ...@@ -876,6 +882,8 @@ export default {
const errorMessage = error.response && error.response.data && error.response.data.message ? const errorMessage = error.response && error.response.data && error.response.data.message ?
error.response.data.message : error.message error.response.data.message : error.message
this.$message.error('任务开始失败:' + errorMessage) this.$message.error('任务开始失败:' + errorMessage)
} finally {
this.startLoading = false;
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment