This commit is contained in:
joylink_cuiweidong 2020-05-14 15:19:59 +08:00
commit 812a7534b7
4 changed files with 103 additions and 108 deletions

View File

@ -964,7 +964,7 @@ export const asyncRouter = [
component: Layout, component: Layout,
meta: { meta: {
i18n: 'router.studentManage', 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'), hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('gzb') && !window.document.location.pathname.includes('gzb') : !window.document.location.pathname.includes('gzb'),
children: [ children: [

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // 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.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41: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://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -101,7 +101,7 @@ export default {
this.loadInitPage(this.$route.params.examId); this.loadInitPage(this.$route.params.examId);
}, },
methods: { methods: {
getList() { async getList() {
if (this.drawWay) { if (this.drawWay) {
this.typeList = []; this.typeList = [];
for (const val in ConstConfig.ConstSelect.trainingDeviceType) { for (const val in ConstConfig.ConstSelect.trainingDeviceType) {
@ -161,53 +161,53 @@ export default {
this.$Dictionary.trainOperation().then(list => { this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list; // this.trainingOperateTypeMap['07'] = list; //
}); });
getDetailList('training_type').then(res => { const res = await getDetailList('training_type');
this.typeList = res.data; this.typeList = res.data;
if (LangStorage.getLang() == 'en') { if (LangStorage.getLang() == 'en' && this.typeList) {
this.typeList.forEach(item => { this.typeList.forEach(item => {
switch (item.code) { switch (item.code) {
case '01': case '01':
item.name = 'Control permission operation'; item.name = 'Control permission operation';
break; break;
case '02': case '02':
item.name = 'Signalling machine operation'; item.name = 'Signalling machine operation';
break; break;
case '03': case '03':
item.name = 'Turnout operation'; item.name = 'Turnout operation';
break; break;
case '04': case '04':
item.name = 'Section operation'; item.name = 'Section operation';
break; break;
case '05': case '05':
item.name = 'Platform operation'; item.name = 'Platform operation';
break; break;
case '06': case '06':
item.name = 'Train scheduling operation'; item.name = 'Train scheduling operation';
break; break;
case '07': case '07':
item.name = 'Train operation'; item.name = 'Train operation';
break; break;
case '08': case '08':
item.name = 'Temporary speed limit operation of the whole line'; item.name = 'Temporary speed limit operation of the whole line';
break; break;
} }
}); });
} }
});
} }
}, },
async loadInitPage(examId) { async loadInitPage(examId) {
if (examId) { if (examId) {
getPublishMapInfo(this.$route.query.mapId).then(res => { try {
if (res.data) { const response = await getPublishMapInfo(this.$route.query.mapId);
this.drawWay = res.data.drawWay; if (response.data) {
this.lineCode = res.data.lineCode; this.drawWay = response.data.drawWay;
this.lineCode = response.data.lineCode;
this.typeList = []; this.typeList = [];
this.getList(); await this.getList();
} }
}).catch(() => { } catch (e) {
this.$message.error(this.$t('error.getMapDataFailed')); this.$message.error(this.$t('error.getMapDataFailed'));
}); }
const res = await getExamLessonDetail(examId); const res = await getExamLessonDetail(examId);
this.examDetails = res.data; this.examDetails = res.data;
this.examDetails.examDefinitionRulesVOList.forEach((res, index) => { this.examDetails.examDefinitionRulesVOList.forEach((res, index) => {

View File

@ -77,7 +77,7 @@ export default {
methods:{ methods:{
// //
editSectionNum() { editSectionNum() {
const models = []; let models = [];
this.addList = []; this.addList = [];
const counts = 0; const counts = 0;
const sectionPoints = [...this.editModel.points]; // const sectionPoints = [...this.editModel.points]; //
@ -87,59 +87,9 @@ export default {
lineLength = lengthFact / this.logicNum; // lineLength = lengthFact / this.logicNum; //
} }
if (sectionPoints.length === 2) { if (sectionPoints.length === 2) {
const triangle = new JTriangle(sectionPoints[0], sectionPoints[1]); models = this.createLogicalSections(sectionPoints, counts, lineLength);
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);
}
} else { } else {
const triangleList = []; models = this.createLogicalMoerScetion(sectionPoints, counts, lineLength);
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 = []; let logicSectionCodeList = [];
models.forEach(item=> { models.forEach(item=> {
@ -157,25 +107,70 @@ export default {
models.push(model); models.push(model);
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
}, },
handleDelete(index, row) { // 2线
row.num = 0; createLogicalSections(sectionPoints, counts, lineLength) {
},
//
createLogicalSections(num, beg, end, model, counts, lineLength, totalNum) {
const models = []; const models = [];
const triangle = new JTriangle(beg, end); const triangle = new JTriangle(sectionPoints[0], sectionPoints[1]);
const offset = Math.sqrt(triangle.abspowz) / num; const offset = Math.sqrt(triangle.abspowz) / this.logicNum;
for (let i = 0; i < num; i++) { for (let i = 0; i < this.logicNum; i++) {
const points = [ const points = [
{ x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) }, { x: sectionPoints[0].x + triangle.getCos(offset * i), y: sectionPoints[0].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 + 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); models.push(param);
this.addList.push(param); this.addList.push(param);
} }
return models; 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) { addLogicalSection(model, points, index, lineLength, totalNum) {
const data = { const data = {