This commit is contained in:
张成
2025-12-19 11:40:25 +08:00
parent f233f368ed
commit 34ebad316a
5 changed files with 276 additions and 66 deletions

View File

@@ -132,6 +132,17 @@ class PlaAccountServer {
})
}
/**
* 重试指令
* @param {Number|String} commandId - 指令ID
* @returns {Promise}
*/
retryCommand(commandId) {
return window.framework.http.post(`pla_account/retryCommand`, {
commandId
})
}
/**
* 停止账号的所有任务
* @param {Object} row - 账号数据包含id和sn_code

View File

@@ -122,7 +122,7 @@
<Col span="8">
<div class="detail-item">
<span class="label">过期时间</span>
<span class="value" :class="{'text-danger': isExpired(accountInfo)}">
<span class="value" :class="{ 'text-danger': isExpired(accountInfo) }">
{{ getExpireDate(accountInfo) }}
</span>
</div>
@@ -176,7 +176,8 @@
<span class="priority-value">{{ item.weight }}%</span>
</div>
<div class="priority-total-display">
<span>总权重<strong :class="{'weight-warning': totalWeight !== 100}">{{ totalWeight }}%</strong></span>
<span>总权重<strong :class="{ 'weight-warning': totalWeight !== 100 }">{{ totalWeight
}}%</strong></span>
</div>
</div>
<div v-else class="empty-config">暂无配置</div>
@@ -204,13 +205,15 @@
<Col span="8">
<div class="detail-item">
<span class="label">最低薪资()</span>
<span class="value">{{ deliverConfig.min_salary || deliverConfig.min_salary === 0 ? deliverConfig.min_salary : '-' }}</span>
<span class="value">{{ deliverConfig.min_salary || deliverConfig.min_salary === 0 ?
deliverConfig.min_salary : '-' }}</span>
</div>
</Col>
<Col span="8">
<div class="detail-item">
<span class="label">最高薪资()</span>
<span class="value">{{ deliverConfig.max_salary || deliverConfig.max_salary === 0 ? deliverConfig.max_salary : '-' }}</span>
<span class="value">{{ deliverConfig.max_salary || deliverConfig.max_salary === 0 ?
deliverConfig.max_salary : '-' }}</span>
</div>
</Col>
<Col span="8">
@@ -354,8 +357,8 @@
</div>
<TabPane name="tasks" label="任务列表">
<div class="tab-content">
<div class="tab-body">
<tables :columns="taskColumns" :value="tasksData" :loading="tasksLoading"
<div class="tab-body" v-if="tasksLoading">
<tables :columns="taskColumns" :value="tasksData"
:pageOption="tasksPageOption" @changePage="queryTasks">
</tables>
</div>
@@ -364,8 +367,8 @@
<TabPane name="commands" label="指令列表">
<div class="tab-content">
<div class="tab-body">
<tables :columns="commandColumns" :value="commandsData" :loading="commandsLoading"
<div class="tab-body" v-if="commandsLoading">
<tables :columns="commandColumns" :value="commandsData"
:pageOption="commandsPageOption" @changePage="queryCommands">
</tables>
</div>
@@ -524,10 +527,10 @@ export default {
return {
accountInfo: {},
activeTab: 'tasks',
// 职位类型选项
jobTypeOptions: [],
// 配置数据
priorityList: [],
deliverConfig: {
@@ -778,17 +781,35 @@ export default {
{
title: '操作',
key: 'action',
width: 120,
width: 180,
render: (h, params) => {
return h('Button', {
props: {
type: 'primary',
size: 'small'
},
on: {
click: () => this.showCommandDetail(params.row)
}
}, '详情')
const btns = []
// 详情按钮
btns.push({
title: '详情',
type: 'primary',
click: () => this.showCommandDetail(params.row)
})
// 重试按钮(只在失败状态时显示)
if (params.row.status === 'failed') {
btns.push({
title: '重试',
type: 'warning',
click: () => this.retryCommand(params.row)
})
}
return h('div', btns.map(btn =>
h('Button', {
props: {
type: btn.type,
size: 'small'
},
style: { marginRight: '5px' },
on: {
click: btn.click
}
}, btn.title)
))
}
}
]
@@ -828,7 +849,7 @@ export default {
this.accountInfo = {}
}
},
// 解析配置数据
parseConfigData(accountInfo) {
// 解析排序优先级配置
@@ -847,7 +868,7 @@ export default {
} else {
this.priorityList = []
}
// 解析自动投递配置
if (accountInfo.deliver_config) {
const deliverConfig = typeof accountInfo.deliver_config === 'string'
@@ -885,7 +906,7 @@ export default {
deliver_workdays_only: 1
}
}
// 解析自动沟通配置
if (accountInfo.chat_strategy) {
const chatStrategy = typeof accountInfo.chat_strategy === 'string'
@@ -909,7 +930,7 @@ export default {
chat_workdays_only: 1
}
}
// 解析自动活跃配置
if (accountInfo.active_actions) {
const activeActions = typeof accountInfo.active_actions === 'string'
@@ -928,7 +949,7 @@ export default {
}
}
},
// 加载职位类型
async loadJobTypes() {
try {
@@ -943,14 +964,14 @@ export default {
console.error('加载职位类型失败:', err)
}
},
// 获取职位类型名称
getJobTypeName(jobTypeId) {
if (!jobTypeId) return ''
const jobType = this.jobTypeOptions.find(item => item.value === jobTypeId)
return jobType ? jobType.label : ''
},
// 获取优先级标签
getPriorityLabel(key) {
const labelMap = {
@@ -974,8 +995,16 @@ export default {
pageOption: this.tasksPageOption
}
const res = await plaAccountServer.getTasks(this.accountId, param)
this.tasksData = res.data.rows || []
this.tasksPageOption.total = res.data.count || 0
setTimeout(() => {
this.$forceUpdate()
}, 0)
} catch (error) {
this.$Message.error('加载任务列表失败')
this.tasksData = []
@@ -997,8 +1026,13 @@ export default {
pageOption: this.commandsPageOption
}
const res = await plaAccountServer.getCommands(this.accountId, param)
this.commandsData = res.data.rows || []
this.commandsPageOption.total = res.data.count || 0
setTimeout(() => {
this.$forceUpdate()
}, 0)
} catch (error) {
this.$Message.error('加载指令列表失败')
this.commandsData = []
@@ -1020,6 +1054,27 @@ export default {
}
},
// 重试指令
async retryCommand(command) {
this.$Modal.confirm({
title: '确认重试',
content: `确定要重试指令"${command.command_name}"吗?`,
onOk: async () => {
try {
await plaAccountServer.retryCommand(command.id)
this.$Message.success('重试指令成功')
// 刷新指令列表
setTimeout(() => {
this.queryCommands(this.commandsPageOption.page)
}, 1000)
} catch (error) {
console.error('重试指令失败:', error)
this.$Message.error(error.message || '重试指令失败')
}
}
})
},
// 取消任务
async cancelTask(task) {
this.$Modal.confirm({

View File

@@ -284,6 +284,7 @@ export default {
try {
const res = await taskStatusServer.getCommands(row.id)
this.commandsModal.data = res.data || []
} catch (error) {
this.$Message.error('获取指令列表失败')