Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
dd6030d346
@ -134,11 +134,19 @@ export function previewRunPlan(planId) {
|
||||
/** 加载剧本 */
|
||||
export function loadDraftScript(scriptId, memberId, group) {
|
||||
return request({
|
||||
url: `api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`,
|
||||
url: `/api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
||||
/** 剧本预览选择角色 */
|
||||
export function loadDraftScriptNew(memberId, group) {
|
||||
return request({
|
||||
url: `/simulation/${group}/${memberId}`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取已发布的有地图的城市列表*/
|
||||
export function publisMapCityList(data) {
|
||||
return request({
|
||||
|
@ -426,6 +426,14 @@ export function loadScript(scriptId, memberId, group) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 加载剧本(新版) */
|
||||
export function loadScriptNew(scriptId, memberId, group) {
|
||||
return request({
|
||||
url: `/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
|
||||
method: 'PUT'
|
||||
});
|
||||
}
|
||||
|
||||
/** 退出剧本*/
|
||||
export function quitScript(group) {
|
||||
return request({
|
||||
@ -434,6 +442,14 @@ export function quitScript(group) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 退出剧本(新版)*/
|
||||
export function quitScriptNew(group) {
|
||||
return request({
|
||||
url: `/simulation/${group}/exitScript`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
/** 退出任务*/
|
||||
export function quitQuest(group) {
|
||||
return request({
|
||||
|
File diff suppressed because one or more lines are too long
@ -271,8 +271,8 @@ export default class Section extends Group {
|
||||
createSection() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
// 创建区段 model.logicSectionNum 为空 或 0 表明没有逻辑区段 创建 否则过滤
|
||||
if ((model.type == '01' && (model.logicSectionNum[0] == 0 || model.logicSectionNum.length == 0)) || model.type == '02' || model.type == '03') {
|
||||
// 创建区段 model.logicSectionCodeList 为空 或 0 表明没有逻辑区段 创建 否则过滤
|
||||
if ((model.type == '01' && (!model.logicSectionCodeList || !model.logicSectionCodeList.length)) || model.type == '02' || model.type == '03') {
|
||||
this.section = new ELines({
|
||||
zlevel: this.zlevel,
|
||||
z: model.type == '02' ? this.z + 1 : this.z, // 逻辑区段会覆盖物理区段
|
||||
|
@ -35,6 +35,7 @@ import { simulationNotify, schedulingNotify, createSimulationNew } from '@/api/s
|
||||
import LimitList from '@/views/components/limits/index';
|
||||
import { getSubSystemDetail } from '@/api/trainingPlatform';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
name: 'ExamDetailList',
|
||||
@ -152,8 +153,15 @@ export default {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
this.$message.error(this.$t('error.refreshFailed'));
|
||||
if (error.code == 30001) {
|
||||
const url = localStore.get('orignalTrainingPlatformRoute' + this.$store.state.user.id);
|
||||
if (url) {
|
||||
this.$router.push(url);
|
||||
}
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.$message.error(this.$t('error.refreshFailed'));
|
||||
}
|
||||
}
|
||||
},
|
||||
refresh() {
|
||||
@ -235,7 +243,14 @@ export default {
|
||||
}
|
||||
},
|
||||
async enterScreen() {
|
||||
this.$router.push({ path: `/displayBigScreen/${this.courseModel.mapId}` });
|
||||
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
|
||||
createSimulationNew(data).then(resp => {
|
||||
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser };
|
||||
this.$router.push({ path: `/displayBigScreen/${this.courseModel.mapId}`, query: query });
|
||||
}).catch(error => {
|
||||
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
||||
this.disabled = false;
|
||||
});
|
||||
},
|
||||
async start() {
|
||||
if (this.courseModel.prdType == '05') {
|
||||
|
@ -10,9 +10,11 @@
|
||||
</template>
|
||||
<script>
|
||||
import JlmapVisual from '@/views/newMap/jlmapNew/index';
|
||||
import { loadMapDataById } from '@/utils/loaddata';
|
||||
import { loadNewMapDataByGroup } from '@/utils/loaddata';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
export default {
|
||||
name: 'MapPreview',
|
||||
@ -61,6 +63,12 @@ export default {
|
||||
this.$jlmap.off('zoom');
|
||||
this.$jlmap.off('pan');
|
||||
this.handleUpdateScreen();
|
||||
this.subscribe();
|
||||
},
|
||||
'$store.state.socket.equipmentStatus': function (val) {
|
||||
if (val.length) {
|
||||
this.statusMessage(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
async beforeDestroy() {
|
||||
@ -72,25 +80,29 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async initLoadData() { // 加载地图数据
|
||||
if (parseInt(this.mapId)) {
|
||||
await this.loadMapDataById(this.mapId);
|
||||
if (this.$route.query.group) {
|
||||
await loadNewMapDataByGroup(this.$route.query.group);
|
||||
} else {
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
async statusMessage(list) {
|
||||
await this.$store.dispatch('training/updateMapState', list);
|
||||
await this.$store.dispatch('socket/setEquipmentStatus');
|
||||
},
|
||||
// 通过id加载地图数据
|
||||
async loadMapDataById(mapId) {
|
||||
try {
|
||||
await this.$store.dispatch('training/changeMode', { mode: null });
|
||||
loadMapDataById(mapId).then(()=>{
|
||||
this.$store.dispatch('training/over');
|
||||
this.$store.dispatch('training/setMapDefaultState');
|
||||
this.$store.dispatch('map/clearJlmapTrainView');
|
||||
});
|
||||
} catch (error) {
|
||||
this.$messageBox(`获取地图数据失败: ${error.message}`);
|
||||
this.endViewLoading();
|
||||
}
|
||||
// try {
|
||||
// await this.$store.dispatch('training/changeMode', { mode: null });
|
||||
// loadMapDataById(mapId).then(()=>{
|
||||
// this.$store.dispatch('training/over');
|
||||
// this.$store.dispatch('training/setMapDefaultState');
|
||||
// this.$store.dispatch('map/clearJlmapTrainView');
|
||||
// });
|
||||
// } catch (error) {
|
||||
// this.$messageBox(`获取地图数据失败: ${error.message}`);
|
||||
// this.endViewLoading();
|
||||
// }
|
||||
},
|
||||
// 结束加载状态
|
||||
endViewLoading(isSuccess) {
|
||||
@ -139,6 +151,16 @@ export default {
|
||||
history.go(-1);
|
||||
Notification.closeAll();
|
||||
});
|
||||
},
|
||||
async subscribe() {
|
||||
this.clearSubscribe();
|
||||
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
|
||||
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
|
||||
|
||||
await this.$store.dispatch('training/setHasSubscribed');
|
||||
},
|
||||
clearSubscribe() {
|
||||
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -49,8 +49,15 @@ export default {
|
||||
if (resp.data) {
|
||||
this.tableData = resp.data.lessonList;
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
|
||||
}).catch((error)=>{
|
||||
if (error.code == 30001) {
|
||||
const url = localStore.get('orignalTrainingPlatformRoute' + this.$store.state.user.id);
|
||||
if (url) {
|
||||
this.$router.push(url);
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -7,8 +7,8 @@
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<el-radio v-model="radio1" label="1" border>备选项1</el-radio>
|
||||
<el-radio v-model="radio1" label="2" border>备选项2</el-radio>
|
||||
<el-radio v-model="radio1" label="1" border>开启LCD屏</el-radio>
|
||||
<el-radio v-model="radio1" label="2" border>关闭LCD屏</el-radio>
|
||||
</div>
|
||||
<div>确定</div>
|
||||
</div>
|
||||
|
@ -65,7 +65,7 @@ import { checkLoginLine } from '@/api/login';
|
||||
import { loadNewMapDataByGroup } from '@/utils/loaddata';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import Vue from 'vue';
|
||||
import {loadDraftScript} from '@/api/designPlatform';
|
||||
import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
|
||||
|
||||
// 三维
|
||||
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
|
||||
@ -389,7 +389,7 @@ export default {
|
||||
}
|
||||
}
|
||||
this.switchMode(prdType);
|
||||
const res = await loadDraftScript(row.id, id, this.group);
|
||||
const res = this.$route.query.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) {
|
||||
|
@ -92,7 +92,7 @@ import Scheduling from './demon/scheduling';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getTrainingStepsDetailNew, getTrainingDetailNew } from '@/api/jmap/training';
|
||||
import { setGoodsTryUse } from '@/api/management/goods';
|
||||
import { clearSimulation, loadScript, getSimulationInfoNew } from '@/api/simulation';
|
||||
import { clearSimulation, loadScript, loadScriptNew, getSimulationInfoNew } from '@/api/simulation';
|
||||
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
|
||||
import { checkLoginLine } from '@/api/login';
|
||||
import { loadNewMapDataByGroup } from '@/utils/loaddata';
|
||||
@ -474,8 +474,8 @@ export default {
|
||||
// 选择脚本
|
||||
async selectQuest(row, id, mapLocation, roleName) {
|
||||
try {
|
||||
|
||||
const res = await loadScript(row.id, id, this.group);
|
||||
// const res = await loadScript(row.id, id, this.group);
|
||||
const res = this.$route.query.drawWay == 'true' ? await loadScriptNew(row.id, id, this.group) : await loadScript(row.id, id, this.group);
|
||||
if (res && res.code == 200) {
|
||||
this.questId = parseInt(row.id);
|
||||
if (mapLocation) {
|
||||
|
@ -37,7 +37,7 @@ import { getGoodsTryUse } from '@/api/management/goods';
|
||||
import { ranAsPlan, exitRunPlan, clearSimulation } from '@/api/simulation';
|
||||
import { PermissionType } from '@/scripts/ConstDic';
|
||||
import { getCountTime } from '@/utils/index';
|
||||
import { quitScript } from '@/api/simulation';
|
||||
import { quitScript, quitScriptNew } from '@/api/simulation';
|
||||
|
||||
export default {
|
||||
name: 'MenuDemon',
|
||||
@ -224,12 +224,22 @@ export default {
|
||||
});
|
||||
},
|
||||
handleQuitQuest() {
|
||||
quitScript(this.group).then(resp => {
|
||||
this.$emit('quitQuest');
|
||||
this.initLoadPage();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('display.demon.exitTaskFail'));
|
||||
});
|
||||
if (this.$route.query.drawWay) {
|
||||
quitScriptNew(this.group).then(resp => {
|
||||
this.$emit('quitQuest');
|
||||
this.initLoadPage();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('display.demon.exitTaskFail'));
|
||||
});
|
||||
} else {
|
||||
quitScript(this.group).then(resp => {
|
||||
this.$emit('quitQuest');
|
||||
this.initLoadPage();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('display.demon.exitTaskFail'));
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
async back() {
|
||||
await clearSimulation(this.group);
|
||||
|
@ -177,7 +177,6 @@ export default {
|
||||
this.$refs.addQuest.doShow();
|
||||
},
|
||||
viewScriptRoles() {
|
||||
debugger;
|
||||
const row = {id: this.$route.query.scriptId, group:this.$route.query.group, drawWay:this.$route.query.drawWay};
|
||||
this.$refs.addQuest.handleLoad(1, row);
|
||||
},
|
||||
|
@ -96,7 +96,7 @@ export default {
|
||||
return false;
|
||||
},
|
||||
isScreen() {
|
||||
return this.$route.path.includes('displayBigScreen');
|
||||
return this.$route.path.includes('displayBigScreen') || this.$route.path.includes('bigScreen');
|
||||
},
|
||||
maskOpen() {
|
||||
return this.$store.state.config.maskOpen;
|
||||
@ -400,7 +400,7 @@ export default {
|
||||
const nameList = Object.keys(this.$store.state.map.map || {});
|
||||
let list = [];
|
||||
nameList.forEach(item => {
|
||||
if (item != 'skinVO' && item != 'generateConfig') {
|
||||
if (item !== 'skinVO') {
|
||||
list = [...list, ...this.$store.state.map.map[item]];
|
||||
}
|
||||
});
|
||||
@ -416,7 +416,7 @@ export default {
|
||||
const nameList = Object.keys(this.$store.state.map.map || {});
|
||||
let list = [];
|
||||
nameList.forEach(item => {
|
||||
if (item != 'skinVO' && item != 'generateConfig') {
|
||||
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
|
||||
list = [...list, ...this.$store.state.map.map[item]];
|
||||
}
|
||||
});
|
||||
@ -427,7 +427,7 @@ export default {
|
||||
const nameList = Object.keys(this.$store.state.map.map);
|
||||
let list = [];
|
||||
nameList.forEach(item => {
|
||||
if (item !== 'skinVO' && item != 'generateConfig') {
|
||||
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
|
||||
list = [...list, ...this.$store.state.map.map[item]];
|
||||
}
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ export default {
|
||||
},
|
||||
concentrationStationList(val) {
|
||||
if (val.length) {
|
||||
this.stationList = [...this.stationList, ...val];
|
||||
this.stationList = [...val];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -206,7 +206,6 @@ export default {
|
||||
kmRangeLeft: '',
|
||||
region: '',
|
||||
namePosition: { x: 0, y: 0 },
|
||||
logicSectionNum: [0],
|
||||
logicSectionCodeList: [],
|
||||
logicSectionShow: true,
|
||||
logicSectionNameSort: true,
|
||||
|
@ -129,7 +129,6 @@ export default {
|
||||
kmRangeRight: 0,
|
||||
kmRangeLeft: 0,
|
||||
region: '',
|
||||
logicSectionNum: [],
|
||||
logicSectionCodeList: [],
|
||||
logicSectionShow: false, // 是否显示逻辑区段
|
||||
standTrack: false, // 是否站台轨
|
||||
@ -166,7 +165,6 @@ export default {
|
||||
belongStation: '' // 所属车站
|
||||
},
|
||||
oldPoint: [], // 区段未修改前 坐标
|
||||
logicSectionNums: [1],
|
||||
field: '',
|
||||
oldLeftSectionCode: '',
|
||||
oldRightSectionCode: '',
|
||||
@ -924,7 +922,7 @@ export default {
|
||||
if (val === 'four') {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.logicBlock.computedLogicSectionNumList(
|
||||
this.editModel.logicSectionNum
|
||||
this.editModel.logicSectionCodeList
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -975,8 +973,6 @@ export default {
|
||||
this.clear();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
this.editModel.logicSectionNum =
|
||||
selected.type === '01' ? selected.logicSectionNum : [0];
|
||||
this.editModel.points = JSON.parse(
|
||||
JSON.stringify(selected.points)
|
||||
);
|
||||
@ -1058,11 +1054,9 @@ export default {
|
||||
addPoint(index) {
|
||||
const data = { x: 0, y: 0 };
|
||||
this.editModel.points.splice(index + 1, 0, data);
|
||||
this.logicSectionNums.splice(index + 1, 0, 1);
|
||||
},
|
||||
delPoint(index) {
|
||||
this.editModel.points.splice(index, 1);
|
||||
this.logicSectionNums.splice(index, 1);
|
||||
},
|
||||
// 修改区段属性
|
||||
edit() {
|
||||
|
@ -2,25 +2,28 @@
|
||||
<div style="height:100%">
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
|
||||
<el-table-column :label="$t('map.sectionPolyline')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ $t('map.aux') }}{{ scope.row.index }}{{ $t('map.sectionLine') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('map.sectionLogicalNumber')" width="130">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.num" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('map.operation')">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.empty') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--<el-table :data="tableData" style="width: 80%; margin: 0 auto;">-->
|
||||
<!--<el-table-column :label="$t('map.sectionPolyline')" width="150">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<span style="margin-left: 10px">{{ $t('map.aux') }}{{ scope.row.index }}{{ $t('map.sectionLine') }}</span>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<!--<el-table-column :label="$t('map.sectionLogicalNumber')" width="130">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<el-input v-model="scope.row.num" size="mini" />-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<!--<el-table-column :label="$t('map.operation')">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.empty') }}-->
|
||||
<!--</el-button>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<!--</el-table>-->
|
||||
<el-form ref="showDelimiter" label-width="130px" size="mini">
|
||||
<el-form-item label="逻辑区段数量">
|
||||
<el-input-number v-model="logicNum" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示分隔符" style="margin-top:30px;margin-left:30px;">
|
||||
<el-checkbox v-model="isDelimiter" />
|
||||
</el-form-item>
|
||||
@ -57,9 +60,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
addList: [],
|
||||
isDelimiter:false
|
||||
isDelimiter:false,
|
||||
logicNum: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -70,50 +73,85 @@ export default {
|
||||
methods:{
|
||||
// 生成逻辑区段
|
||||
editSectionNum() {
|
||||
let models = [];
|
||||
const models = [];
|
||||
this.addList = [];
|
||||
let counts = 0;
|
||||
let logicSectionNumList = [];
|
||||
const counts = 0;
|
||||
const sectionPoints = [...this.editModel.points]; // 获取区段点
|
||||
let allNotZeros = true;
|
||||
let totalNum = 0;
|
||||
const lengthFact = this.editModel.lengthFact;
|
||||
this.tableData.forEach((ele, index) => {
|
||||
totalNum += Number(ele.num);
|
||||
});
|
||||
let lineLength = 0; // NaN 由于 0/0 造成的
|
||||
if (totalNum) {
|
||||
lineLength = lengthFact / totalNum; // 均分逻辑区段偏移量
|
||||
if (this.logicNum) {
|
||||
lineLength = lengthFact / this.logicNum; // 均分逻辑区段偏移量
|
||||
}
|
||||
this.tableData.forEach((ele, index) => {
|
||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)];
|
||||
allNotZeros = Number(ele.num) && allNotZeros;
|
||||
logicSectionNumList.push(Number(ele.num));
|
||||
counts += parseInt(ele.num);
|
||||
});
|
||||
if (counts == 0 || allNotZeros) {
|
||||
let logicSectionCodeList = [];
|
||||
models.forEach(item=> {
|
||||
logicSectionCodeList.push(item.code);
|
||||
});
|
||||
this.sectionList.forEach(section => { // 删除之前的逻辑区段
|
||||
if (section.type === '02' && section.parentCode == this.editModel.code) {
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
}
|
||||
});
|
||||
if (counts == 0) {
|
||||
logicSectionNumList = [];
|
||||
logicSectionCodeList = [];
|
||||
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);
|
||||
}
|
||||
const model = deepAssign(this.editModel, {_type: 'Section'});
|
||||
model.logicSectionNum = [...logicSectionNumList];
|
||||
model.logicSectionCodeList = [...logicSectionCodeList];
|
||||
models.push(model);
|
||||
this.$emit('updateMapModel', models);
|
||||
} else {
|
||||
this.$messageBox('逻辑区段在个折线上数量要均为0或均不为0');
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let logicSectionCodeList = [];
|
||||
models.forEach(item=> {
|
||||
logicSectionCodeList.push(item.code);
|
||||
});
|
||||
this.editModel.logicSectionCodeList.forEach( logicCode => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](logicCode);
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
});
|
||||
if (this.logicNum === 0) {
|
||||
logicSectionCodeList = [];
|
||||
}
|
||||
const model = deepAssign(this.editModel, {_type: 'Section'});
|
||||
model.logicSectionCodeList = [...logicSectionCodeList];
|
||||
models.push(model);
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
row.num = 0;
|
||||
@ -168,7 +206,6 @@ export default {
|
||||
logicSectionNameSort: model.logicSectionNameSort,
|
||||
switchSection: model.switchSection,
|
||||
relSwitchCode: model.relSwitchCode,
|
||||
logicSectionNum: [],
|
||||
logicSectionShow: model.logicSectionShow,
|
||||
stationCode: model.stationCode,
|
||||
destinationCode: '', // 目的地码
|
||||
@ -178,7 +215,8 @@ export default {
|
||||
points: points,
|
||||
curve: false,
|
||||
nameShow: true,
|
||||
lengthFact: lineLength ? lineLength.toFixed(3) : lineLength,
|
||||
logicSectionCodeList: [],
|
||||
lengthFact: lineLength ? lineLength.toFixed(3) : 0,
|
||||
trainWindowCode: '',
|
||||
kmRangeRight: model.kmRangeRight,
|
||||
kmRangeLeft: model.kmRangeLeft,
|
||||
@ -194,24 +232,8 @@ export default {
|
||||
return data;
|
||||
},
|
||||
// 计算逻辑区段数量列表展示
|
||||
computedLogicSectionNumList(logicSectionNum) {
|
||||
this.tableData = [];
|
||||
this.logicSectionNums = [...logicSectionNum];
|
||||
|
||||
var i; var num; var len = this.editModel.points.length;
|
||||
if (len > 1 && this.editModel.type === '01') {
|
||||
for (i = 0; i < len - 1; i++) {
|
||||
num = 0;
|
||||
if (Array.isArray(this.logicSectionNums) && this.logicSectionNums[i]) {
|
||||
num = parseInt(this.logicSectionNums[i]);
|
||||
}
|
||||
this.tableData.push({ index: i + 1, num: num });
|
||||
}
|
||||
|
||||
if (this.tableData.length <= 0) {
|
||||
this.tableData.push({ index: i + 1, num: 0 });
|
||||
}
|
||||
}
|
||||
computedLogicSectionNumList(logicSectionCodeList) {
|
||||
this.logicNum = logicSectionCodeList ? logicSectionCodeList.length : 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -186,7 +186,6 @@ export default {
|
||||
relSwitchCode: '',
|
||||
trainWindowCode: '',
|
||||
logicSectionNameSort: selected.logicSectionNameSort,
|
||||
logicSectionNum: selected.logicSectionNum,
|
||||
logicSectionShow: selected.logicSectionShow,
|
||||
sepTypeLeft: index == 0 ? selected.sepTypeLeft : '01', // 左侧分隔符类型 (起始左侧按原来区段类型走 其余 默认 01)
|
||||
sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // 右侧分隔符类型 (终点右侧按原来区段类型走 其余 默认 01)
|
||||
@ -208,7 +207,7 @@ export default {
|
||||
relevanceSectionList: [],
|
||||
roadType: selected.roadType,
|
||||
firstTurnBack: false,
|
||||
belongStation: ''
|
||||
belongStation: ''
|
||||
};
|
||||
models.push(model);
|
||||
}
|
||||
@ -287,7 +286,7 @@ export default {
|
||||
relevanceSectionList: [],
|
||||
roadType: null,
|
||||
firstTurnBack: false,
|
||||
belongStation: ''
|
||||
belongStation: ''
|
||||
};
|
||||
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](lsection.code), { _dispose: true }));
|
||||
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](rsection.code), { _dispose: true }));
|
||||
@ -312,7 +311,6 @@ export default {
|
||||
});
|
||||
},
|
||||
handleRealLocationRelationships(model, realRigth, realLeft) {
|
||||
model.logicSectionNum = realLeft.logicSectionNum;
|
||||
model.logicSectionShow = realLeft.logicSectionShow;
|
||||
model.sepTypeLeft = realLeft.sepTypeLeft;
|
||||
model.sepTypeRight = realRigth.sepTypeRight;
|
||||
|
@ -126,7 +126,6 @@ export default {
|
||||
relSwitchCode: '',
|
||||
relevanceSectionList: this.fromData.relevanceSectionList,
|
||||
points: [{ x: 0, y: 0 }, { x: 0, y: 0 }],
|
||||
logicSectionNum: [0],
|
||||
logicSectionShow: false,
|
||||
sepTypeLeft: '00',
|
||||
offsetLeft: 0,
|
||||
|
@ -204,7 +204,7 @@ export default {
|
||||
this.field = field == this.field ? '' : field;
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'TrainWindow'.toUpperCase()) {
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
@ -311,7 +311,7 @@ export default {
|
||||
if (this.sectionList && this.sectionList.length) {
|
||||
this.sectionList.forEach(elem => {
|
||||
// elem.type !== '03' // 更宽泛的匹配条件 !elem.switchSection 严格匹配条件
|
||||
if (elem.type !== '04' && !elem.switchSection && !elem.trainWindowCode && (elem.logicSectionNum.length == 0 || elem.logicSectionNum.length == 1 && elem.logicSectionNum[0] == 0)) {
|
||||
if (elem.type !== '04' && !elem.switchSection && !elem.trainWindowCode && ( !elem.logicSectionCodeList || elem.logicSectionCodeList.length === 0)) {
|
||||
const triangle = new JTriangle(elem.points[0], elem.points[elem.points.length - 1]);
|
||||
const param = this.createModel({
|
||||
triangle: triangle,
|
||||
|
@ -148,7 +148,7 @@ export default {
|
||||
methods: {
|
||||
listJoiningTogether(sessionList) {
|
||||
let sessionId = '';
|
||||
if (sessionList.length > 0) {
|
||||
if (sessionList && sessionList.length > 0) {
|
||||
sessionList.forEach((item) => {
|
||||
sessionId = sessionId + item + ',';
|
||||
});
|
||||
|
@ -51,8 +51,15 @@ export default {
|
||||
} else {
|
||||
this.tableData = [];
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
|
||||
}).catch((error)=>{
|
||||
if (error.code == 30001) {
|
||||
const url = localStore.get('orignalTrainingPlatformRoute' + this.$store.state.user.id);
|
||||
if (url) {
|
||||
this.$router.push(url);
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -50,6 +50,7 @@ export default {
|
||||
launchFullscreen();
|
||||
const path = localStore.get('trainingPlatformRoute' + this.userId);
|
||||
if (path && path.startsWith('/trainingPlatform')) {
|
||||
localStore.set('orignalTrainingPlatformRoute' + this.userId, `/trainingPlatform/permission/${data[0].id}`);
|
||||
this.$router.push(path);
|
||||
} else if (data && data[0]) {
|
||||
this.$router.push(`/trainingPlatform/permission/${data[0].id}`);
|
||||
|
Loading…
Reference in New Issue
Block a user