新增前端vue

This commit is contained in:
2025-12-12 13:21:43 +08:00
parent 2089f6eddb
commit 05a3fd25ac

View File

@@ -0,0 +1,508 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<BasicModal
v-bind="$attrs"
title="流程明细"
:showFooter="true"
:showOkBtn="false"
@register="registerModal"
width="70%"
class="calendar-flow-modal"
destroyOnClose
>
<!-- 主容器 -->
<div class="flow-container">
<!-- 表格滚动容器 -->
<div class="table-scroll-container">
<!-- 表格包装器 -->
<div class="table-wrapper">
<table class="flow-table">
<!-- 表头 -->
<thead class="table-header">
<tr>
<th class="col-time">记录时间</th>
<th class="col-user">操作人</th>
<th class="col-type">操作类型</th>
<th class="col-status">操作状态</th>
<th class="col-content">明细内容</th>
</tr>
</thead>
<tbody class="table-body">
<!-- 空数据处理 -->
<tr v-if="listData.length === 0" class="empty-row">
<td colspan="5" class="empty-text">暂无流程记录</td>
</tr>
<tr v-else v-for="(item, index) in listData" :key="index" class="table-row">
<td class="col-time">
<div class="cell-content">{{ item.createTime }}</div>
</td>
<td class="col-user">
<div class="cell-content">{{ item.operationUser }}</div>
</td>
<td class="col-type">
<div class="cell-content">{{ item.operationType }}</div>
</td>
<td class="col-status">
<div class="cell-content">{{ item.statusName }}</div>
</td>
<td class="col-content">
<div
class="cell-content content-tooltip"
@mouseenter="showFullContent(item.flowContent, $event)"
@mouseleave="hideFullContent"
>
{{ item.flowContent }}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 自定义悬浮提示框 - 保留原始格式 -->
<div
v-if="showTooltip"
class="custom-tooltip"
:style="{
top: `${tooltipTop}px`,
left: `${tooltipLeft}px`,
zIndex: 9999
}"
>
<!-- 使用pre标签保留原始格式 -->
<pre class="tooltip-content">{{ fullContent }}</pre>
<div class="tooltip-arrow"></div>
</div>
</BasicModal>
</template>
<script lang="ts" setup name="ViewsBizCalendarFlowList">
import { ref } from 'vue';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { BizCalendarFlow, bizCalendarFlowListAll } from '@jeesite/biz/api/biz/calendarFlow';
const listData = ref<BizCalendarFlow[]>([]);
// 悬浮提示相关状态
const showTooltip = ref(false);
const fullContent = ref('');
const tooltipTop = ref(0);
const tooltipLeft = ref(0);
// 显示全部内容 - 保留原始格式
const showFullContent = (content: string, event: MouseEvent) => {
// 内容为空或无截断时不显示提示
if (!content) return;
const target = event.target as HTMLElement;
// 判断内容是否被截断(容器宽度 < 内容宽度)
if (target.scrollWidth <= target.clientWidth) return;
// 直接赋值原始内容,不做任何格式化处理
fullContent.value = content;
// 定位提示框(鼠标位置偏移,避免遮挡鼠标)
tooltipTop.value = event.clientY + 10;
tooltipLeft.value = event.clientX + 10;
showTooltip.value = true;
};
// 隐藏提示框
const hideFullContent = () => {
showTooltip.value = false;
fullContent.value = '';
};
const [registerModal, { closeModal }] = useModalInner(async (data) => {
try {
if (!data) return;
const params = { ...data };
// 清空旧数据
listData.value = [];
// 获取新数据
const res = await bizCalendarFlowListAll(params);
listData.value = res || [];
} catch (error) {
console.error('Calendar flow load error:', error);
}
});
</script>
<style scoped>
/* 重置基础样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* 模态框整体样式 - 修复深度选择器警告 */
.calendar-flow-modal :deep(.ant-modal) {
top: 20px;
}
.calendar-flow-modal :deep(.ant-modal-content) {
border-radius: 12px;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
border: none;
}
.calendar-flow-modal :deep(.ant-modal-header) {
border-bottom: 1px solid #e8f4f8;
padding: 20px 24px;
border-radius: 12px 12px 0 0;
text-align: center; /* 标题容器居中 */
}
.calendar-flow-modal :deep(.ant-modal-title) {
font-size: 18px;
font-weight: 600;
color: #1f2937;
line-height: 1.5;
display: inline-block; /* 标题文字居中 */
width: 100%;
}
.calendar-flow-modal :deep(.ant-modal-body) {
padding: 0;
background-color: #f9fafb;
border-radius: 0 0 12px 12px;
}
.calendar-flow-modal :deep(.ant-modal-footer) {
padding: 16px 24px;
border-top: 1px solid #e8f4f8;
background-color: #ffffff;
border-radius: 0 0 12px 12px;
text-align: center; /* 底部按钮区域居中 */
}
/* 主容器样式 */
.flow-container {
background-color: #e8f4f8;
padding: 24px;
border-radius: 10px;
min-height: 60vh;
width: 100%;
text-align: center; /* 容器内容居中 */
}
/* 表格滚动容器 - 核心优化 */
.table-scroll-container {
width: 100%;
height: 60vh;
background: #ffffff;
border-radius: 8px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
overflow: hidden;
position: relative;
margin: 0 auto; /* 容器水平居中 */
}
/* 表格包装器 */
.table-wrapper {
width: 100%;
height: 100%;
overflow-y: auto;
/* 滚动条偏移,避免遮挡最后一列 */
padding-right: 6px;
}
/* 自定义滚动条 */
.table-wrapper::-webkit-scrollbar {
width: 6px;
position: absolute;
right: 0;
}
.table-wrapper::-webkit-scrollbar-track {
background: #f8f9fa;
border-radius: 3px;
margin: 8px 0;
}
.table-wrapper::-webkit-scrollbar-thumb {
background: #c1c7cd;
border-radius: 3px;
transition: background 0.2s;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
background: #a0a6ac;
}
/* 表格样式 - 核心修复 */
.flow-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
color: #333;
table-layout: fixed; /* 关键:固定表格布局,确保列宽生效 */
background-color: #ffffff;
margin: 0 auto; /* 表格水平居中 */
}
/* 表头样式 - 固定表头 */
.table-header {
position: sticky;
top: 0;
z-index: 100;
background-color: #f0f8fb;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}
.table-header tr {
height: 56px;
}
.table-header th {
padding: 16px 12px; /* 减少内边距,确保省略号显示 */
color: #2d3748;
font-weight: 600;
text-align: center; /* 表头文字居中 */
border-bottom: 2px solid #e8f4f8;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 列宽定义 - 精确控制 */
.col-time { width: 18%; }
.col-user { width: 15%; }
.col-type { width: 18%; }
.col-status { width: 15%; }
.col-content { width: 34%; }
/* 表体样式 */
.table-body {
width: 100%;
}
/* 数据行样式 */
.table-row {
height: 52px;
transition: background-color 0.2s;
}
.table-row:hover {
background-color: #f8fafc;
}
.table-row td {
padding: 14px 12px; /* 减少内边距,确保省略号显示 */
border-bottom: 1px solid #f1f5f9;
color: #4a5568;
text-align: center; /* 表格内容居中 */
vertical-align: middle; /* 垂直居中 */
/* 关键td必须设置overflow确保子元素省略号生效 */
overflow: hidden;
}
/* 核心:单元格内容容器 - 确保省略号显示 */
.cell-content {
width: 100%;
height: 100%;
white-space: nowrap; /* 强制单行 */
overflow: hidden; /* 隐藏超出内容 */
text-overflow: ellipsis; /* 显示省略号 */
display: inline-block; /* 关键:确保宽度生效 */
line-height: 1.4; /* 行高适配 */
padding: 0 4px; /* 少量内边距,避免文字贴边 */
}
/* 首列样式强化 */
.col-time .cell-content {
color: #2d3748;
font-weight: 500;
}
/* 流程内容容器 - 悬浮提示基础样式 */
.content-tooltip {
cursor: pointer;
position: relative;
/* 禁用原生提示 */
pointer-events: auto;
}
/* 空数据样式 */
.empty-row {
height: 120px;
}
.empty-text {
padding: 40px 0;
color: #718096;
font-size: 14px;
text-align: center; /* 空数据提示居中 */
font-weight: 400;
}
/* 自定义悬浮提示框样式 - 适配原始格式 */
.custom-tooltip {
position: fixed;
background: #1f2937;
color: #ffffff;
padding: 12px 16px;
border-radius: 8px;
max-width: 500px; /* 加宽适配原始格式内容 */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
font-size: 14px;
line-height: 1.6;
z-index: 9999;
animation: fadeIn 0.2s ease-in-out;
/* 防止内容溢出 */
max-height: 400px;
overflow-y: auto;
}
/* 保留原始格式的内容样式 */
.tooltip-content {
font-family: "Consolas", "Monaco", "Courier New", monospace; /* 等宽字体更适合展示原始格式 */
white-space: pre-wrap; /* 保留换行和空格,自动换行 */
word-wrap: break-word;
color: #e5e7eb;
margin: 0;
padding: 0;
}
/* 提示框滚动条样式 */
.custom-tooltip::-webkit-scrollbar {
width: 4px;
}
.custom-tooltip::-webkit-scrollbar-track {
background: #2d3748;
border-radius: 2px;
}
.custom-tooltip::-webkit-scrollbar-thumb {
background: #4a5568;
border-radius: 2px;
}
/* 提示框箭头 */
.tooltip-arrow {
position: absolute;
bottom: 100%;
left: 10px;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #1f2937;
}
/* 淡入动画 */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(5px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 响应式适配 */
@media (max-width: 1200px) {
.calendar-flow-modal {
width: 80% !important;
}
.custom-tooltip {
max-width: 400px;
}
}
@media (max-width: 768px) {
.calendar-flow-modal {
width: 95% !important;
}
.flow-container {
padding: 16px;
min-height: 70vh;
}
.table-scroll-container {
height: 70vh;
}
.flow-table {
font-size: 13px;
}
.table-header th, .table-row td {
padding: 12px 8px;
}
.table-header tr {
height: 50px;
}
.table-row {
height: 48px;
}
.custom-tooltip {
max-width: 300px;
font-size: 13px;
max-height: 300px;
}
}
/* 适配暗黑模式(可选) */
@media (prefers-color-scheme: dark) {
.flow-container {
background-color: #1e293b;
}
.table-scroll-container {
background-color: #273449;
}
.table-header {
background-color: #2d3b55;
}
.table-row:hover {
background-color: #334155;
}
.table-header th {
color: #e2e8f0;
border-bottom-color: #334155;
}
.table-row td {
color: #cbd5e1;
border-bottom-color: #334155;
}
.col-time .cell-content {
color: #f1f5f9;
}
.empty-text {
color: #94a3b8;
}
.custom-tooltip {
background: #334155;
}
.tooltip-arrow {
border-bottom-color: #334155;
}
.tooltip-content {
color: #f1f5f9;
}
}
</style>