This commit is contained in:
张成
2025-12-29 15:27:55 +08:00
parent eed08a30fb
commit 517a320627
4 changed files with 40 additions and 95 deletions

View File

@@ -349,12 +349,12 @@ export default {
{ title: '密码', key: 'pwd', com: 'Password', required: true },
],
listColumns: [
{ title: 'ID', key: 'id' },
{ title: '账户名', key: 'name' },
{ title: '设备SN码', key: 'sn_code'},
{ title: '账户名', key: 'name', minWidth: 120 },
{ title: '设备SN码', key: 'sn_code', minWidth: 150 },
{
title: '平台',
key: 'platform_type',
minWidth: 100,
render: (h, params) => {
const platformMap = {
'boss': { text: 'Boss直聘', color: 'blue' },
@@ -364,26 +364,10 @@ export default {
return h('Tag', { props: { color: platform.color } }, platform.text)
}
},
{ title: '登录名', key: 'login_name'},
{ title: '搜索关键词', key: 'keyword' },
{ title: '用户地址', key: 'user_address' },
{
title: '经纬度',
key: 'location',
render: (h, params) => {
const lon = params.row.user_longitude;
const lat = params.row.user_latitude;
if (lon && lat) {
return h('span', `${lat}, ${lon}`)
}
return h('span', { style: { color: '#999' } }, '未设置')
}
},
{
title: '在线状态',
key: 'is_online',
minWidth: 90,
render: (h, params) => {
return h('Tag', {
props: { color: params.row.is_online ? 'success' : 'default' }
@@ -393,12 +377,7 @@ export default {
{
title: '自动投递',
key: 'auto_deliver',
com: "Radio",
options: [
{ value: 1, label: '开启' },
{ value: 0, label: '关闭' }
],
minWidth: 90,
render: (h, params) => {
return h('Tag', {
props: { color: params.row.auto_deliver ? 'success' : 'default' }
@@ -408,11 +387,7 @@ export default {
{
title: '自动沟通',
key: 'auto_chat',
"com": "Radio",
options: [
{ value: 1, label: '开启' },
{ value: 0, label: '关闭' }
],
minWidth: 90,
render: (h, params) => {
return h('Tag', {
props: { color: params.row.auto_chat ? 'success' : 'default' }
@@ -422,7 +397,7 @@ export default {
{
title: '剩余天数',
key: 'remaining_days',
minWidth: 100,
render: (h, params) => {
const remainingDays = params.row.remaining_days || 0
let color = 'success'
@@ -436,52 +411,10 @@ export default {
}, remainingDays > 0 ? `${remainingDays}` : '已过期')
}
},
{
title: '授权日期',
key: 'authorization_date',
render: (h, params) => {
if (!params.row.authorization_date) {
return h('span', { style: { color: '#999' } }, '未授权')
}
const date = new Date(params.row.authorization_date)
return h('span', this.formatDate(date))
}
},
{
title: '过期时间',
key: 'expire_date',
render: (h, params) => {
if (!params.row.authorization_date || !params.row.authorization_days) {
return h('span', { style: { color: '#999' } }, '未授权')
}
const authDate = new Date(params.row.authorization_date)
const expireDate = new Date(authDate.getTime() + params.row.authorization_days * 24 * 60 * 60 * 1000)
const remainingDays = params.row.remaining_days || 0
return h('span', {
style: { color: remainingDays <= 0 ? '#ed4014' : remainingDays <= 7 ? '#ff9900' : '#515a6e' }
}, this.formatDate(expireDate))
}
},
{
title: '自动活跃',
key: 'auto_active',
"com": "Radio",
options: [
{ value: 1, label: '开启' },
{ value: 0, label: '关闭' }
],
render: (h, params) => {
return h('Tag', {
props: { color: params.row.auto_active ? 'success' : 'default' }
}, params.row.auto_active ? '开启' : '关闭')
}
},
{
title: '启用状态',
key: 'is_enabled',
minWidth: 100,
render: (h, params) => {
return h('i-switch', {
props: {
@@ -496,7 +429,6 @@ export default {
})
}
},
{ title: '创建时间', key: 'create_time', },
{
title: '操作',
key: 'action',
@@ -640,18 +572,21 @@ export default {
}
this.query(1)
},
async handleSaveSuccess({ data }) {
async handleSaveSuccess({ data, isEdit } = {}) {
try {
// 如果是新增(来自 editModaldata 只包含必填字段,直接保存
if (data && !data.id) {
if (data && !data.id && !isEdit) {
await plaAccountServer.add(data)
this.$Message.success('保存成功!')
}
// 编辑时由 FloatPanel 组件PlaAccountEdit处理保存这里只刷新列表
this.query(this.gridOption.param.pageOption.page)
// 刷新列表,保持当前页码
this.query(this.gridOption.param.pageOption.page || 1)
} catch (error) {
console.error('保存失败:', error)
this.$Message.error('保存失败:' + (error.message || '请稍后重试'))
// 优先从 error.response.data.message 获取,然后是 error.message
const errorMsg = error.response?.data?.message || error.message || '请稍后重试'
this.$Message.error('保存失败:' + errorMsg)
}
},
// 显示账号详情