fix: BUG修改

This commit is contained in:
kun 2023-11-08 18:40:55 +08:00
parent 6b1e0cddbf
commit ef5db2eff3
2 changed files with 116 additions and 13 deletions

View File

@ -245,7 +245,14 @@ import MapPrint from "./components/mapPrint.vue";
import FlyRoam from "./components/flyRoam.vue";
import MapMark from "./components/mapMark.vue";
import RouteNavigation from "./components/routeNavigation.vue";
import { getSystemConfig, baseMapList, albugineaMapList, diffuseWallList, polylineCombineList } from "@/api/modules/mapCommon";
import {
getSystemConfig,
baseMapList,
albugineaMapList,
diffuseWallList,
polylineCombineList,
gltfModelList
} from "@/api/modules/mapCommon";
const configJson = ref<any>({});
const screenComparisonShow = ref(false); //
const leftRollerList = ref<any>([]);
@ -394,6 +401,31 @@ onMounted(async () => {
configJson.value.layers = initAlbugineamaps;
});
}
// gltf
const resModel: any = await gltfModelList({});
console.log(resModel, "gltf模型666666");
if (resModel.result && resModel.result.length > 0) {
let initModel: any = [{ id: 2020, name: "gltf模型", type: "group" }];
resModel.result.map((item: any) => {
initModel.push({
pid: 2020,
type: "graphic",
name: item.name,
data: [
{
type: "modelP",
position: [+item.lng, +item.lat, +item.alt],
style: {
url: item.url
}
}
],
popup: item.name,
show: item.show ? item.show : false
});
});
configJson.value.layers = configJson.value.layers.concat(initModel);
}
await initMars3d(configJson.value);
await initTree();
});
@ -760,16 +792,6 @@ const closeSearch = () => {
};
const initMars3d = (option: any) => {
map = new mars3d.Map("mars3dContainer", option);
//
// const tiles3dLayer = new mars3d.layer.TilesetLayer({
// name: "",
// url: "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
// position: { lng: 117.077158, lat: 31.659116, alt: -2.0 },
// maximumScreenSpaceError: 1,
// popup: "all"
// });
// map.addLayer(tiles3dLayer);
// tiles3dLayer.flyTo();
// api
queryPoi = new mars3d.query.GaodePOI({
key: ["ad31e514e7e740179d6d8f182720bcf5"]
@ -889,7 +911,7 @@ const getLineEffect = async () => {
} else {
mars3d.Util.fetchJson({ url: JSON.parse(item.jsonFile).url }).then(function (data) {
const busLines: any = [];
data.forEach(function (busLine: any, idx: any) {
data.map((busLine: any, idx: any) => {
let prevPt: any;
const points = [];
for (let i = 0; i < busLine.length; i += 2) {
@ -912,7 +934,7 @@ const getLineEffect = async () => {
bgColor: item.bgColor
});
});
busLines.forEach(function (item2: any, index2: any) {
busLines.map((item2: any, index2: any) => {
arrData.push({
positions: item2.positions,
style: {

View File

@ -20,6 +20,36 @@
</el-select>
</el-form-item>
</div>
<div class="row" v-if="formData.type != 'ODLine'">
<el-form-item label="坐标点位:" :required="true">
<div class="table-content" v-for="(item, index) in addPositions" :key="index">
<div class="table-head">
<div class="head-value">经度{{ index + 1 }}</div>
<div class="head-value">纬度{{ index + 1 }}</div>
<div class="head-value">高度{{ index + 1 }}</div>
</div>
<div class="table-body">
<div class="body-value">
<el-input v-model="item.lng" style="width: 100%" placeholder="请输入" />
</div>
<div class="body-value">
<el-input v-model="item.lat" placeholder="请输入" />
</div>
<div class="body-value">
<el-input v-model="item.alt" placeholder="请输入" />
</div>
<div class="body-operate">
<el-button type="danger" link @click="deleteRow(index)">删除</el-button>
</div>
</div>
</div>
<div class="table-operate">
<div>
<el-button type="success" @click="appendRow">追加</el-button>
</div>
</div>
</el-form-item>
</div>
<div class="row">
<el-form-item label="线宽度:" prop="width">
<el-input-number v-model.number="formData.width" placeholder="请输入" controls-position="right" />
@ -86,6 +116,7 @@ const props = defineProps({
title: String
});
const emits = defineEmits(["update:operateVisible", "confirm"]);
const addPositions = ref([]);
const baseUrl = import.meta.env.VITE_API_URL;
const fileList = ref([]);
const store = GlobalStore();
@ -127,6 +158,18 @@ const rules = ref({
const formRef = ref<FormInstance>();
const formData = ref<any>({});
const visible1 = ref(false);
//
const appendRow = () => {
addPositions.value.push({ lng: "", lat: "", alt: "" });
};
//
const deleteRow = (index: number) => {
if (addPositions.value.length == minLength.value) {
ElMessage.error("不能少于最少点位数据");
return;
}
addPositions.value.splice(index, 1);
};
//
const typeChange = (e: any) => {
if (e == "ODLine") {
@ -179,6 +222,16 @@ const confirmSubmit = () => {
let requestData = {
...formData.value
};
let positionPass = true;
addPositions.value.map((item: any) => {
if (!item.lng || !item.lat || !item.alt) {
positionPass = false;
}
});
if (!positionPass) {
ElMessage.error("请输入坐标");
return;
}
if (requestData.type == "ODLine") {
requestData.jsonFile = JSON.stringify(requestData.jsonFile);
}
@ -278,6 +331,34 @@ onMounted(() => {});
margin: 0 auto;
margin-top: 25px;
.row {
.table-content {
display: flex;
flex-direction: column;
.table-head {
@include flex;
.head-value {
width: 200px;
color: #333;
font-weight: 700;
margin-right: 10px;
}
}
.table-body {
@include flex;
.body-value {
margin-right: 10px;
width: 200px;
}
.body-operate {
margin-left: 5px;
}
}
}
.table-operate {
width: 100%;
display: block;
margin-top: 5px;
}
}
}
}