Browse Source

sceneTreePopContextMenu 处理防区编辑功能

master
DIAMOND 11 months ago
parent
commit
a719cfcb56
  1. 4
      src/components/earthMap/toolbar/AddModelWin.vue
  2. 115
      src/utils/earthMap/sceneTreePopContextMenu.ts

4
src/components/earthMap/toolbar/AddModelWin.vue

@ -385,7 +385,7 @@
let selectHostDevice: any = ref(null);
let deviceNumList = ref([]); //
let selectDeviceNum = ref(null); //
let timer = ref(null); //
let timer: any = ref(null); //
//
let uploadFileCount = ref(1);
//ref
@ -862,7 +862,6 @@
const poistions = currentModel.positions;
if (poistions.length <= 0) {
createMessage.warning('路径为空,无法创建', 2);
return;
}
//
@ -939,7 +938,6 @@
break;
}
//
defHttp
.post({ url: '/military/msMapLine/add', params: submitData }, { isTransformResponse: false })
.then((response) => {

115
src/utils/earthMap/sceneTreePopContextMenu.ts

@ -13,7 +13,7 @@ import { handleNodeType } from '@/utils/earthMap/handleNodeType';
import setIconByRef from '@/utils/earthMap/setIconByRef';
import { createVNode, nextTick, render } from 'vue';
import seneIdTreeSelect from '/@/components/earthMap/components/seneIdTreeSelect.vue';
import _ from 'lodash';
import _, { reject } from 'lodash';
import $mitt from '@/utils/earthMap/mitt';
import $ from 'jquery';
@ -546,7 +546,7 @@ export default function sceneTreePopContextMenu({ item, vueObject }, earthUI, th
let tempData = sn.czmObject.toAllJSON();
// 设置属性面板的确定按钮方法
// 显示属性面板
console.log("sn", sn);
// console.log("sn", sn);
earthUI.showPropertyWindow(sn.czmObject);
nextTick(() => {
@ -555,7 +555,7 @@ export default function sceneTreePopContextMenu({ item, vueObject }, earthUI, th
// 找到该模型设置属性窗口
const modelToolKey = windowsAttrList.filter((f) => f.indexOf(sn.czmObject.guid || sn.guid) > -1)[0];
const modelTool = mainUI.$refs[modelToolKey][0];
console.log("modelTool",modelTool);
// console.log("modelTool",modelTool);
// 对应处理方法
handleNodeType(sn)
@ -584,7 +584,7 @@ export default function sceneTreePopContextMenu({ item, vueObject }, earthUI, th
let instance: ReturnType<typeof createVNode> | null = null;
// 创建虚拟节点,传入模型的数据
// let currentModel = window.$earth.getObject(sn.czmObject.xbsjGuid);
console.log("currentModel",sn.czmObject);
// console.log("currentModel",sn.czmObject);
instance = createVNode(seneIdTreeSelect, { currentModel: sn.czmObject});
// 渲染
render(instance, divCustom);
@ -668,7 +668,7 @@ export function handlerModelDelete(url, params) {
createMessage.success('删除成功');
} else {
createMessage.error('删除失败');
console.log('asdasdasd');
// console.log('asdasdasd');
}
});
}
@ -934,29 +934,94 @@ export function propertiesWindowConfirm(propertiesWindow, sn, index) {
// material.XbsjODLineMaterial.totoalFrameCount = data.cycleFrame
break;
}
console.log("submitData",submitData);
console.log("modelData",modelData);
// defHttp
// .put(
// console.log("submitData",submitData);
// console.log("modelData",modelData);
defHttp.put(
{
url: earthMapUrl.updateMapLine,
params: submitData,
},
{ isTransformResponse: false }
)
.then((res) => {
if (res.success) {
createMessage.success('正在修改防区!请稍等', 2);
// plan 2
// 直接刷新页面
setTimeout(() => {
location.reload();
}, 500);
sn.title = submitData.name;
window.$earth.sceneTree.$refs['node_' + sn.ref].title = '<防区>'+ submitData.name;
return sn
} else {
// createMessage.error('修改失败', 2);
reject("修改失败")
}
})
.then((res)=>{
console.log("修改成功!",sn);
// plan 1
// try{
// const currentNode = sn;
// // 目标
// const parent = window.$earth.sceneTree.$refs[currentNode.czmObject.sceneId];
// // console.log("parent",parent);
// console.log("parent.children",parent.children);
// // currentNode.cloneTo(parent.children, index);
// /**
// * 移动在树上的节点,此为虚假的节点
// * 关联关系为ref一个为 node_ref 一个为ref
// * Maximum call stack size exceeded
// * 对象太多
// * */
// let vNode = window.$earth.sceneTree.$refs['node_'+ currentNode.czmObject.id];
// let copyVNode = {
// ref: vNode.ref,
// title: vNode.title,
// expand: vNode.expand,
// children: [
// {
// url: earthMapUrl.updateMapLine,
// params: submitData,
// expand: vNode.children[0].expand,
// title: vNode.children[0].title,
// ref: vNode.children[0].ref,
// children: vNode.children[0].children,
// },
// { isTransformResponse: false }
// )
// .then((res) => {
// if (res.success) {
// createMessage.success('修改成功!', 2);
// sn.title = submitData.name;
// window.$earth.sceneTree.$refs['node_' + sn.ref].title = submitData.name;
// } else {
// createMessage.error('修改失败', 2);
// {
// expand: vNode.children[1].expand,
// title: vNode.children[1].title,
// ref: vNode.children[1].ref,
// children: vNode.children[1].children,
// },
// {
// expand: vNode.children[2].expand,
// title: vNode.children[2].title,
// ref: vNode.children[2].ref,
// children: vNode.children[2].children,
// },
// ],
// };
// console.log("vNode",vNode);
// console.log("copyVNode",copyVNode);
// // const node = window.$earth.sceneTree.$refs[nodeRef];
// // const childList = vNode.parent.children;
// // childList.splice(childList.indexOf(vNode), 1);
// // vNode.destroy();
// parent.children.push(copyVNode);
// }
// })
// .catch((error) => {
// createMessage.error('修改失败', 2);
// });
// catch(e){
// console.error(e);
// }
})
.catch((error) => {
createMessage.error(error, 2);
});
})
.run();
}
Loading…
Cancel
Save