运行图编制工具 修改站间运行时间那里加个更新距离的功能
bug144 运行图设计:生成计划的服务号不能输入0,修改
This commit is contained in:
parent
6d70fd3fb2
commit
ec89eca2ad
@ -45,7 +45,7 @@ export default {
|
||||
rules:{
|
||||
serviceNumber:[
|
||||
{required: true, validator: this.validateServiceNumber, trigger: 'blur'},
|
||||
{required: true, validator: this.validateServiceNumber, trigger: 'change'}
|
||||
{required: true, validator: this.validateServiceNo, trigger: 'change'}
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -65,15 +65,30 @@ export default {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
},
|
||||
validateServiceNo(rule, value, callback) {
|
||||
if (typeof value == 'string' && value.trim().length == 0) {
|
||||
return callback(new Error('请填写服务号'));
|
||||
} else {
|
||||
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
|
||||
if (serviceNumberList.includes(value)) {
|
||||
return callback(new Error('该服务号已存在,请重新填写'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
},
|
||||
validateServiceNumber(rule, value, callback) {
|
||||
if (typeof value == 'string' && value.trim().length == 0) {
|
||||
return callback(new Error('请填写服务号'));
|
||||
} else {
|
||||
const newValue = parseInt(value);
|
||||
let newValue = parseInt(value);
|
||||
if (newValue) {
|
||||
if (newValue.toString() != value) {
|
||||
this.formModel.serviceNumber = newValue;
|
||||
if (newValue > 0 & newValue < 9) {
|
||||
newValue = '00' + newValue;
|
||||
} else if (newValue > 10 & newValue < 99) {
|
||||
newValue = '0' + newValue;
|
||||
}
|
||||
this.formModel.serviceNumber = newValue;
|
||||
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
|
||||
if (serviceNumberList.includes(value)) {
|
||||
return callback(new Error('该服务号已存在,请重新填写'));
|
||||
|
@ -54,7 +54,8 @@
|
||||
</el-select> -->
|
||||
<!-- </el-col> -->
|
||||
<el-col :span="3" style="margin-left:10px;height: 28px;line-height: 28px;">
|
||||
<span>{{ $t('planMonitor.defaultRunLevel') }}</span>
|
||||
<!-- {{ $t('planMonitor.defaultRunLevel') }} -->
|
||||
<span>运行等级</span>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-select v-model="defaultSpeedLevel" size="mini" :placeholder="this.$t('global.choose')">
|
||||
|
@ -49,7 +49,7 @@
|
||||
<span style="margin-left: 10px">{{ formatName(scope.row.startStationCode) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="startSectionCode" :label="$t('planMonitor.modifying.startSection')">
|
||||
<el-table-column prop="startSectionCode" :label="$t('planMonitor.modifying.startSection')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ formatName(scope.row.startSectionCode) }}</span>
|
||||
</template>
|
||||
@ -59,7 +59,7 @@
|
||||
<span style="margin-left: 10px">{{ formatName(scope.row.endStationCode) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="endSectionCode" :label="$t('planMonitor.modifying.endSection')">
|
||||
<el-table-column prop="endSectionCode" :label="$t('planMonitor.modifying.endSection')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ formatName(scope.row.endSectionCode) }}</span>
|
||||
</template>
|
||||
@ -69,9 +69,10 @@
|
||||
<span style="margin-left: 10px">{{ scope.row.right?'上行':'下行' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="distance" :label="$t('planMonitor.modifying.distance')" width="65">
|
||||
<el-table-column prop="distance" :label="$t('planMonitor.modifying.distance')" width="85">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.distance }}</span>
|
||||
<!-- <span style="margin-left: 10px">{{ scope.row.distance }}</span> -->
|
||||
<el-input v-model="scope.row.distance" class="input_text_box" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<div>
|
||||
|
@ -10,12 +10,17 @@
|
||||
:modal="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-row>
|
||||
<!-- <el-row>
|
||||
<el-col :span="6" :offset="2" style="height: 30px; line-height: 30px;">{{ $t('planMonitor.serviceNumber2')+$t('global.colon') }}</el-col>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-input v-model="serviceNumber" size="mini" maxlength="3" minlength="2" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row> -->
|
||||
<el-form ref="form" :rules="rules" :model="formModel" label-width="100px" size="medium" @submit.native.prevent>
|
||||
<el-form-item prop="serviceNumber" :label="$t('planMonitor.serviceNumber2')+$t('global.colon')" :required="true">
|
||||
<el-input v-model="formModel.serviceNumber" type="text" size="mini" maxlength="3" minlength="2" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
|
||||
@ -40,7 +45,15 @@ export default {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
serviceNumber: ''
|
||||
formModel:{
|
||||
serviceNumber: ''
|
||||
},
|
||||
rules:{
|
||||
serviceNumber:[
|
||||
{required: true, validator: this.validateServiceNumber, trigger: 'blur'},
|
||||
{required: true, validator: this.validateServiceNo, trigger: 'change'}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -58,37 +71,73 @@ export default {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
},
|
||||
validateServiceNo(rule, value, callback) {
|
||||
if (typeof value == 'string' && value.trim().length == 0) {
|
||||
return callback(new Error('请填写服务号'));
|
||||
} else {
|
||||
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
|
||||
if (serviceNumberList.includes(value)) {
|
||||
return callback(new Error('该服务号已存在,请重新填写'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
},
|
||||
validateServiceNumber(rule, value, callback) {
|
||||
if (typeof value == 'string' && value.trim().length == 0) {
|
||||
return callback(new Error('请填写服务号'));
|
||||
} else {
|
||||
let newValue = parseInt(value);
|
||||
if (newValue) {
|
||||
if (newValue > 0 & newValue < 9) {
|
||||
newValue = '00' + newValue;
|
||||
} else if (newValue > 10 & newValue < 99) {
|
||||
newValue = '0' + newValue;
|
||||
}
|
||||
this.formModel.serviceNumber = newValue;
|
||||
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
|
||||
if (serviceNumberList.includes(value)) {
|
||||
return callback(new Error('该服务号已存在,请重新填写'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
} else {
|
||||
this.formModel.serviceNumber = '';
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
handleCommit() {
|
||||
if (this.$route.query.planId || this.loadRunPlanId) {
|
||||
if (this.serviceNumber.length >= 2 && this.serviceNumber.length <= 3) {
|
||||
checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.serviceNumber }).then(resp => {
|
||||
if (resp.data) {
|
||||
this.$emit('dispatchDialog', {
|
||||
name: 'offLine',
|
||||
params: {
|
||||
type: 'warning',
|
||||
operate: 'AddPlanningTrain',
|
||||
width: 460,
|
||||
message: this.$t('tip.serviceNumberExistHint')
|
||||
}
|
||||
});
|
||||
checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.formModel.serviceNumber }).then(resp => {
|
||||
if (resp.data) {
|
||||
this.$emit('dispatchDialog', {
|
||||
name: 'offLine',
|
||||
params: {
|
||||
type: 'warning',
|
||||
operate: 'AddPlanningTrain',
|
||||
width: 460,
|
||||
message: this.$t('tip.serviceNumberExistHint')
|
||||
}
|
||||
});
|
||||
|
||||
this.doClose();
|
||||
} else {
|
||||
this.handleConfirm(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$messageBox('长度在二到三位');
|
||||
}
|
||||
this.doClose();
|
||||
} else {
|
||||
this.handleConfirm(true);
|
||||
}
|
||||
});
|
||||
// if (this.serviceNumber.length >= 2 && this.serviceNumber.length <= 3) {
|
||||
// } else {
|
||||
// this.$messageBox('长度在二到三位');
|
||||
// }
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.chooseToOpenTheRunGraph'));
|
||||
}
|
||||
},
|
||||
handleConfirm(isNew = false) {
|
||||
this.doClose();
|
||||
this.$store.dispatch('runPlan/addserviceNumber', this.serviceNumber);
|
||||
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.serviceNumber, isNew:isNew } });
|
||||
this.$store.dispatch('runPlan/addserviceNumber', this.formModel.serviceNumber);
|
||||
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.formModel.serviceNumber, isNew:isNew } });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -54,7 +54,7 @@
|
||||
</el-select> -->
|
||||
<!-- </el-col> -->
|
||||
<el-col :span="3" style="margin-left:10px;height: 28px;line-height: 28px;">
|
||||
<span>{{ $t('planMonitor.defaultRunLevel') }}</span>
|
||||
<span>运行等级</span>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-select v-model="defaultSpeedLevel" size="mini" :placeholder="this.$t('global.choose')">
|
||||
|
Loading…
Reference in New Issue
Block a user