新增store管理
This commit is contained in:
parent
10e9ecc4a7
commit
490ff6d1ac
|
@ -35,19 +35,19 @@ const usePermissionStore = defineStore(
|
||||||
},
|
},
|
||||||
generateRoutes(roles) {
|
generateRoutes(roles) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let menu = JSON.parse(Cookies.get('menu')||'{}')
|
let menu = JSON.parse(Cookies.get('menu')||sessionStorage.getItem("menu")||'{}')
|
||||||
if(!menu.menuId){
|
if(!menu?.menuId){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Cookies.remove("menu")
|
||||||
|
sessionStorage.setItem('menu',JSON.stringify(menu));
|
||||||
// 向后端请求路由数据
|
// 向后端请求路由数据
|
||||||
getRouters({menuId:menu.menuId}).then(res => {
|
getRouters({menuId:menu.menuId}).then(res => {
|
||||||
|
|
||||||
res.data.forEach(data=>{
|
res.data.forEach(data=>{
|
||||||
if(!isHttp(data.path) ){
|
if(!isHttp(data.path) ){
|
||||||
data.path = '/'+data.path
|
data.path = '/'+data.path
|
||||||
data.component = "Layout"
|
data.component = "Layout"
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||||
|
|
|
@ -23,7 +23,7 @@ const userStore = useUserStore()
|
||||||
import {getDesktopRouters} from '@index/api/menu'
|
import {getDesktopRouters} from '@index/api/menu'
|
||||||
const {proxy} = getCurrentInstance();
|
const {proxy} = getCurrentInstance();
|
||||||
const openMenu =(item)=>{
|
const openMenu =(item)=>{
|
||||||
|
debugger
|
||||||
if(item.path){
|
if(item.path){
|
||||||
|
|
||||||
if(isHttp(item.path)){
|
if(isHttp(item.path)){
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="楼层:" prop="houseFloors">
|
<el-form-item label="楼层:" prop="houseFloors">
|
||||||
<el-input v-model="form.houseFloors" type="number" placeholder="请输入" class="inputCss" />
|
<el-input v-model="form.houseFloors" type="number" placeholder="请输入" class="inputCss" />
|
||||||
<label for="" style="color: #fff;">({{maxHouseFloors}}~{{minHouseFloors}})</label>
|
<!-- <label for="" style="color: #fff;">({{maxHouseFloors}}~{{minHouseFloors}})</label> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="面积:" prop="area">
|
<el-form-item label="面积:" prop="area">
|
||||||
|
@ -121,33 +121,9 @@ const rules=ref( {
|
||||||
])
|
])
|
||||||
const maxHouseFloors = ref('')
|
const maxHouseFloors = ref('')
|
||||||
const minHouseFloors = ref('')
|
const minHouseFloors = ref('')
|
||||||
onMounted(() => {
|
|
||||||
|
|
||||||
let lineId = form.value.geometryId
|
|
||||||
let graphics =ldMap.sketchLayer.polygonLayer.sublayers.items
|
|
||||||
let garphic = graphics.filter(element => {
|
|
||||||
return element.id == lineId
|
|
||||||
})[0];
|
|
||||||
let center = [[garphic.geometry.centroid.x,garphic.geometry.centroid.y]]
|
|
||||||
getElevation({
|
|
||||||
layersId:props.layerId,
|
|
||||||
geoJsonData:[...center,...garphic.geometry.rings[0]]
|
|
||||||
}).then(res=>{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const [maxNumber, minNumber] = getMaxAndMin(res.data);
|
|
||||||
maxHouseFloors.value=maxNumber
|
|
||||||
minHouseFloors.value=minNumber
|
|
||||||
console.log(`最大数: ${maxNumber}`);
|
|
||||||
console.log(`最小数: ${minNumber}`);
|
|
||||||
console.log(`楼层差: ${maxNumber}-${minNumber}`+(maxNumber-minNumber));
|
|
||||||
form.value.houseFloors= parseInt( (maxNumber-minNumber)/3)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
function getMaxAndMin(numbers) {
|
function getMaxAndMin(numbers) {
|
||||||
const max = Math.max(...numbers);
|
const max = Math.max(...numbers);
|
||||||
const min = Math.min(...numbers);
|
const min = Math.min(...numbers);
|
||||||
|
|
|
@ -365,14 +365,15 @@ onMounted(() => {
|
||||||
treeHeight.value = window.innerHeight - 258;
|
treeHeight.value = window.innerHeight - 258;
|
||||||
};
|
};
|
||||||
tableDate.value = house.value;
|
tableDate.value = house.value;
|
||||||
$ldMap.initMap().then((e) => {
|
|
||||||
getLayerList().then(() => {
|
getLayerList().then(() => {
|
||||||
if (layerslist.value) {
|
let firstData =layerslist.value[0]
|
||||||
selectLayer(layerslist.value[0].id);
|
selectLayer(firstData.id);
|
||||||
}
|
|
||||||
});
|
|
||||||
getlegend();
|
getlegend();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
emitter.on("loadLayer", () => {
|
emitter.on("loadLayer", () => {
|
||||||
getLayerList();
|
getLayerList();
|
||||||
});
|
});
|
||||||
|
@ -483,10 +484,16 @@ function selectLayer(e) {
|
||||||
console.log(item);
|
console.log(item);
|
||||||
layerId.value = item.id;
|
layerId.value = item.id;
|
||||||
layerName.value = item.layerName
|
layerName.value = item.layerName
|
||||||
|
$ldMap.initMap(item.coordinateSystem.epsg).then((e) => {
|
||||||
|
|
||||||
$ldMap.addLayer({
|
$ldMap.addLayer({
|
||||||
url: item.layerUrl,
|
url: item.layerUrl,
|
||||||
id: e,
|
id: e,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,9 +421,7 @@ function addPointMap(val) {
|
||||||
$ldMap.addDefaultByPoint(data);
|
$ldMap.addDefaultByPoint(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getAllMapData() {
|
|
||||||
$ldMap.getAllData();
|
|
||||||
}
|
|
||||||
function cutPolygon() {
|
function cutPolygon() {
|
||||||
let { flag, data } = cut();
|
let { flag, data } = cut();
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
@ -571,11 +569,12 @@ function setPolygonData() {
|
||||||
$ldMap.addDeviceData(mapdata.station, "Station");
|
$ldMap.addDeviceData(mapdata.station, "Station");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportCad(){
|
function exportCad(){
|
||||||
// exporGis()
|
// exporGis()
|
||||||
if(profilesId.value){
|
if(profilesId.value){
|
||||||
proxy.download("/pipe/recognition/exportCad?profilesId="+profilesId.value, {},
|
proxy.download("/pipe/recognition/exportCad?profilesId="+profilesId.value, {},
|
||||||
`${layerName.value}.dxf`,{
|
`${layerName.value}.dwg`,{
|
||||||
baseURL: "/map-api"
|
baseURL: "/map-api"
|
||||||
},true);
|
},true);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
v-model="findValue"
|
v-model="findValue"
|
||||||
style="background: rgb(0, 0, 0, 0.4)"
|
style="background: rgb(0, 0, 0, 0.4)"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
:before-close="closeWaitDialog"
|
||||||
width="30%"
|
width="30%"
|
||||||
>
|
>
|
||||||
<template #header="{ close, titleId, titleClass }">
|
<template #header="{ close, titleId, titleClass }">
|
||||||
|
@ -135,10 +136,7 @@
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
@click="
|
@click="closeBtn"
|
||||||
findValue = false;
|
|
||||||
loading = false;
|
|
||||||
"
|
|
||||||
>取消</el-button
|
>取消</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -148,6 +146,7 @@
|
||||||
v-model="lineValue"
|
v-model="lineValue"
|
||||||
title=""
|
title=""
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
:before-close="closeWaitDialog"
|
||||||
width="30%"
|
width="30%"
|
||||||
>
|
>
|
||||||
<template #header="{ close, titleId, titleClass }">
|
<template #header="{ close, titleId, titleClass }">
|
||||||
|
@ -253,10 +252,7 @@
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
@click="
|
@click="closeBtn"
|
||||||
lineValue = false;
|
|
||||||
loading = false;
|
|
||||||
"
|
|
||||||
>取消</el-button
|
>取消</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -407,6 +403,7 @@ import html2canvas from "html2canvas";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
const $ldMap = inject("$ldMap"); // 调用全局变量
|
const $ldMap = inject("$ldMap"); // 调用全局变量
|
||||||
const $ldBox = inject("$ldBox"); // 调用全局变量
|
const $ldBox = inject("$ldBox"); // 调用全局变量
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
const componentId = ref(sjLeft);
|
const componentId = ref(sjLeft);
|
||||||
const comid = ref("sj");
|
const comid = ref("sj");
|
||||||
const changemenu = (e) => {
|
const changemenu = (e) => {
|
||||||
|
@ -439,10 +436,13 @@ const posterimg = ref();
|
||||||
|
|
||||||
let mapdata = useMapDataStore();
|
let mapdata = useMapDataStore();
|
||||||
let mapLog = useMapLogStore();
|
let mapLog = useMapLogStore();
|
||||||
const { sseData, profilesList, secen } = storeToRefs(mapdata);
|
const { sseData, profilesList, secen,clientId } = storeToRefs(mapdata);
|
||||||
|
|
||||||
const setFlag = ref(false);
|
const setFlag = ref(false);
|
||||||
const priceRef = ref();
|
const priceRef = ref();
|
||||||
|
watch(clientId,(val)=>{
|
||||||
|
loading.value=Boolean(val)
|
||||||
|
})
|
||||||
watch(setFlag, (val) => {
|
watch(setFlag, (val) => {
|
||||||
!val && priceRef.value.init();
|
!val && priceRef.value.init();
|
||||||
});
|
});
|
||||||
|
@ -523,9 +523,6 @@ const verificationChange = () => {
|
||||||
const findValue = ref<Boolean>(false);
|
const findValue = ref<Boolean>(false);
|
||||||
const lineValue = ref<Boolean>(false);
|
const lineValue = ref<Boolean>(false);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
watch([lineValue, findValue], (val) => {
|
|
||||||
!val[0] && !val[1] && (loading.value = false);
|
|
||||||
});
|
|
||||||
const setFindVal = (e) => {
|
const setFindVal = (e) => {
|
||||||
mapdata.getProfilesList().then((res) => {
|
mapdata.getProfilesList().then((res) => {
|
||||||
findValue.value = e;
|
findValue.value = e;
|
||||||
|
@ -541,7 +538,7 @@ const setLineVal = (e) => {
|
||||||
|
|
||||||
const current = ref("");
|
const current = ref("");
|
||||||
const handleCurrentChange = (e) => {
|
const handleCurrentChange = (e) => {
|
||||||
current.value = e.id;
|
e&&(current.value = e.id)
|
||||||
};
|
};
|
||||||
const profilesDelete = (e) => {
|
const profilesDelete = (e) => {
|
||||||
mapdata
|
mapdata
|
||||||
|
@ -552,10 +549,38 @@ const profilesDelete = (e) => {
|
||||||
})
|
})
|
||||||
.catch((e) => {});
|
.catch((e) => {});
|
||||||
};
|
};
|
||||||
|
function closeBtn(){
|
||||||
|
closeWaitDialog(()=>{
|
||||||
|
|
||||||
|
lineValue.value=false;
|
||||||
|
findValue.value = false;
|
||||||
|
loading.value = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function closeWaitDialog(fun){
|
||||||
|
|
||||||
|
console.log(clientId.value)
|
||||||
|
if(clientId.value){
|
||||||
|
ElMessageBox.confirm("数据加载中,是否确定关闭", {
|
||||||
|
confirmButtonText: "关闭",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
|
||||||
|
mapdata.closeSse();
|
||||||
|
fun();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
fun();
|
||||||
|
}
|
||||||
|
}
|
||||||
const priceFlag = ref(false);
|
const priceFlag = ref(false);
|
||||||
function findArea(override) {
|
function findArea(override) {
|
||||||
loading.value = true;
|
// loading.value = true;
|
||||||
$ldMap.removeAllLayer();
|
$ldMap.removeAllLayer();
|
||||||
if (override) {
|
if (override) {
|
||||||
mapdata
|
mapdata
|
||||||
|
@ -563,8 +588,9 @@ function findArea(override) {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setValue();
|
setValue();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((e) => {
|
||||||
loading.value = false;
|
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (current.value) {
|
if (current.value) {
|
||||||
|
@ -587,6 +613,7 @@ function findArea(override) {
|
||||||
actionType: "data", //add,exit,del,
|
actionType: "data", //add,exit,del,
|
||||||
isrevoke: false, //是否允许撤回,
|
isrevoke: false, //是否允许撤回,
|
||||||
});
|
});
|
||||||
|
$ldMap.removeAllLayer();
|
||||||
$ldMap.addDefaultData(mapdata.road, "Road");
|
$ldMap.addDefaultData(mapdata.road, "Road");
|
||||||
$ldMap.addDefaultData(mapdata.house, "House");
|
$ldMap.addDefaultData(mapdata.house, "House");
|
||||||
$ldMap.addDefaultData(mapdata.river, "River");
|
$ldMap.addDefaultData(mapdata.river, "River");
|
||||||
|
@ -595,7 +622,7 @@ function findArea(override) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function findLine(override) {
|
function findLine(override) {
|
||||||
loading.value = true;
|
// loading.value = true;
|
||||||
if(override){
|
if(override){
|
||||||
mapdata
|
mapdata
|
||||||
.setLineData(override)
|
.setLineData(override)
|
||||||
|
@ -603,7 +630,7 @@ function findLine(override) {
|
||||||
setLine()
|
setLine()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false;
|
// loading.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -24,6 +24,7 @@ const useMapDataStore = defineStore(
|
||||||
'mapData',
|
'mapData',
|
||||||
{
|
{
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
source:null,
|
||||||
profilesList: [],
|
profilesList: [],
|
||||||
profilesId: '',
|
profilesId: '',
|
||||||
layerId: '',
|
layerId: '',
|
||||||
|
@ -117,7 +118,7 @@ const useMapDataStore = defineStore(
|
||||||
|
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
reject()
|
reject(err)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
recognitionload({ layersId: this.layerId, override }).then(res => {
|
recognitionload({ layersId: this.layerId, override }).then(res => {
|
||||||
|
@ -252,16 +253,27 @@ const useMapDataStore = defineStore(
|
||||||
});
|
});
|
||||||
this.house = houseData;
|
this.house = houseData;
|
||||||
},
|
},
|
||||||
|
closeSse(){
|
||||||
|
let self = this;
|
||||||
|
sseClose(self.clientId).then(res=>{
|
||||||
|
self.clientId = ''
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
sseConfig(type) {
|
sseConfig(type) {
|
||||||
let self = this;
|
let self = this;
|
||||||
self.sseData = []
|
self.sseData = []
|
||||||
self.clientId = ''
|
if(self.clientId){
|
||||||
|
this.closeSse()
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
let base = '/map-api';
|
let base = '/map-api';
|
||||||
let url = `${base}/sse/connect/`;
|
let url = `${base}/sse/connect/`;
|
||||||
|
|
||||||
var es = new EventSourcePolyfill(url, {
|
self.source = new EventSourcePolyfill(url, {
|
||||||
heartbeatTimeout: 10000000,
|
heartbeatTimeout: 10000000,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: 'Bearer ' + getToken()
|
Authorization: 'Bearer ' + getToken()
|
||||||
|
@ -269,12 +281,12 @@ const useMapDataStore = defineStore(
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
es.onopen = function (event) {
|
self.source.onopen = function (event) {
|
||||||
console.log("连接成功", event);
|
console.log("连接成功", event);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
es.onmessage = function (event) {
|
self.source.onmessage = function (event) {
|
||||||
// to to something…
|
// to to something…
|
||||||
console.log("接收信息", event);
|
console.log("接收信息", event);
|
||||||
// console.log(event.data)
|
// console.log(event.data)
|
||||||
|
@ -284,14 +296,19 @@ const useMapDataStore = defineStore(
|
||||||
case 'clientId': setRecogn(data.data); break;
|
case 'clientId': setRecogn(data.data); break;
|
||||||
case 'text': self.sseData.push(data); break;
|
case 'text': self.sseData.push(data); break;
|
||||||
case 'data': setdata(data.data); break;
|
case 'data': setdata(data.data); break;
|
||||||
|
case 'error': errordata(data.data); break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function setRecogn(clientId) {
|
function setRecogn(clientId) {
|
||||||
if (!self.clientId) {
|
if (!self.clientId) {
|
||||||
self.clientId = clientId
|
self.clientId = clientId
|
||||||
if (type == 'recognition') {
|
if (type == 'recognition') {
|
||||||
recognitionreload({ layersId: self.layerId, clientId })
|
recognitionreload({ layersId: self.layerId, clientId }).then(res=>{
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
|
||||||
|
self.closeSse()
|
||||||
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pipelinereload({ layersId: self.layerId, clientId })
|
pipelinereload({ layersId: self.layerId, clientId })
|
||||||
|
@ -304,9 +321,7 @@ const useMapDataStore = defineStore(
|
||||||
let text = (type == 'recognition' ? '特征物识别' : '布线') + '结束,关闭并刷新?点击确定刷新,点击取消停留当前页面'
|
let text = (type == 'recognition' ? '特征物识别' : '布线') + '结束,关闭并刷新?点击确定刷新,点击取消停留当前页面'
|
||||||
ElMessageBox.confirm(text, '识别提示',
|
ElMessageBox.confirm(text, '识别提示',
|
||||||
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||||
|
self.closeSse()
|
||||||
self.clientId = ''
|
|
||||||
es.close()
|
|
||||||
resolve(data)
|
resolve(data)
|
||||||
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -314,12 +329,18 @@ const useMapDataStore = defineStore(
|
||||||
reject()
|
reject()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function errordata(text){
|
||||||
|
ElMessageBox.confirm(text, '错误提示',
|
||||||
|
{ confirmButtonText: '关闭',showCancelButton:false, type: 'warning' }).then(() => {
|
||||||
|
self.clientId=''
|
||||||
|
});
|
||||||
|
|
||||||
es.onerror = function (error) {
|
}
|
||||||
|
|
||||||
|
self.source = function (error) {
|
||||||
// 监听错误
|
// 监听错误
|
||||||
console.log("错误", error);
|
console.log("错误", error);
|
||||||
self.clientId = ''
|
self.clientId = ''
|
||||||
es.close()
|
|
||||||
// reject()
|
// reject()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
const tk="0eab750b26cdeee155e8c4f2310b53ef"
|
const tk="0eab750b26cdeee155e8c4f2310b53ef"
|
||||||
const TileInfoData={
|
const TileInfoData={
|
||||||
infoData:{
|
infoData:function (wkid:number){
|
||||||
|
let data = {
|
||||||
|
'4326':{
|
||||||
dpi: 90.71428571427429, // 切片方案的每英寸点数(即像素)。
|
dpi: 90.71428571427429, // 切片方案的每英寸点数(即像素)。
|
||||||
size: 256, // 设置每个瓷砖的高度和宽度为[256, 256]像素。
|
size: 256, // 设置每个瓷砖的高度和宽度为[256, 256]像素。
|
||||||
origin: {
|
origin: {
|
||||||
|
@ -8,9 +10,9 @@ const TileInfoData={
|
||||||
type: "point",
|
type: "point",
|
||||||
x: -180,
|
x: -180,
|
||||||
y: 90,
|
y: 90,
|
||||||
spatialReference: { wkid: 4326 },
|
spatialReference: { wkid: wkid },
|
||||||
},
|
},
|
||||||
spatialReference: { wkid: 4326 },
|
spatialReference: { wkid: wkid },
|
||||||
lods: [
|
lods: [
|
||||||
// 定义平铺方案的详细级别数组。
|
// 定义平铺方案的详细级别数组。
|
||||||
{
|
{
|
||||||
|
@ -122,7 +124,145 @@ const TileInfoData={
|
||||||
scale: 1127.23386023998275,
|
scale: 1127.23386023998275,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
'4490':{
|
||||||
|
dpi: 96,
|
||||||
|
rows: 256,
|
||||||
|
cols: 256,
|
||||||
|
compressionQuality: 0,
|
||||||
|
origin: {
|
||||||
|
x: -180,
|
||||||
|
y: 90
|
||||||
|
},
|
||||||
|
spatialReference: {
|
||||||
|
wkid: 4490
|
||||||
|
},
|
||||||
|
lods: [
|
||||||
|
{
|
||||||
|
level: 1,
|
||||||
|
levelValue: 1,
|
||||||
|
resolution: 0.703125,
|
||||||
|
scale: 295497593.05875003
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 2,
|
||||||
|
levelValue: 2,
|
||||||
|
resolution: 0.3515625,
|
||||||
|
scale: 147748796.52937502
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 3,
|
||||||
|
levelValue: 3,
|
||||||
|
resolution: 0.17578125,
|
||||||
|
scale: 73874398.264687508
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 4,
|
||||||
|
levelValue: 4,
|
||||||
|
resolution: 0.087890625,
|
||||||
|
scale: 36937199.132343754
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 5,
|
||||||
|
levelValue: 5,
|
||||||
|
resolution: 0.0439453125,
|
||||||
|
scale: 18468599.566171877
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 6,
|
||||||
|
levelValue: 6,
|
||||||
|
resolution: 0.02197265625,
|
||||||
|
scale: 9234299.7830859385
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 7,
|
||||||
|
levelValue: 7,
|
||||||
|
resolution: 0.010986328125,
|
||||||
|
scale: 4617149.8915429693
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 8,
|
||||||
|
levelValue: 8,
|
||||||
|
resolution: 0.0054931640625,
|
||||||
|
scale: 2308574.9457714846
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 9,
|
||||||
|
levelValue: 9,
|
||||||
|
resolution: 0.00274658203125,
|
||||||
|
scale: 1154287.4728857423
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 10,
|
||||||
|
levelValue: 10,
|
||||||
|
resolution: 0.001373291015625,
|
||||||
|
scale: 577143.73644287116
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 11,
|
||||||
|
levelValue: 11,
|
||||||
|
resolution: 0.0006866455078125,
|
||||||
|
scale: 288571.86822143558
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 12,
|
||||||
|
levelValue: 12,
|
||||||
|
resolution: 0.00034332275390625,
|
||||||
|
scale: 144285.93411071779
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 13,
|
||||||
|
levelValue: 13,
|
||||||
|
resolution: 0.000171661376953125,
|
||||||
|
scale: 72142.967055358895
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 14,
|
||||||
|
levelValue: 14,
|
||||||
|
resolution: 8.58306884765625e-5,
|
||||||
|
scale: 36071.483527679447
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 15,
|
||||||
|
levelValue: 15,
|
||||||
|
resolution: 4.291534423828125e-5,
|
||||||
|
scale: 18035.741763839724
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 16,
|
||||||
|
levelValue: 16,
|
||||||
|
resolution: 2.1457672119140625e-5,
|
||||||
|
scale: 9017.8708819198619
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 17,
|
||||||
|
levelValue: 17,
|
||||||
|
resolution: 1.0728836059570313e-5,
|
||||||
|
scale: 4508.9354409599309
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 18,
|
||||||
|
levelValue: 18,
|
||||||
|
resolution: 5.3644180297851563e-6,
|
||||||
|
scale: 2254.4677204799655
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 19,
|
||||||
|
levelValue: 19,
|
||||||
|
resolution: 2.68220901489257815e-6,
|
||||||
|
scale: 1127.23386023998275
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 20,
|
||||||
|
levelValue: 20,
|
||||||
|
resolution: 1.341104507446289075e-6,
|
||||||
|
scale: 563.616930119991375
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data[wkid]
|
||||||
},
|
},
|
||||||
img_c: "http://{subDomain}.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}&tk=" +tk,
|
img_c: "http://{subDomain}.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}&tk=" +tk,
|
||||||
cia_c: "http://{subDomain}.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}&tk=" +tk
|
cia_c: "http://{subDomain}.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}&tk=" +tk
|
||||||
|
|
|
@ -4,6 +4,7 @@ import TianData from './Tmap'
|
||||||
import TileInfo from "@arcgis/core/layers/support/TileInfo";
|
import TileInfo from "@arcgis/core/layers/support/TileInfo";
|
||||||
import WebTileLayer from "@arcgis/core/layers/WebTileLayer";
|
import WebTileLayer from "@arcgis/core/layers/WebTileLayer";
|
||||||
import TileLayer from "@arcgis/core/layers/TileLayer.js";
|
import TileLayer from "@arcgis/core/layers/TileLayer.js";
|
||||||
|
import MapImageLayer from "@arcgis/core/layers/MapImageLayer.js";
|
||||||
import Draw from "@arcgis/core/views/draw/Draw.js";
|
import Draw from "@arcgis/core/views/draw/Draw.js";
|
||||||
import Polyline from "@arcgis/core/geometry/Polyline.js";
|
import Polyline from "@arcgis/core/geometry/Polyline.js";
|
||||||
import Polygon from "@arcgis/core/geometry/Polygon.js";
|
import Polygon from "@arcgis/core/geometry/Polygon.js";
|
||||||
|
@ -69,18 +70,23 @@ const ldMap = {
|
||||||
hightlayer: '',
|
hightlayer: '',
|
||||||
pngLayer: null,
|
pngLayer: null,
|
||||||
selectPng: '',
|
selectPng: '',
|
||||||
|
wkid: null,
|
||||||
//初始化地图
|
//初始化地图
|
||||||
initMap: function () {
|
initMap: function (wkid) {
|
||||||
|
|
||||||
self = this;
|
self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
let tileInfo = new TileInfo(TianData.infoData);
|
if(wkid==self.wkid){
|
||||||
|
resolve()
|
||||||
|
|
||||||
|
}else{
|
||||||
|
let tileInfo = new TileInfo(TianData.infoData(wkid));
|
||||||
|
self.wkid = wkid
|
||||||
let defaultInfo = {
|
let defaultInfo = {
|
||||||
subDomains: ["t1"],
|
subDomains: ["t1"],
|
||||||
spatialReference: {
|
spatialReference: {
|
||||||
wkid: 4326,
|
wkid: wkid,
|
||||||
},
|
},
|
||||||
tileInfo: tileInfo,
|
tileInfo: tileInfo,
|
||||||
}
|
}
|
||||||
|
@ -139,7 +145,7 @@ const ldMap = {
|
||||||
container: "viewDiv",
|
container: "viewDiv",
|
||||||
map: this.map,
|
map: this.map,
|
||||||
spatialReference: {
|
spatialReference: {
|
||||||
wkid: 4326,
|
wkid: wkid,
|
||||||
},
|
},
|
||||||
constraints: {
|
constraints: {
|
||||||
lods: lodsView,
|
lods: lodsView,
|
||||||
|
@ -253,6 +259,10 @@ const ldMap = {
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -301,10 +311,7 @@ const ldMap = {
|
||||||
self.initSketch()
|
self.initSketch()
|
||||||
},
|
},
|
||||||
removeAll() {
|
removeAll() {
|
||||||
|
|
||||||
|
|
||||||
self.view.map.removeAll();
|
self.view.map.removeAll();
|
||||||
|
|
||||||
},
|
},
|
||||||
addLayer: function (e) {
|
addLayer: function (e) {
|
||||||
|
|
||||||
|
@ -312,15 +319,17 @@ const ldMap = {
|
||||||
let data = {
|
let data = {
|
||||||
id: "layerName",
|
id: "layerName",
|
||||||
url: '',
|
url: '',
|
||||||
...e
|
...e,
|
||||||
|
spatialReference: {
|
||||||
|
wkid: self.wkid,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
var imgLayer = new TileLayer(data);
|
var imgLayer = new TileLayer(data);
|
||||||
|
|
||||||
this.map.layers.add(imgLayer);
|
this.map.add(imgLayer);
|
||||||
|
|
||||||
imgLayer.when((e) => {
|
imgLayer.when((e) => {
|
||||||
self.nowlayer = e
|
self.nowlayer = e
|
||||||
|
|
||||||
self.setCenter(e.fullExtent.center.x, e.fullExtent.center.y)
|
self.setCenter(e.fullExtent.center.x, e.fullExtent.center.y)
|
||||||
})
|
})
|
||||||
self.view.whenLayerView(imgLayer).then(function (layerView) {
|
self.view.whenLayerView(imgLayer).then(function (layerView) {
|
||||||
|
@ -915,7 +924,7 @@ const ldMap = {
|
||||||
type == 'left' ? paths[0][0] = nowXy : paths[0][paths[0].length - 1] = nowXy
|
type == 'left' ? paths[0][0] = nowXy : paths[0][paths[0].length - 1] = nowXy
|
||||||
const polyline = new Polyline({
|
const polyline = new Polyline({
|
||||||
paths: paths,
|
paths: paths,
|
||||||
spatialReference: self.view.spatialReference,
|
|
||||||
})
|
})
|
||||||
const length = geometryEngine.geodesicLength(polyline, "meters");
|
const length = geometryEngine.geodesicLength(polyline, "meters");
|
||||||
console.log(length.toFixed(2))
|
console.log(length.toFixed(2))
|
||||||
|
@ -945,7 +954,8 @@ const ldMap = {
|
||||||
self.sketchLayer.pointLayer.removeAll();
|
self.sketchLayer.pointLayer.removeAll();
|
||||||
self.lineLayer && self.lineLayer.removeAll()
|
self.lineLayer && self.lineLayer.removeAll()
|
||||||
self.loadelevationLayer.removeAll()
|
self.loadelevationLayer.removeAll()
|
||||||
|
self.hightlayer &&self.hightlayer.removeAll()
|
||||||
|
self.textLayer&&self.textLayer.removeAll()
|
||||||
},
|
},
|
||||||
//清除点位
|
//清除点位
|
||||||
removePoint() {
|
removePoint() {
|
||||||
|
@ -972,7 +982,7 @@ const ldMap = {
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
const polyline = new Polyline({
|
const polyline = new Polyline({
|
||||||
paths: item.path,
|
paths: item.path,
|
||||||
spatialReference: self.view.spatialReference,
|
|
||||||
|
|
||||||
})
|
})
|
||||||
const lineSymbol = self.returnLineSymbole(item.width, item.color)
|
const lineSymbol = self.returnLineSymbole(item.width, item.color)
|
||||||
|
@ -1202,7 +1212,7 @@ const ldMap = {
|
||||||
width: 0
|
width: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.pointType == 'y') {
|
if (data.pointType == 'y') {
|
||||||
|
@ -1232,7 +1242,7 @@ const ldMap = {
|
||||||
width: 10
|
width: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
});
|
});
|
||||||
self.pngLayer.add(pointGraphic, 10)
|
self.pngLayer.add(pointGraphic, 10)
|
||||||
},
|
},
|
||||||
|
@ -1256,7 +1266,7 @@ const ldMap = {
|
||||||
height: 20,
|
height: 20,
|
||||||
width: 20,
|
width: 20,
|
||||||
},
|
},
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
});
|
});
|
||||||
self.pngLayer.add(pointGraphic, 10)
|
self.pngLayer.add(pointGraphic, 10)
|
||||||
})
|
})
|
||||||
|
@ -1427,7 +1437,7 @@ const ldMap = {
|
||||||
const point = new Point({
|
const point = new Point({
|
||||||
x: data.path[0],
|
x: data.path[0],
|
||||||
y: data.path[1],
|
y: data.path[1],
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const newPointGraphic = new Graphic({
|
const newPointGraphic = new Graphic({
|
||||||
|
@ -1532,7 +1542,7 @@ const ldMap = {
|
||||||
}
|
}
|
||||||
const polygon = new Polygon({
|
const polygon = new Polygon({
|
||||||
rings: path,
|
rings: path,
|
||||||
spatialReference: self.view.spatialReference
|
//
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -1557,9 +1567,14 @@ const ldMap = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.type == "House") {
|
if (res.type == "House") {
|
||||||
|
try{
|
||||||
const areas = geodesicUtils.geodesicAreas([polygon], "square-meters");
|
const areas = geodesicUtils.geodesicAreas([polygon], "square-meters");
|
||||||
const area = Math.abs(areas[0]).toFixed(2)
|
const area = Math.abs(areas[0]).toFixed(2)
|
||||||
res.area = res.area || area
|
res.area = res.area || area
|
||||||
|
}catch{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
const newPolygonGraphic = new Graphic({
|
const newPolygonGraphic = new Graphic({
|
||||||
geometry: polygon,
|
geometry: polygon,
|
||||||
|
@ -1619,7 +1634,6 @@ const ldMap = {
|
||||||
color: [255, 255, 255, 255],
|
color: [255, 255, 255, 255],
|
||||||
font: { // autocasts as new Font()
|
font: { // autocasts as new Font()
|
||||||
size: 12,
|
size: 12,
|
||||||
|
|
||||||
weight: "bold"
|
weight: "bold"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2076,7 +2090,7 @@ const ldMap = {
|
||||||
let polyline = {
|
let polyline = {
|
||||||
type: "polyline", // autocasts as new Polyline()
|
type: "polyline", // autocasts as new Polyline()
|
||||||
paths: vertices,
|
paths: vertices,
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
}
|
}
|
||||||
const lineSymbol = self.returnLineSymbole(3, [0, 255, 255, 255])
|
const lineSymbol = self.returnLineSymbole(3, [0, 255, 255, 255])
|
||||||
let graphic = new Graphic({
|
let graphic = new Graphic({
|
||||||
|
@ -2164,7 +2178,7 @@ const ldMap = {
|
||||||
hasZ: false,
|
hasZ: false,
|
||||||
hasM: false,
|
hasM: false,
|
||||||
rings: [rings],
|
rings: [rings],
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
})
|
})
|
||||||
let graphic = new Graphic({
|
let graphic = new Graphic({
|
||||||
geometry: polygon,
|
geometry: polygon,
|
||||||
|
@ -2604,7 +2618,7 @@ const ldMap = {
|
||||||
|
|
||||||
const polygon = new Polygon({
|
const polygon = new Polygon({
|
||||||
rings: data.path,
|
rings: data.path,
|
||||||
spatialReference: self.view.spatialReference
|
|
||||||
|
|
||||||
})
|
})
|
||||||
let graphic = new Graphic({
|
let graphic = new Graphic({
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -63,6 +63,11 @@ export default defineConfig(({ mode, command }) => {
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (p) => p.replace(/^\/afterSales-api/, '')
|
rewrite: (p) => p.replace(/^\/afterSales-api/, '')
|
||||||
},
|
},
|
||||||
|
'/arcgis': {
|
||||||
|
target: 'http://139.224.252.239:6080',
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (p) => p.replace(/^\/arcgis-map/, '')
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
|
//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
|
||||||
|
|
Loading…
Reference in New Issue