diff --git a/src/components/earthMap/Toolbar.vue b/src/components/earthMap/Toolbar.vue
index 1cb3b8a..f56f6a1 100644
--- a/src/components/earthMap/Toolbar.vue
+++ b/src/components/earthMap/Toolbar.vue
@@ -44,10 +44,7 @@
-
+
@@ -131,10 +128,9 @@
import { defHttp } from '/@/utils/http/axios';
import $ from 'jquery';
import { useUserStore } from '/@/store/modules/user';
+ import { useEarthMapStore } from '/@/store/modules/earthMap';
import { useMessage } from '/@/hooks/web/useMessage';
- import TestCom from './TestCom.vue';
-
export default defineComponent({
name: 'Toolbar',
props: {
@@ -155,6 +151,7 @@
const { proxy }: any = getCurrentInstance();
// const { userInfo } = useUserStore();
const userStore = useUserStore();
+ const store = useEarthMapStore();
const { createMessage } = useMessage();
let _viewer = ref();
let show = ref(true);
@@ -181,7 +178,7 @@
const notificationModelShow = ref(false);
const WarnListShow = ref(false);
const drawShapeShow = ref(false);
- const drawShapePackage = ref(null);
+ const drawShapePackage: any = ref(null);
const drawShapeMilitaryShow = ref(false);
//计算属性
@@ -954,12 +951,18 @@
//绘画图形
function drawShape() {
+ //基本绘图没有被使用中,则关闭
+ if(drawShapeMilitaryShow.value && store.shapeUsing == false)
+ {drawShapeMilitaryShow.value = false}
//清空数据
drawShapePackage.value = null
drawShapeShow.value = !drawShapeShow.value;
}
//绘画图形-军事态势
function drawShapeMilitary() {
+ //基本绘图没有被使用中,则关闭
+ if(drawShapeShow.value && store.shapeUsing == false)
+ {drawShapeShow.value = false}
drawShapeMilitaryShow.value = !drawShapeMilitaryShow.value;
}
@@ -1064,23 +1067,6 @@
$mitt.off('warnInfoMan');
});
- //测试研究 showPropertyWindow
- function test() {
- const currentModel = new window.XE.Obj.Polyline(window.$earth);
- // debugger
- window.$uia.showPropertyWindow({}, { component: TestCom });
- nextTick(() => {});
- // window.$uia.tools.push({
- // component: currentModel,
- // ref: "sdfcsdcfsdc",
- // guid: "sdfcsdcfsdc",
- // item: () => {
- // return {}
- // },
- //mrq添加
- // nextczm: options && options.jsonSchema
- // })
- }
return {
show,
@@ -1150,7 +1136,6 @@
drawShapePackage,
drawShapeMilitaryShow,
drawShapeMilitaryIMG,
- test,
};
},
});
diff --git a/src/components/earthMap/ToolbarShow.vue b/src/components/earthMap/ToolbarShow.vue
index 61fda1a..91d0c27 100644
--- a/src/components/earthMap/ToolbarShow.vue
+++ b/src/components/earthMap/ToolbarShow.vue
@@ -44,10 +44,7 @@
-
+
@@ -127,8 +124,8 @@
import { defHttp } from '/@/utils/http/axios';
import $ from 'jquery';
import { useUserStore } from '/@/store/modules/user';
-
- import TestCom from './TestCom.vue';
+ import { useEarthMapStore } from '/@/store/modules/earthMap';
+ import { useMessage } from '/@/hooks/web/useMessage';
export default defineComponent({
name: 'ToolbarShow',
@@ -149,6 +146,8 @@
const { proxy }: any = getCurrentInstance();
// const { userInfo } = useUserStore();
const userStore = useUserStore();
+ const store = useEarthMapStore();
+ const { createMessage } = useMessage();
let _viewer = ref();
let show = ref(true);
let modalVisible = ref(false);
@@ -938,12 +937,19 @@
notificationModelShow.value = !notificationModelShow.value;
}
- //绘画图形
- function drawShape() {
+ //绘画图形
+ function drawShape() {
+ //基本绘图没有被使用中,则关闭
+ if(drawShapeMilitaryShow.value && store.shapeUsing == false)
+ {drawShapeMilitaryShow.value = false}
+ //清空数据
drawShapeShow.value = !drawShapeShow.value;
}
//绘画图形-军事态势
function drawShapeMilitary() {
+ //基本绘图没有被使用中,则关闭
+ if(drawShapeShow.value && store.shapeUsing == false)
+ {drawShapeShow.value = false}
drawShapeMilitaryShow.value = !drawShapeMilitaryShow.value;
}
@@ -1046,23 +1052,6 @@
$mitt.off('warnInfoMan');
});
- //测试研究 showPropertyWindow
- function test() {
- const currentModel = new window.XE.Obj.Polyline(window.$earth);
- // debugger
- window.$uia.showPropertyWindow({}, { component: TestCom });
- nextTick(() => {});
- // window.$uia.tools.push({
- // component: currentModel,
- // ref: "sdfcsdcfsdc",
- // guid: "sdfcsdcfsdc",
- // item: () => {
- // return {}
- // },
- //mrq添加
- // nextczm: options && options.jsonSchema
- // })
- }
return {
show,
@@ -1130,7 +1119,7 @@
drawShapeShow,
drawShapeMilitaryShow,
drawShapeMilitaryIMG,
- test,
+
};
},
});
diff --git a/src/components/earthMap/toolbar/AddKeyControlArea.vue b/src/components/earthMap/toolbar/AddKeyControlArea.vue
index 7a18805..a2fbc4b 100644
--- a/src/components/earthMap/toolbar/AddKeyControlArea.vue
+++ b/src/components/earthMap/toolbar/AddKeyControlArea.vue
@@ -280,7 +280,7 @@
// store.keyAreaPos.push(point);
// console.log("point", point);
positions.value.push(point);
- }, window.Cesium.ScreenSpaceEventType.LEFT_CLICK); //右键事件
+ }, window.Cesium.ScreenSpaceEventType.LEFT_CLICK); //左键事件
}
// 关闭记录位置
diff --git a/src/components/earthMap/toolbar/DrawShape.vue b/src/components/earthMap/toolbar/DrawShape.vue
index 82ab617..ae49bf4 100644
--- a/src/components/earthMap/toolbar/DrawShape.vue
+++ b/src/components/earthMap/toolbar/DrawShape.vue
@@ -253,9 +253,14 @@ onMounted(() => {
}
})
-
+onBeforeUnmount(() => {
+ // 结束使用
+ store.shapeUsing = false
+})
function draw(type: String = '') {
+ // 正在使用组件,创建中
+ store.shapeUsing = true
let t = null
switch (type) {
case 'GeoPolygon':
@@ -322,11 +327,11 @@ function draw(type: String = '') {
console.log("错误");
break;
}
- //判断是否被创建区域组件调用,有则返回实体 t,交给调用组件处理
+ // 判断是否被创建区域组件调用,有则返回实体 t,交给调用组件处理
if (props.drawShapePackage &&
props.drawShapePackage.from &&
props.drawShapePackage.from == 'addArea') {
- $mitt.emit('addAreaFinished', t)
+ $mitt.emit('addAreaFinished', t)
return
}
else
diff --git a/src/components/earthMap/toolbar/DrawShapeMilitary.vue b/src/components/earthMap/toolbar/DrawShapeMilitary.vue
index 84fc258..d40d3cc 100644
--- a/src/components/earthMap/toolbar/DrawShapeMilitary.vue
+++ b/src/components/earthMap/toolbar/DrawShapeMilitary.vue
@@ -88,13 +88,15 @@
-->
-
+
+
+
@@ -257,7 +259,15 @@ const activeKey = ref(['1', '2', '3', '4']);
const customStyle = 'background: rgb(255 255 255 / 0%);border-radius: 4px;border: 0;overflow: hidden';
const earthUI = window.$uia // 获取地图ui对象
+//移除事件
+onBeforeUnmount(()=>{
+ //说明该组件结束使用
+ store.shapeUsing = false
+})
+
function draw(type: String = '') {
+ //正在使用组件,创建中
+ store.shapeUsing = true
let t = null
switch (type) {
case 'GeoPolygon':
diff --git a/src/store/modules/earthMap.ts b/src/store/modules/earthMap.ts
index 468a952..58eae2b 100644
--- a/src/store/modules/earthMap.ts
+++ b/src/store/modules/earthMap.ts
@@ -8,6 +8,7 @@ export const useEarthMapStore = defineStore({
token: '',
customPrimitiveList: [],// 视频图元数组
customPrimitive: null,
+ shapeUsing: false, //判断绘画组件使用状态
shapeList: [], //绘画数组(区域)
shapeShowList: [], //绘画存储(临时)
keyAreaPos: [], //记录创建防区的点位,重点管控区域
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 6981c06..ddb053b 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -29,7 +29,7 @@ interface UserState {
lastUpdateTime: number;
tenantid?: string | number;
loginInfo?: Nullable;
- customPrimitiveList
+
}
export const useUserStore = defineStore({
@@ -51,7 +51,6 @@ export const useUserStore = defineStore({
tenantid: '',
//登录返回信息
loginInfo: null,
- customPrimitiveList: [],
}),
getters: {
getUserInfo(): UserInfo {
diff --git a/src/utils/earthMap/earthDraw.ts b/src/utils/earthMap/earthDraw.ts
index a41deae..38d4a2e 100644
--- a/src/utils/earthMap/earthDraw.ts
+++ b/src/utils/earthMap/earthDraw.ts
@@ -25,12 +25,17 @@ const earthUI = window.$uia // 获取地图ui对象
//绘画图形初始化
export async function drawInit() {
+ // console.log("sceneId",userStore.userInfo?.sceneId);
+ /**
+ * listBySceneId 查询 SceneId以及SceneId为空的列表
+ */
defHttp.get({
- url: '/military/dtMapDraw/list',
+ url: '/military/dtMapDraw/listBySceneId',
params: {
sceneId: userStore.userInfo?.sceneId
}
}, { isTransformResponse: false }).then((res) => {
+ // console.log("listBySceneId",res);
res.result.records.forEach((res) => {
let item = res;
let config = JSON.parse(item.drawData);
@@ -138,10 +143,14 @@ export function drawShow(obj: any, config: any, state: Number) {
obj.showProperty = (cancel: Function = () => { }, ok: Function = () => { }, cancelText = "取消", okText = "确认",) => {
return popup("属性", [h(basicEditing, { obj: obj, cancel: cancel, ok: ok, cancelText: cancelText, okText: okText })], "basicEditing");
}
+ //状态为0,保存
if (state == 0) {
saveInStore(obj)
}
+ //添加鼠标事件 ,双击结束创建/编辑
+ listenMouseHandler(obj)
+
/**
* 由于返回具有 `primitive` 属性的对象,该属性包含场景中特定窗口坐标处的第一个(顶部)图元,
* 如果该位置没有任何内容,则返回未定义的对象。其他属性可能会根据基元的类型进行设置,并可用于进一步识别拾取的对象。
@@ -150,7 +159,7 @@ export function drawShow(obj: any, config: any, state: Number) {
*/
nextTick(() => {
if (obj._polygon) {
- obj._polygon.customProp = {
+ obj._polygon.customProp = {
id: obj.id,
drawType: obj.customProp.drawType,
remark: obj.customProp.remark,
@@ -162,12 +171,12 @@ export function drawShow(obj: any, config: any, state: Number) {
// Object.assign(obj._polygon, obj)
}
if (obj._polyline) {
- obj._polyline.customProp = {
+ obj._polyline.customProp = {
id: obj.id,
drawType: obj.customProp.drawType,
remark: obj.customProp.remark,
sceneId: obj.customProp.sceneId
- }
+ }
obj._polyline.id = obj.id
obj._polyline.name = '绘画'
// obj._polyline = Object.assign({},obj)
@@ -178,6 +187,29 @@ export function drawShow(obj: any, config: any, state: Number) {
return obj
}
+function listenMouseHandler(obj: any) {
+ //添加鼠标事件 ,双击结束创建/编辑
+ let handler = new window.Cesium.ScreenSpaceEventHandler(window.$earth.czm.viewer.scene.canvas);
+ handler.setInputAction(() => {
+ if (obj.creating || obj.editing) {
+ obj.creating = false
+ obj.editing = false
+ console.log("完成", obj);
+ }
+
+ }, window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); //鼠标左键双击事件
+ // obj.ondbclick = () => {
+ // obj.creating = false
+ // obj.editing = false
+ // console.log("完成", obj);
+ // }
+ // obj.onclick = () => {
+ // obj.creating = false
+ // obj.editing = false
+ // console.log("完成222", obj);
+ // }
+}
+
//区域编辑ui窗体
export function editUI(obj: any, cancel: Function = null, ok: Function = null) {
obj.creating = true;
diff --git a/src/views/earthMap/edit/EarthComp.vue b/src/views/earthMap/edit/EarthComp.vue
index 97d7cc1..667935e 100644
--- a/src/views/earthMap/edit/EarthComp.vue
+++ b/src/views/earthMap/edit/EarthComp.vue
@@ -1285,14 +1285,14 @@
// console.log("type",type);
return new Promise((resolve, reject) => {
- let submitData: any = undefined;
- // 如果进入单位是岛屿,则只加载相关岛屿信息
- if (type == 2) {
- submitData = {
- sysOrgCode: that.orgCode,
+ let submitData: any = {
pageNo: 1,
pageSize: 99999,
};
+
+ // 如果进入单位是岛屿,则只加载相关岛屿信息
+ if (type == 2) {
+ submitData.sysOrgCode = that.orgCode
}
//请求线路信息
defHttp.get({ url: this.url.queryLineList, params: submitData }, { isTransformResponse: false }).then(async (res) => {
@@ -2151,6 +2151,10 @@
let that: any = this;
this._handler = new window.Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
+ //取消双击旋转事件
+ this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
+ window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
+ );
/* MOUSE事件(有性能问题,慎用!) */
/* 鼠标左键事件 */
@@ -2415,10 +2419,14 @@
const el = modelTool.$el
// this.cloneEl(el)
// 样式
+ el.style.width = '380px' //宽度
el.children[2].style.padding = '0px'
el.children[2].style.transition = 'none'
+ el.children[2].children[0].children[0].style.minWidth = '370px'
// 关闭名称input
el.children[2].children[0].children[0].children[0].style.display = 'none';
+ // 关闭创建按钮
+ el.children[2].children[0].children[0].children[1].children[0].children[1].style.display = 'none';
// 关闭贴地
el.children[2].children[0].children[0].children[2].children[0].style.display = 'none';
// 关闭拉伸
diff --git a/src/views/military/modules/earthMap/scene/model/mapModel/EarthMapModal.vue b/src/views/military/modules/earthMap/scene/model/mapModel/EarthMapModal.vue
index debdbf2..6f4f14f 100644
--- a/src/views/military/modules/earthMap/scene/model/mapModel/EarthMapModal.vue
+++ b/src/views/military/modules/earthMap/scene/model/mapModel/EarthMapModal.vue
@@ -17,9 +17,9 @@
-
+
@@ -444,9 +444,9 @@ function updateArea() {
// emit('update:areaData', JSON.stringify(areaData));
// }
// }
-const test = function () {
- _viewer.camera.moveLeft(100000)
-}
+// const test = function () {
+// _viewer.camera.moveLeft(100000)
+// }
const mapManageShow = ref(false);
const modelText = ref('2D');