完善保险端

This commit is contained in:
xuqiuyun
2025-10-11 08:59:57 +08:00
parent 9b8d177e34
commit 434fa135d1
8 changed files with 461 additions and 161 deletions

View File

@@ -87,8 +87,12 @@ const handleResponse = async (response) => {
try {
const contentType = response.headers.get('content-type')
// 处理Excel文件下载
if (contentType && contentType.includes('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')) {
// 处理文件下载Excel、CSV等
if (contentType && (
contentType.includes('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') ||
contentType.includes('text/csv') ||
contentType.includes('application/octet-stream')
)) {
data = await response.blob()
} else if (contentType && contentType.includes('application/json')) {
data = await response.json()

View File

@@ -643,10 +643,11 @@ const exportData = async () => {
const url = window.URL.createObjectURL(response.data)
const link = document.createElement('a')
link.href = url
link.setAttribute('download', `申请数据_${new Date().toISOString().slice(0, 10)}.xlsx`)
link.setAttribute('download', `保险申请数据_${new Date().toISOString().slice(0, 10)}.xlsx`)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url) // 释放内存
message.success('导出成功')
} catch (error) {
console.error('导出失败:', error)

View File

@@ -126,9 +126,9 @@
row-key="id"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<a-tag :color="getStatusColor(record.status)">
{{ getStatusText(record.status) }}
<template v-if="column.key === 'taskStatus'">
<a-tag :color="getStatusColor(record.taskStatus)">
{{ getStatusText(record.taskStatus) }}
</a-tag>
</template>
<template v-else-if="column.key === 'priority'">
@@ -136,9 +136,6 @@
{{ getPriorityText(record.priority) }}
</a-tag>
</template>
<template v-else-if="column.key === 'duration'">
{{ record.duration }}
</template>
<template v-else-if="column.key === 'action'">
<a-space>
<a-button type="link" size="small" @click="handleView(record)">
@@ -182,11 +179,29 @@
>
<div v-if="selectedTask" class="task-detail">
<a-descriptions :column="2" bordered>
<a-descriptions-item label="任务名称">
{{ selectedTask.taskName }}
<a-descriptions-item label="申请单号">
{{ selectedTask.applicationNumber || '-' }}
</a-descriptions-item>
<a-descriptions-item label="任务编号">
{{ selectedTask.taskCode }}
<a-descriptions-item label="保单编号">
{{ selectedTask.policyNumber || '-' }}
</a-descriptions-item>
<a-descriptions-item label="产品名称">
{{ selectedTask.productName || '-' }}
</a-descriptions-item>
<a-descriptions-item label="保险期间">
{{ selectedTask.insurancePeriod || '-' }}
</a-descriptions-item>
<a-descriptions-item label="客户姓名">
{{ selectedTask.customerName || '-' }}
</a-descriptions-item>
<a-descriptions-item label="证件类型">
{{ selectedTask.idType || '-' }}
</a-descriptions-item>
<a-descriptions-item label="证件号码">
{{ selectedTask.idNumber || '-' }}
</a-descriptions-item>
<a-descriptions-item label="监管生资数量">
{{ selectedTask.supervisorySuppliesQuantity || '-' }}
</a-descriptions-item>
<a-descriptions-item label="优先级">
<a-tag :color="getPriorityColor(selectedTask.priority)">
@@ -194,27 +209,30 @@
</a-tag>
</a-descriptions-item>
<a-descriptions-item label="状态">
<a-tag :color="getStatusColor(selectedTask.status)">
{{ getStatusText(selectedTask.status) }}
<a-tag :color="getStatusColor(selectedTask.taskStatus)">
{{ getStatusText(selectedTask.taskStatus) }}
</a-tag>
</a-descriptions-item>
<a-descriptions-item label="负责人">
{{ selectedTask.assignedUser?.real_name || '-' }}
</a-descriptions-item>
<a-descriptions-item label="创建人">
{{ selectedTask.creator?.real_name || '-' }}
</a-descriptions-item>
<a-descriptions-item label="创建时间">
{{ selectedTask.createdAt }}
{{ selectedTask.createdAt || '-' }}
</a-descriptions-item>
<a-descriptions-item label="更新时间">
{{ selectedTask.updatedAt || '-' }}
</a-descriptions-item>
<a-descriptions-item label="完成时间">
{{ selectedTask.completedAt }}
</a-descriptions-item>
<a-descriptions-item label="负责人">
{{ selectedTask.assignee }}
{{ selectedTask.completedAt || '-' }}
</a-descriptions-item>
<a-descriptions-item label="处理时长">
{{ selectedTask.duration }}
{{ calculateDuration(selectedTask) }}
</a-descriptions-item>
<a-descriptions-item label="任务描述" :span="2">
{{ selectedTask.description }}
</a-descriptions-item>
<a-descriptions-item label="完成备注" :span="2">
{{ selectedTask.completionNotes }}
<a-descriptions-item label="备注" :span="2">
{{ selectedTask.notes || '-' }}
</a-descriptions-item>
</a-descriptions>
</div>
@@ -274,14 +292,14 @@ const pagination = reactive({
const columns = [
{
title: '任务编号',
dataIndex: 'taskCode',
key: 'taskCode',
dataIndex: 'applicationNumber',
key: 'applicationNumber',
width: 120
},
{
title: '任务名称',
dataIndex: 'taskName',
key: 'taskName',
dataIndex: 'productName',
key: 'productName',
ellipsis: true
},
{
@@ -292,27 +310,34 @@ const columns = [
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
dataIndex: 'taskStatus',
key: 'taskStatus',
width: 100
},
{
title: '负责人',
dataIndex: 'assignee',
key: 'assignee',
width: 120
width: 120,
customRender: ({ record }) => record.assignedUser?.real_name || '-'
},
{
title: '完成时间',
dataIndex: 'completedAt',
key: 'completedAt',
width: 150
width: 150,
customRender: ({ text }) => text || '-'
},
{
title: '处理时长',
dataIndex: 'duration',
key: 'duration',
width: 100
width: 100,
customRender: ({ record }) => {
if (!record.completedAt || !record.createdAt) return '-'
const created = new Date(record.createdAt)
const completed = new Date(record.completedAt)
const days = Math.ceil((completed - created) / (1000 * 60 * 60 * 24))
return `${days}`
}
},
{
title: '操作',
@@ -325,17 +350,31 @@ const columns = [
// 获取状态颜色
const getStatusColor = (status) => {
const colorMap = {
completed: 'green',
archived: 'purple'
'待处理': 'orange',
'处理中': 'blue',
'已完成': 'green',
'已取消': 'red',
'已归档': 'purple',
// 英文兼容
'completed': 'green',
'archived': 'purple'
}
return colorMap[status] || 'default'
}
// 获取状态文本
const getStatusText = (status) => {
// 如果已经是中文,直接返回
if (['待处理', '处理中', '已完成', '已取消', '已归档'].includes(status)) {
return status
}
// 英文转中文
const textMap = {
completed: '已完成',
archived: '已归档'
'pending': '待处理',
'processing': '处理中',
'completed': '已完成',
'rejected': '已取消',
'archived': '已归档'
}
return textMap[status] || status
}
@@ -343,23 +382,48 @@ const getStatusText = (status) => {
// 获取优先级颜色
const getPriorityColor = (priority) => {
const colorMap = {
high: 'red',
medium: 'orange',
low: 'blue'
'低': 'blue',
'中': 'green',
'高': 'orange',
'紧急': 'red',
// 英文兼容
'low': 'blue',
'medium': 'green',
'high': 'orange',
'urgent': 'red'
}
return colorMap[priority] || 'default'
}
// 获取优先级文本
const getPriorityText = (priority) => {
// 如果已经是中文,直接返回
if (['低', '中', '高', '紧急'].includes(priority)) {
return priority
}
// 英文转中文
const textMap = {
high: '',
medium: '中',
low: ''
'low': '',
'medium': '中',
'high': '',
'urgent': '紧急'
}
return textMap[priority] || priority
}
// 计算处理时长
const calculateDuration = (task) => {
if (!task.completedAt || !task.createdAt) return '-'
try {
const created = new Date(task.createdAt)
const completed = new Date(task.completedAt)
const days = Math.ceil((completed - created) / (1000 * 60 * 60 * 24))
return `${days}`
} catch (error) {
return '-'
}
}
// 搜索处理
const handleSearch = () => {
pagination.current = 1
@@ -520,12 +584,20 @@ const fetchTaskList = async () => {
const fetchStats = async () => {
try {
const response = await supervisionTaskApi.getStats()
console.log('统计数据响应:', response)
if (response.data && response.data.status === 'success') {
const statsData = response.data.data
stats.total = statsData.total || 0
stats.thisMonth = statsData.thisMonth || 0
stats.archived = statsData.archived || 0
stats.avgDuration = statsData.avgDuration || 0
// 从statusStats中获取已完成任务数
const statusStats = statsData.statusStats || []
const completedStat = statusStats.find(s => s.status === '已完成')
stats.total = completedStat ? completedStat.count : 0
// 这些数据暂时从总数获取后续可以从API补充
stats.thisMonth = 0
stats.archived = 0
stats.avgDuration = 0
}
} catch (error) {
console.error('获取统计数据失败:', error)