1
This commit is contained in:
@@ -190,8 +190,8 @@
|
||||
<div class="detail-item">
|
||||
<span class="label">自动投递:</span>
|
||||
<span class="value">
|
||||
<Tag :color="deliverConfig.auto_deliver ? 'success' : 'default'">
|
||||
{{ deliverConfig.auto_deliver ? '开启' : '关闭' }}
|
||||
<Tag :color="deliverConfig.auto_deliver ? 'success' : 'default'">
|
||||
{{ deliverConfig.auto_deliver ? '开启' : '关闭' }}
|
||||
</Tag>
|
||||
</span>
|
||||
</div>
|
||||
@@ -360,15 +360,9 @@
|
||||
<div class="tab-body">
|
||||
<Table :columns="taskColumns" :data="tasksData" :loading="tasksLoading" border>
|
||||
</Table>
|
||||
<Page
|
||||
:current="tasksPageOption.page"
|
||||
:total="tasksPageOption.total"
|
||||
:page-size="tasksPageOption.pageSize"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
@on-change="queryTasks"
|
||||
@on-page-size-change="handleTasksPageSizeChange"
|
||||
<Page :current="tasksPageOption.page" :total="tasksPageOption.total"
|
||||
:page-size="tasksPageOption.pageSize" show-total show-elevator show-sizer
|
||||
@on-change="queryTasks" @on-page-size-change="handleTasksPageSizeChange"
|
||||
style="margin-top: 16px; text-align: right;">
|
||||
</Page>
|
||||
</div>
|
||||
@@ -380,15 +374,9 @@
|
||||
<div class="tab-body">
|
||||
<Table :columns="commandColumns" :data="commandsData" :loading="commandsLoading" border>
|
||||
</Table>
|
||||
<Page
|
||||
:current="commandsPageOption.page"
|
||||
:total="commandsPageOption.total"
|
||||
:page-size="commandsPageOption.pageSize"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
@on-change="queryCommands"
|
||||
@on-page-size-change="handleCommandsPageSizeChange"
|
||||
<Page :current="commandsPageOption.page" :total="commandsPageOption.total"
|
||||
:page-size="commandsPageOption.pageSize" show-total show-elevator show-sizer
|
||||
@on-change="queryCommands" @on-page-size-change="handleCommandsPageSizeChange"
|
||||
style="margin-top: 16px; text-align: right;">
|
||||
</Page>
|
||||
</div>
|
||||
@@ -497,6 +485,10 @@
|
||||
</div>
|
||||
<div slot="footer">
|
||||
<Button @click="closeCommandDetail">关闭</Button>
|
||||
<Button v-if="currentCommandDetail && currentCommandDetail.status === 'failed'" type="primary"
|
||||
:loading="retryCommandLoading" @click="retryCommand(currentCommandDetail)">
|
||||
重试
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -708,13 +700,13 @@ export default {
|
||||
width: 150,
|
||||
render: (h, params) => {
|
||||
const btns = []
|
||||
if (params.row.status === 'failed') {
|
||||
btns.push({
|
||||
title: '重试',
|
||||
type: 'primary',
|
||||
click: () => this.retryTask(params.row)
|
||||
})
|
||||
}
|
||||
|
||||
btns.push({
|
||||
title: '重试',
|
||||
type: 'primary',
|
||||
click: () => this.retryTask(params.row)
|
||||
})
|
||||
|
||||
if (params.row.status === 'pending' || params.row.status === 'running') {
|
||||
btns.push({
|
||||
title: '取消',
|
||||
@@ -748,6 +740,7 @@ export default {
|
||||
},
|
||||
// 指令详情弹窗
|
||||
commandDetailVisible: false,
|
||||
retryCommandLoading: false,
|
||||
currentCommandDetail: null,
|
||||
|
||||
// 二维码弹窗
|
||||
@@ -825,13 +818,13 @@ export default {
|
||||
click: () => this.showCommandDetail(params.row)
|
||||
})
|
||||
// 重试按钮(只在失败状态时显示)
|
||||
if (params.row.status === 'failed') {
|
||||
btns.push({
|
||||
title: '重试',
|
||||
type: 'warning',
|
||||
click: () => this.retryCommand(params.row)
|
||||
})
|
||||
}
|
||||
|
||||
btns.push({
|
||||
title: '重试',
|
||||
type: 'warning',
|
||||
click: () => this.retryCommand(params.row)
|
||||
})
|
||||
|
||||
return h('div', btns.map(btn =>
|
||||
h('Button', {
|
||||
props: {
|
||||
@@ -1031,7 +1024,7 @@ export default {
|
||||
const res = await plaAccountServer.getTasks(this.accountId, param)
|
||||
|
||||
console.log('res', res);
|
||||
|
||||
|
||||
this.tasksData = res.data.rows || []
|
||||
this.tasksPageOption.total = res.data.count || 0
|
||||
|
||||
@@ -1081,23 +1074,37 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 重试指令
|
||||
// 重试指令(指令列表与指令详情弹窗共用,成功后刷新列表与详情)
|
||||
async retryCommand(command) {
|
||||
this.$Modal.confirm({
|
||||
title: '确认重试',
|
||||
content: `确定要重试指令"${command.command_name}"吗?`,
|
||||
onOk: async () => {
|
||||
try {
|
||||
await plaAccountServer.retryCommand(command.id)
|
||||
this.$Message.success('重试指令成功')
|
||||
// 刷新指令列表
|
||||
|
||||
} catch (error) {
|
||||
console.error('重试指令失败:', error)
|
||||
this.$Message.error(error.message || '重试指令失败')
|
||||
const isFromDetail = this.commandDetailVisible && this.currentCommandDetail && this.currentCommandDetail.id === command.id
|
||||
if (!isFromDetail) {
|
||||
this.$Modal.confirm({
|
||||
title: '确认重试',
|
||||
content: `确定要重试指令"${command.command_name}"吗?`,
|
||||
onOk: async () => {
|
||||
await this.doRetryCommand(command)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
await this.doRetryCommand(command)
|
||||
},
|
||||
async doRetryCommand(command) {
|
||||
this.retryCommandLoading = true
|
||||
try {
|
||||
await plaAccountServer.retryCommand(command.id)
|
||||
this.$Message.success('重试指令成功')
|
||||
this.queryCommands(this.commandsPageOption.page)
|
||||
if (this.commandDetailVisible && this.currentCommandDetail && this.currentCommandDetail.id === command.id) {
|
||||
const res = await plaAccountServer.getCommandDetail(this.accountId, command.id)
|
||||
this.currentCommandDetail = res.data || {}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('重试指令失败:', error)
|
||||
this.$Message.error(error.message || '重试指令失败')
|
||||
} finally {
|
||||
this.retryCommandLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
// 取消任务
|
||||
|
||||
Reference in New Issue
Block a user