Browse Source

更新toolbar功能

master
DIAMOND 8 months ago
parent
commit
9c2686191e
  1. 45
      src/components/earthMap/Toolbar.vue

45
src/components/earthMap/Toolbar.vue

@ -110,7 +110,7 @@
</template> </template>
<script lang="ts"> <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 Window from '@/components/earthMap/components/Window.vue';
import AddModelWin from '@/components/earthMap/toolbar/AddModelWin.vue'; import AddModelWin from '@/components/earthMap/toolbar/AddModelWin.vue';
import RoamPathList from '@/components/earthMap/RoamPathList.vue'; import RoamPathList from '@/components/earthMap/RoamPathList.vue';
@ -138,7 +138,7 @@
import AddMonitorPointCom from '@/components/earthMap/toolbar/AddMonitorPointCom.vue'; import AddMonitorPointCom from '@/components/earthMap/toolbar/AddMonitorPointCom.vue';
import AddWaveCom from '@/components/earthMap/toolbar/AddWaveCom.vue'; import AddWaveCom from '@/components/earthMap/toolbar/AddWaveCom.vue';
import AddRadarCom from '@/components/earthMap/toolbar/AddRadarCom.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 $mitt from '@/utils/earthMap/mitt';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import $ from 'jquery'; import $ from 'jquery';
@ -1207,6 +1207,27 @@
// //
el.children[2].style.padding = '0px'; el.children[2].style.padding = '0px';
el.children[2].style.transition = 'none'; 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]; const cancelBtn = el.children[3].children[0];
// //
@ -1215,6 +1236,13 @@
const xBtn = el.children[1].children[1]; const xBtn = el.children[1].children[1];
// //
okBtn.onclick = function () { okBtn.onclick = function () {
// console.log("currentModel",currentModel);
// return
//
if (!currentModel.sceneId) {
createMessage.warning('请选择所属区域', 2);
return;
}
$mitt.emit('windowCancel'); $mitt.emit('windowCancel');
// //
const submitData: any = {}; const submitData: any = {};
@ -1226,6 +1254,8 @@
} }
// //
submitData.name = currentModel.name; submitData.name = currentModel.name;
//
submitData.sceneId = currentModel.sceneId;
// 线 // 线
submitData.lineCode = currentModel.guid; submitData.lineCode = currentModel.guid;
// //
@ -1297,6 +1327,10 @@
.then((response) => { .then((response) => {
// //
if (response.success) { if (response.success) {
// id
currentModel.id = response.result;
//
const parent = window.$earth.sceneTree.$refs[currentModel.sceneId];
// //
const leaf = new window.XE.SceneTree.Leaf(currentModel); const leaf = new window.XE.SceneTree.Leaf(currentModel);
// //
@ -1326,7 +1360,7 @@
// ref node_ref ref // ref node_ref ref
const node = { const node = {
ref: 'node_' + response.result, ref: 'node_' + response.result,
title: currentModel.name, title:'<防区>'+ currentModel.name,
expand: false, expand: false,
children: [ 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 { } else {
throw '新增防区数据出错'; throw '新增防区数据出错';
} }

Loading…
Cancel
Save