Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
812a7534b7
@ -964,7 +964,7 @@ export const asyncRouter = [
|
||||
component: Layout,
|
||||
meta: {
|
||||
i18n: 'router.studentManage',
|
||||
roles: [admin, user, lessonCreater]
|
||||
roles: [admin, lessonCreater]
|
||||
},
|
||||
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('gzb') && !window.document.location.pathname.includes('gzb') : !window.document.location.pathname.includes('gzb'),
|
||||
children: [
|
||||
|
@ -2,11 +2,11 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
|
@ -101,7 +101,7 @@ export default {
|
||||
this.loadInitPage(this.$route.params.examId);
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
async getList() {
|
||||
if (this.drawWay) {
|
||||
this.typeList = [];
|
||||
for (const val in ConstConfig.ConstSelect.trainingDeviceType) {
|
||||
@ -161,53 +161,53 @@ export default {
|
||||
this.$Dictionary.trainOperation().then(list => {
|
||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||
});
|
||||
getDetailList('training_type').then(res => {
|
||||
this.typeList = res.data;
|
||||
if (LangStorage.getLang() == 'en') {
|
||||
this.typeList.forEach(item => {
|
||||
switch (item.code) {
|
||||
case '01':
|
||||
item.name = 'Control permission operation';
|
||||
break;
|
||||
case '02':
|
||||
item.name = 'Signalling machine operation';
|
||||
break;
|
||||
case '03':
|
||||
item.name = 'Turnout operation';
|
||||
break;
|
||||
case '04':
|
||||
item.name = 'Section operation';
|
||||
break;
|
||||
case '05':
|
||||
item.name = 'Platform operation';
|
||||
break;
|
||||
case '06':
|
||||
item.name = 'Train scheduling operation';
|
||||
break;
|
||||
case '07':
|
||||
item.name = 'Train operation';
|
||||
break;
|
||||
case '08':
|
||||
item.name = 'Temporary speed limit operation of the whole line';
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
const res = await getDetailList('training_type');
|
||||
this.typeList = res.data;
|
||||
if (LangStorage.getLang() == 'en' && this.typeList) {
|
||||
this.typeList.forEach(item => {
|
||||
switch (item.code) {
|
||||
case '01':
|
||||
item.name = 'Control permission operation';
|
||||
break;
|
||||
case '02':
|
||||
item.name = 'Signalling machine operation';
|
||||
break;
|
||||
case '03':
|
||||
item.name = 'Turnout operation';
|
||||
break;
|
||||
case '04':
|
||||
item.name = 'Section operation';
|
||||
break;
|
||||
case '05':
|
||||
item.name = 'Platform operation';
|
||||
break;
|
||||
case '06':
|
||||
item.name = 'Train scheduling operation';
|
||||
break;
|
||||
case '07':
|
||||
item.name = 'Train operation';
|
||||
break;
|
||||
case '08':
|
||||
item.name = 'Temporary speed limit operation of the whole line';
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
async loadInitPage(examId) {
|
||||
if (examId) {
|
||||
getPublishMapInfo(this.$route.query.mapId).then(res => {
|
||||
if (res.data) {
|
||||
this.drawWay = res.data.drawWay;
|
||||
this.lineCode = res.data.lineCode;
|
||||
try {
|
||||
const response = await getPublishMapInfo(this.$route.query.mapId);
|
||||
if (response.data) {
|
||||
this.drawWay = response.data.drawWay;
|
||||
this.lineCode = response.data.lineCode;
|
||||
this.typeList = [];
|
||||
this.getList();
|
||||
await this.getList();
|
||||
}
|
||||
}).catch(() => {
|
||||
} catch (e) {
|
||||
this.$message.error(this.$t('error.getMapDataFailed'));
|
||||
});
|
||||
}
|
||||
const res = await getExamLessonDetail(examId);
|
||||
this.examDetails = res.data;
|
||||
this.examDetails.examDefinitionRulesVOList.forEach((res, index) => {
|
||||
|
@ -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