修改创建运行图表单

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>
</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

@ -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,25 +19,26 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getStationList } from '@/api/runplan';
export default {
data() {
return {
dialogShow: false,
stationList: [],
formModel: {
stationRunningTime: 60, //
right: 3, //
startTime: '',
endTime: '',
departTime: 180, //
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: {
startTime: [
{ required: true, message: '请填写开始时间', trigger: 'blur' }
@ -50,6 +51,15 @@ export default {
],
stopTime: [
{ 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,50 @@ export default {
computed: {
title() {
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: {
doShow(params) {
this.dialogShow = true;
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogShow = false;
},
handleCommit() {
this.$refs.dataform.validateForm(() => {
console.log(this.formModel);
this.doClose()
});
},
//