feat: 优化FAQ导入结果卡片UI与功能
This commit is contained in:
@@ -58,49 +58,58 @@
|
|||||||
<div v-if="importResult && importResult.display_status === 'open' && !importState.taskId" class="faq-import-result-card">
|
<div v-if="importResult && importResult.display_status === 'open' && !importState.taskId" class="faq-import-result-card">
|
||||||
<div class="import-result-content">
|
<div class="import-result-content">
|
||||||
<div class="import-result-header">
|
<div class="import-result-header">
|
||||||
<t-icon name="check-circle" size="18px" class="result-icon" />
|
<div class="header-left">
|
||||||
<span class="result-title">最近导入结果</span>
|
<t-icon name="check-circle-filled" size="20px" class="result-icon" />
|
||||||
<span class="result-time">{{ formatImportTime(importResult.imported_at) }}</span>
|
<span class="result-title">最近导入结果</span>
|
||||||
</div>
|
|
||||||
<div class="import-result-stats">
|
|
||||||
<div class="stat-item">
|
|
||||||
<span class="stat-label">导入数据</span>
|
|
||||||
<span class="stat-value">{{ importResult.total_entries }}条</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-item success">
|
<div class="header-right">
|
||||||
<span class="stat-label">成功</span>
|
<span class="result-time">{{ formatImportTime(importResult.imported_at) }}</span>
|
||||||
<span class="stat-value">{{ importResult.success_count }}条</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="importResult.failed_count > 0" class="stat-item failed">
|
|
||||||
<span class="stat-label">失败</span>
|
|
||||||
<span class="stat-value">{{ importResult.failed_count }}条</span>
|
|
||||||
<t-button
|
<t-button
|
||||||
v-if="importResult.failed_entries_url"
|
|
||||||
variant="text"
|
variant="text"
|
||||||
theme="primary"
|
theme="default"
|
||||||
size="small"
|
size="small"
|
||||||
class="download-failed-btn"
|
class="result-close-btn"
|
||||||
@click="downloadFailedEntries"
|
@click="closeImportResult"
|
||||||
>
|
>
|
||||||
下载原因
|
<t-icon name="close" size="16px" />
|
||||||
</t-button>
|
</t-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="importResult.skipped_count > 0" class="stat-item skipped">
|
|
||||||
<span class="stat-label">跳过</span>
|
|
||||||
<span class="stat-value">{{ importResult.skipped_count }}条</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="import-result-footer">
|
<div class="import-result-body">
|
||||||
<span class="import-mode">{{ importResult.import_mode === 'append' ? '追加模式' : '替换模式' }}</span>
|
<div class="import-result-stats">
|
||||||
<t-button
|
<div class="stat-item">
|
||||||
variant="text"
|
<span class="stat-label">导入数据</span>
|
||||||
theme="default"
|
<span class="stat-value">{{ importResult.total_entries }}条</span>
|
||||||
size="small"
|
</div>
|
||||||
class="result-close-btn"
|
<div class="stat-item success">
|
||||||
@click="closeImportResult"
|
<span class="stat-label">成功</span>
|
||||||
>
|
<span class="stat-value">{{ importResult.success_count }}条</span>
|
||||||
<t-icon name="close" size="14px" />
|
</div>
|
||||||
</t-button>
|
<div v-if="importResult.failed_count > 0" class="stat-item failed">
|
||||||
|
<span class="stat-label">失败</span>
|
||||||
|
<span class="stat-value">{{ importResult.failed_count }}条</span>
|
||||||
|
<t-button
|
||||||
|
v-if="importResult.failed_entries_url"
|
||||||
|
variant="outline"
|
||||||
|
theme="danger"
|
||||||
|
size="small"
|
||||||
|
class="download-failed-btn"
|
||||||
|
@click="downloadFailedEntries"
|
||||||
|
>
|
||||||
|
<t-icon name="download" size="14px" />
|
||||||
|
下载原因
|
||||||
|
</t-button>
|
||||||
|
</div>
|
||||||
|
<div v-if="importResult.skipped_count > 0" class="stat-item skipped">
|
||||||
|
<span class="stat-label">跳过</span>
|
||||||
|
<span class="stat-value">{{ importResult.skipped_count }}条</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="import-mode-tag">
|
||||||
|
<t-tag size="small" variant="light" theme="success">
|
||||||
|
{{ importResult.import_mode === 'append' ? '追加模式' : '替换模式' }}
|
||||||
|
</t-tag>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2522,6 +2531,16 @@ const closeImportResult = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下载失败条目原因
|
||||||
|
const downloadFailedEntries = () => {
|
||||||
|
if (!importResult.value?.failed_entries_url) {
|
||||||
|
MessagePlugin.warning('暂无失败记录可下载')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 直接打开下载链接
|
||||||
|
window.open(importResult.value.failed_entries_url, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
// 格式化导入时间
|
// 格式化导入时间
|
||||||
const formatImportTime = (timeStr?: string) => {
|
const formatImportTime = (timeStr?: string) => {
|
||||||
if (!timeStr) return ''
|
if (!timeStr) return ''
|
||||||
@@ -3692,11 +3711,11 @@ watch(() => entries.value.map(e => ({
|
|||||||
// 导入结果统计卡片样式
|
// 导入结果统计卡片样式
|
||||||
.faq-import-result-card {
|
.faq-import-result-card {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
background: linear-gradient(135deg, #f8fffe 0%, #f5fff9 100%);
|
background: #ffffff;
|
||||||
border: 1px solid #d4f0e0;
|
border: 1px solid #e7ebf0;
|
||||||
border-radius: 10px;
|
border-radius: 8px;
|
||||||
padding: 14px 18px;
|
padding: 16px 20px;
|
||||||
box-shadow: 0 2px 12px rgba(0, 168, 112, 0.08);
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
|
||||||
|
|
||||||
.import-result-content {
|
.import-result-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -3707,36 +3726,70 @@ watch(() => entries.value.map(e => ({
|
|||||||
.import-result-header {
|
.import-result-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
justify-content: space-between;
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
.result-icon {
|
.header-left {
|
||||||
color: #00a870;
|
display: flex;
|
||||||
flex-shrink: 0;
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.result-icon {
|
||||||
|
color: #07C05F;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-title {
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #1d2129;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.result-title {
|
.header-right {
|
||||||
font-weight: 600;
|
display: flex;
|
||||||
color: #1d2129;
|
align-items: center;
|
||||||
}
|
gap: 12px;
|
||||||
|
|
||||||
.result-time {
|
.result-time {
|
||||||
color: #86909c;
|
font-family: "PingFang SC";
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
margin-left: auto;
|
color: #86909c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-close-btn {
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #86909c;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f2f3f5;
|
||||||
|
color: #4e5969;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.import-result-body {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.import-result-stats {
|
.import-result-stats {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 16px;
|
gap: 24px;
|
||||||
padding: 8px 0;
|
|
||||||
|
|
||||||
.stat-item {
|
.stat-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
|
font-family: "PingFang SC";
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|
||||||
.stat-label {
|
.stat-label {
|
||||||
@@ -3744,60 +3797,41 @@ watch(() => entries.value.map(e => ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
.stat-value {
|
.stat-value {
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
color: #1d2129;
|
color: #1d2129;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.success .stat-value {
|
&.success .stat-value {
|
||||||
color: #00a870;
|
color: #07C05F;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failed .stat-value {
|
&.failed .stat-value {
|
||||||
color: #fa5151;
|
color: #E34D59;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.skipped .stat-value {
|
&.skipped .stat-value {
|
||||||
color: #ff7d00;
|
color: #ED7B2F;
|
||||||
}
|
}
|
||||||
|
|
||||||
.download-failed-btn {
|
.download-failed-btn {
|
||||||
padding: 0 4px;
|
margin-left: 4px;
|
||||||
height: auto;
|
padding: 0 8px;
|
||||||
|
height: 24px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #165dff;
|
border-radius: 4px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
&:hover {
|
.t-icon {
|
||||||
color: #4080ff;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.import-result-footer {
|
.import-mode-tag {
|
||||||
display: flex;
|
flex-shrink: 0;
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding-top: 8px;
|
|
||||||
border-top: 1px solid #e5e8eb;
|
|
||||||
|
|
||||||
.import-mode {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #86909c;
|
|
||||||
background: rgba(0, 168, 112, 0.1);
|
|
||||||
padding: 2px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-close-btn {
|
|
||||||
padding: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #86909c;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: rgba(0, 0, 0, 0.06);
|
|
||||||
color: #4e5969;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user