diff --git a/src/components/earthMap/toolbar/AddModelWin.vue b/src/components/earthMap/toolbar/AddModelWin.vue index 460467e..c588279 100644 --- a/src/components/earthMap/toolbar/AddModelWin.vue +++ b/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 @@ -849,7 +849,7 @@ okBtn.onclick = function () { // console.log("currentModel",currentModel); // return - //判断所属区域 + // 判断所属区域 if (!currentModel.sceneId) { createMessage.warning('请选择所属区域', 2); return; @@ -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) => { diff --git a/src/utils/earthMap/sceneTreePopContextMenu.ts b/src/utils/earthMap/sceneTreePopContextMenu.ts index f281fa9..d4430e3 100644 --- a/src/utils/earthMap/sceneTreePopContextMenu.ts +++ b/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 | 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( - // { - // url: earthMapUrl.updateMapLine, - // params: submitData, - // }, - // { 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); - // } - // }) - // .catch((error) => { - // createMessage.error('修改失败', 2); - // }); + // 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: [ + // { + // expand: vNode.children[0].expand, + // title: vNode.children[0].title, + // ref: vNode.children[0].ref, + // children: vNode.children[0].children, + // }, + // { + // 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(e){ + // console.error(e); + + // } + }) + .catch((error) => { + createMessage.error(error, 2); + }); }) .run(); } \ No newline at end of file