This commit is contained in:
sunzhenyu 2020-06-01 15:43:48 +08:00
commit dfa91c5234
4 changed files with 159 additions and 122 deletions

View File

@ -15,84 +15,84 @@ import DataTable from '../menusPlan/components/dataTable';
import { formatTime, formatName } from '@/utils/runPlan';
export default {
name: 'PlanStatusBar',
components: {
DataTable
},
props: {
maxTop: {
type: Number,
required: true
}
},
data() {
return {
maxmini: true,
height: 100,
stationListConfig: {
data: [],
showClose: true,
highlightCurrentRow: true,
columns: [
{
prop: 'stationName',
label: '站台',
width: 400
},
{
prop: 'startTime',
label: '到点'
},
{
prop: 'stopTime',
label: '停站时间'
},
{
prop: 'endTime',
label: '发点'
},
{
prop: 'level',
label: '运行等级'
name: 'PlanStatusBar',
components: {
DataTable
},
props: {
maxTop: {
type: Number,
required: true
}
},
data() {
return {
maxmini: true,
height: 100,
stationListConfig: {
data: [],
showClose: true,
highlightCurrentRow: true,
columns: [
{
prop: 'stationName',
label: '站台',
width: 400
},
{
prop: 'startTime',
label: '到点'
},
{
prop: 'stopTime',
label: '停站时间'
},
{
prop: 'endTime',
label: '发点'
},
{
prop: 'level',
label: '运行等级'
}
]
}
};
},
watch: {
'$store.state.runPlan.selected': function (select) {
this.stationListConfig.data = [];
const serviceObj = this.$store.state.runPlan.editData[select.serviceNumber];
if (serviceObj) {
const trainMap = serviceObj.trainMap;
if (trainMap) {
const trainObj = trainMap[select.tripNumber];
if (trainObj) {
const stationTimeList = trainObj.stationTimeList;
if (stationTimeList && stationTimeList.length) {
stationTimeList.forEach((elem, index) => {
const stationObj = {
stationName: formatName(elem.stationCode),
startTime: formatTime(index == 0 ? null : stationTimeList[index - 1].secondTime),
stopTime: formatTime(index == 0 ? null : elem.secondTime - stationTimeList[index - 1].secondTime),
endTime: formatTime(elem.secondTime),
level: ''
};
this.stationListConfig.data.push(stationObj);
});
}
}
}
}
}
},
methods: {
touch(maxmini) {
this.maxmini = maxmini;
this.$emit('setPosition');
}
}
}
]
}
};
},
watch: {
'$store.state.runPlan.selected': function (select) {
this.stationListConfig.data = [];
const serviceObj = this.$store.state.runPlan.editData[select.serviceNumber];
if (serviceObj) {
const trainMap = serviceObj.trainMap;
if (trainMap) {
const trainObj = trainMap[select.tripNumber];
if (trainObj) {
const stationTimeList = trainObj.stationTimeList;
if (stationTimeList && stationTimeList.length) {
stationTimeList.forEach((elem, index) => {
const stationObj = {
stationName: formatName(elem.stationCode),
startTime: formatTime(index == 0 ? null : stationTimeList[index - 1].secondTime),
stopTime: formatTime(index == 0 ? null : elem.secondTime - stationTimeList[index - 1].secondTime),
endTime: formatTime(elem.secondTime),
level: ''
};
this.stationListConfig.data.push(stationObj);
});
}
}
}
}
}
},
methods: {
touch(maxmini) {
this.maxmini = maxmini;
this.$emit('setPosition');
}
}
};
</script>

View File

@ -152,7 +152,9 @@ export default {
}
},
'$store.state.map.showCentralizedStationNum': function (val) {
this.setShowStation(this.$store.state.map.showCentralizedStationCode);
if (this.$store.state.map.showCentralizedStationCode) {
this.setShowStation(this.$store.state.map.showCentralizedStationCode);
}
},
'$store.state.training.offsetStationCode': function(code) {
if (code && this.localStationShow && this.$store.state.training.prdType === '01') {

View File

@ -28,44 +28,44 @@
<script>
export default {
name: 'DataTable',
props: {
height: {
type: Number,
required: true
},
config: {
type: Object,
required: true
}
},
data() {
return {
show: true,
maxmini: true,
touchStrategy: {
'Close': [false, true],
'Minim': [true, false],
'Maxim': [true, true]
}
};
},
methods: {
handleChange(row) {
if (this.config.handleChange) {
this.config.handleChange(row);
}
},
setCurrentRow(row) {
this.$refs.table.setCurrentRow(row);
},
touch(operate) {
this.$nextTick(() => {
[this.show, this.maxmini] = this.touchStrategy[operate];
this.$emit('touch', this.maxmini);
});
}
}
name: 'DataTable',
props: {
height: {
type: Number,
required: true
},
config: {
type: Object,
required: true
}
},
data() {
return {
show: true,
maxmini: true,
touchStrategy: {
'Close': [false, true],
'Minim': [true, false],
'Maxim': [true, true]
}
};
},
methods: {
handleChange(row) {
if (this.config.handleChange) {
this.config.handleChange(row);
}
},
setCurrentRow(row) {
this.$refs.table.setCurrentRow(row);
},
touch(operate) {
this.$nextTick(() => {
[this.show, this.maxmini] = this.touchStrategy[operate];
this.$emit('touch', this.maxmini);
});
}
}
};
</script>

View File

@ -45,7 +45,7 @@ export default {
},
maxWidth: {
type: Number,
require: true
default: 0
},
maxHeight: {
type: Number,
@ -205,6 +205,11 @@ export default {
indexKmRangeMap: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
watch: {
maxWidth() {
this.setPosition();
@ -232,11 +237,6 @@ export default {
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
}
},
computed: {
...mapGetters('runPlan', [
'stations'
])
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
@ -247,6 +247,7 @@ export default {
serviceNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
this.renderTripNumber({ serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap);
@ -256,6 +257,7 @@ export default {
tripNumberChange(row) {
if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
this.renderTripNumber({ serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
}
},
async analyticalServiceNumber(data) {
@ -426,6 +428,39 @@ export default {
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
renderTripNumber(params) {
const tripNumber = params.tripNumber; //
const serviceNumber = params.serviceNumber; //
let data;
const op = this.myChart.getOption();
op.series.forEach((item, index) => {
if (item.name == serviceNumber && item.data) {
const temp = item.data.filter(elem => elem[3] == tripNumber);
if (temp.length) {
data = temp;
}
}
if (item.name == 'trainLabel') {
op.series.pop();
this.myChart && this.myChart.setOption(op, true);
}
});
op.series.push({
name: 'trainLabel',
lineStyle: {
color: '#000',
width: 2,
type: 'solid'
},
z: 10,
type: 'line',
data: data
});
setTimeout(() => {
this.myChart && this.myChart.setOption(op, true);
}, 50);
},
mouseClick(params) {
const model = {
serviceNumber: params.seriesName