|
|
@ -110,7 +110,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
import { computed, defineComponent, ref, onMounted, onBeforeMount, getCurrentInstance, onBeforeUnmount, nextTick, watch } from 'vue'; |
|
|
|
import { computed, defineComponent, ref, onMounted, onBeforeMount, getCurrentInstance, onBeforeUnmount, nextTick, watch, createVNode, render } from 'vue'; |
|
|
|
import Window from '@/components/earthMap/components/Window.vue'; |
|
|
|
import AddModelWin from '@/components/earthMap/toolbar/AddModelWin.vue'; |
|
|
|
import RoamPathList from '@/components/earthMap/RoamPathList.vue'; |
|
|
@ -138,7 +138,7 @@ |
|
|
|
import AddMonitorPointCom from '@/components/earthMap/toolbar/AddMonitorPointCom.vue'; |
|
|
|
import AddWaveCom from '@/components/earthMap/toolbar/AddWaveCom.vue'; |
|
|
|
import AddRadarCom from '@/components/earthMap/toolbar/AddRadarCom.vue'; |
|
|
|
// import mitt from '/@/utils/mitt'; |
|
|
|
import seneIdTreeSelect from '/@/components/earthMap/components/seneIdTreeSelect.vue'; |
|
|
|
import $mitt from '@/utils/earthMap/mitt'; |
|
|
|
import { defHttp } from '/@/utils/http/axios'; |
|
|
|
import $ from 'jquery'; |
|
|
@ -1207,6 +1207,27 @@ |
|
|
|
//样式 |
|
|
|
el.children[2].style.padding = '0px'; |
|
|
|
el.children[2].style.transition = 'none'; |
|
|
|
|
|
|
|
//加入区域场景选择器 |
|
|
|
let divCustom = document.createElement("div"); |
|
|
|
divCustom.setAttribute("data-v-74b863e5", ""); |
|
|
|
divCustom.setAttribute("class", "flatten"); |
|
|
|
divCustom.setAttribute("style", "display: flex; margin-bottom: 20px;"); |
|
|
|
divCustom.innerHTML = |
|
|
|
` |
|
|
|
<label data-v-74b863e5="">所属区域</label> |
|
|
|
` |
|
|
|
let instance: ReturnType<typeof createVNode> | null = null; |
|
|
|
// 创建虚拟节点,传入模型的数据 |
|
|
|
instance = createVNode(seneIdTreeSelect,{currentModel}); |
|
|
|
// 渲染 |
|
|
|
render(instance, divCustom); |
|
|
|
// 父节点 |
|
|
|
let fatherNode = el.children[2].children[0].children[0] |
|
|
|
// 插入位置 |
|
|
|
let insertBeforeWhich = el.children[2].children[0].children[0].children[1]; |
|
|
|
fatherNode.insertBefore(divCustom,insertBeforeWhich); |
|
|
|
|
|
|
|
// 取消按钮元素 |
|
|
|
const cancelBtn = el.children[3].children[0]; |
|
|
|
// 确认按钮元素 |
|
|
@ -1215,6 +1236,13 @@ |
|
|
|
const xBtn = el.children[1].children[1]; |
|
|
|
// 设置确认按钮点击事件 |
|
|
|
okBtn.onclick = function () { |
|
|
|
// console.log("currentModel",currentModel); |
|
|
|
// return |
|
|
|
// 判断所属区域 |
|
|
|
if (!currentModel.sceneId) { |
|
|
|
createMessage.warning('请选择所属区域', 2); |
|
|
|
return; |
|
|
|
} |
|
|
|
$mitt.emit('windowCancel'); |
|
|
|
// 提交对象 |
|
|
|
const submitData: any = {}; |
|
|
@ -1226,6 +1254,8 @@ |
|
|
|
} |
|
|
|
// 模型名称 |
|
|
|
submitData.name = currentModel.name; |
|
|
|
// 场景区域 |
|
|
|
submitData.sceneId = currentModel.sceneId; |
|
|
|
// 线段编码 |
|
|
|
submitData.lineCode = currentModel.guid; |
|
|
|
// 首尾相连属性 |
|
|
@ -1297,6 +1327,10 @@ |
|
|
|
.then((response) => { |
|
|
|
// 成功后挂载节点到树中 |
|
|
|
if (response.success) { |
|
|
|
// 记录id |
|
|
|
currentModel.id = response.result; |
|
|
|
// 设置父节点 |
|
|
|
const parent = window.$earth.sceneTree.$refs[currentModel.sceneId]; |
|
|
|
// 生成叶子节点 |
|
|
|
const leaf = new window.XE.SceneTree.Leaf(currentModel); |
|
|
|
// 设置叶子节点标识 |
|
|
@ -1326,7 +1360,7 @@ |
|
|
|
// 生成显示在树上的节点,此为虚假的节点,关联关系为ref一个为 node_ref 一个为ref |
|
|
|
const node = { |
|
|
|
ref: 'node_' + response.result, |
|
|
|
title: currentModel.name, |
|
|
|
title:'<防区>'+ currentModel.name, |
|
|
|
expand: false, |
|
|
|
children: [ |
|
|
|
{ |
|
|
@ -1350,7 +1384,10 @@ |
|
|
|
], |
|
|
|
}; |
|
|
|
// 挂载并显示到树上 |
|
|
|
window.$earth.sceneTree.$refs.areas.children.push(node); |
|
|
|
// window.$earth.sceneTree.$refs.areas.children.push(node); |
|
|
|
parent.children.push(node); |
|
|
|
// 提示用户 |
|
|
|
createMessage.success('添加成功!', 2); |
|
|
|
} else { |
|
|
|
throw '新增防区数据出错'; |
|
|
|
} |
|
|
|