1
This commit is contained in:
@@ -49,6 +49,56 @@
|
||||
<!-- 编辑组件(使用 FloatPanel,包含所有字段) -->
|
||||
<PlaAccountEdit ref="accountEdit" @on-save="handleSaveSuccess" />
|
||||
|
||||
<!-- 授权设置弹窗 -->
|
||||
<Modal
|
||||
v-model="authorizationModal.visible"
|
||||
title="设置授权"
|
||||
:mask-closable="false"
|
||||
width="600"
|
||||
@on-ok="handleSaveAuthorization"
|
||||
@on-cancel="handleCancelAuthorization"
|
||||
>
|
||||
<Form ref="authorizationForm" :model="authorizationModal.formData" :label-width="120">
|
||||
<FormItem label="账号名称">
|
||||
<Input v-model="authorizationModal.formData.accountName" disabled />
|
||||
</FormItem>
|
||||
<FormItem label="设备SN码">
|
||||
<Input v-model="authorizationModal.formData.sn_code" disabled />
|
||||
</FormItem>
|
||||
<FormItem label="授权日期">
|
||||
<DatePicker
|
||||
v-model="authorizationModal.formData.authorization_date"
|
||||
type="date"
|
||||
placeholder="请选择授权日期(不选择则使用当前时间)"
|
||||
style="width: 100%;"
|
||||
format="yyyy-MM-dd"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="授权天数">
|
||||
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
||||
<InputNumber
|
||||
v-model="authorizationModal.formData.authorization_days"
|
||||
:min="0"
|
||||
placeholder="请输入授权天数"
|
||||
style="width: 200px;"
|
||||
/>
|
||||
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
||||
<Button size="small" @click="setQuickAuthorizationDays(7)">7天</Button>
|
||||
<Button size="small" @click="setQuickAuthorizationDays(30)">30天</Button>
|
||||
<Button size="small" @click="setQuickAuthorizationDays(90)">90天</Button>
|
||||
<Button size="small" @click="setQuickAuthorizationDays(180)">180天</Button>
|
||||
<Button size="small" @click="setQuickAuthorizationDays(365)">365天</Button>
|
||||
</div>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem label="过期时间" v-if="authorizationModal.formData.authorization_date && authorizationModal.formData.authorization_days">
|
||||
<span :style="{ color: getExpireDateColor(authorizationModal.formData) }">
|
||||
{{ getExpireDate(authorizationModal.formData) }}
|
||||
</span>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
<!-- 简历详情弹窗 -->
|
||||
<Modal v-model="resumeModal.visible" :title="resumeModal.title" width="900" :footer-hide="true">
|
||||
<div v-if="resumeModal.loading" style="text-align: center; padding: 40px;">
|
||||
@@ -253,6 +303,16 @@ export default {
|
||||
title: '在线简历详情',
|
||||
data: null
|
||||
},
|
||||
authorizationModal: {
|
||||
visible: false,
|
||||
formData: {
|
||||
id: null,
|
||||
accountName: '',
|
||||
sn_code: '',
|
||||
authorization_date: null,
|
||||
authorization_days: 0
|
||||
}
|
||||
},
|
||||
gridOption: {
|
||||
param: {
|
||||
seachOption: {
|
||||
@@ -356,6 +416,51 @@ export default {
|
||||
}, params.row.auto_chat ? '开启' : '关闭')
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '剩余天数',
|
||||
key: 'remaining_days',
|
||||
minWidth: 100,
|
||||
render: (h, params) => {
|
||||
const remainingDays = params.row.remaining_days || 0
|
||||
let color = 'success'
|
||||
if (remainingDays <= 0) {
|
||||
color = 'error'
|
||||
} else if (remainingDays <= 7) {
|
||||
color = 'warning'
|
||||
}
|
||||
return h('Tag', {
|
||||
props: { color: color }
|
||||
}, remainingDays > 0 ? `${remainingDays} 天` : '已过期')
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '授权日期',
|
||||
key: 'authorization_date',
|
||||
minWidth: 150,
|
||||
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',
|
||||
minWidth: 150,
|
||||
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',
|
||||
@@ -418,6 +523,13 @@ export default {
|
||||
this.showEditWarp(params.row)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '设置授权',
|
||||
type: 'warning',
|
||||
click: () => {
|
||||
this.showAuthorizationModal(params.row)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '解析位置',
|
||||
type: 'success',
|
||||
@@ -597,6 +709,108 @@ export default {
|
||||
return []
|
||||
}
|
||||
},
|
||||
// 格式化日期
|
||||
formatDate(date) {
|
||||
if (!date) return '-'
|
||||
const d = new Date(date)
|
||||
const year = d.getFullYear()
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
},
|
||||
// 显示授权设置弹窗
|
||||
showAuthorizationModal(row) {
|
||||
this.authorizationModal.formData = {
|
||||
id: row.id,
|
||||
accountName: row.name,
|
||||
sn_code: row.sn_code,
|
||||
// 如果有授权日期则使用,否则默认使用当天
|
||||
authorization_date: row.authorization_date ? new Date(row.authorization_date) : new Date(),
|
||||
authorization_days: row.authorization_days || 0
|
||||
}
|
||||
this.authorizationModal.visible = true
|
||||
},
|
||||
// 设置快捷授权天数
|
||||
setQuickAuthorizationDays(days) {
|
||||
this.authorizationModal.formData.authorization_days = days
|
||||
// 如果没有设置授权日期,自动设置为当前日期
|
||||
if (!this.authorizationModal.formData.authorization_date) {
|
||||
this.authorizationModal.formData.authorization_date = new Date()
|
||||
}
|
||||
},
|
||||
// 保存授权信息
|
||||
async handleSaveAuthorization() {
|
||||
if (!this.authorizationModal.formData.id) {
|
||||
this.$Message.error('账号ID不能为空')
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.authorizationModal.formData.authorization_days || this.authorizationModal.formData.authorization_days <= 0) {
|
||||
this.$Message.error('请输入授权天数')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const param = {
|
||||
id: this.authorizationModal.formData.id,
|
||||
authorization_days: this.authorizationModal.formData.authorization_days
|
||||
}
|
||||
|
||||
// 如果设置了授权日期,添加到参数中
|
||||
if (this.authorizationModal.formData.authorization_date) {
|
||||
param.authorization_date = this.authorizationModal.formData.authorization_date
|
||||
}
|
||||
|
||||
await plaAccountServer.updateAuthorization(param)
|
||||
this.$Message.success('授权设置成功!')
|
||||
this.authorizationModal.visible = false
|
||||
// 刷新列表
|
||||
this.query(this.gridOption.param.pageOption.page || 1)
|
||||
} catch (error) {
|
||||
console.error('设置授权失败:', error)
|
||||
this.$Message.error('设置授权失败:' + (error.message || '请稍后重试'))
|
||||
}
|
||||
},
|
||||
// 取消授权设置
|
||||
handleCancelAuthorization() {
|
||||
this.authorizationModal.visible = false
|
||||
this.authorizationModal.formData = {
|
||||
id: null,
|
||||
accountName: '',
|
||||
sn_code: '',
|
||||
authorization_date: null,
|
||||
authorization_days: 0
|
||||
}
|
||||
},
|
||||
// 获取过期时间
|
||||
getExpireDate(formData) {
|
||||
if (!formData.authorization_date || !formData.authorization_days) {
|
||||
return '未授权'
|
||||
}
|
||||
const authDate = new Date(formData.authorization_date)
|
||||
const expireDate = new Date(authDate.getTime() + formData.authorization_days * 24 * 60 * 60 * 1000)
|
||||
const year = expireDate.getFullYear()
|
||||
const month = String(expireDate.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(expireDate.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
},
|
||||
// 获取过期时间颜色
|
||||
getExpireDateColor(formData) {
|
||||
if (!formData.authorization_date || !formData.authorization_days) {
|
||||
return '#999'
|
||||
}
|
||||
const authDate = new Date(formData.authorization_date)
|
||||
const expireDate = new Date(authDate.getTime() + formData.authorization_days * 24 * 60 * 60 * 1000)
|
||||
const now = new Date()
|
||||
const remaining = Math.ceil((expireDate.getTime() - now.getTime()) / (24 * 60 * 60 * 1000))
|
||||
if (remaining <= 0) {
|
||||
return '#ed4014'
|
||||
} else if (remaining <= 7) {
|
||||
return '#ff9900'
|
||||
} else {
|
||||
return '#515a6e'
|
||||
}
|
||||
},
|
||||
// 解析工作经历
|
||||
parseWorkExp(workExp) {
|
||||
if (!workExp) return []
|
||||
|
||||
Reference in New Issue
Block a user