This commit is contained in:
fan 2020-04-27 14:01:37 +08:00
commit c02f42fba1
8 changed files with 157 additions and 97 deletions

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-dialogDrag class="autoSignal" :title="$t('map.automaticSignalList')" :visible.sync="show" width="85%" :before-do-close="doClose">
<el-dialog v-dialogDrag class="autoSignal" title="停站时间列表" :visible.sync="show" width="85%" :before-do-close="doClose">
<div>
<QueryListPage
ref="queryListPage"
@ -13,7 +13,6 @@
<script>
import { mapGetters } from 'vuex';
import { listMap } from '@/api/jmap/mapdraft';
import { getStationParkTimeList, deleteStationParkTime, getStationParkTime } from '@/api/jmap/mapdraft';
export default {
@ -29,7 +28,6 @@ export default {
data() {
return {
show: false,
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -37,16 +35,9 @@ export default {
queryForm: {
labelWidth: '120px',
queryObject: {
code: {
type: 'text',
label: this.$t('map.autoSignalCode'),
config: {
data: []
}
},
signalCode: {
stationCode: {
type: 'select',
label: this.$t('map.signal'),
label: '经停车站',
config: {
data: []
}
@ -95,24 +86,17 @@ export default {
},
computed: {
...mapGetters('map', [
'sectionList',
'signalList',
'stationStandList'
'stationList'
])
},
watch: {
signalList: function (val, old) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: val[i].uniqueName, value: val[i].code });
}
this.queryForm.queryObject.signalCode.config.data = list;
}
}
},
mounted() {
this.acquireMapList();
const list = [];
if (this.stationList && this.stationList.length) {
for (let i = 0; i < this.stationList.length; i++) {
list.push({ label: this.stationList[i].name, value: this.stationList[i].code });
}
this.queryForm.queryObject.stationCode.config.data = list;
}
},
methods: {
doShow() {
@ -143,26 +127,6 @@ export default {
return getStationParkTimeList(this.mapInfo.id, params);
}
},
acquireMapList() {
//
listMap({ drawWay:true}).then(response => {
this.mapList = response.data;
});
},
afterQuery(data) {
if (data && data.list) {
const that = this;
const list = data.list;
if (list) {
list.map(elem => {
that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']);
elem.code = elem.signalCode;
elem.signalCode = that.formatName(elem.signalCode);
});
}
}
return data;
},
editObj(index, row) {
getStationParkTime(row.id).then(response => {
const data = response.data;

View File

@ -4,7 +4,7 @@
<el-form ref="form" :model="addModel" :rules="rules" label-width="80px" size="mini">
<div class="definition">
<el-form-item label="停站车站" prop="stationCode">
<el-select v-model="addModel.stationCode" clearable :filterable="true">
<el-select v-model="addModel.stationCode" clearable :filterable="true" :disabled="editShow">
<el-option
v-for="item in stationList"
:key="item.code"
@ -13,6 +13,7 @@
/>
</el-select>
<el-button
:disabled="editShow"
:type=" field === 'parkStationCode' ? 'danger' : 'primary'"
@click="hover('parkStationCode')"
>{{ $t('map.activate') }}</el-button>
@ -60,7 +61,7 @@
<el-button
type="text"
size="small"
@click.native.prevent="deleteSection(addModel.routingSectionList, scope.$index)"
@click.native.prevent="deleteSection(addModel.parkingTimeVOList, scope.$index)"
>
{{ $t('map.remove') }}
</el-button>
@ -162,7 +163,6 @@ export default {
this.sectionCode = val.parkingTimeVOList[0].sectionCode;
this.parkingTime = val.parkingTimeVOList[0].parkingTime;
}
this.editShow = true;
}
}
},
@ -175,8 +175,17 @@ export default {
formatName(code) {
return formatName(code);
},
editData() {
this.isSave = false;
this.editShow = true;
},
pushSection(list, data) {
list.push(data);
const index = list.findIndex(elem => { return elem.sectionCode == data.sectionCode; });
if (index < 0) {
list.push(data);
} else {
this.$messageBox('该区段已经在列表中存在');
}
},
setSelected(selected) {
if (selected) {
@ -191,6 +200,9 @@ export default {
}
}
},
deleteSection(list, index) {
list.splice(index, 1);
},
buildModel(code) {
const model = Object.assign({}, this.addModel);
if (code) { model['code'] = code; }
@ -236,9 +248,10 @@ export default {
this.addModel.stationCode = '';
this.addModel.parkingTimeVOList = [];
this.sectionCode = '';
this.parkingTime = 0;
this.parkingTime = 30;
this.addModel.code = '';
this.isSave = true;
this.editShow = false;
}
}
}

View File

@ -60,7 +60,7 @@ export default {
autoMaticoSelected: function (data) {
this.routeData = data;
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.isSave = false;
this.$refs.routeEdit.editData();
}
},
previewRouteEvent: function () {

View File

@ -55,6 +55,20 @@ export default {
config: {
data: []
}
},
startSectionCode: {
type: 'select',
label: '起始区段',
config: {
data: []
}
},
endSectionCode: {
type: 'select',
label: '终到区段',
config: {
data: []
}
}
}
},
@ -74,7 +88,7 @@ export default {
},
{
title: this.$t('map.startStationCode'),
title: '起始区段',
prop: 'startSectionCode'
},
{
@ -82,7 +96,7 @@ export default {
prop: 'endStationCode'
},
{
title: this.$t('map.endStationCode'),
title: '终到区段',
prop: 'endSectionCode'
},
{
@ -151,6 +165,16 @@ export default {
this.queryForm.queryObject.startStationCode.config.data = list;
this.queryForm.queryObject.endStationCode.config.data = list;
}
},
sectionList: function (val, old) {
const list = [];
if (val && val.length) {
val.forEach(elem => {
list.push({ label: this.formatName(elem.code), value: elem.code });
});
this.queryForm.queryObject.startSectionCode.config.data = list;
this.queryForm.queryObject.endSectionCode.config.data = list;
}
}
},
mounted() {
@ -218,13 +242,19 @@ export default {
},
deleteObj(index, row) {
if (this.mapInfo && this.mapInfo.id && row) {
//
deleteRoutingData(row.id).then(response => {
this.$message.success(this.$t('map.successfullyDelete'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('map.failDelete'));
});
this.$confirm('是否确认删除交路', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
//
deleteRoutingData(row.id).then(response => {
this.$message.success(this.$t('map.successfullyDelete'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('map.failDelete'));
});
}).catch();
}
},
generateData(index, row) {
@ -234,16 +264,15 @@ export default {
this.$message.success(this.$t('map.generateStationRunDataSuccess'));
//
this.reloadTable();
}).catch(() => {
}).catch((error) => {
//
this.$messageBox(this.$t('map.generateStationRunDataFailed'));
this.$messageBox(this.$t('map.generateStationRunDataFailed') + ': ' + error.message);
});
}
},
sectionDetail(index, row) {
const sectionDict = {};
const stationDict = {};
this.sectionList.forEach(elem => { sectionDict[elem.code] = elem.name; });
this.stationList.forEach(elem => { stationDict[elem.code] = elem.name; });
@ -257,7 +286,7 @@ export default {
items: [
{ prop: 'stationCode', label: this.$t('map.stationCodeClomn'), type: 'text' },
{
prop: 'stationCode', label: this.$t('map.sectionName'), type: 'select', options: stationDict
prop: 'stationCode', label: '车站名称', type: 'select', options: stationDict
},
{ prop: 'sectionCode', label: this.$t('map.blockCodingClomn'), type: 'text' },
{
@ -266,7 +295,7 @@ export default {
]
}
};
this.$refs.previewField.doShow(fieldList, row.routingSectionList);
this.$refs.previewField.doShow(fieldList, row.parkSectionCodeList);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {

View File

@ -60,7 +60,7 @@ export default {
routingSelected: function (data) {
this.routeData = data;
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.isSave = false;
this.$refs.routeEdit.editData();
}
},
previewRouteEvent: function () {

View File

@ -20,8 +20,8 @@
@click="hover('startStationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.startSectionColon')" prop="startSectionCode" @change="changeStartSection()">
<el-select v-model="addModel.startSectionCode" clearable :filterable="true">
<el-form-item :label="$t('map.startSectionColon')" prop="startSectionCode">
<el-select v-model="addModel.startSectionCode" clearable :filterable="true" :disabled="editShow" @change="changeStartSection()">
<el-option
v-for="item in filterSectionList"
:key="item.code"
@ -30,12 +30,13 @@
/>
</el-select>
<el-button
:disabled="editShow"
:type=" field === 'startSectionCode' ? 'danger' : 'primary'"
@click="hover('startSectionCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.endStationColon')" prop="endStationCode" @change="changeEndStation()">
<el-select v-model="addModel.endStationCode" clearable :filterable="true">
<el-form-item :label="$t('map.endStationColon')" prop="endStationCode">
<el-select v-model="addModel.endStationCode" clearable :filterable="true" :disabled="!isStartSelected" @change="changeEndStation()">
<el-option
v-for="item in filterStationList"
:key="item.code"
@ -44,12 +45,13 @@
/>
</el-select>
<el-button
:disabled="!isStartSelected"
:type=" field === 'endStationCode' ? 'danger' : 'primary'"
@click="hover('endStationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.endSectionColon')" prop="endSectionCode" @change="changeEndSection()">
<el-select v-model="addModel.endSectionCode" clearable :filterable="true">
<el-form-item :label="$t('map.endSectionColon')" prop="endSectionCode">
<el-select v-model="addModel.endSectionCode" clearable :filterable="true" :disabled="editShow || !isStartSelected" @change="changeEndSection()">
<el-option
v-for="item in filterSectionList"
:key="item.code"
@ -58,11 +60,12 @@
/>
</el-select>
<el-button
:disabled="editShow || !isStartSelected"
:type=" field === 'endSectionCode' ? 'danger' : 'primary'"
@click="hover('endSectionCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.destinationCode')" prop="destinationCode">
<el-form-item :label="$t('map.destinationCode')" prop="destinationCode" :disabled="editShow">
<el-input v-model="addModel.destinationCode" />
</el-form-item>
<el-form-item :label="$t('map.routingDirection')" prop="directionCode">
@ -202,6 +205,7 @@ export default {
ViewMode: ViewMode,
field: '',
allowSelect:false,
isStartSelected:false,
stationCode: '',
sectionCode: '',
isSave: true,
@ -272,7 +276,6 @@ export default {
routeData(val, old) {
if (val) {
this.addModel = val;
this.editShow = true;
}
}
},
@ -293,21 +296,27 @@ export default {
// });
// }
// },
editData() {
this.isSave = false;
this.allowSelect = true;
this.isStartSelected = true;
this.editShow = true;
},
changeStartStation() {
this.judgeAllowSelected();
this.addStartSectionData();
this.addStartSectionData(true);
},
changeStartSection() {
this.judgeAllowSelected();
this.addStartSectionData();
this.addStartSectionData(false);
},
changeEndStation() {
this.judgeAllowSelected();
this.addEndSectionData();
this.addEndSectionData(true);
},
changeEndSection() {
this.judgeAllowSelected();
this.addEndSectionData();
this.addEndSectionData(false);
},
judgeAllowSelected() {
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '' && this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
@ -316,14 +325,15 @@ export default {
this.allowSelect = false;
}
},
addStartSectionData() {
addStartSectionData(isStation) {
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '') {
this.pushSection({stationCode: this.addModel.startStationCode, sectionCode: this.addModel.startSectionCode}, 'top');
this.isStartSelected = true;
this.pushSection({stationCode: this.addModel.startStationCode, sectionCode: this.addModel.startSectionCode}, 'top', isStation);
}
},
addEndSectionData() {
addEndSectionData(isStation) {
if (this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
this.pushSection({stationCode: this.addModel.endStationCode, sectionCode: this.addModel.endSectionCode}, 'bottom');
this.pushSection({stationCode: this.addModel.endStationCode, sectionCode: this.addModel.endSectionCode}, 'bottom', isStation);
}
},
hover(field) {
@ -337,19 +347,19 @@ export default {
if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'startStationCode'.toUpperCase()) {
this.addModel.startStationCode = selected.code;
this.judgeAllowSelected();
this.addStartSectionData();
this.addStartSectionData(true);
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'endStationCode'.toUpperCase()) {
this.addModel.endStationCode = selected.code;
this.judgeAllowSelected();
this.addEndSectionData();
this.addEndSectionData(true);
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected();
this.addStartSectionData();
this.addStartSectionData(false);
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected();
this.addEndSectionData();
this.addEndSectionData(false);
this.addModel.destinationCode = selected.destinationCode || '';
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) {
this.sectionCode = selected.code;
@ -358,7 +368,7 @@ export default {
}
}
},
pushSection(data, type) {
pushSection(data, type, isStation) {
const list = this.addModel.parkSectionCodeList;
if (data && data.stationCode && data.sectionCode) {
const index = list.findIndex(elem => { return elem.sectionCode == data.sectionCode; });
@ -367,16 +377,52 @@ export default {
if (index < 0) {
list.splice(list.length - 1, 0, data);
} else {
this.$messageBox(this.$t('tip.routeSameID'));
this.$messageBox('该区段已经在交路区段中存在');
}
break;
}
case 'top': {
list.splice(0, 1, data);
if (isStation) {
list.splice(0, 1, data);
} else {
if (index < 0) {
list.splice(0, 1, data);
} else {
if (index == list.length - 1) {
this.$messageBox('起始区段和终到区段不能相同');
this.addModel.startSectionCode = list[0].sectionCode;
} else {
this.$messageBox('该区段已经在交路区段中存在');
}
}
}
break;
}
case 'bottom': {
list.splice(list.length, 1, data);
if (isStation) {
if (list.length >= 2) {
list.splice(list.length - 1, 1, data);
} else {
if (index < 0) {
list.push(data);
}
}
} else {
if (index < 0) {
if (list.length >= 2) {
list.splice(list.length - 1, 1, data);
} else {
list.push(data);
}
} else {
if (index == 0) {
this.$messageBox('起始区段和终到区段不能相同');
this.addModel.endSectionCode = list[list.length - 1].sectionCode;
} else {
this.$messageBox('该区段已经在交路区段中存在');
}
}
}
break;
}
default: {
@ -448,6 +494,9 @@ export default {
this.stationCode = '';
this.sectionCode = '';
this.isSave = true;
this.allowSelect = false;
this.isStartSelected = false;
this.editShow = false;
}
}
}

View File

@ -69,7 +69,7 @@ export default {
},
{
title: this.$t('map.startStationCode'),
title: '起始区段',
prop: 'startSectionCode'
},
{
@ -77,7 +77,7 @@ export default {
prop: 'endStationCode'
},
{
title: this.$t('map.endStationCode'),
title: '终到区段',
prop: 'endSectionCode'
},
{
@ -89,7 +89,10 @@ export default {
},
{
title: '站间距离',
prop: 'distance'
prop: 'distance',
type: 'tag',
columnValue: (row) => { return row.distance + ' m'; },
tagType: (row) => { return 'success'; }
},
{
title: '第一等级时间',

View File

@ -19,7 +19,7 @@
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.startSectionColon')" prop="startSectionCode">
<el-select v-model="addModel.startSectionCode" clearable :filterable="true">
<el-select v-model="addModel.startSectionCode" clearable :filterable="true" :disabled="editShow">
<el-option
v-for="item in filterSectionList"
:key="item.code"
@ -28,6 +28,7 @@
/>
</el-select>
<el-button
:disabled="editShow"
:type=" field === 'startSectionCode' ? 'danger' : 'primary'"
@click="hover('startSectionCode')"
>{{ $t('map.activate') }}</el-button>
@ -47,7 +48,7 @@
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.endSectionColon')" prop="endSectionCode">
<el-select v-model="addModel.endSectionCode" clearable :filterable="true">
<el-select v-model="addModel.endSectionCode" clearable :filterable="true" :disabled="editShow">
<el-option
v-for="item in filterSectionList"
:key="item.code"
@ -56,6 +57,7 @@
/>
</el-select>
<el-button
:disabled="editShow"
:type=" field === 'endSectionCode' ? 'danger' : 'primary'"
@click="hover('endSectionCode')"
>{{ $t('map.activate') }}</el-button>