This commit is contained in:
zyy 2019-08-07 16:23:11 +08:00
commit fe9b59e2de
5 changed files with 42 additions and 59 deletions

View File

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

View File

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

View File

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

View File

@ -4,8 +4,8 @@ class Theme {
this._mapMenu = { this._mapMenu = {
'01': 'default', // 成都4号线 '01': 'default', // 成都4号线
'02': 'fuzhou_01', '02': 'fuzhou_01',
'03': 'beijing_01', // '03': 'beijing_01',
'04': 'chengdou_03', '03': 'chengdou_03',
'05': 'batong_01' '05': 'batong_01'
}; };
} }

View File

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