Browse Source

MsMapLineForm 编辑线路功能

master
DIAMOND 11 months ago
parent
commit
993d7de6a8
  1. 84
      src/components/earthMap/Toolbar.vue
  2. 2
      src/utils/earthMap/getLineInfo.ts
  3. 24
      src/views/military/modules/earthMap/msMapLine/components/MsMapLineForm.vue

84
src/components/earthMap/Toolbar.vue

@ -1104,9 +1104,33 @@
addRadarComShow.value = true;
}
// , msMapLineHandler
function addArea(msMapLineHandler = null) {
function addArea(msMapLineHandler: any = {}) {
// console.log("",msMapLineHandler);
let objConfig: any = {}
if (typeof msMapLineHandler === 'object' && Object.keys(msMapLineHandler).length != 0 && msMapLineHandler.create){
// -
objConfig.from = "msMapLineHandler.create";
}
else if (typeof msMapLineHandler === 'object' && Object.keys(msMapLineHandler).length != 0) {
// -
//
// console.log("msMapLineHandler",msMapLineHandler);
let config = {
id: msMapLineHandler.id,
name: msMapLineHandler.name,
sceneId: msMapLineHandler.sceneId,
// guid: msMapLineHandler.lineCode,
loop: Boolean(msMapLineHandler.isLoop),
depthTest: Boolean(msMapLineHandler.isDepthCheck),
width: msMapLineHandler.width,
arcType: msMapLineHandler.interpolation,
positions: JSON.parse(msMapLineHandler.positions),
material: JSON.parse(msMapLineHandler.material),
from : "msMapLineHandler.edit"
}
return addPolyline(config)
}
$mitt.emit('drawShapeShow', { show: true, title: '防区创建工具', from: 'addArea' });
$mitt.on('addAreaFinished', (t: any) => {
// console.log('addAreaFinished', t);
@ -1119,15 +1143,15 @@
if (n == false) {
//
let positions: any = [];
// let positions: any = [];
if (t._polygon) {
positions = t._polygon._polyline.positions;
objConfig.positions = t._polygon._polyline.positions;
}
//线
else if (t._polyline) {
positions = t._polyline.positions;
objConfig.positions = t._polyline.positions;
} else {
positions = t.positions;
objConfig.positions = t.positions;
}
//
@ -1138,7 +1162,7 @@
*
*/
nextTick(() => {
addPolyline(positions,msMapLineHandler);
addPolyline(objConfig);
});
} else {
}
@ -1151,9 +1175,8 @@
}
/**
* @params 需要调用 addArea 方法进行绘图获取坐标点position
* @params msMapLineHandler标识 后台防区管理调用
*/
function addPolyline(positions: any = null, msMapLineHandler:any =null) {
function addPolyline(objConf: any = null) {
// console.log('positions', positions);
@ -1163,35 +1186,18 @@
const currentModel = new window.XE.Obj.Polyline(window.$earth);
//
const objConfig: any = {
positions: positions,
positions: objConf.positions,
};
/**
* 后台防区管理调用
* */
// if (typeof msMapLineHandler === 'object' && Object.keys(msMapLineHandler).length != 0) {
// console.log("");
// //
// //
// objConfig.loop = msMapLineHandler.isLoop;
// objConfig.depthTest = msMapLineHandler.isDepthCheck;
// objConfig.width = msMapLineHandler.width;
// objConfig.arcType = msMapLineHandler.interpolation;
// objConfig.positions = JSON.parse(msMapLineHandler.positions);
// objConfig.material = JSON.parse(msMapLineHandler.material);
// }
//
Object.assign(objConfig, objConf);
console.log("objConfig",objConfig);
//
currentModel.xbsjFromJSON(objConfig);
// console.log('currentModel', currentModel);
console.log('currentModel', currentModel);
// ui
const earthUI = window.$uia;
// console.log("msMapLineHandler",msMapLineHandler);
//return
if(msMapLineHandler){
$mitt.emit('toMsMapLineForm',currentModel)
return
}
// ui
earthUI.showPropertyWindow(currentModel);
nextTick(() => {
@ -1236,8 +1242,13 @@
const xBtn = el.children[1].children[1];
//
okBtn.onclick = function () {
// console.log("currentModel",currentModel);
// return
//return
if(currentModel.from == "msMapLineHandler.edit" || currentModel.from == "msMapLineHandler.create"){
$mitt.emit('toMsMapLineForm',currentModel)
return
}
//
if (!currentModel.sceneId) {
createMessage.warning('请选择所属区域', 2);
@ -1398,6 +1409,11 @@
};
//
cancelBtn.onclick = xBtn.onclick = function () {
//return
if(currentModel.from == "msMapLineHandler.edit" || currentModel.from == "msMapLineHandler.create"){
$mitt.emit('toMsMapLineForm')
return
}
$mitt.off('windowCancel');
// dom
el.remove();

2
src/utils/earthMap/getLineInfo.ts

@ -14,7 +14,7 @@ import $ from 'jquery';
let userStore = useUserStore();
let store = useEarthMapStore();
export default function getLineInfo(models, type) {
// console.log("加载防区");
console.log("加载防区");
return new Promise((resolve, reject) => {
//请求线路信息

24
src/views/military/modules/earthMap/msMapLine/components/MsMapLineForm.vue

@ -95,11 +95,19 @@
</a-row>
</a-form>
<a-modal title="绘制区域" style="top: 20px" :visible="mapVisible" @ok="destroyed" @cancel="destroyed" width="80vw" destroyOnClose wrapClassName="EarthMap">
<!-- :createBBHLineOpen="true"
:getLineInfoShow="true" -->
<a-modal title="绘制区域" style="top: 20px" :visible="mapVisible"
@ok="destroyed" @cancel="destroyed" width="80vw"
destroyOnClose
wrapClassName="EarthMap"
:footer="null"
>
<a-row style="height: 80vh;">
<a-col :span="24">
<EarthComp ref="earth" :msMapLineHandler="formData.id ? formData: {}"/>
<EarthComp ref="earth"
:msMapLineHandler="formData.id ? formData: {create: true}"
/>
</a-col>
</a-row>
</a-modal>
@ -175,7 +183,7 @@ const validatorRules = {
isLoop: [{ required: true, message: '请选择是否首尾相连!' },],
isDepthCheck: [{ required: true, message: '请选择是否深度检测!' },],
width: [{ required: true, message: '请输入宽度!' },],
dashLength: [{ required: true, message: '请输入虚线长度!' },],
// dashLength: [{ required: true, message: '线!' },],
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
@ -342,7 +350,9 @@ function destroyed() {
//
function areaAssign(currentModel) {
//
// formData.name = currentModel.name
formData.name = currentModel.name
//
formData.sceneId = currentModel.sceneId;
// 线
formData.lineCode = currentModel.guid
//
@ -417,7 +427,11 @@ onMounted(() => {
$mitt.on('toMsMapLineForm', (currentModel: any) => {
console.log("currentModel", currentModel);
//
if(currentModel)
areaAssign(currentModel)
nextTick(()=>{
destroyed()
})
})
})

Loading…
Cancel
Save