代码调整

This commit is contained in:
joylink_cuiweidong 2022-05-16 18:15:47 +08:00
parent 0353d4dfa2
commit 9a3a4242fc
2 changed files with 14 additions and 12 deletions

View File

@ -786,7 +786,7 @@ class SkinCode extends defaultStyle {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 1, // 车身line宽
changeTrainWidth: true, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [
{
type: '03',

View File

@ -114,28 +114,30 @@ export default {
mouseCancelState(this.selected);
},
handleTripNumber() {
const figuresOfServiceNumber = 3;
const figuresOfServiceMinNumber = 2;
const figuresOfServiceMaxNumber = 6;
// this.$store.state.map.mapConfig.figuresOfServiceNumber;
let tripNumber = parseInt(this.addModel.tripNumber);
if (tripNumber) {
tripNumber = Math.abs(tripNumber);
if (tripNumber.toString().length > figuresOfServiceNumber) {
this.messageTip1 = '车次号长度最多' + figuresOfServiceNumber + '位';
const tripNumber = this.addModel.tripNumber;
const judge = /^[a-zA-Z0-9]$/.test(this.addModel.tripNumber);
if (judge) {
if (tripNumber.toString().length > figuresOfServiceMaxNumber || tripNumber.toString().length < figuresOfServiceMinNumber) {
this.messageTip1 = '车次号长度' + figuresOfServiceMinNumber + '-' + figuresOfServiceMaxNumber + '位';
} else {
tripNumber = tripNumber.toString().padStart(figuresOfServiceNumber, '0');
this.addModel.tripNumber = tripNumber;
this.messageTip1 = '';
}
} else {
// debugger;
this.addModel.tripNumber = '';
this.messageTip1 = '请输入车次号';
}
},
commit() {
const figuresOfServiceNumber = 3;
const figuresOfServiceMinNumber = 2;
const figuresOfServiceMaxNumber = 6;
let result = false;
const value = parseInt(this.addModel.tripNumber);
if (value.toString().length > figuresOfServiceNumber) {
const tripNumber = this.addModel.tripNumber;
if (tripNumber.toString().length > figuresOfServiceMaxNumber || tripNumber.toString().length < figuresOfServiceMinNumber) {
result = false;
} else {
result = true;
@ -164,7 +166,7 @@ export default {
});
} else {
if (this.addModel.tripNumber) {
this.messageTip1 = '该车次号长度最多' + figuresOfServiceNumber + '位';
this.messageTip1 = '该车次号长度' + figuresOfServiceMinNumber + '-' + figuresOfServiceMaxNumber + '位';
} else {
this.messageTip1 = '请输入车次号';
}