Browse Source

sceneTreePopContextMenu 处理防区编辑功能

master
DIAMOND 8 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 selectHostDevice: any = ref(null);
let deviceNumList = ref([]); // let deviceNumList = ref([]); //
let selectDeviceNum = ref(null); // let selectDeviceNum = ref(null); //
let timer = ref(null); // let timer: any = ref(null); //
// //
let uploadFileCount = ref(1); let uploadFileCount = ref(1);
//ref //ref
@ -862,7 +862,6 @@
const poistions = currentModel.positions; const poistions = currentModel.positions;
if (poistions.length <= 0) { if (poistions.length <= 0) {
createMessage.warning('路径为空,无法创建', 2); createMessage.warning('路径为空,无法创建', 2);
return; return;
} }
// //
@ -939,7 +938,6 @@
break; break;
} }
// //
defHttp defHttp
.post({ url: '/military/msMapLine/add', params: submitData }, { isTransformResponse: false }) .post({ url: '/military/msMapLine/add', params: submitData }, { isTransformResponse: false })
.then((response) => { .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 setIconByRef from '@/utils/earthMap/setIconByRef';
import { createVNode, nextTick, render } from 'vue'; import { createVNode, nextTick, render } from 'vue';
import seneIdTreeSelect from '/@/components/earthMap/components/seneIdTreeSelect.vue'; import seneIdTreeSelect from '/@/components/earthMap/components/seneIdTreeSelect.vue';
import _ from 'lodash'; import _, { reject } from 'lodash';
import $mitt from '@/utils/earthMap/mitt'; import $mitt from '@/utils/earthMap/mitt';
import $ from 'jquery'; import $ from 'jquery';
@ -546,7 +546,7 @@ export default function sceneTreePopContextMenu({ item, vueObject }, earthUI, th
let tempData = sn.czmObject.toAllJSON(); let tempData = sn.czmObject.toAllJSON();
// 设置属性面板的确定按钮方法 // 设置属性面板的确定按钮方法
// 显示属性面板 // 显示属性面板
console.log("sn", sn); // console.log("sn", sn);
earthUI.showPropertyWindow(sn.czmObject); earthUI.showPropertyWindow(sn.czmObject);
nextTick(() => { 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 modelToolKey = windowsAttrList.filter((f) => f.indexOf(sn.czmObject.guid || sn.guid) > -1)[0];
const modelTool = mainUI.$refs[modelToolKey][0]; const modelTool = mainUI.$refs[modelToolKey][0];
console.log("modelTool",modelTool); // console.log("modelTool",modelTool);
// 对应处理方法 // 对应处理方法
handleNodeType(sn) handleNodeType(sn)
@ -584,7 +584,7 @@ export default function sceneTreePopContextMenu({ item, vueObject }, earthUI, th
let instance: ReturnType<typeof createVNode> | null = null; let instance: ReturnType<typeof createVNode> | null = null;
// 创建虚拟节点,传入模型的数据 // 创建虚拟节点,传入模型的数据
// let currentModel = window.$earth.getObject(sn.czmObject.xbsjGuid); // let currentModel = window.$earth.getObject(sn.czmObject.xbsjGuid);
console.log("currentModel",sn.czmObject); // console.log("currentModel",sn.czmObject);
instance = createVNode(seneIdTreeSelect, { currentModel: sn.czmObject}); instance = createVNode(seneIdTreeSelect, { currentModel: sn.czmObject});
// 渲染 // 渲染
render(instance, divCustom); render(instance, divCustom);
@ -668,7 +668,7 @@ export function handlerModelDelete(url, params) {
createMessage.success('删除成功'); createMessage.success('删除成功');
} else { } else {
createMessage.error('删除失败'); createMessage.error('删除失败');
console.log('asdasdasd'); // console.log('asdasdasd');
} }
}); });
} }
@ -934,29 +934,94 @@ export function propertiesWindowConfirm(propertiesWindow, sn, index) {
// material.XbsjODLineMaterial.totoalFrameCount = data.cycleFrame // material.XbsjODLineMaterial.totoalFrameCount = data.cycleFrame
break; break;
} }
console.log("submitData",submitData); // console.log("submitData",submitData);
console.log("modelData",modelData); // console.log("modelData",modelData);
// defHttp defHttp.put(
// .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, // expand: vNode.children[0].expand,
// params: submitData, // title: vNode.children[0].title,
// ref: vNode.children[0].ref,
// children: vNode.children[0].children,
// }, // },
// { isTransformResponse: false } // {
// ) // expand: vNode.children[1].expand,
// .then((res) => { // title: vNode.children[1].title,
// if (res.success) { // ref: vNode.children[1].ref,
// createMessage.success('修改成功!', 2); // children: vNode.children[1].children,
// sn.title = submitData.name; // },
// window.$earth.sceneTree.$refs['node_' + sn.ref].title = submitData.name; // {
// expand: vNode.children[2].expand,
// } else { // title: vNode.children[2].title,
// createMessage.error('修改失败', 2); // 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(e){
// .catch((error) => { // console.error(e);
// createMessage.error('修改失败', 2);
// }); // }
})
.catch((error) => {
createMessage.error(error, 2);
});
}) })
.run(); .run();
} }
Loading…
Cancel
Save