From 2ad6bc1b474df9bfd06d2069a5c5047bba75c8ea Mon Sep 17 00:00:00 2001 From: gcw_IJ7DAiVL Date: Fri, 10 Oct 2025 15:32:47 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/views/home/home.vue | 245 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 236 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 7f9a28f..73c9c6e 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "core-js": "^3.8.3", "echarts": "^5.4.3", "element-ui": "2.9.2", + "file-saver": "^2.0.5", "gsap": "^3.13.0", "ini-parser": "^0.0.2", "js-cookie": "2.2.1", diff --git a/src/views/home/home.vue b/src/views/home/home.vue index a1c80ab..5d31ebc 100644 --- a/src/views/home/home.vue +++ b/src/views/home/home.vue @@ -1,15 +1,17 @@ @@ -249,6 +360,7 @@ import Cookies from 'js-cookie' import axios from 'axios' import iniParser from 'ini-parser' import configIni from '/config.ini'; +import { saveAs } from 'file-saver'; export default { data() { @@ -294,6 +406,9 @@ export default { factoriesWithVehicles: [], // 塞入车的厂房集合 accordFactoryLayer: null, // 隐蔽规划 accordPoint: null, // 隐蔽规划点 + dialogExportVisible: false, + routeData: [], + hideData: [], } }, async mounted() { @@ -2274,6 +2389,104 @@ export default { return [tip, left, right, tip] // 闭合三角形 }, + /** 右侧表单导出 */ + handleExport() { + const hideData = [] + if (this.factoriesWithVehicles.length > 0) { + this.factoriesWithVehicles.forEach((item) => [ + hideData.push({ + FID_1: item.options.style.properties.FID_1, + vehiclesNum: (item.vehicles.map(e => e.name)).join(','), + area: item.area.toFixed(2) + }) + ]) + } + this.hideData = JSON.parse(JSON.stringify(hideData)) + const routeData = [] + if (this.infoList.length > 0) { + this.infoList.forEach((item) => [ + routeData.push({ + 编码: item.编码, + 名称: item.名称, + 宽度: item.宽度, + 曲率半: item.曲率半, + 载重吨: item.载重吨, + 水深: item.水深, + 净空高: item.净空高, + }) + ]) + } + this.routeData = JSON.parse(JSON.stringify(routeData)) + this.dialogExportVisible = true + }, + /** 增删改查 */ + handleRouteAdd() { + const newRow = { + 编码: null, + 名称: null, + 宽度: null, + 曲率半: null, + 载重吨: null, + 水深: null, + 净空高: null, + editing: true, + }; + this.routeData.push(newRow); + }, + handleRouteDelete(row) { + const index = this.routeData.findIndex(item => item.id === row.id); + if (index !== -1) { + this.routeData.splice(index, 1); + } + }, + handleRouteEdit(row) { + this.$set(row, 'editing', true); + }, + handleRouteSave(row) { + this.$set(row, 'editing', false); + }, + handleHideAdd() { + const newRow = { + id: this.hideData.length + 1, + FID_1: '', + vehiclesNum: '', + area: '', + editing: true, + }; + this.hideData.push(newRow); + }, + handleHideDelete(row) { + const index = this.hideData.findIndex(item => item.id === row.id); + if (index !== -1) { + this.hideData.splice(index, 1); + } + }, + handleHideEdit(row) { + this.$set(row, 'editing', true); + }, + handleHideSave(row) { + this.$set(row, 'editing', false); + }, + closeExport() { + this.dialogExportVisible = false + }, + confirmExport() { + this.hideData = this.hideData.map(item => { + const { editing, ...rest } = item; // 解构赋值,移除 age 键 + return rest; + }); + this.routeData = this.routeData.map(item => { + const { editing, ...rest } = item; // 解构赋值,移除 age 键 + return rest; + }); + const info = JSON.stringify({ + hideData: this.hideData, + routeData: this.routeData, + }, null, 2) + const blob = new Blob([info], { type: 'application/json;charset=utf-8' }) + saveAs(blob, '机动路线规划.json') + this.closeExport() + }, }, } @@ -2284,10 +2497,16 @@ export default { line-height: 60px; display: flex; align-items: center; - padding-left: 34px; + justify-content: space-between; + padding: 0 34px; box-sizing: border-box; background: #abc6bc; } +.home-header-left { + display: flex; + align-items: center; + box-sizing: border-box; +} .home-header img { height: 24px; width: 24px; @@ -2406,4 +2625,10 @@ export default { } .popDiloag .popDiloag-p { } +::v-deep .el-dialog__body{ + padding: 0px 20px!important; +} +::v-deep .el-dialog { + margin-top: 6vh !important; +}