Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
6eb6cd5340
@ -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'
|
||||
});
|
||||
}
|
||||
|
@ -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({
|
||||
|
@ -124,7 +124,6 @@ deviceState[deviceType.StationStand] = {
|
||||
assignSkip: 0, // 是否指定跳停
|
||||
runLevelTime: 0, // 区间运行时间 自动为 0
|
||||
parkingTime: 0, // 站台停车时间 自动为0
|
||||
doorOpen:0, // 车门开启 自动为0 (西安二号线样式 暂时后端没加该字段)
|
||||
|
||||
// /** 折返策略*/
|
||||
// reentryStrategy: {
|
||||
|
@ -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) {
|
||||
|
@ -493,7 +493,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); // 设置站台停车时间
|
||||
|
@ -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);
|
||||
|
@ -147,7 +147,9 @@ export default {
|
||||
this.mapViewLoaded(true);
|
||||
},
|
||||
'$store.state.training.prdType': function (val) {
|
||||
if (val) {
|
||||
this.changePrdType(val);
|
||||
}
|
||||
},
|
||||
'$store.state.map.showCentralizedStationNum': function (val) {
|
||||
this.setShowStation(this.$store.state.map.showCentralizedStationCode);
|
||||
|
@ -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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user