解决冲突

This commit is contained in:
ival 2021-03-19 10:52:57 +08:00
parent 1b2abcffb3
commit 12f6bae8e5
10 changed files with 52 additions and 95 deletions

View File

@ -20,6 +20,27 @@ export function createMartPoint(opt) {
};
}
/** 创建一个车次数据点*/
export function createMartPointReverse(opt) {
const rotate = opt.directionCode == '1' ? 45 : (opt.directionCode == '2' ? -45 : 0);
const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft';
return {
coord: opt.coord,
name: opt.name,
label: {
normal: {
rotate: rotate,
formatter: '{b}',
backgroundColor: 'rgb(242,242,242,0.1)',
color: 'black',
// color: opt.color,
position: position
}
}
};
}
/** 创建一个服务数据序列*/
export function createSeriesModel(opt, lineStyle={}, itemStyle={}) {
return {

View File

@ -13,6 +13,9 @@ export default {
/** 偏移时间*/
translation: 60 * 60 * 2,
/** 标签方向 */
reverse: true,
/** excel解析配置*/
excelConfig: {
beginRow: 1,

View File

@ -13,6 +13,9 @@ export default {
/** 偏移时间*/
translation: 60 * 60 * 2,
/** 标签方向 */
reverse: true,
/** excel解析配置*/
excelConfig: {
beginRow: 1,

View File

@ -1,4 +1,4 @@
import { createSeriesModel, createMarkLineModels, createRectArea, createMartPoint } from '../aus_00/utils';
import { createSeriesModel, createMarkLineModels, createRectArea, createMartPoint, createMartPointReverse } from '../aus_00/util';
import { toTimeStamp } from '@/utils/date';
class AUSToolParser {
@ -195,11 +195,12 @@ class AUSToolParser {
/** 根据方向计算y折返偏移量*/
getOffsetY(isSpecial, direction) {
const sign = this.getReverse() ? -1 : 1;
if (isSpecial) {
if (direction === '1') {
return -this.getEdge() / 2;
return - sign * this.getEdge() / 2;
} else if (direction === '2') {
return +this.getEdge() / 2;
return + sign * this.getEdge() / 2;
}
}
@ -306,6 +307,10 @@ class AUSToolParser {
return this.config.edge;
}
getReverse() {
return this.config.reverse;
}
__createMartPoint(...args) {
return this.config.reverse ? createMartPointReverse(...args): createMartPoint(...args);
}

View File

@ -1,4 +1,4 @@
import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor } from './util';
import { createMartPoint, createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor } from './util';
import store from '@/store/index';
const defaultConfig = {
@ -232,10 +232,11 @@ class EqualDistanceParser {
/** 根据方向计算y折返偏移量*/
getValueYByDirectionCode(defaultValue, directionCode) {
const sign = this.getReverse() ? -1 : 1;
if (directionCode === '1') {
defaultValue -= this.getEdge() / 2;
defaultValue -= sign*this.getEdge() / 2;
} else if (directionCode === '2') {
defaultValue += this.getEdge() / 2;
defaultValue += sign*this.getEdge() / 2;
}
return defaultValue;
@ -267,6 +268,10 @@ class EqualDistanceParser {
return this.config.edge;
}
getReverse() {
return this.config.reverse;
}
__createMartPoint(...args) {
return this.config.reverse ? createMartPointReverse(...args): createMartPoint(...args);
}

View File

@ -246,10 +246,11 @@ class EqualRatioParser {
/** 根据方向计算y折返偏移量*/
getValueYByDirectionCode(defaultValue, directionCode, num) {
const sign = this.getReverse() ? -1 : 1;
if (directionCode === '1') {
defaultValue -= this.getEdge() / 2 * num;
defaultValue -= sign * this.getEdge() / 2 * num;
} else if (directionCode === '2') {
defaultValue += this.getEdge() / 2 * num;
defaultValue += sign * this.getEdge() / 2 * num;
}
return defaultValue;
@ -281,6 +282,10 @@ class EqualRatioParser {
return this.config.edge;
}
getReverse() {
return this.config.reverse;
}
__createMartPoint(...args) {
return this.config.reverse ? createMartPointReverse(...args): createMartPoint(...args);
}

View File

@ -37,7 +37,6 @@ export default {
DataTable
},
data() {
return {
return {
top: 0,
height: 0,

View File

@ -1,13 +1,7 @@
<template>
<<<<<<< HEAD
<div class="demo">
<lesson-training v-if="hasGroup" />
</div>
=======
<div class="demo" v-loading="loading">
<lesson-training v-if="hasGroup"/>
</div>
>>>>>>> test-ival
</template>
<script>
@ -16,7 +10,6 @@ import { trainingNotifyNew } from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus';
export default {
<<<<<<< HEAD
components: {
LessonTraining
},
@ -68,60 +61,6 @@ export default {
window.parent.postMessage(Object.assign(result, {type: 'DEMO_RESULT'}), 'http://localhost:9527/cbtc/demo');
}
}
=======
components: {
LessonTraining
},
data() {
return {
loading: false,
result: {
}
};
},
computed: {
hasGroup() {
return this.$route.query.group;
},
},
watch: {
'$route': function() {
this.loading = false;
}
},
async mounted() {
await this.createSimulation();
},
methods: {
async createSimulation() {
const lineCode = this.$route.query.lineCode;
const mapId = this.$route.query.mapId;
const prdType = this.$route.query.prdType;
const trainingId = this.$route.query.trainingId;
const lessonId = this.$route.query.lessonId;
const mode = this.$route.params.mode;
const goodsId = '';
this.loading = true;
const resp = await trainingNotifyNew({trainingId});
if (resp && resp.code == 200) {
const query = { lineCode, group: resp.data, prdType, mapId, lessonId, trainingId, goodsId, from: 'kzfmooc', project: 'login', try: '0'};
this.$store.dispatch('training/setPrdType', prdType);
this.$router.replace({ path: `/demoTraining/${mode}`, query: query });
EventBus.$on('demoResult', e => this.exitSimulation(e) );
} else if (resp.code == 10003) {
this.loading = false;
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
} else {
this.loading = false;
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
};
},
exitSimulation(result={}) {
window.parent.postMessage(Object.assign(result, {type: 'DEMO_RESULT'}), 'http://localhost:9527/cbtc/demo')
}
}
>>>>>>> test-ival
};
</script>
<style lang="scss" scoped>

View File

@ -67,11 +67,7 @@ export default {
},
data() {
return {
<<<<<<< HEAD
result: {},
=======
result: {},
>>>>>>> test-ival
timeInterval: null,
TrainingMode: TrainingMode,
trainingObj:{},
@ -112,15 +108,9 @@ export default {
project() {
return getSessionStorage('project');
},
<<<<<<< HEAD
isOther() {
return this.$route.query.from == 'kzfmooc';
}
=======
isOther() {
return this.$route.query.from == 'kzfmooc';
}
>>>>>>> test-ival
},
watch: {
demoMode: function (val) {
@ -238,11 +228,7 @@ export default {
};
endTrainingNew(mode, this.group).then(response => {
const data = response.data;
<<<<<<< HEAD
this.result = data;
=======
this.result = data;
>>>>>>> test-ival
this.$store.dispatch('training/judgeFinish', data).then(rsp => {
this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/emitTipFresh');
@ -276,11 +262,7 @@ export default {
usedTime: this.usedTime
};
endTrainingNew(mode, this.group).then(response => {
<<<<<<< HEAD
this.result = response.data;
=======
this.result = response.data;
>>>>>>> test-ival
this.$store.dispatch('training/end', null);
this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/setScore', 0);
@ -299,15 +281,9 @@ export default {
},
back() {
Notification.closeAll();
<<<<<<< HEAD
if (this.isOther) {
EventBus.$emit('demoResult', this.result);
} else if (this.$route.params.mode == 'record') {
=======
if (this.isOther) {
EventBus.$emit('demoResult', this.result);
} else if (this.$route.params.mode == 'record') {
>>>>>>> test-ival
/** 如果是演示返回时,需要重新创建仿真*/
trainingNotifyNew({ trainingId: this.$route.query.trainingId }).then(resp => {
this.$router.push({ path: `${UrlConfig.lesson.record}/${this.$route.query.trainingId}/${this.$route.query.trainingName}`, query: { group: resp.data } });

View File

@ -87,7 +87,8 @@ export default {
onUpdateZoom(e) {
const fixedList = ['area'];
const option = this.myChart.getOption();
const elements = option.graphic[0].elements||[]
const graphics = option.graphic||[];
const elements = graphics[0].elements||[]
const graphic = echarts.util.map(elements, (el) => {
if (fixedList.includes(el.subType)) {
const position1 = this.myChart.convertToPixel('grid', el.point1);