Browse Source

MsMapLineForm 编辑线路功能

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

82
src/components/earthMap/Toolbar.vue

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

2
src/utils/earthMap/getLineInfo.ts

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

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

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

Loading…
Cancel
Save