修改创建运行图表单

This commit is contained in:
zyy 2020-02-13 12:14:39 +08:00
parent b81f6fc967
commit 42c11d0b7c
3 changed files with 62 additions and 13 deletions

View File

@ -97,6 +97,13 @@
</el-form-item> </el-form-item>
</template> </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')"> <template v-else-if="checkFieldType(item, 'radio')">
<el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required"> <el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required">
<el-radio-group <el-radio-group

View File

@ -289,7 +289,7 @@ export default {
list.forEach((elem, index) => { list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : ''; elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime); 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; elem.stopTime = this.addModel.defaultStopTime != '0' ? 30 : 0;
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel); tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
}); });

View File

@ -4,7 +4,7 @@
class="planEdit__tool duplicate-train" class="planEdit__tool duplicate-train"
:title="title" :title="title"
:visible.sync="dialogShow" :visible.sync="dialogShow"
width="420px" width="500px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
:modal="false" :modal="false"
@ -19,25 +19,26 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import { getStationList } from '@/api/runplan';
export default { export default {
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
stationList: [],
formModel: { formModel: {
stationRunningTime: 60, //
right: 3, //
startTime: '', startTime: '',
endTime: '', endTime: '',
departTime: 180, // departTime: 180, //
stopTime: 30, // stopTime: 30, //
reentryTime: 60, //
startStationCode: '',
endStationCode: ''
}, },
form: {
labelWidth: '100px',
items: [
{ prop: 'startTime', label: '开始时间', type: 'timePicker'},
{ prop: 'endTime', label: '结束时间', type: 'timePicker'},
{ prop: 'departTime', label: '发车间隔', type: 'number'},
{ prop: 'stopTime', label: '停站时间', type: 'number'}
]
},
rules: { rules: {
startTime: [ startTime: [
{ required: true, message: '请填写开始时间', trigger: 'blur' } { required: true, message: '请填写开始时间', trigger: 'blur' }
@ -50,6 +51,15 @@ export default {
], ],
stopTime: [ stopTime: [
{ required: true, message: '请填写停站时间', trigger: 'blur' } { required: true, message: '请填写停站时间', trigger: 'blur' }
],
reentryTime: [
{ required: true, message: '请填写折返时间', trigger: 'blur' }
],
startStationCode: [
{ required: true, message: '请选择起始站', trigger: 'change' }
],
endStationCode: [
{ required: true, message: '请选择终止站', trigger: 'change' }
] ]
} }
}; };
@ -57,6 +67,36 @@ export default {
computed: { computed: {
title() { title() {
return '创建运行图'; return '创建运行图';
},
form() {
return {
labelWidth: '100px',
items: [
{ prop: 'startTime', label: '开始时间', type: 'timePicker'},
{ prop: 'endTime', label: '结束时间', type: 'timePicker'},
{ prop: 'departTime', label: '发车间隔', type: 'number'},
{ prop: 'stopTime', 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: { methods: {
@ -64,11 +104,13 @@ export default {
this.dialogShow = true; this.dialogShow = true;
}, },
doClose() { doClose() {
this.$refs.dataform.resetForm();
this.dialogShow = false; this.dialogShow = false;
}, },
handleCommit() { handleCommit() {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
console.log(this.formModel); console.log(this.formModel);
this.doClose()
}); });
}, },
// //