成都三号线运行图解析

This commit is contained in:
ival 2019-08-07 15:32:35 +08:00
parent 3751748979
commit 7feea79e44
5 changed files with 42 additions and 59 deletions

View File

@ -1,8 +1,8 @@
const mapDeviceStyle = {
// '01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'bejing_01',
'04': 'chengdu_03',
// '03': 'bejing_01',
'03': 'chengdu_03',
'05': 'batong_01' // 暂时没有画北京八通线
};

View File

@ -83,7 +83,7 @@ export default class Switch extends Group {
const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth];
const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)];
const switchWidth1 = style.Section.line.width / 2;
const switchWidth1 = style.Section.line.width / 2 + 0.1;
const width1 = switchWidth1 * this.triangle.getSinRate();
const height1 = switchWidth1 * this.triangle.getCosRate();
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
@ -213,10 +213,8 @@ export default class Switch extends Group {
this.setSwitchCoreColor(this.style.backgroundColor);
this.name.getNameText().stopAnimation(false);
this.swCore.stopAnimation(false);
if (!this.model.cutOff) {
this.relocShelter.stopAnimation(false);
this.relocShelter.hide();
}
this.relocShelter.stopAnimation(false);
this.relocShelter.hide();
this.releaseBackground.hide();
this.setHasTextBorder(0);
}
@ -234,9 +232,9 @@ export default class Switch extends Group {
setInversionAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.setTextColor(this.style.Switch.text.inversionColor);
this.locShelter.hide();
this.relocShelter.show();
this.setTextColor(this.style.Switch.text.inversionColor);
this.setSectionState(this.relocShelter.getSection(), 'fill', this.model);
}
@ -324,7 +322,7 @@ export default class Switch extends Group {
}
setSectionState(section, style, state) {
if (section) {
if (section && !section.animators.length) {
switch (state.sectionAstatus) {
case '00': break;
case '01': /** 空闲*/
@ -359,11 +357,12 @@ export default class Switch extends Group {
section.setStyle(style, this.style.Section.line.protectiveLockColor);
break;
}
if (state.cutOff) {
this.sectionCutOff(section);
}
}
if (state.cutOff && !section.animators.length ) {
this.sectionCutOff(section);
}
}
setLocateType(model) {
@ -387,6 +386,7 @@ export default class Switch extends Group {
setState(model) {
this.setLocateType(model);
switch (model.status) {
case '01':
this.spare(); /** 空闲*/

View File

@ -14,10 +14,10 @@ export default {
ExcelConfig: {
beginRow: 1,
beginCol: 0,
fieldNum: 10,
fieldNum: 8,
sepField: '车次',
columns: {
'车站名': { key: 'stationName', formatter: (val) => { return val; } },
'车站名': { key: 'stationName', formatter: (val) => { return val; } },
'到点': { key: 'arriveTime', formatter: (val) => { return val; } },
'发点': { key: 'departureTime', formatter: (val) => { return val; } }
}
@ -25,64 +25,46 @@ export default {
/** 解析exal数据转换为Json后台数据*/
importData(Sheet, JsonData) {
var dataList = convertSheetToList(Sheet, true);
var dataList = convertSheetToList(Sheet, false);
var needList = Object.keys(this.ExcelConfig.columns);
if (dataList && dataList.length) {
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) {
var isContinue = true;
var tripObj = { code: '', arrivalList: [] };
for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
isContinue = false;
for (var rowIndex = this.ExcelConfig.beginRow; rowIndex < dataList.length; rowIndex += 1) {
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList[this.ExcelConfig.beginCol].length; colIndex += this.ExcelConfig.fieldNum + 1) {
var tripNew, tripObj;
var stationObj = {};
tripNew = tripObj = { code: '', arrivalList: [] };
for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) {
if (dataList[colIndex + index]) {
var title = dataList[colIndex + index][0];
var value = dataList[colIndex + index][rowIndex];
var title = dataList[0][colIndex + index];
var value = dataList[rowIndex][colIndex + index];
if (title && value) {
// 数据列解析
isContinue = true;
var titleStr = `${title}`.trim();
var valueStr = `${value}`.trim();
if (title && value) {
var titleStr = `${title}`.trim();
var valueStr = `${value}`.trim();
if (titleStr == this.ExcelConfig.sepField) {
if (tripObj.code) {
const length = tripObj.arrivalList.length;
if (length == 1) {
tripObj.arrivalList[0]['flag'] = true;
}
JsonData.push(tripObj);
tripObj = { code: valueStr, arrivalList: [] };
} else {
tripObj.code = valueStr;
if (titleStr.includes(this.ExcelConfig.sepField)) {
tripObj.code = valueStr;
JsonData.forEach(elem => {
if (elem.code == valueStr) {
tripObj = elem;
return;
}
}
});
}
// 取需要的字段
if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
}
// 取需要的字段
if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
}
}
}
// 添加字段值
if (Object.keys(stationObj).length) {
tripObj.arrivalList.push(stationObj);
tripObj.arrivalList.push(stationObj);
if (tripObj == tripNew) {
JsonData.push(tripObj);
}
}
// 添加最后那条没有车次的记录
if (tripObj.code) {
const length = tripObj.arrivalList.length;
if (length) {
tripObj.arrivalList[length - 1]['flag'] = true;
}
JsonData.push(tripObj);
}
}
}

View File

@ -3,8 +3,8 @@ class Theme {
this._code = '02';
this._mapMenu = {
'02': 'fuzhou_01',
'03': 'beijing_01',
'04': 'chengdou_03',
// '03': 'beijing_01',
'03': 'chengdou_03',
'05': 'batong_01'
};
}

View File

@ -177,6 +177,7 @@
case '5': return 'targetCode:serviceNumber:tripNumber'; //++
case '6': return 'targetCode:serviceNumber:groupNumber'; //++
}
return ''; //
}
}