用户管理页面展示优化

This commit is contained in:
LHD_HY 2025-12-31 16:07:48 +08:00
parent f4745a253c
commit 427c04cc5d
1 changed files with 25 additions and 231 deletions

View File

@ -2,13 +2,6 @@
<div class="app-container">
<el-form size="small" :inline="true" ref="queryForm" :model="queryParams">
<el-form-item label="项目名称" prop="projectId">
<!-- <el-input
clearable
placeholder="请输入项目名称"
v-model="queryParams.proName"
@keyup.enter.native="handleQuery"
/> -->
<el-select
placeholder="请选择项目名称"
style="width: 240px"
@ -18,22 +11,6 @@
<el-option :key="item.id" :value="item.id" :label="item.name" v-for="item in projectSelectList" />
</el-select>
</el-form-item>
<!-- <el-form-item label="所属单位" prop="unit">
<el-input
clearable
placeholder="请输入所属单位"
v-model="queryParams.unit"
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="负责人" prop="chargePerson">-->
<!-- <el-input-->
<!-- clearable-->
<!-- placeholder="请输入负责人"-->
<!-- v-model="queryParams.chargePerson"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="设计人" prop="designer">
<el-input
@ -59,7 +36,6 @@
模型预览
</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getModelList"></right-toolbar> -->
</el-row>
<el-table border row-key="id" v-loading="loading" :data="modelList" default-expand-all>
@ -97,16 +73,6 @@
{{ row.modelUrl ? '查看模型' : '上传模型' }}
</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(row)"
v-if="row.level != 1"
>
修改
</el-button> -->
<el-button
size="mini"
type="text"
@ -121,14 +87,6 @@ v-if="row.level != 1"
</el-table-column>
</el-table>
<!-- <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getModelList"
/> -->
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="项目名称" prop="proName">
@ -169,7 +127,6 @@ v-show="total > 0"
@refreshParentList="getModelList"
/>
</el-dialog>
<!-- 添加或修改岗位对话框 -->
<el-dialog
width="40%"
append-to-body
@ -208,16 +165,13 @@ v-show="total > 0"
<div id="map-container-batch" class="model-map-container"></div>
</div>
<!-- 单独查看模型时只显示地图容器不显示树形 -->
<div id="map-container-single" v-else style="min-height: 76vh;"></div>
<!-- <dxf-viewer :entities="dxfPreviewUrl"></dxf-viewer> -->
<div id="map-container-single" v-else class="single-map-container"></div>
</el-dialog>
</div>
</template>
<script>
import AddOrEditForm from './addOrEditForm.vue'
// import UseOrReturnForm from './useOrReturnForm.vue'
import UseOrReturnForm from './useOrReturnFormNew.vue'
import UseRecordTable from './useRecordTable.vue'
import DxfViewer from './DxfViewer.vue'
@ -294,11 +248,6 @@ export default {
level: 1,
count: 2,
children: [
// {
// label: '1',
// id: 1,
// level: 2,
// },
],
},
{
@ -356,28 +305,12 @@ export default {
},
//
handleViewModel(row) {
/* const modelUrl = row.modelUrl
if (!modelUrl || !modelUrl.endsWith('.dxf')) {
this.$modal.msgWarning('模型地址无效或不是DXF文件')
return
} */
/* 新需求 重新做 上面建议不要删除 有需要直接可以查看 */
// openView({ id: row.id })
// .then((response) => {
// this.dxfPreviewUrl = response.data
// this.viewDialogVisible = true
// })
// .catch((error) => {
// // console.error(':', error)
// })
//
this.isBatchPreview = false
openView({ id: row.id })
.then((res) => {
this.modelPreviewInfoList = res.data
this.modelPreviewVisible = true
console.log('res', res.data)
this.initMap()
})
@ -420,7 +353,6 @@ return
},
//
// UUID nodeId
generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0
@ -429,8 +361,6 @@ return
})
},
//
// -
// -
async getModelList() {
this.loading = true
@ -439,70 +369,12 @@ return
console.log(res, '模型列表')
this.loading = false
this.modelList = this.onBuildTree(res)
// getModelListApi(this.queryParams)
// .then((response) => {
// const rawList = response.rows || []
// //
// const formatNodes = (nodes, level = 2) => {
// //
// if (!Array.isArray(nodes)) return []
// return nodes
// .filter((item) => item && item.nodeId) //
// .map((item) => ({
// ...item,
// id: item.nodeId,
// name: item.nodeName || '',
// level: level, //
// // +1
// nodes: formatNodes(item.nodes || item.children || [], level + 1),
// }))
// }
// //
// const formatted = rawList.map((project) => {
// const children = project.children || []
// //
// let levelName = ''
// let nodeCount = ''
// if (this.levelList && this.levelList.length > 0) {
// const levelConfig = this.levelList.find(
// (item) => item.configId == project.level, //
// )
// levelName = levelConfig ? levelConfig.configName : ''
// }
// return {
// ...project,
// id: project.projectId,
// name: project.proName || '',
// level: 1, // 1
// levelName: project.levelName, //
// nodes: formatNodes(children),
// rawData: project,
// nodeCount: project.nodeCount,
// }
// })
// this.modelList = formatted
// this.total = response.total
// this.loading = false
// })
// .catch((error) => {
// console.error(':', error)
// this.loading = false
// this.$message.error('')
// })
},
//
handleUploadModel(row) {
this.$nextTick(() => {
this.currentProjectId = row.id || null
this.useOrReturnFormVisible = true
// resetForm ()
// useOrReturnFormComponentRef resetForm
if (
this.$refs.useOrReturnFormComponentRef &&
typeof this.$refs.useOrReturnFormComponentRef.resetForm === 'function'
@ -527,7 +399,6 @@ return
const editForm = { deviceName: proName, id, level, nodeCount }
this.$nextTick(() => {
// addOrEditComponentRef
if (this.$refs.addOrEditComponentRef) {
this.$refs.addOrEditComponentRef.setFormData(editForm)
}
@ -543,9 +414,6 @@ return
this.form = response.data
this.open = true
this.title = '修改项目'
// form.level
// response.data.level configId
// this.form.level = response.data.level;
})
.catch((error) => {
console.error('获取项目详情失败:', error)
@ -557,15 +425,6 @@ return
this.$modal
.confirm('是否确认删除当前节点数据吗?')
.then(async () => {
// row.level
// let res
// if (row.level === 1) {
// // level 1
// res = await delProject(row.id) // 使 delProject API
// } else {
// res = await delModelApi({ id: row.id }) // 使 delModelApi
// }
const res = await delModelApi({ id })
if (res.code === 200) {
this.$modal.msgSuccess('删除成功')
@ -592,11 +451,6 @@ return
// (UseOrReturnForm)
closeUseOrReturnFormDialog() {
// @closeUseOrReturnFormDialog="useOrReturnFormVisible = false"
// resetForm
// if (this.$refs.useOrReturnFormComponentRef) {
// this.$refs.useOrReturnFormComponentRef.resetForm();
// }
this.useOrReturnFormVisible = false
},
@ -738,7 +592,6 @@ return
getAllChildNodeIds(node) {
let nodeIds = []
// ID
//
nodeIds.push(node.id)
//
if (node.children && node.children.length > 0) {
@ -751,11 +604,6 @@ return
//
handleNodeCheckChange(node, checked) {
//
// if (!node || !node.isLeaf || Number(node.nodelevel) !== Number(node.nodeCount)) {
// return
// }
// 1. ID
const allChildIds = this.getAllChildNodeIds(node);
@ -844,30 +692,20 @@ return
this.modelPreviewVisible = true
this.initMap()
//
// openViewAll({ projectId: selectedProjectId })
// .then((res) => {
// this.modelPreviewInfoList = res.data
// this.modelPreviewVisible = true
// this.initMap()
// })
// .catch((err) => {
// console.error(':', err)
// })
// this.modelPreviewVisible = true
//
// //
// this.initMap()
},
//
onCloseMapView() {
//
// DOM
if (this.map) {
this.map.clearOverlays()
this.map = null
}
//
const batchMapContainer = document.getElementById('map-container-batch')
const singleMapContainer = document.getElementById('map-container-single')
if (batchMapContainer) batchMapContainer.innerHTML = ''
if (singleMapContainer) singleMapContainer.innerHTML = ''
//
this.checkedNodeIds = []
if (this.$refs.projectTree) {
@ -893,6 +731,10 @@ return
//
const mapContainerId = this.isBatchPreview ? 'map-container-batch' : 'map-container-single'
//
const targetContainer = document.getElementById(mapContainerId)
if (targetContainer) targetContainer.innerHTML = ''
//
this.map = new BMapGL.Map(mapContainerId) //
this.map.setMapType(BMAP_EARTH_MAP) //
this.map.setDisplayOptions({
@ -955,18 +797,6 @@ return
},
)
this.map.addOverlay(line)
// const arcPoints = this.generateArcPoints(
// item.center,
// item.radius,
// item.start_point,
// item.end_point,
// )
// const arcPolyline = new BMapGL.Polyline(arcPoints, {
// strokeColor: 'red',
// strokeWeight: 2,
// strokeOpacity: 0.8,
// })
// this.map.addOverlay(arcPolyline)
} else {
//
const circle = new BMapGL.Circle(
@ -982,48 +812,12 @@ return
}
}
})
// if (pointList.points && pointList.points.length > 0) {
// //
// const pointsWithAngles = pointList.points.map((point) => {
// const [lng, lat, , , angle] = point //
// return {
// point: new BMapGL.Point(lng, lat),
// angle: angle || 40, //
// }
// })
// console.log(pointsWithAngles, 'pointsWithAngles')
// // 线
// const getColorByIndex = (colorIndex) => {
// const colors = ['red', 'yellow', 'green', 'cyan', 'blue', 'magenta', 'white', 'gray']
// return colors[colorIndex] || 'red'
// }
// // 0-7
// const colorIndex = Math.floor(Math.random() * 7)
// // 线
// const curvedLinePoints = this.createCurvedLine(pointsWithAngles)
// // 线
// const polyline = new BMapGL.Polyline(curvedLinePoints, {
// strokeColor: getColorByIndex(colorIndex),
// strokeWeight: 2,
// strokeOpacity: 0.8,
// strokeStyle: 'solid',
// })
// this.map.addOverlay(polyline)
// }
} else if (item.entityType === 'LINE') {
const geometry = JSON.parse(item.geometry)
const start = geometry.start
const end = geometry.end
//
const polyline = new BMapGL.Polyline(
[new BMapGL.Point(start[0], start[1]), new BMapGL.Point(end[0], end[1])],
{ strokeColor: 'red', strokeWeight: 2, strokeOpacity: 0.8 },
@ -1035,7 +829,6 @@ return
const radius = geometry.radius
//
if (center.length > 0) {
const circle = new BMapGL.Circle(new BMapGL.Point(center[0], center[1]), radius, {
strokeColor: 'blue',
@ -1135,13 +928,6 @@ return
//
const viewport = this.map.getViewport(points)
// n
const zoomOffset = 2 // 1-3
// const adjustedZoom = Math.min(
// viewport.zoom + zoomOffset,
// this.map.getMaxZoom(), //
// )
const adjustedZoom = Math.min(
16, // 18
this.map.getMaxZoom(),
@ -1248,19 +1034,15 @@ return
}
//
// π180
if (Math.abs(angleDiff) > Math.PI) {
angleDiff = angleDiff > 0 ? angleDiff - 2 * Math.PI : angleDiff + 2 * Math.PI
}
//
//
// 11111111*cos(lat)
const latRad = (centerPoint.lat * Math.PI) / 180
const metersPerDegreeLat = 111000 // 111
// >1<0.1
// 1
let radiusInDegrees = radius
if (radius > 1) {
//
@ -1281,7 +1063,6 @@ return
const angle = startAngle + angleDiff * t
//
// 使
const deltaLng = (radiusInDegrees * Math.cos(angle)) / Math.cos(latRad)
const deltaLat = radiusInDegrees * Math.sin(angle)
const x = centerPoint.lng + deltaLng
@ -1323,8 +1104,11 @@ return
background-color: #f0f7ff;
}
#map-container-single {
/* 单独地图容器样式 */
.single-map-container {
min-height: 76vh;
position: relative;
z-index: 1;
}
/* 模型预览弹窗样式(仅批量预览时生效) */
@ -1332,6 +1116,8 @@ return
display: flex;
height: 76vh;
gap: 10px;
position: relative; /* 建立层级上下文 */
z-index: 1;
}
.model-tree-container {
@ -1341,17 +1127,25 @@ return
border-radius: 4px;
overflow-y: auto;
padding: 10px;
background-color: #ffffff; /* 强制设置白色背景 */
position: relative; /* 建立层级上下文 */
z-index: 10; /* 高于地图容器,防止被覆盖 */
flex-shrink: 0; /* 防止树形容器被挤压变形 */
}
.model-map-container {
flex: 1;
height: 100%;
border-radius: 4px;
position: relative; /* 建立层级上下文 */
z-index: 1; /* 低于树形容器 */
}
/* 树形组件样式优化 */
::v-deep .model-tree {
--el-tree-node-content-hover-bg-color: #f5f7fa;
position: relative;
z-index: 11; /* 确保树形内容高于容器 */
}
::v-deep .model-tree .el-tree-node__checkbox {