From 04aacc3818ac53ee1d35c5cabc304a77aa0471b0 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Thu, 14 May 2020 15:05:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=A9=E7=90=86?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E5=88=9B=E5=BB=BA=E9=80=BB=E8=BE=91=E5=8C=BA?= =?UTF-8?q?=E6=AE=B5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapoperate/section/logicBlock.vue | 123 +++++++++--------- 1 file changed, 59 insertions(+), 64 deletions(-) diff --git a/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue b/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue index 2c2e07e4c..3fad1a2d5 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue @@ -77,7 +77,7 @@ export default { methods:{ // 生成逻辑区段 editSectionNum() { - const models = []; + let models = []; this.addList = []; const counts = 0; const sectionPoints = [...this.editModel.points]; // 获取区段点 @@ -87,59 +87,9 @@ export default { lineLength = lengthFact / this.logicNum; // 均分逻辑区段偏移量 } if (sectionPoints.length === 2) { - const triangle = new JTriangle(sectionPoints[0], sectionPoints[1]); - const offset = Math.sqrt(triangle.abspowz) / this.logicNum; - for (let i = 0; i < this.logicNum; i++) { - const points = [ - { x: sectionPoints[0].x + triangle.getCos(offset * i), y: sectionPoints[0].y + triangle.getSin(offset * i) }, - { x: sectionPoints[0].x + triangle.getCos(offset * (i + 1)), y: sectionPoints[0].y + triangle.getSin(offset * (i + 1)) } - ]; - const param = this.addLogicalSection(this.editModel, points, counts + i, lineLength, this.logicNum); - models.push(param); - this.addList.push(param); - } + models = this.createLogicalSections(sectionPoints, counts, lineLength); } else { - const triangleList = []; - const pointLength = [0]; - let totalLength = 0; - for (let i = 1; i < sectionPoints.length; i++) { - const triangle = new JTriangle(sectionPoints[i - 1], sectionPoints[i]); - triangleList.push(triangle); - totalLength += Math.floor(Math.sqrt(triangle.abspowz)); - pointLength.push(totalLength); - } - const offset = this.logicNum ? Math.floor(totalLength / this.logicNum) : 0; - let startPoint = sectionPoints[0]; - let startIndex = 1; - for (let i = 0; i < this.logicNum; i++) { - const rectLength = (i + 1) * offset; - let flag = true; - for (let index = 0; index < pointLength.length; index++) { - if (rectLength <= pointLength[index] && flag) { - const points = [{x: startPoint.x, y: startPoint.y}]; - let surplusLength = rectLength - pointLength[index - 1]; - if (startIndex === index) { - surplusLength = offset; - } - for (let j = startIndex; j <= index; j++) { - if (i === this.logicNum - 1 && j === index) { - points.push(sectionPoints[sectionPoints.length - 1]); - } else if (j === index) { - points.push({x: points[points.length - 1].x + triangleList[index - 1].getCos(surplusLength), - y: points[points.length - 1].y + triangleList[index - 1].getSin(surplusLength)}); - } else if (index - startIndex > 1) { - points.push(sectionPoints[j]); - } - } - startIndex = index; - const param = this.addLogicalSection(this.editModel, points, counts + i, lineLength, this.logicNum); - startPoint = {x:points[points.length - 1].x, y:points[points.length - 1].y }; - models.push(param); - this.addList.push(param); - flag = false; - } - } - } + models = this.createLogicalMoerScetion(sectionPoints, counts, lineLength); } let logicSectionCodeList = []; models.forEach(item=> { @@ -157,25 +107,70 @@ export default { models.push(model); this.$emit('updateMapModel', models); }, - handleDelete(index, row) { - row.num = 0; - }, - // 创建逻辑区段 - createLogicalSections(num, beg, end, model, counts, lineLength, totalNum) { + // 2点直线 创建逻辑区段 + createLogicalSections(sectionPoints, counts, lineLength) { const models = []; - const triangle = new JTriangle(beg, end); - const offset = Math.sqrt(triangle.abspowz) / num; - for (let i = 0; i < num; i++) { + const triangle = new JTriangle(sectionPoints[0], sectionPoints[1]); + const offset = Math.sqrt(triangle.abspowz) / this.logicNum; + for (let i = 0; i < this.logicNum; i++) { const points = [ - { x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) }, - { x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) } + { x: sectionPoints[0].x + triangle.getCos(offset * i), y: sectionPoints[0].y + triangle.getSin(offset * i) }, + { x: sectionPoints[0].x + triangle.getCos(offset * (i + 1)), y: sectionPoints[0].y + triangle.getSin(offset * (i + 1)) } ]; - const param = this.addLogicalSection(model, points, counts + i, lineLength, totalNum); + const param = this.addLogicalSection(this.editModel, points, counts + i, lineLength, this.logicNum); models.push(param); this.addList.push(param); } return models; }, + // 物理区段 多段折线 创建逻辑区段 + createLogicalMoerScetion(sectionPoints, counts, lineLength) { + const models = []; + const triangleList = []; + let totalLength = 0; // 多段直线 长度 + const pointLength = [0]; + for (let i = 1; i < sectionPoints.length; i++) { + const triangle = new JTriangle(sectionPoints[i - 1], sectionPoints[i]); + triangleList.push(triangle); + totalLength += Math.floor(Math.sqrt(triangle.abspowz)); + pointLength.push(totalLength); + } + const offset = this.logicNum ? Math.floor(totalLength / this.logicNum) : 0; // 均分偏移距离 + let startPoint = sectionPoints[0]; + let startIndex = 1; + for (let i = 0; i < this.logicNum; i++) { + const rectLength = (i + 1) * offset; + const points = [{x: startPoint.x, y: startPoint.y}]; + let flag = true; + for (let index = 0; index < pointLength.length; index++) { + if (rectLength <= pointLength[index] && flag) { + let surplusLength = offset; + if (index - startIndex >= 1) { + surplusLength = rectLength - pointLength[index - 1]; + } + for (let j = startIndex; j <= index; j++) { + if (i == this.logicNum - 1) { + points.push(sectionPoints[sectionPoints.length - 1]); // 最后一个添加 + } else if (j == index) { + points.push({x: points[points.length - 1].x + triangleList[index - 1].getCos(surplusLength), + y: points[points.length - 1].y + triangleList[index - 1].getSin(surplusLength)}); + } else if (index - startIndex >= 1) { + points.push(sectionPoints[j]); + } + } + startIndex = index; + if (points.length > 1) { + const param = this.addLogicalSection(this.editModel, points, counts + i, lineLength, this.logicNum); + models.push(param); + this.addList.push(param); + startPoint = {x: points[points.length - 1].x, y: points[points.length - 1].y }; // 末端转始端 + flag = false; + } + } + } + } + return models; + }, // 逻辑区段模型 addLogicalSection(model, points, index, lineLength, totalNum) { const data = { From bbeb6d44aacdd2a4e6e5017c95b3e7f90dc025d7 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 14 May 2020 15:19:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=89=A7=E6=9C=AC=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/designPlatform.js | 2 +- src/api/simulation.js | 8 ++++++++ src/views/newMap/displayNew/designIndex.vue | 14 ++++++++++++-- src/views/newMap/jlmapNew/index.vue | 4 +++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/api/designPlatform.js b/src/api/designPlatform.js index 3d7eb400a..861d4fe60 100644 --- a/src/api/designPlatform.js +++ b/src/api/designPlatform.js @@ -142,7 +142,7 @@ export function loadDraftScript(scriptId, memberId, group) { /** 剧本预览选择角色 */ export function loadDraftScriptNew(memberId, group) { return request({ - url: `/simulation/${group}/${memberId}`, + url: `/simulation/${group}/choosePlay?memberId=${memberId}`, method: 'put' }); } diff --git a/src/api/simulation.js b/src/api/simulation.js index af6e69e51..43bfb7ad1 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -285,6 +285,14 @@ export function selectScriptMembers(group, data) { }); } +/** 剧本开始执行(新版) */ +export function scriptExecuteNew(group) { + return request({ + url: `/api/scriptExecute/${group}`, + method: 'put' + }); +} + /** 选择剧本演出成员角色 (新版地图)*/ export function selectScriptMembersNew(group, data) { return request({ diff --git a/src/views/newMap/displayNew/designIndex.vue b/src/views/newMap/displayNew/designIndex.vue index 7fb6a0f28..c45597e82 100644 --- a/src/views/newMap/displayNew/designIndex.vue +++ b/src/views/newMap/displayNew/designIndex.vue @@ -52,7 +52,7 @@ import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime'; import AddQuest from './demon/addQuest'; import { mapGetters } from 'vuex'; import { setGoodsTryUse } from '@/api/management/goods'; -import { clearSimulation, getSimulationInfoNew } from '@/api/simulation'; +import { clearSimulation, getSimulationInfoNew, scriptExecuteNew } from '@/api/simulation'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { checkLoginLine } from '@/api/login'; import { loadNewMapDataByGroup } from '@/utils/loaddata'; @@ -145,6 +145,10 @@ export default { }, isDemon() { return this.mode === 'demon'; + }, + drawWay() { + const drawWay = this.$route.query.drawWay; + return drawWay && JSON.parse(drawWay); } // isDrive() { // return this.prdType == '04'; @@ -343,13 +347,19 @@ export default { } } this.switchMode(prdType); - const res = this.$route.query.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(row.id, id, this.group); + const res = this.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(row.id, id, this.group); if (res && res.code == 200) { this.questId = parseInt(row.id); if (mapLocation) { const newMapLocation = {'offsetX': mapLocation.x, 'offsetY': mapLocation.y, 'scaleRate': mapLocation.scale}; Vue.prototype.$jlmap.setOptions(newMapLocation); } + if (this.drawWay) { + scriptExecuteNew(this.group).then(data=>{ + }).catch(error=>{ + console.log(error); + }); + } // if (res.data && res.data.mapLocation) { // const mapLocation={'offsetX': res.data.mapLocation.x, 'offsetY': res.data.mapLocation.y, 'scaleRate': res.data.mapLocation.scale}; // Vue.prototype.$jlmap.setOptions(mapLocation); diff --git a/src/views/newMap/jlmapNew/index.vue b/src/views/newMap/jlmapNew/index.vue index 7e0d29400..670999819 100644 --- a/src/views/newMap/jlmapNew/index.vue +++ b/src/views/newMap/jlmapNew/index.vue @@ -147,7 +147,9 @@ export default { this.mapViewLoaded(true); }, '$store.state.training.prdType': function (val) { - this.changePrdType(val); + if (val) { + this.changePrdType(val); + } }, '$store.state.map.showCentralizedStationNum': function (val) { this.setShowStation(this.$store.state.map.showCentralizedStationCode); From 77a8fd7c41de22c2aaccf73b0a06ae8526a88042 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 14 May 2020 15:32:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A5=BF=E5=AE=89=E4=BA=8C=E5=8F=B7?= =?UTF-8?q?=E7=BA=BF=20=E5=88=97=E8=BD=A6=E5=9C=A8=E7=AB=99=E5=8F=B0?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E6=97=B6=EF=BC=8C=E7=AB=99=E5=8F=B0=E6=A1=86?= =?UTF-8?q?=E4=B9=9F=E6=98=BE=E7=A4=BA=E4=B8=BA=E7=BB=BF=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/constant/deviceState.js | 1 - src/jmapNew/constant/stateTransition.js | 3 +-- src/jmapNew/shape/StationStand/index.js | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/jmapNew/constant/deviceState.js b/src/jmapNew/constant/deviceState.js index 685b10874..fc28859b7 100644 --- a/src/jmapNew/constant/deviceState.js +++ b/src/jmapNew/constant/deviceState.js @@ -124,7 +124,6 @@ deviceState[deviceType.StationStand] = { assignSkip: 0, // 是否指定跳停 runLevelTime: 0, // 区间运行时间 自动为 0 parkingTime: 0, // 站台停车时间 自动为0 - doorOpen:0, // 车门开启 自动为0 (西安二号线样式 暂时后端没加该字段) // /** 折返策略*/ // reentryStrategy: { diff --git a/src/jmapNew/constant/stateTransition.js b/src/jmapNew/constant/stateTransition.js index 98178fda3..1acf8f664 100644 --- a/src/jmapNew/constant/stateTransition.js +++ b/src/jmapNew/constant/stateTransition.js @@ -24,8 +24,7 @@ class Status { assignSkip: device.assignSkip, // 是否指定跳停 runLevelTime: device.runLevelTime, // 区间运行时间 自动为 0 parkingTime: device.parkingTime, // 站台停车时间 自动为0 - fault: device.fault, /** 非故障*/ - doorOpen:device.doorOpen /** 车门开启 自动为0 (西安二号线样式 暂时后端没加该字段)*/ + fault: device.fault /** 非故障*/ }; } handleSection(device) { diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index 2ce6b4d69..c268329c2 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -492,7 +492,7 @@ class StationStand extends Group { model.trainParking && this.stop(); /** 列车停站*/ model.emergencyClosed && this.emergentClose(); /** 站台紧急关闭*/ - model.doorOpen && this.doorOpen(); /** 车门开启 (西安二号线样式)*/ + model.trainParking && this.doorOpen(); /** 车门开启 (西安二号线样式)*/ if (Number(model.parkingTime) > 0) { this.setManuallyArmisticeTime(model.parkingTime); // 设置站台停车时间