} 返回海拔高度(米)
+ */
+async function getElevationByLngLat(lng, lat) {
+ // 方案1: 优先使用第三方 API(最可靠,不依赖地形服务)
+ let elevation = await getElevationByAPI(lng, lat)
+ if (elevation > 0) {
+ return elevation
+ }
+
+ // 方案2: 尝试使用 mars3d 工具方法
+ elevation = await getElevationByMars3dUtil(lng, lat)
+ if (elevation > 0) {
+ return elevation
+ }
+
+ // 方案3: 尝试使用地形采样
+ elevation = await getElevationByTerrain(lng, lat)
+ if (elevation > 0) {
+ return elevation
+ }
+
+ // 方案4: 尝试使用 pickPosition
+ elevation = await getElevationByPickPosition(lng, lat)
+ if (elevation > 0) {
+ return elevation
+ }
+
+ // 所有方法都失败,返回0
+ console.warn(`所有方法都无法获取坐标(${lng}, ${lat})的海拔高度,返回默认值0`)
+ return 0
+}
+
+const mapConfig = {
+ scene: {
+ center: {
+ lat: 31.686288,
+ lng: 117.229619,
+ // alt: 11333.9,
+ // heading: 359.2,
+ // pitch: -39.5,
+ alt: 12000, // 高度≈缩放级别
+ heading: 30, // 旋转30度
+ pitch: -45, // 俯视角45度
+ },
+
+ highDynamicRange: false, // 关闭HDR(可减少模糊)
+
+ scene3DOnly: false,
+ shadows: false,
+ removeDblClick: true,
+ sceneMode: 3,
+ showSun: true,
+ showMoon: true,
+ showSkyBox: true,
+ showSkyAtmosphere: true,
+ fog: true,
+ fxaa: false,
+ requestRenderMode: false,
+ globe: {
+ depthTestAgainstTerrain: false,
+ baseColor: '#546a53',
+ showGroundAtmosphere: true,
+ enableLighting: false,
+ },
+ cameraController: {
+ zoomFactor: 3.0,
+ minimumZoomDistance: 1,
+ maximumZoomDistance: 50000000,
+ enableRotate: true,
+ enableTranslate: true,
+ enableTilt: true,
+ enableZoom: true,
+ enableCollisionDetection: true,
+ minimumCollisionTerrainHeight: 15000,
+ },
+ },
+ control: {
+ homeButton: true,
+ baseLayerPicker: true,
+ sceneModePicker: true,
+ vrButton: false,
+ fullscreenButton: true,
+ navigationHelpButton: true,
+ animation: false,
+ timeline: false,
+ infoBox: false,
+ geocoder: false,
+ selectionIndicator: false,
+ contextmenu: { hasDefault: false },
+ mouseDownView: true,
+ zoom: { insertIndex: 1 },
+ compass: { bottom: 'toolbar', left: '5px' },
+ distanceLegend: { left: '10px', bottom: '2px' },
+ locationBar: {
+ fps: true,
+ crs: 'CGCS2000_GK_Zone_3',
+ crsDecimal: 0,
+ template:
+ "经度:{lng}
纬度:{lat}
横{crsx} 纵{crsy}
海拔:{alt}米
层级:{level}
方向:{heading}°
俯仰角:{pitch}°
视高:{cameraHeight}米
",
+ },
+ },
+ templateValues: {
+ dataServer: '//data.mars3d.cn',
+ gltfServerUrl: '//data.mars3d.cn/gltf',
+ },
+ terrain: {
+ url: '//data.mars3d.cn/terrain',
+ show: true,
+ },
+ basemaps: [
+ { id: 10, name: '地图底图', type: 'group' },
+ {
+ id: 2021,
+ pid: 10,
+ name: '天地图影像',
+ icon: '../../img/mars-map-img/tdt_img.png',
+ type: 'group',
+ layers: [
+ { name: '底图', type: 'tdt', layer: 'img_d' },
+ { name: '注记', type: 'tdt', layer: 'img_z' },
+ ],
+ show: true,
+ },
+ {
+ pid: 10,
+ name: '天地图电子',
+ icon: '../../img/mars-map-img/tdt_vec.png',
+ type: 'group',
+ layers: [
+ { name: '底图', type: 'tdt', layer: 'vec_d' },
+ { name: '注记', type: 'tdt', layer: 'vec_z' },
+ ],
+ },
+ {
+ pid: 10,
+ name: '高德影像',
+ type: 'group',
+ icon: '../../img/mars-map-img/gaode_img.png',
+ layers: [
+ { name: '底图', type: 'gaode', layer: 'img_d' },
+ { name: '注记', type: 'gaode', layer: 'img_z' },
+ ],
+ },
+ {
+ pid: 10,
+ name: '高德电子',
+ type: 'gaode',
+ icon: '../../img/mars-map-img/gaode_vec.png',
+ layer: 'vec',
+ },
+ {
+ pid: 10,
+ name: '百度影像',
+ type: 'group',
+ icon: '../../img/mars-map-img/bd-img.png',
+ layers: [
+ { name: '底图', type: 'baidu', layer: 'img_d' },
+ { name: '注记', type: 'baidu', layer: 'img_z' },
+ ],
+ },
+ {
+ pid: 10,
+ name: '百度电子',
+ icon: '../../img/mars-map-img/bd-vec.png',
+ type: 'baidu',
+ layer: 'vec',
+ },
+ {
+ pid: 10,
+ name: '腾讯影像',
+ icon: '../../img/mars-map-img/tencent_img.png',
+ type: 'group',
+ layers: [
+ { name: '底图', type: 'tencent', layer: 'img_d' },
+ { name: '注记', type: 'tencent', layer: 'img_z' },
+ ],
+ },
+ {
+ pid: 10,
+ name: '腾讯电子',
+ icon: '../../img/mars-map-img/tencent_vec.png',
+ type: 'tencent',
+ layer: 'vec',
+ },
+ {
+ pid: 10,
+ name: 'ArcGIS影像',
+ icon: '../../img/mars-map-img/esriWorldImagery.png',
+ type: 'xyz',
+ url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
+ enablePickFeatures: false,
+ },
+ ],
+}
+
+// 图例数据
+const legendData = [
+ {
+ name: '协调完成',
+ value: 0,
+ // icon: "../../img/digitalSignage/icon_three.png",
+ icon: '../../img/digitalSignage/icon_three_new.png',
+ },
+ {
+ name: '基础开挖',
+ value: 0,
+ // icon: "../../img/digitalSignage/icon_two.png",
+ icon: '../../img/digitalSignage/icon_two_new.png',
+ },
+ {
+ name: '基础开挖完成',
+ value: 0,
+ // icon: "../../img/digitalSignage/icon_five.png",
+ icon: '../../img/digitalSignage/icon_five_new.png',
+ },
+ {
+ name: '基础浇筑',
+ value: 0,
+ // icon: "../../img/digitalSignage/icon_seven.png",
+ icon: '../../img/digitalSignage/icon_seven_new.png',
+ },
+ {
+ name: '基础浇筑完成',
+ value: 0,
+ // icon: "../../img/digitalSignage/icon_four.png",
+ icon: '../../img/digitalSignage/icon_four_new.png',
+ },
+ {
+ name: '铁塔组立',
+ value: 0,
+ // icon: "../../img/digitalSignage/icon_six.png",
+ icon: '../../img/digitalSignage/zt_orange.png',
+ },
+ {
+ name: '铁塔组立完成',
+ value: 0,
+ icon: '../../img/digitalSignage/zt_red.png',
+ },
+ {
+ name: '架线施工',
+ value: 0,
+ icon: '../../img/digitalSignage/line_y.png',
+ },
+ // {
+ // name: "架线施工完成",
+ // value: 0,
+ // icon: "../../img/digitalSignage/zt_purple.png",
+ // },
+ {
+ name: '架线施工完成',
+ value: 0,
+ icon: '../../img/digitalSignage/line_r.png',
+ },
+ {
+ name: '附件安装完成',
+ value: 0,
+ icon: '../../img/digitalSignage/zt_green.png',
+ },
+ {
+ name: '未 开 始',
+ value: 0,
+ icon: '../../img/digitalSignage/icon_one_new.png',
+ },
+ {
+ name: '索道运输',
+ value: 0,
+ icon: '../../img/digitalSignage/sd.png',
+ },
+ // {
+ // name: "项 目 部",
+ // value: 0,
+ // icon: "../../img/digitalSignage/project.png",
+ // },
+]
+
+// 地图配置项
+const config = {
+ polyline: {
+ strokeWeight: 3, // 线条宽度
+ strokeOpacity: 0.9, // 透明度
+ strokeStyle: 'dashed', // solid(实线)或dashed(虚线)
+ enableEditing: false, // 是否可编辑
+ enableClicking: true, // 是否可点击
+ },
+}
+
+// 获取位置信息
+function getLocationInfo(id) {
+ const params = {
+ encryptedData: encryptCBC(JSON.stringify({ id })),
+ }
+ ajaxRequest(
+ dataUrl + '/backstage/digitalSignage/getTowersInfo',
+ 'POST',
+ params,
+ true,
+ function () {},
+ function (result) {
+ console.log(result, '获取位置信息---')
+ const { data } = result
+
+ crossingList = []
+ crossingListNew = []
+ crossingLineListNew = []
+ cablewayList = []
+ towerList = []
+
+ if (data.cablewaTransVos.length > 0) {
+ cablewayList = data.cablewaTransVos
+ } else {
+ cablewayList = []
+ }
+ if (data.towerInfoVos.length > 0) {
+ towerList = data.towerInfoVos
+ } else {
+ towerList = []
+ }
+ if (data.spanInfoVos.length > 0) {
+ crossingList = data.spanInfoVos
+ } else {
+ crossingList = []
+ crossingListNew = []
+ crossingLineListNew = []
+ }
+
+ if (data.highwayList.length > 0) {
+ highwayList = data.highwayList
+ } else {
+ highwayList = []
+ }
+
+ if (data.aThousandFieldsList.length > 0) {
+ aThousandFieldsList = data.aThousandFieldsList
+ } else {
+ aThousandFieldsList = []
+ }
+
+ // 处理一下交叉信息
+ if (crossingList && crossingList.length > 0) {
+ crossingList.forEach((item) => {
+ let lineList = []
+ if (item.lonAndLat && item.lonAndLat.indexOf(',') > -1) {
+ const lonAndLatList = item.lonAndLat.split(',')
+
+ lonAndLatList.forEach((lonAndLat, index) => {
+ const lonAndLatItem = lonAndLat.split('@')
+ crossingListNew.push({
+ baiduLon: lonAndLatItem[0],
+ baiduLat: lonAndLatItem[1],
+ ...item,
+ })
+
+ lineList.push({
+ baiduLon: lonAndLatItem[0],
+ baiduLat: lonAndLatItem[1],
+ ...item,
+ })
+ })
+ }
+
+ crossingLineListNew.push({ lineList })
+ })
+ }
+ initMap()
+ },
+ function (xhr) {
+ error(xhr)
+ },
+ )
+}
+
+async function initMap() {
+ const mars3d = window.mars3d // 静态资源引入时,对象都是挂载在window中
+ const Cesium = window.mars3d.Cesium
+ try {
+ if (map) {
+ // 移除所有自定义图层
+ if (graphicLayer) {
+ graphicLayerList.forEach((e) => {
+ graphicLayer.removeGraphic(e)
+ })
+
+ polylines1.forEach((e) => {
+ graphicLayer.removeGraphic(e)
+ })
+ polylines2.forEach((e) => {
+ graphicLayer.removeGraphic(e)
+ })
+ polylines3.forEach((e) => {
+ graphicLayer.removeGraphic(e)
+ })
+
+ polylines1 = []
+ polylines2 = []
+ polylines3 = []
+ }
+ const centerPoint = [intLng, intLat]
+
+ // 方式1:直接飞向目标点
+ map.flyToPoint(centerPoint, {
+ radius: 5000, // 可视范围半径(米)
+ duration: 2, // 飞行时间(秒)
+ heading: 0, // 视角方向(0-360度)
+ pitch: -45, // 俯仰角度(-90俯视,0平视,90仰视)
+ })
+ await addAllMapPoints(graphicLayer, mars3d, Cesium)
+ await addMapLine(graphicLayer, mars3d, Cesium)
+ await addMapAThousandFields(graphicLayer, mars3d, Cesium)
+ } else {
+ // 2. WebGL兼容性检查
+ if (!mars3d.Util.webglreport()) {
+ mars3d.Util.webglerror()
+ return
+ }
+
+ // 3. 初始化新地图
+ mapConfig.scene.center.lat = intLat || 31.686288
+ mapConfig.scene.center.lng = intLng || 117.229619
+ map = new mars3d.Map('map-box', mapConfig)
+
+ // 4. 创建新的图形图层
+ graphicLayer = new mars3d.layer.GraphicLayer()
+
+ const centerPoint = [intLng, intLat]
+
+ map.flyToPoint(centerPoint, {
+ radius: 5000, // 可视范围半径(米)
+ duration: 5, // 飞行时间(秒)
+ heading: 0, // 视角方向(0-360度)
+ pitch: -45, // 俯仰角度(-90俯视,0平视,90仰视)
+ })
+
+ map.addLayer(graphicLayer)
+
+ // 5. 添加内容
+ await addAllMapPoints(graphicLayer, mars3d, Cesium)
+ await addMapLine(graphicLayer, mars3d, Cesium)
+ await addMapAThousandFields(graphicLayer, mars3d, Cesium)
+ }
+ } catch (error) {
+ // 失败时也清理残留
+ if (map) {
+ map.destroy()
+ map = null
+ }
+ }
+}
+
+// 添加标点
+async function addAllMapPoints(graphicLayer, mars3d, Cesium) {
+ const iconTypeList = {
+ // 1: "../../img/digitalSignage/icon_three.png",
+ 1: '../../img/digitalSignage/icon_three_new.png',
+ // 2: "../../img/digitalSignage/icon_two.png",
+ 2: '../../img/digitalSignage/icon_two_new.png',
+ // 3: "../../img/digitalSignage/icon_five.png",
+ 3: '../../img/digitalSignage/icon_five_new.png',
+ // 4: "../../img/digitalSignage/icon_seven.png",
+ // 4: "../../img/digitalSignage/icon_purple.png",
+ 4: '../../img/digitalSignage/icon_seven_new.png',
+ // 5: "../../img/digitalSignage/icon_four.png",
+ 5: '../../img/digitalSignage/icon_four_new.png',
+ // 6: "../../img/digitalSignage/icon_six.png",
+ 6: '../../img/digitalSignage/zt_orange.png',
+ 7: '../../img/digitalSignage/zt_red.png',
+ 8: '../../img/digitalSignage/zt_red.png', // 新增的工序
+ 9: '../../img/digitalSignage/zt_red.png',
+ 10: '../../img/digitalSignage/zt_green.png',
+ // 0: "../../img/digitalSignage/icon_one.png",
+ 0: '../../img/digitalSignage/icon_one_new.png',
+ 12: '../../img/digitalSignage/sd.png',
+ 20: '../../img/digitalSignage/project.png',
+ // 21: "../../img/digitalSignage/zt_white.png",
+ 21: '../../img/digitalSignage/zt_gary.png',
+ }
+
+ // 绘制索道标点
+ if (cablewayList && cablewayList.length > 0) {
+ cablewayList.forEach((pointData, index) => {
+ if (pointData.cablewaTransPointVoList && pointData.cablewaTransPointVoList.length > 0) {
+ // const positionNew = mars3d.PointTrans.bd2wgs([
+ // pointData.cablewaTransPointVoList[0].lng,
+ // pointData.cablewaTransPointVoList[0].lat,
+ // ]);
+ const billboard = new mars3d.graphic.BillboardEntity({
+ position: [
+ pointData.cablewaTransPointVoList[0].lng,
+ pointData.cablewaTransPointVoList[0].lat,
+ 1000,
+ ],
+ style: {
+ image: iconTypeList[12],
+ width: 30,
+ height: 30,
+ scale: 1,
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
+ clampToGround: true,
+ },
+ })
+
+ // 添加点击事件
+ billboard.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+ const graphic = event.graphic
+ const infoContent = `
+
+
+ 索道运输
+
+
+ 索道位置
+ ${pointData.towerName}
+
+
+ 索道长度
+ ${pointData.cablewayLength} KM
+
+
+ 最大载重
+ ${pointData.maxHeight} kg
+
+
+ 安全距离
+ ${pointData.safetyDistance} m
+
+
+ 最大坡度
+ ${pointData.maxSlope} °
+
+
+ 索道宽度
+ ${pointData.cablewayWidth} m
+
+
`
+ // 创建自定义信息窗体
+ graphicLayer.bindPopup(infoContent, {
+ position: graphic.position,
+ })
+ })
+
+ graphicLayer.addGraphic(billboard)
+
+ graphicLayerList.push(billboard)
+ }
+ })
+ }
+
+ // 绘制项目部
+ if (intLng && intLat) {
+ // const positionNew = mars3d.PointTrans.bd2wgs([intLng, intLat]);
+ const billboard = new mars3d.graphic.BillboardEntity({
+ position: [intLng, intLat, 1000],
+ style: {
+ image: iconTypeList[20],
+ width: 30,
+ height: 30,
+
+ scale: 1,
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
+ clampToGround: true,
+ },
+ })
+
+ // 添加点击事件
+ billboard.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+ const graphic = event.graphic
+ const infoContent = `
+
+
+ ${projectTitle}
+
+ `
+ // 创建自定义信息窗体
+ graphicLayer.bindPopup(infoContent, {
+ position: graphic.position,
+ })
+ })
+
+ graphicLayer.addGraphic(billboard)
+ graphicLayerList.push(billboard)
+ }
+
+ // 绘制杆塔
+ if (towerList && towerList.length > 0) {
+ // showData(towerList, graphicLayer);
+
+ const towerList1 = towerList
+
+ // 异步获取所有点的海拔高度
+ // const hList = [
+ // 1719.018, 1692.086, 1603.903, 1613.565, 1766.005, 1731.971, 1740.48,
+ // 1751.94, 1762.712, 1711.249,
+ // ];
+
+ const newTowerList2D = towerList1.filter(
+ (item) =>
+ item.towerProgress != 6 &&
+ item.towerProgress != 7 &&
+ item.towerProgress != 8 &&
+ item.towerProgress != 9 &&
+ item.towerProgress != 10,
+ )
+ const newTowerList3D = towerList1.filter(
+ (item) =>
+ item.towerProgress == 6 ||
+ item.towerProgress == 7 ||
+ item.towerProgress == 8 ||
+ item.towerProgress == 9 ||
+ item.towerProgress == 10,
+ )
+ const newTowerList3DData = await Promise.all(
+ newTowerList3D.map(async (item, index) => {
+ const altitude = await getElevationByLngLat(item.baiduLon, item.baiduLat)
+
+ const heightInit = item.towerType == 1 ? 68.5 : 80
+ return {
+ alt: altitude - heightInit, // 海拔高度 根据经纬度计算
+ heading: 23.0667, // 方向
+ headingStr: '23°4′', // 方向字符串
+ height: heightInit, // 杆塔高度
+ lat: item.baiduLat, // 纬度
+ lon: item.baiduLon, // 经度
+ ...item,
+ type: item.towerType,
+ }
+ }),
+ )
+
+ // 过滤出需要绘制3D塔的数据
+
+ showData(newTowerList3DData, graphicLayer)
+
+ newTowerList2D.forEach((pointData, index) => {
+ const isEven = index % 2 === 0
+ // 标点垂直方向设置
+ const billboardVerticalOrigin = Cesium.VerticalOrigin.BOTTOM // 标点固定底部对齐
+
+ // 标签位置设置
+ const labelVerticalOrigin = isEven
+ ? Cesium.VerticalOrigin.BOTTOM
+ : Cesium.VerticalOrigin.TOP
+ const pixelOffsetY = isEven ? 40 : -70 // 调整偏移量(根据标点大小适当调整)
+
+ const iconUrl = iconTypeList[parseInt(pointData.towerProgress)]
+
+ // const wgsPoint = mars3d.PointTrans.bd2wgs([
+ // pointData.baiduLon,
+ // pointData.baiduLat,
+ // ]);
+
+ // const wgsPoint = [
+ // dmsToDecimal(pointData.baiduLon),
+ // dmsToDecimal(pointData.baiduLat),
+ // ];
+
+ const billboard = new mars3d.graphic.BillboardEntity({
+ position: [pointData.baiduLon, pointData.baiduLat],
+ style: {
+ image: iconUrl,
+ width: 30,
+ height: 30,
+ scale: 1,
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
+ clampToGround: true,
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 必须设置
+ disableDepthTestDistance: Number.POSITIVE_INFINITY, // 防止被地形遮挡
+ },
+ // 其他属性
+ attr: {
+ id: index,
+ name: pointData.towerName,
+ },
+ })
+
+ const label2 = new mars3d.graphic.DivGraphic({
+ position: [pointData.baiduLon, pointData.baiduLat],
+ style: {
+ html: `${pointData.towerName}
`,
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
+ verticalOrigin: labelVerticalOrigin,
+ scaleByDistance: true,
+ offsetY: isEven ? -40 : 10,
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ },
+ })
+
+ graphicLayer.addGraphic(billboard)
+ graphicLayer.addGraphic(label2)
+
+ // 添加点击事件
+ billboard.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+ const graphic = event.graphic
+ let infoContent = `
+
+
${pointData.towerName}
+
+ 协调完成
+ ${pointData.time1 || '/'}
+
+
+ 基础开挖
+ ${pointData.time2 || '/'}
+
+
+ 基础开挖完成
+ ${pointData.time3 || '/'}
+
+
+ 基础浇筑
+ ${pointData.time4 || '/'}
+
+
+ 基础浇筑完成
+ ${pointData.time5 || '/'}
+
+
+ 铁塔组立
+ ${pointData.time6 || '/'}
+
+
+ 铁塔组立完成
+ ${pointData.time7 || '/'}
+
+
+ 架线施工
+ ${pointData.time8 || '/'}
+
+
+ 架线施工完成
+ ${pointData.time9 || '/'}
+
+
+ 附件安装完成
+ ${pointData.time10 || '/'}
+
+
`
+ // 创建自定义信息窗体
+ graphicLayer.bindPopup(infoContent, {
+ position: graphic.position,
+ })
+ })
+
+ graphicLayerList.push(billboard)
+ graphicLayerList.push(label2)
+ })
+ }
+
+ // 绘制交叉跨越
+ if (crossingListNew.length > 0) {
+ crossingListNew.forEach((pointData, index) => {
+ // const positionNew = mars3d.PointTrans.bd2wgs([
+ // pointData.baiduLon,
+ // pointData.baiduLat,
+ // ]);
+ const billboard = new mars3d.graphic.BillboardEntity({
+ position: [pointData.baiduLon, pointData.baiduLat, 1000],
+ style: {
+ image: iconTypeList[21],
+ width: 30,
+ height: 30,
+ scale: 1,
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
+ clampToGround: true,
+ },
+ })
+
+ // 添加点击事件
+ billboard.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+
+ console.log(event, 'pointData点击了----')
+
+ //
+ //
+ // ${pointData.towerInfoVo.towerName}
+ //
+ //
+ // 协调完成
+ // ${
+ // pointData.towerInfoVo.time1 || "/"
+ // }
+ //
+ //
+ // 基础开挖
+ //
+ // ${pointData.towerInfoVo.time2 || "/"}
+ //
+ //
+ //
+ // 基础开挖完成
+ //
+ // ${pointData.towerInfoVo.time3 || "/"}
+ //
+ //
+ //
+ // 基础浇筑
+ //
+ // ${pointData.towerInfoVo.time4 || "/"}
+ //
+ //
+ //
+ // 基础浇筑完成
+ //
+ // ${pointData.towerInfoVo.time5 || "/"}
+ //
+ //
+ //
+ // 铁塔组立
+ //
+ // ${pointData.towerInfoVo.time6 || "/"}
+ //
+ //
+ //
+ // 铁塔组立完成
+ //
+ // ${pointData.towerInfoVo.time7 || "/"}
+ //
+ //
+ //
+ // 架线施工
+ //
+ // ${pointData.towerInfoVo.time8 || "/"}
+ //
+ //
+ //
+ // 架线施工完成
+ //
+ // ${pointData.towerInfoVo.time9 || "/"}
+ //
+ //
+ //
+ // 附件安装完成
+ //
+ // ${pointData.towerInfoVo.time10 || "/"}
+ //
+ //
+ //
+ const graphic = event.graphic
+ const infoContent = `
+
+
+
+
+ 交叉跨越信息 ( ${pointData.spanTowerName} )
+
+
+ 上层线路
+ ${pointData.upperLine}
+
+
+ 下层线路
+ ${pointData.lowerLine}
+
+
+ 交叉角度
+ ${pointData.intersectionAngle} °
+
+
+ 垂直距离
+ ${pointData.verticalDistance} m
+
+
+ 安全裕度
+ ${pointData.safetyMargin} m
+
+
+
`
+ // 创建自定义信息窗体
+ graphicLayer.bindPopup(infoContent, {
+ position: graphic.position,
+ })
+ })
+
+ graphicLayer.addGraphic(billboard)
+ graphicLayerList.push(billboard)
+ })
+ }
+}
+
+// 添加标点折线(智能绘制虚实线)
+async function addMapLine(graphicLayer, mars3d, Cesium) {
+ const newTowerList1 = towerList.filter(
+ (item) =>
+ item.towerProgress != 6 &&
+ item.towerProgress != 7 &&
+ item.towerProgress != 8 &&
+ item.towerProgress != 9 &&
+ item.towerProgress != 10,
+ )
+
+ console.log(newTowerList1, 'newTowerList1----')
+ // 存储所有线段
+ const segments = []
+ // 绘制杆塔线
+ for (let i = 0; i < newTowerList1.length - 1; i++) {
+ const startPoint = newTowerList1[i]
+ const endPoint = newTowerList1[i + 1]
+
+ let lineColor = ''
+ let lineMaterial = null // 用于存储线材质
+
+ // 判断条件部分保持不变
+ if (
+ (startPoint.towerProgress == 8 && endPoint.towerProgress == 8) ||
+ startPoint.towerProgress == 8
+ ) {
+ // lineColor = "#FFFF00";
+ // lineMaterial = new Cesium.ColorMaterialProperty({
+ // // 实线
+ // color: Cesium.Color.fromCssColorString("#FFFF00"),
+ // });
+
+ // 创建线段点数组
+ const positions = [
+ [startPoint.baiduLon, startPoint.baiduLat, 500],
+ [endPoint.baiduLon, endPoint.baiduLat, 500],
+ ]
+ const polyline = new mars3d.graphic.PolylineEntity({
+ positions: positions,
+ eventParent: false,
+ style: {
+ width: 2, // 线宽(像素)
+ color: '#FFFF00', // 使用动态设置的材质
+ clampToGround: true, // 是否贴地(山区建议设为true)
+ },
+ })
+ graphicLayer.addGraphic(polyline)
+ graphicLayerList.push(polyline)
+ } else if (
+ endPoint.existSpan === 1 &&
+ startPoint.existSpan === 1 &&
+ startPoint.towerProgress != 9 &&
+ endPoint.towerProgress != 9 &&
+ startPoint.towerProgress != 8 &&
+ endPoint.towerProgress != 8 &&
+ startPoint.towerProgress != 10 &&
+ endPoint.towerProgress != 10
+ ) {
+ // lineColor = "#d81e06";
+ // lineMaterial = new Cesium.PolylineDashMaterialProperty({
+ // // 虚线
+ // color: Cesium.Color.fromCssColorString(lineColor),
+ // dashLength: 16.0, // 可调整虚线长度
+ // });
+ // // 创建线段点数组
+ // const positions = [
+ // [startPoint.baiduLon, startPoint.baiduLat, 500],
+ // [endPoint.baiduLon, endPoint.baiduLat, 500],
+ // ];
+ // const polyline = new mars3d.graphic.PolylineEntity({
+ // positions: positions,
+ // eventParent: false,
+ // style: {
+ // width: 2, // 线宽(像素)
+ // material: lineMaterial, // 使用动态设置的材质
+ // clampToGround: true, // 是否贴地(山区建议设为true)
+ // },
+ // });
+ // graphicLayer.addGraphic(polyline);
+ // graphicLayerList.push(polyline);
+ } else if (
+ (startPoint.towerProgress === 9 && endPoint.towerProgress === 9) ||
+ (startPoint.towerProgress === 10 && endPoint.towerProgress === 10) ||
+ startPoint.towerProgress === 9
+ ) {
+ // lineColor = "#d81e06";
+ // lineMaterial = new Cesium.ColorMaterialProperty({
+ // // 实线
+ // color: Cesium.Color.fromCssColorString(lineColor),
+ // });
+
+ // 创建线段点数组
+ const positions = [
+ [startPoint.baiduLon, startPoint.baiduLat],
+ [endPoint.baiduLon, endPoint.baiduLat],
+ ]
+ const polyline = new mars3d.graphic.PolylineEntity({
+ positions: positions,
+ eventParent: false,
+ style: {
+ width: 2, // 线宽(像素)
+ color: '#d81e06', // 使用动态设置的材质
+ clampToGround: true, // 是否贴地(山区建议设为true)
+ },
+ })
+ graphicLayer.addGraphic(polyline)
+ graphicLayerList.push(polyline)
+ } else {
+ lineColor = '#fff'
+ lineMaterial = new Cesium.PolylineDashMaterialProperty({
+ // 虚线
+ // color: Cesium.Color.fromCssColorString(lineColor),
+ color: Cesium.Color.TRANSPARENT,
+ dashLength: 16.0, // 可调整虚线长度
+ })
+ }
+ }
+
+ // 绘制交叉线路
+ if (crossingLineListNew.length > 0) {
+ for (let i = 0; i < crossingLineListNew.length; i++) {
+ for (let j = 0; j < crossingLineListNew[i].lineList.length - 1; j++) {
+ const startPoint = crossingLineListNew[i].lineList[j]
+ const endPoint = crossingLineListNew[i].lineList[j + 1]
+
+ // 创建线段点数组
+ const positions = [
+ [startPoint.baiduLon, startPoint.baiduLat],
+ [endPoint.baiduLon, endPoint.baiduLat],
+ ]
+
+ // const positions2 = positions.map((item) => {
+ // return mars3d.PointTrans.bd2wgs(item);
+ // });
+
+ const polyline = new mars3d.graphic.PolylineEntity({
+ positions: positions,
+ eventParent: false,
+ style: {
+ width: 2, // 线宽(像素)
+ color: '#800080', // 线颜色
+ clampToGround: true, // 是否贴地(山区建议设为true)
+ },
+ })
+ graphicLayer.addGraphic(polyline)
+ graphicLayerList.push(polyline)
+ }
+ }
+ }
+
+ // 绘制索道线
+ if (cablewayList.length > 0) {
+ cablewayList.forEach((pointData) => {
+ if (pointData.cablewaTransPointVoList && pointData.cablewaTransPointVoList.length > 0) {
+ for (let j = 0; j < pointData.cablewaTransPointVoList.length - 1; j++) {
+ const startPoint = pointData.cablewaTransPointVoList[j]
+ const endPoint = pointData.cablewaTransPointVoList[j + 1]
+
+ // 创建线段点数组
+ const positions = [
+ [startPoint.lng, startPoint.lat],
+ [endPoint.lng, endPoint.lat],
+ ]
+
+ // const positions2 = positions.map((item) => {
+ // return mars3d.PointTrans.bd2wgs(item);
+ // });
+
+ const polyline = new mars3d.graphic.PolylineEntity({
+ positions: positions,
+ eventParent: false,
+ style: {
+ width: 2, // 线宽(像素)
+ color: '#262fc9', // 线颜色
+ clampToGround: true, // 是否贴地(山区建议设为true)
+ },
+ })
+ graphicLayer.addGraphic(polyline)
+ graphicLayerList.push(polyline)
+ }
+ }
+ })
+ }
+
+ // 绘制公路线
+ if (highwayList.length > 0) {
+ for (let i = 0; i < highwayList.length; i++) {
+ if (highwayList[i].cablewaTransPointVoList.length > 0) {
+ for (let j = 0; j < highwayList[i].cablewaTransPointVoList.length - 1; j++) {
+ const startPoint = highwayList[i].cablewaTransPointVoList[j]
+ const endPoint = highwayList[i].cablewaTransPointVoList[j + 1]
+
+ // 创建线段点数组
+ const positions = [
+ [startPoint.lng, startPoint.lat],
+ [endPoint.lng, endPoint.lat],
+ ]
+
+ // const positions2 = positions.map((item) => {
+ // return mars3d.PointTrans.bd2wgs(item);
+ // });
+
+ const polyline = new mars3d.graphic.PolylineEntity({
+ positions: positions,
+ // eventParent: true,
+ style: {
+ width: 2, // 线宽(像素)
+ color: '#FFFF00', // 线颜色
+ clampToGround: true, // 是否贴地(山区建议设为true)
+ },
+ })
+
+ // 添加点击事件
+ polyline.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+ const graphic = event.graphic
+ let infoContent = `
+
+
公路所在杆塔:${highwayList[i].towerName}
+
+ 宽度
+ ${highwayList[i].cablewayWidth || '/'}
+
+
+ 长度
+ ${highwayList[i].cablewayLength || '/'}
+
+
`
+ // 创建自定义信息窗体
+ // graphicLayer.bindPopup(infoContent, {
+ // position: graphic.position,
+ // });
+
+ graphic.bindPopup(infoContent)
+ graphic.openPopup()
+ })
+ graphicLayer.addGraphic(polyline)
+ graphicLayerList.push(polyline)
+ }
+ }
+ }
+ }
+
+ // 将所有线段添加到地图
+ segments.forEach((segment) => map.addOverlay(segment))
+}
+
+// 绘制牵张场地区域图
+async function addMapAThousandFields(graphicLayer, mars3d, Cesium) {
+ if (aThousandFieldsList.length > 0) {
+ aThousandFieldsList.forEach((item) => {
+ if (item.cablewaTransPointVoList && item.cablewaTransPointVoList.length > 0) {
+ let points = []
+ // 根据sort字段排序 防止点位顺序不一致
+ item.cablewaTransPointVoList.forEach((j) => {
+ points.push([j.lng, j.lat])
+ })
+
+ // const positions2 = points.map((item) => {
+ // return mars3d.PointTrans.bd2wgs(item);
+ // });
+
+ if (points.length > 0) {
+ const graphic = new mars3d.graphic.PolygonEntity({
+ positions: points,
+ // eventParent: false,
+ style: {
+ color: '#00FFFF', // 区域填充颜色
+ opacity: 0.5, // 透明度(0-1)
+ outline: true, // 是否显示边框
+ outlineWidth: 2, // 边框宽度(像素)
+ outlineColor: '#00FFFF', // 边框颜色
+ clampToGround: true,
+ },
+ attr: { remark: '示例区域' },
+ })
+
+ // 添加点击事件
+ graphic.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+ const graphic = event.graphic
+ let infoContent = `
+
+
名称:${item.name}
+
+ 宽度
+ ${item.cablewayWidth || '/'}
+
+
+ 长度
+ ${item.cablewayLength || '/'}
+
+
`
+ // 创建自定义信息窗体
+ // graphicLayer.bindPopup(infoContent, {
+ // position: graphic.position,
+ // });
+
+ graphic.bindPopup(infoContent)
+ graphic.openPopup()
+ })
+ graphicLayer.addGraphic(graphic)
+ graphicLayerList.push(graphic)
+ }
+ }
+ })
+ }
+}
+
+function showData(arrdata, graphicLayer) {
+ const polylinesTB = [] // 图标显示的点
+
+ // 预处理坐标及角度
+ for (let i = 0, len = arrdata.length; i < len; i++) {
+ const item = arrdata[i]
+ const position = Cesium.Cartesian3.fromDegrees(item.lon, item.lat, item.alt)
+ item.position = position
+ item.index = i + 1
+
+ // 模型比例,根据塔高换算
+ item.scale = item.height / (item.type === '1' ? 69 : 80.5)
+
+ // 测试塔顶高度与实际高度是否一致
+ // const positionTop = mars3d.PointUtil.addPositionsHeight(position, item.height) // 顶部点
+ // const graphic2 = new mars3d.graphic.PointPrimitive({
+ // position: positionTop,
+ // style: {
+ // color: "#ff0000",
+ // pixelSize: 8,
+ // outlineColor: "#ffffff",
+ // outlineWidth: 2
+ // }
+ // })
+ // graphicLayer.addGraphic(graphic2)
+
+ // 计算电线塔转角角度
+ if (i !== 0) {
+ const priorPt = arrdata[i - 1].position
+ item.lineHeading = mars3d.MeasureUtil.getAngle(priorPt, position) // 线的角度
+ }
+ }
+
+ // 计算各坐标及路线坐标,并渲染矢量对象
+ for (let i = 0, len = arrdata.length; i < len; i++) {
+ const item = arrdata[i]
+ const position = item.position
+
+ // 计算电线塔转角角度
+ let degree = -2.2333
+ // if (degree) {
+ // item.degree = item.lineHeading - item.heading
+ // } else {
+ if (i === 0) {
+ degree = arrdata[i + 1].lineHeading
+ } else if (i === len - 1) {
+ degree = arrdata[i].lineHeading
+ } else {
+ const nextTower = arrdata[i + 1]
+ let stepAngle = (nextTower.lineHeading - item.lineHeading) / 2
+ if (stepAngle > 90) {
+ stepAngle = 180 - stepAngle
+ } else if (stepAngle < -90) {
+ stepAngle = stepAngle + 180
+ }
+ degree = item.lineHeading + stepAngle
+ }
+ item.degree = degree
+ // }
+
+ const hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(degree), 0, 0)
+
+ // 3个悬垂串的位置
+ const offsetLineZ = item.height - 3.9
+ let newPoint1 = mars3d.PointUtil.getPositionByHprAndOffset(
+ position,
+ new Cesium.Cartesian3(0, 10.6, offsetLineZ),
+ hpr,
+ ) // 左边挂线
+ let newPoint2 = mars3d.PointUtil.getPositionByHprAndOffset(
+ position,
+ new Cesium.Cartesian3(0, 0, offsetLineZ),
+ hpr,
+ ) // 中间线
+ let newPoint3 = mars3d.PointUtil.getPositionByHprAndOffset(
+ position,
+ new Cesium.Cartesian3(0, -10.6, offsetLineZ),
+ hpr,
+ ) // 右边挂线
+
+ // polylinesTB.push(newPoint2); // 图标显示的点
+
+ drawWireTowerModel(graphicLayer, position, degree, item.scale, item)
+ drawWireTowerJYZModel(newPoint1, degree, graphicLayer) // 3个悬垂串模型
+ // drawWireTowerJYZModel(newPoint2, degree, graphicLayer);
+ drawWireTowerJYZModel(newPoint3, degree, graphicLayer)
+
+ // 计算路线点
+ const jyzHeight = -5
+ newPoint1 = mars3d.PointUtil.addPositionsHeight(newPoint1, jyzHeight)
+ // newPoint2 = mars3d.PointUtil.addPositionsHeight(newPoint2, jyzHeight);
+ newPoint3 = mars3d.PointUtil.addPositionsHeight(newPoint3, jyzHeight)
+
+ if (i === 0) {
+ polylines1.push(newPoint1)
+ polylines2.push(newPoint2)
+ polylines3.push(newPoint3)
+ } else {
+ const angularityFactor = -5000
+ const num = 50
+ let positions = mars3d.PolyUtil.getLinkedPointList(
+ polylines1[polylines1.length - 1],
+ newPoint1,
+ angularityFactor,
+ num,
+ ) // 计算曲线点
+ polylines1 = polylines1.concat(positions)
+
+ positions = mars3d.PolyUtil.getLinkedPointList(
+ polylines2[polylines2.length - 1],
+ newPoint2,
+ angularityFactor,
+ num,
+ ) // 计算曲线点
+ polylines2 = polylines2.concat(positions)
+
+ positions = mars3d.PolyUtil.getLinkedPointList(
+ polylines3[polylines3.length - 1],
+ newPoint3,
+ angularityFactor,
+ num,
+ ) // 计算曲线点
+ polylines3 = polylines3.concat(positions)
+ }
+ }
+
+ // 绘制路线
+ drawGuideLine(polylines1, '#0000ff', graphicLayer)
+ // drawGuideLine(polylines2, "#cccccc", graphicLayer);
+ drawGuideLine(polylines3, '#ff0000', graphicLayer)
+
+ polylines1 = mars3d.LngLatArray.toArray(polylines1)
+ // polylines2 = mars3d.LngLatArray.toArray(polylines2);
+ polylines3 = mars3d.LngLatArray.toArray(polylines3)
+}
+
+// 绘制电线塔模型
+function drawWireTowerModel(graphicLayer, position, degree, scale, item) {
+ const item1 = {
+ alt: 488.28,
+ heading: -2.2333,
+ headingStr: '-2°14′',
+ height: 52,
+ lat: item.baiduLat,
+ lon: item.baiduLon,
+ }
+
+ const graphic = new mars3d.graphic.ModelPrimitive({
+ position,
+ style: {
+ url:
+ item.type === '1'
+ ? '../../img/3d-model/tower_1.glb'
+ : '../../img/3d-model/tower_2.glb',
+ heading: degree,
+ scale: scale,
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 4000.0),
+ },
+ // popup: html,
+ })
+
+ // 添加点击事件
+ graphic.on(mars3d.EventType.click, function (event) {
+ // console.log("点击了标点", event.graphic.attr);
+ const graphic = event.graphic
+ let infoContent = `
+
+
${item.towerName}
+
+ 协调完成
+ ${item.time1 || '/'}
+
+
+ 基础开挖
+ ${item.time2 || '/'}
+
+
+ 基础开挖完成
+ ${item.time3 || '/'}
+
+
+ 基础浇筑
+ ${item.time4 || '/'}
+
+
+ 基础浇筑完成
+ ${item.time5 || '/'}
+
+
+ 铁塔组立
+ ${item.time6 || '/'}
+
+
+ 铁塔组立完成
+ ${item.time7 || '/'}
+
+
+ 架线施工
+ ${item.time8 || '/'}
+
+
+ 架线施工完成
+ ${item.time9 || '/'}
+
+
+ 附件安装完成
+ ${item.time10 || '/'}
+
+
`
+ // 创建自定义信息窗体
+ graphicLayer.bindPopup(infoContent, {
+ position: graphic.position,
+ })
+ })
+ graphicLayer.addGraphic(graphic)
+ graphicLayerList.push(graphic)
+}
+
+function drawWireTowerJYZModel(position, degree, graphicLayer) {
+ const graphic2 = new mars3d.graphic.ModelPrimitive({
+ position,
+ style: {
+ url: 'https://data.mars3d.cn/gltf/mars/tower/tower-jyz.glb',
+ heading: degree,
+ pitch: 90, // 模型本身不是竖直,需要加pitch纠正
+ scale: 1,
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 4000.0),
+ },
+ })
+ graphicLayer.addGraphic(graphic2)
+ graphicLayerList.push(graphic2)
+}
+
+function drawGuideLine(positions, color, graphicLayer) {
+ const graphic = new mars3d.graphic.PolylinePrimitive({
+ positions,
+ style: {
+ width: 4,
+ color,
+ },
+ })
+ graphicLayer.addGraphic(graphic)
+ graphicLayerList.push(graphic)
+}
diff --git a/src/views/showComponents/showMap/index.vue b/src/views/showComponents/showMap/index.vue
new file mode 100644
index 0000000..b364322
--- /dev/null
+++ b/src/views/showComponents/showMap/index.vue
@@ -0,0 +1,1078 @@
+
+
+
+
+
+
+
diff --git a/src/views/showComponents/showTable/config.js b/src/views/showComponents/showTable/config.js
new file mode 100644
index 0000000..1807bcb
--- /dev/null
+++ b/src/views/showComponents/showTable/config.js
@@ -0,0 +1,183 @@
+// 表单配置
+export const formColumns = [
+ {
+ type: 'input',
+ prop: 'queryTableName',
+ label: '', // 表格名称
+ placeholder: '请输入表格名称',
+ defaultValue: '', // 默认值
+ isShowLabel: false,
+ },
+ {
+ type: 'select',
+ prop: 'queryStatus',
+ label: '', // 状态
+ placeholder: '请选择状态',
+ options: [
+ { label: '启用', value: '1' },
+ { label: '禁用', value: '0' },
+ ],
+ },
+ {
+ type: 'cascader',
+ prop: 'queryClass',
+ label: '', // 班级
+ placeholder: '请选择班级',
+ options: [
+ {
+ label: '班级1',
+ value: '1',
+ children: [
+ { label: '班级1-1', value: '1-1' },
+ { label: '班级1-2', value: '1-2' },
+ { label: '班级1-3', value: '1-3' },
+ ],
+ },
+ {
+ label: '班级2',
+ value: '2',
+ children: [
+ { label: '班级2-1', value: '2-1' },
+ { label: '班级2-2', value: '2-2' },
+ { label: '班级2-3', value: '2-3' },
+ ],
+ },
+ {
+ label: '班级3',
+ value: '3',
+ children: [
+ { label: '班级3-1', value: '3-1' },
+ { label: '班级3-2', value: '3-2' },
+ { label: '班级3-3', value: '3-3' },
+ ],
+ },
+ ],
+ },
+ {
+ type: 'date',
+ prop: 'queryDateRange',
+ label: '', // 日期区间
+ dateType: 'daterange', // 日期区间
+ paramsList: ['queryStartDate', 'queryEndDate'],
+ valueFormat: 'YYYY-MM-DD',
+ startPlaceholder: '开始日期',
+ endPlaceholder: '结束日期',
+ },
+ // 月份区间筛选(Element Plus 支持 monthrange)
+ {
+ type: 'date',
+ prop: 'queryMonthRange',
+ label: '', // 月份区间
+ dateType: 'monthrange', // 月份区间
+ paramsList: ['queryStartMonth', 'queryEndMonth'],
+ valueFormat: 'YYYY-MM',
+ startPlaceholder: '开始月份',
+ endPlaceholder: '结束月份',
+ },
+ {
+ type: 'date',
+ prop: 'queryYear',
+ label: '', // 年份
+ dateType: 'year', // 单选年份
+ valueFormat: 'YYYY',
+ placeholder: '请选择年份',
+ },
+ {
+ type: 'date',
+ prop: 'queryMonth',
+ label: '', // 月份
+ dateType: 'month', // 单选月份
+ valueFormat: 'YYYY-MM',
+ placeholder: '请选择月份',
+ },
+ {
+ type: 'date',
+ prop: 'queryDate',
+ label: '', // 日期
+ dateType: 'date', // 单选日期
+ valueFormat: 'YYYY-MM-DD',
+ placeholder: '请选择日期',
+ },
+]
+
+// 表格列配置
+export const tableColumns = [
+ {
+ prop: 'tableName', // 字段名
+ label: '表格名称', // 标签
+ width: 180, // 列宽
+ minWidth: 120, // 最小列宽
+ align: 'left', // 对齐方式
+ showOverflowTooltip: true, // 超出显示提示
+ id: 'tableName',
+ },
+ {
+ prop: 'status',
+ label: '状态',
+ width: 100,
+ // 自定义渲染(使用插槽)
+ slot: 'status',
+ id: 'status',
+ // 或者使用格式化函数
+ // formatter: (row, column, cellValue) => {
+ // return cellValue === '1' ? '启用' : '禁用'
+ // }
+ },
+ {
+ prop: 'createTime',
+ label: '创建时间',
+ width: 180,
+ id: 'createTime',
+ },
+ {
+ prop: 'remark',
+ label: '备注',
+ minWidth: 200,
+ showOverflowTooltip: true,
+ id: 'remark',
+ },
+]
+
+// 操作列配置(可选)
+export const actionColumns = [
+ {
+ label: '编辑',
+ type: 'primary',
+ link: true,
+ handler: (row) => {
+ console.log('编辑', row)
+ },
+ },
+ {
+ label: '删除',
+ type: 'danger',
+ link: true,
+ handler: (row) => {
+ console.log('删除', row)
+ },
+ },
+ {
+ label: '详情',
+ type: 'danger',
+ link: true,
+ handler: (row) => {
+ console.log('删除', row)
+ },
+ },
+ {
+ label: '执行',
+ type: 'danger',
+ link: true,
+ handler: (row) => {
+ console.log('删除', row)
+ },
+ },
+ {
+ label: '测试',
+ type: 'warning',
+ link: true,
+ handler: (row) => {
+ console.log('删除', row)
+ },
+ },
+]
diff --git a/src/views/showComponents/showTable/index.vue b/src/views/showComponents/showTable/index.vue
new file mode 100644
index 0000000..60b4de1
--- /dev/null
+++ b/src/views/showComponents/showTable/index.vue
@@ -0,0 +1,444 @@
+
+
+
+ 组件展示 · Table
+ 表格组件设计指南
+
+ 基于配置驱动的列表查询组件,通过简单的配置即可快速构建包含查询表单和数据表格的完整页面,支持丰富的表单类型和表格功能。
+
+
+
+
+
+
+
+
+
+ 以下示例展示了如何使用配置化的方式快速构建一个包含查询表单和数据表格的完整列表页面。
+ 通过简单的配置,即可实现表单渲染、数据查询、表格展示等完整功能。
+
+
+
+
+
+ 新增
+
+ 批量删除
+
+
+
+
+
+
+ {{ row.status === '1' ? '启用' : '禁用' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
表单配置(formColumns)
+
{{ formConfigExample }}
+
+
+
表格配置(tableColumns)
+
{{ tableConfigExample }}
+
+
+
搜索字段示例(本次查询参数)
+
+ 在上方查询表单中输入条件并点击「搜索」后,这里会实时展示本次请求携带的查询字段名及其对应的值。
+
+
{{ searchParamsDisplay }}
+
+
+
+
+
+
+
+
+
+
+
+ - 表单和表格组件采用职责分离设计,可独立使用,也可组合使用。
+ - 通过配置驱动的方式定义表单字段和表格列,减少重复代码。
+ - 表单组件已二次封装,提供统一的接口和样式,便于维护和扩展。
+ - 支持插槽自定义渲染,满足复杂场景的定制化需求。
+ - 表格支持分页、选择、操作列等常用功能,开箱即用。
+ - 数据加载通过 loadData 函数统一处理,便于对接后端接口。
+
+
+
+
+
+
+
+
+
diff --git a/src/views/showComponents/showText/index.vue b/src/views/showComponents/showText/index.vue
index a589018..eba156d 100644
--- a/src/views/showComponents/showText/index.vue
+++ b/src/views/showComponents/showText/index.vue
@@ -26,9 +26,9 @@
v-for="item in group.texts"
:key="item.label"
class="text-item">
- {{
- item.content
- }}
+
+ {{ item.content }}
+
{{ item.note }}
diff --git a/vite.config.js b/vite.config.js
index 35c3f1b..3e38eaf 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1,44 +1,47 @@
-import { defineConfig, loadEnv } from "vite";
-import path from "path";
-import createVitePlugins from "./vite/plugins";
+import { defineConfig, loadEnv } from 'vite'
+import path from 'path'
+import createVitePlugins from './vite/plugins'
+import { mars3dPlugin } from 'vite-plugin-mars3d'
-const baseUrl = "http://localhost:8080"; // 后端接口
+const baseUrl = 'http://localhost:8080' // 后端接口
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
- const env = loadEnv(mode, process.cwd());
- env.VITE_APP_BASE_API = env.VITE_APP_BASE_API || "/dev-api";
- env.VITE_APP_TITLE = env.VITE_APP_TITLE || "博诺思管理系统";
- const { VITE_APP_ENV } = env;
+ const env = loadEnv(mode, process.cwd())
+ env.VITE_APP_BASE_API = env.VITE_APP_BASE_API || '/dev-api'
+ env.VITE_APP_TITLE = env.VITE_APP_TITLE || '博诺思管理系统'
+ const { VITE_APP_ENV } = env
return {
// 部署生产环境和开发环境下的URL。
// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
- base: VITE_APP_ENV === "production" ? "/" : "/",
- plugins: createVitePlugins(env, command === "build"),
+ base: VITE_APP_ENV === 'production' ? '/' : '/',
+ plugins: [...createVitePlugins(env, command === 'build'), mars3dPlugin()],
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
// 设置路径
- "~": path.resolve(__dirname, "./"),
+ '~': path.resolve(__dirname, './'),
// 设置别名
- "@": path.resolve(__dirname, "./src"),
+ '@': path.resolve(__dirname, './src'),
},
// https://cn.vitejs.dev/config/#resolve-extensions
- extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
+ extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
},
+ // 让 Vite 将 .glb 视为静态资源,直接复制到产物中
+ assetsInclude: ['**/*.glb'],
// 打包配置
build: {
// https://vite.dev/config/build-options.html
- sourcemap: command === "build" ? false : "inline",
- outDir: "dist",
- assetsDir: "assets",
+ sourcemap: command === 'build' ? false : 'inline',
+ outDir: 'dist',
+ assetsDir: 'assets',
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
- chunkFileNames: "static/js/[name]-[hash].js",
- entryFileNames: "static/js/[name]-[hash].js",
- assetFileNames: "static/[ext]/[name]-[hash].[ext]",
+ chunkFileNames: 'static/js/[name]-[hash].js',
+ entryFileNames: 'static/js/[name]-[hash].js',
+ assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
},
},
},
@@ -49,13 +52,13 @@ export default defineConfig(({ mode, command }) => {
open: true,
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
- "/dev-api": {
+ '/dev-api': {
target: baseUrl,
changeOrigin: true,
- rewrite: (p) => p.replace(/^\/dev-api/, ""),
+ rewrite: (p) => p.replace(/^\/dev-api/, ''),
},
// springdoc proxy
- "^/v3/api-docs/(.*)": {
+ '^/v3/api-docs/(.*)': {
target: baseUrl,
changeOrigin: true,
},
@@ -65,11 +68,11 @@ export default defineConfig(({ mode, command }) => {
postcss: {
plugins: [
{
- postcssPlugin: "internal:charset-removal",
+ postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
- if (atRule.name === "charset") {
- atRule.remove();
+ if (atRule.name === 'charset') {
+ atRule.remove()
}
},
},
@@ -77,5 +80,5 @@ export default defineConfig(({ mode, command }) => {
],
},
},
- };
-});
+ }
+})