This commit is contained in:
joylink_fanyuhong 2020-02-13 13:12:31 +08:00
commit de7a47d0f4
5 changed files with 93 additions and 23 deletions

View File

@ -21,6 +21,15 @@ export function getStationList(mapId) {
});
}
// 创建通用运行图
export function createRunPlan(mapId, data) {
return request({
url: `/api/runPlan/draft/${mapId}`,
method: 'post',
data: data
});
}
/**
* 创建运行图
*/

View File

@ -97,6 +97,13 @@
</el-form-item>
</template>
<template v-else-if="checkFieldType(item, 'checkBox')">
<el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required">
<el-radio-group v-model="formModel[item.prop]">
<el-radio v-for="item in item.children" :key="item.value" :label="item.value">{{item.name}}</el-radio>
</el-radio-group>
</el-form-item>
</template>
<template v-else-if="checkFieldType(item, 'radio')">
<el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required">
<el-radio-group

View File

@ -8,7 +8,8 @@ export function getBaseUrl() {
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://b29z135112.zicp.vip';
BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -289,7 +289,7 @@ export default {
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.speedLevel = this.addModel.defaultSpeedLevel == 'level3' ? this.$t('planMonitor.default') : '';
elem.speedLevel = this.addModel.defaultSpeedLevel == 'level3' ? `${this.$t('planMonitor.default')}(等级三)` : '';
elem.stopTime = this.addModel.defaultStopTime != '0' ? 30 : 0;
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});

View File

@ -4,7 +4,7 @@
class="planEdit__tool duplicate-train"
:title="title"
:visible.sync="dialogShow"
width="420px"
width="500px"
:before-close="doClose"
:z-index="2000"
:modal="false"
@ -19,37 +19,47 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getStationList, createRunPlan } from '@/api/runplan';
export default {
data() {
return {
dialogShow: false,
stationList: [],
formModel: {
startTime: '',
endTime: '',
departTime: 180, //
stopTime: 30, //
},
form: {
labelWidth: '100px',
items: [
{ prop: 'startTime', label: '开始时间', type: 'timePicker'},
{ prop: 'endTime', label: '结束时间', type: 'timePicker'},
{ prop: 'departTime', label: '发车间隔', type: 'number'},
{ prop: 'stopTime', label: '停站时间', type: 'number'}
]
stationRunningTime: 60, //
right: 3, //
beginTime: '',
overTime: '',
departureTimeInterval: 180, //
parkedTime: 30, //
reentryTime: 60, //
startStationCode: '',
endStationCode: ''
},
rules: {
startTime: [
beginTime: [
{ required: true, message: '请填写开始时间', trigger: 'blur' }
],
endTime: [
overTime: [
{ required: true, message: '请填写结束时间', trigger: 'blur' }
],
departTime: [
departureTimeInterval: [
{ required: true, message: '请填写发车间隔', trigger: 'blur' }
],
stopTime: [
parkedTime: [
{ required: true, message: '请填写停站时间', trigger: 'blur' }
],
reentryTime: [
{ required: true, message: '请填写折返时间', trigger: 'blur' }
],
startStationCode: [
{ required: true, message: '请选择起始站', trigger: 'change' }
],
endStationCode: [
{ required: true, message: '请选择终止站', trigger: 'change' }
]
}
};
@ -57,18 +67,61 @@ export default {
computed: {
title() {
return '创建运行图';
}
},
},
form() {
return {
labelWidth: '100px',
items: [
{ prop: 'beginTime', label: '开始时间', type: 'timePicker'},
{ prop: 'overTime', label: '结束时间', type: 'timePicker'},
{ prop: 'departureTimeInterval', label: '发车间隔', type: 'number'},
{ prop: 'parkedTime', label: '停站时间', type: 'number'},
{ prop: 'reentryTime', label: '折返时间', type: 'number'},
{ prop: 'right', label: '发车类型', type: 'checkBox', children: [
{ name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 },
{ name: '同时发车', value: 3 }
] },
{ prop: 'startStationCode', label: '起始站', type: 'select', options: this.stationList },
{ prop: 'endStationCode', label: '终止站', type: 'select', options: this.stationList }
]
}
}
},
created() {
const mapId = this.$route.query.mapId;
if (mapId) {
getStationList(mapId).then(response => {
this.stationList = response.data.map(elem => { return { value: elem.code, label: elem.name }; });
}).catch(() => {
this.$messageBox(`获取车站列表失败`);
});
}
},
methods: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogShow = false;
},
handleCommit() {
this.$refs.dataform.validateForm(() => {
console.log(this.formModel);
if (this.formModel.right == 1) {
this.formModel.right = true
} else if (this.formModel.right == 2) {
this.formModel.right = false
} else {
this.formModel.right = null;
}
createRunPlan(this.$route.query.mapId, this.formModel).then(res => {
console.log(res);
this.doClose()
}).catch(error => {
console.log(error);
})
});
},
//