佛山修改列车识别好调整

This commit is contained in:
fan 2020-09-04 17:57:37 +08:00
parent dc085df977
commit 5af9956f5b

View File

@ -37,20 +37,13 @@
:disabled="serverNoIsDisabled" :disabled="serverNoIsDisabled"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'&&popClass !== 'foshan-01__systerm'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber"> <el-form-item v-if="formModel.type == 'PLAN'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-input <el-input
:id="domIdTrainNo" :id="domIdTrainNo"
v-model="formModel.tripNumber" v-model="formModel.tripNumber"
maxlength="4" maxlength="4"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'&&popClass === 'foshan-01__systerm'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-input
:id="domIdTrainNo"
v-model="formModel.stNumber"
maxlength="5"
/>
</el-form-item>
<el-form-item v-if="formModel.type == 'PLAN' || formModel.type == 'HEAD'" :label="this.$t('menu.targetCode')+this.$t('global.colon')" prop="destinationCode"> <el-form-item v-if="formModel.type == 'PLAN' || formModel.type == 'HEAD'" :label="this.$t('menu.targetCode')+this.$t('global.colon')" prop="destinationCode">
<el-input <el-input
:id="domIdTargetCode" :id="domIdTargetCode"
@ -115,7 +108,6 @@ export default {
tripNumber: '', tripNumber: '',
groupNumber: '', groupNumber: '',
type: 'PLAN', type: 'PLAN',
stNumber: '',
serviceNumber: '', serviceNumber: '',
destinationCode: '', destinationCode: '',
category: 'MM' category: 'MM'
@ -127,9 +119,6 @@ export default {
groupNumber: [ groupNumber: [
{ required: true, message: '请选择车组号', trigger: 'change' } { required: true, message: '请选择车组号', trigger: 'change' }
], ],
stNumber: [
{ required: true, message: '请输入车次号', trigger: 'blur' }
],
type: [ type: [
{ required: true, message: '请选择列车类型', trigger: 'change' } { required: true, message: '请选择列车类型', trigger: 'change' }
], ],
@ -151,7 +140,11 @@ export default {
'map' 'map'
]), ]),
serverNoIsDisabled() { serverNoIsDisabled() {
if (this.popClass === 'foshan-01__systerm' && this.formModel.type === 'PLAN') {
return false;
} else {
return true; return true;
}
}, },
trainNumberIsDisabled() { trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) { if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
@ -257,21 +250,36 @@ export default {
type: this.formModel.type, type: this.formModel.type,
serviceNumber: '', serviceNumber: '',
targetCode: '', targetCode: '',
stNumber: '', category: 'MM'
};
} else if (this.popClass === 'foshan-01__systerm' && val.length === 2 && this.formModel.serviceNumber.length === 3) {
this.trainNoChange(val, this.formModel.serviceNumber);
} else if (this.popClass === 'foshan-01__systerm') {
const serviceNumber = this.formModel.serviceNumber;
const destinationCode = this.formModel.destinationCode;
this.formModel = {
groupNumber: this.formModel.groupNumber,
destinationCode: destinationCode,
tripNumber: val,
type: this.formModel.type,
serviceNumber: serviceNumber,
targetCode: '',
category: 'MM' category: 'MM'
}; };
} }
}, },
'formModel.stNumber': function(val) { 'formModel.serviceNumber': function(val) {
if (this.popClass === 'foshan-01__systerm' && val.length === 5) { if (this.popClass === 'foshan-01__systerm' && val.length === 3 && this.formModel.tripNumber.length === 2) {
this.trainNoChange(val); this.trainNoChange(this.formModel.tripNumber, val);
} else if (this.popClass === 'foshan-01__systerm') { } else if (this.popClass === 'foshan-01__systerm') {
const tripNumber = this.formModel.tripNumber;
const destinationCode = this.formModel.destinationCode;
this.formModel = { this.formModel = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
tripNumber: '', tripNumber: tripNumber,
destinationCode: destinationCode,
type: this.formModel.type, type: this.formModel.type,
stNumber: val, serviceNumber: val,
serviceNumber: '',
targetCode: '', targetCode: '',
category: 'MM' category: 'MM'
}; };
@ -298,7 +306,6 @@ export default {
type: model.type ? model.type : 'PLAN', type: model.type ? model.type : 'PLAN',
serviceNumber: model.serviceNumber, serviceNumber: model.serviceNumber,
destinationCode: model.destinationCode, destinationCode: model.destinationCode,
stNumber: model.serviceNumber + '' + model.tripNumber,
category: 'MM' category: 'MM'
}; };
/** 加载列车数据*/ /** 加载列车数据*/
@ -352,7 +359,7 @@ export default {
} }
}); });
}, },
trainNoChange(tripNumber) { trainNoChange(tripNumber, serviceNumber) {
const operate = { const operate = {
tripNumber: tripNumber, tripNumber: tripNumber,
operation: '' operation: ''
@ -365,10 +372,8 @@ export default {
Handler.undo(1); Handler.undo(1);
try { try {
if (this.popClass === 'foshan-01__systerm') { if (this.popClass === 'foshan-01__systerm') {
getTrainDetailByStNumber(this.$route.query.group, {stNumber: tripNumber}).then(resp => { getTrainDetailByStNumber(this.$route.query.group, {tripNumber: tripNumber, serviceNumber: serviceNumber}).then(resp => {
if (resp.data) { if (resp.data) {
this.formModel.serviceNumber = resp.data.serviceNumber;
this.formModel.tripNumber = resp.data.tripNumber;
this.formModel.destinationCode = resp.data.destinationCode; this.formModel.destinationCode = resp.data.destinationCode;
} }
}); });
@ -381,7 +386,6 @@ export default {
}); });
} }
} catch (e) { } catch (e) {
console.log(e);
this.$message.error('获取列车信息失败!'); this.$message.error('获取列车信息失败!');
} }