From f94b96403234f5927e74f72fc0cbc65d7b426019 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期三, 10 十二月 2025 14:52:50 +0800
Subject: [PATCH] 修改
---
src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/index.vue | 71 +++++++++++++++++++++++++++++++++--
1 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/index.vue b/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/index.vue
index 7ef0d60..d0bcf21 100644
--- a/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/index.vue
+++ b/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/range/index.vue
@@ -2,7 +2,7 @@
<div class="app-container">
<div style="margin-bottom: 10px">
<el-form style="display: flex;flex-wrap: wrap;">
- <el-form-item label="企业名称:" v-if="data.isAdmin" style="margin-left: 20px">
+ <el-form-item label="单位名称:" v-if="data.isAdmin" style="margin-left: 20px">
<el-select
v-model="data.queryParams.companyName"
filterable
@@ -42,7 +42,17 @@
node-key="id"
:current-node-key="currentSelectedKey"
@node-click="handleNodeClick"
- ></el-tree>
+ >
+ <template #default="{ node,data }">
+ <el-tooltip
+ :content="data.mess"
+ placement="bottom"
+ :disabled="!isTextOverflow(data)"
+ >
+ <span class="tree-text">{{ data.mess }}</span>
+ </el-tooltip>
+ </template>
+ </el-tree>
</div>
<el-empty v-else description="暂无数据" />
</div>
@@ -236,10 +246,33 @@
}
loading.value = false;
}
+const textMeasureRef = ref(null);
+const getMeasureElement = () => {
+ if (!textMeasureRef.value) {
+ const el = document.createElement('span');
+ el.className = 'text-measure-element';
+ el.style.cssText = `
+ position: absolute;
+ visibility: hidden;
+ white-space: nowrap;
+ font-size: 14px; /* 匹配实际字体大小 */
+ `;
+ document.body.appendChild(el);
+ textMeasureRef.value = el;
+ }
+ return textMeasureRef.value;
+};
+// 判断文本是否溢出
+const isTextOverflow = (text) => {
+ const measureEl = getMeasureElement();
+ measureEl.textContent = text.mess;
+ return measureEl.scrollWidth > 300; // 180px 是节点容器实际宽度
+};
+
const handleTree = (val) => {
const traverse = (nodes, currentPath = '') => {
nodes.forEach((node, index) => {
- node.name = `${node.number} ${node.mess}`;
+ node.mess= `${node.number} ${node.mess}`;
// 递归处理子节点(传递当前序号路径)
if (node.children && node.children.length) {
traverse(node.children, node.number);
@@ -266,7 +299,7 @@
}else {
loadingCompany.value = true;
const queryParams = {
- pageSize: 10,
+ pageSize: 100,
pageNum: 1,
}
const res = await getCompany(queryParams)
@@ -486,6 +519,15 @@
}
}
const openFile = async(path)=>{
+ const ext = path.split('.').pop().toLowerCase();
+ if (ext === 'doc') {
+ ElMessageBox.confirm('暂不支持线上预览.doc、.xls、.xlsx文件,是否下载查看?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+ window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank');
+ }).catch(() => {
+ console.log('取消预览')
+ });
+ return
+ }
try {
// 1. 获取文件
const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
@@ -588,10 +630,31 @@
:deep(.el-tree){
background: none;
}
+ :deep(.el-tooltip )
+ {
+ color: black;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ word-break: break-all;
+ white-space: nowrap;
+ }
+ .tree-text {
+ display: inline-block;
+ max-width: 300px; /* 根据实际容器宽度调整 */
+ white-space: nowrap; /* 强制不换行 */
+ overflow: hidden; /* 隐藏溢出 */
+ text-overflow: ellipsis; /* 显示省略号 */
+ }
+ /* 可选:移除el-tree默认的节点内边距 */
+ .el-tree-node__content {
+ padding-right: 5px;
+ }
+
.tree-container {
max-width: 600px;
margin-top: 20px;
height: 100%;
+ max-height: 1200px;
box-shadow: 8px 0 15px rgba(0,21,41,0.08);
overflow: auto; /* 确保出现滚动条 */
}
--
Gitblit v1.9.2