|
|
@@ -6,7 +6,7 @@ import { message, Modal } from 'ant-design-vue';
|
|
|
import { updatateGoaf } from './cad.api';
|
|
|
import { createApp, h } from 'vue';
|
|
|
import GoafPopup from './components/GoafPopup.vue';
|
|
|
-import { get } from 'lodash-es';
|
|
|
+import { get, remove } from 'lodash-es';
|
|
|
import { StatusColorEnum } from '/@/enums/jeecgEnum';
|
|
|
|
|
|
import customImage from '/@/assets/icons/location-icon.svg';
|
|
|
@@ -78,8 +78,8 @@ export function useMap2D(): UseMap2DReturn {
|
|
|
container.style.height = `${get(container, 'parentElement.clientHeight', 0) / appStore.heightScale}px`;
|
|
|
|
|
|
const res = await svc.openMap({
|
|
|
- mapid: wjId || 'c56c59154345',
|
|
|
- fileid: wjId || 'c56c59154345',
|
|
|
+ mapid: wjId || 'c96e7423dab1',
|
|
|
+ fileid: wjId || 'c96e7423dab1',
|
|
|
mapopenway: vjmap.MapOpenWay.GeomRender,
|
|
|
style,
|
|
|
});
|
|
|
@@ -485,6 +485,48 @@ export function useMap2D(): UseMap2DReturn {
|
|
|
sensorId = 1;
|
|
|
}
|
|
|
|
|
|
+ async function removePosition(__, id) {
|
|
|
+ const marker = allMarkers.find((marker) => marker.data.id === id);
|
|
|
+ if (marker) {
|
|
|
+ const confirmResult = await new Promise<boolean>((resolve) => {
|
|
|
+ Modal.confirm({
|
|
|
+ title: '移除布点',
|
|
|
+ content: '是否确认移除该布点?',
|
|
|
+ okText: '确定',
|
|
|
+ cancelText: '取消',
|
|
|
+ maskClosable: false,
|
|
|
+ centered: true,
|
|
|
+ onOk: () => resolve(true),
|
|
|
+ onCancel: () => resolve(false),
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!confirmResult) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ await updatateGoaf({
|
|
|
+ id,
|
|
|
+ xcoordinate: '',
|
|
|
+ ycoordinate: '',
|
|
|
+ });
|
|
|
+ } catch (apiError) {
|
|
|
+ message.error(`同步布点信息失败:${(apiError as Error).message}`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ marker.remove();
|
|
|
+ remove(allMarkers, (marker) => marker.data.id === id);
|
|
|
+ syncLocalStorage();
|
|
|
+
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ message.error(`布点信息不存在`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
map,
|
|
|
initMap2d,
|