添加列车识别号&删除列车识别号

This commit is contained in:
fan 2021-11-09 15:28:17 +08:00
parent b0398df85a
commit 87a9235304
14 changed files with 247 additions and 243 deletions

View File

@ -608,7 +608,7 @@ class SkinCode extends defaultStyle {
lineDash: [3, 3], // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0.01, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -549,7 +549,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -746,7 +746,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -581,7 +581,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -630,7 +630,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -703,7 +703,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -663,7 +663,7 @@ class SkinCode extends defaultStyle {
lineDash: [3], // 车次窗虚线间隔
lineWidth: 0.5, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -604,7 +604,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.NoOneReturn] = {
displayCondition: '01', // 显示条件 01所有模式下显示 02 行调显示 03现地显示

View File

@ -4,13 +4,13 @@ export default class EMouse {
}
mouseover(e) {
// if (this.device.prdType) {
// this.device.setVisible(true);
// const instance = this.device.getInstanceByCode(this.device.model.sectionCode);
// if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) {
// instance.mouseEvent.mouseEnter(e);
// }
// }
if (this.device.prdType) {
this.device.setVisible(true);
const instance = this.device.getInstanceByCode(this.device.model.sectionCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) {
instance.mouseEvent.mouseEnter(e);
}
}
}
mouseout(e) {

View File

@ -70,10 +70,10 @@ class TrainWindow extends Group {
setState(model) {
// if (!this.isShowShape) return;
if (this.model.showMode) {
if (this.model.showMode != '02' || !this.style.TrainWindow.show) {
this.eachChild(item => { item.hide(); });
} else if (!store.getters['map/checkDeviceShow'](this._code)) {
this.trainRect && this.trainRect.hide();
// } else if (!store.getters['map/checkDeviceShow'](this._code)) {
// this.trainRect && this.trainRect.hide();
} else if (model._tro) {
this.trainRect && this.trainRect.hide();
} else {
@ -83,7 +83,6 @@ class TrainWindow extends Group {
setVisible(show) {
this.trainRect && this.trainRect.setStyle('lineWidth', show ? 1 : 0);
}
getInstanceByCode(code) {

View File

@ -94,15 +94,15 @@
</template>
<script>
import { mapGetters } from "vuex";
import { OperationEvent } from "@/scripts/cmdPlugin/OperationHandler";
import Handler from "@/scripts/cmdPlugin/Handler";
import { menuOperate, commitOperate } from "@/jmapNew/theme/components/utils/menuOperate";
import { getTrainDetailBytripNumber, getTrainDetailByStNumber } from "@/api/simulation";
import NoticeInfo from "../childDialog/noticeInfo";
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import Handler from '@/scripts/cmdPlugin/Handler';
import { menuOperate, commitOperate } from '@/jmapNew/theme/components/utils/menuOperate';
import { getTrainDetailBytripNumber, getTrainDetailByStNumber } from '@/api/simulation';
import NoticeInfo from '../childDialog/noticeInfo';
export default {
name: "TrainControl",
name: 'TrainControl',
components: {
NoticeInfo
},
@ -110,61 +110,62 @@ export default {
popClass: {
type: String,
default() {
return "";
return '';
}
}
},
data() {
return {
trainList: [],
serviceNumber: "",
// trainList: [],
serviceNumber: '',
formModel: {
tripNumber: "",
groupNumber: "",
type: "PLAN",
serviceNumber: "",
destinationCode: "",
category: "MM"
tripNumber: '',
groupNumber: '',
type: 'PLAN',
serviceNumber: '',
destinationCode: '',
category: 'MM'
},
categoryList: [{ name: "MM", value: "01" }],
categoryList: [{ name: 'MM', value: '01' }],
operation: null,
dialogShow: false,
loading: false,
direction: 0,
selected: null
selected: null,
sectionCode: ''
};
},
computed: {
...mapGetters("map", ["map"]),
...mapGetters('map', ['map', 'trainList', 'sectionList']),
rulesComputed() {
const validateTripNum = (rule, value, callback) => {
const trip = Number.parseInt(value.substring(1));
if (
this.formModel.type === "HEAD" &&
this.popClass === "xian-01__systerm" &&
this.formModel.type === 'HEAD' &&
this.popClass === 'xian-01__systerm' &&
(trip < 701 || trip > 749)
) {
callback(new Error("头码车车次编号为701至749"));
callback(new Error('头码车车次编号为701至749'));
} else {
callback();
}
};
return {
groupNumber: [{ required: true, message: "请选择车组号", trigger: "change" }],
type: [{ required: true, message: "请选择列车类型", trigger: "change" }],
groupNumber: [{ required: true, message: '请选择车组号', trigger: 'change' }],
type: [{ required: true, message: '请选择列车类型', trigger: 'change' }],
tripNumber: [
{
required: !(this.formModel.type === "HEAD" && this.popClass === "xian-01__systerm"),
message: "请输入车次号",
trigger: "change"
required: !(this.formModel.type === 'HEAD' && this.popClass === 'xian-01__systerm'),
message: '请输入车次号',
trigger: 'change'
},
{ validator: validateTripNum, trigger: "change" }
{ validator: validateTripNum, trigger: 'change' }
],
destinationCode: [{ required: true, message: "请输入目的地号", trigger: "change" }]
destinationCode: [{ required: true, message: '请输入目的地号', trigger: 'change' }]
};
},
serverNoIsDisabled() {
if (this.popClass === "foshan-01__systerm" && this.formModel.type === "PLAN") {
if ((this.popClass === 'foshan-01__systerm') && this.formModel.type === 'PLAN') {
return false;
} else {
return true;
@ -174,7 +175,7 @@ export default {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
return "";
return false;
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
@ -189,7 +190,7 @@ export default {
return OperationEvent.Train.editTrainId.trainNumberChange.domId;
}
}
return "";
return '';
},
domIdTrainNo() {
if (this.dialogShow) {
@ -201,7 +202,7 @@ export default {
return OperationEvent.Train.editTrainId.trainNoChange.domId;
}
}
return "";
return '';
},
domIdTrainType() {
if (this.dialogShow) {
@ -213,7 +214,7 @@ export default {
return OperationEvent.Train.editTrainId.trainTypeChange.domId;
}
}
return "";
return '';
},
domIdServerNo() {
if (this.dialogShow) {
@ -225,7 +226,7 @@ export default {
return OperationEvent.Train.editTrainId.serverNoChange.domId;
}
}
return "";
return '';
},
domIdTargetCode() {
if (this.dialogShow) {
@ -237,7 +238,7 @@ export default {
return OperationEvent.Train.editTrainId.targetCodeChange.domId;
}
}
return "";
return '';
},
domIdConfirm() {
if (this.dialogShow) {
@ -249,66 +250,66 @@ export default {
return OperationEvent.Train.editTrainId.menu.domId;
}
}
return "";
return '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : "";
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return "添加列车识别号";
return '添加列车识别号';
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return "修改列车识别号";
return '修改列车识别号';
}
return "";
return '';
}
},
watch: {
"formModel.tripNumber": function(val) {
if (this.popClass !== "foshan-01__systerm" && val.length === 4 && this.formModel.type !== "HEAD") {
'formModel.tripNumber': function(val) {
if (this.popClass !== 'foshan-01__systerm' && val && val.length === 4 && this.formModel.type !== 'HEAD') {
this.trainNoChange(val);
} else if (this.popClass !== "foshan-01__systerm" && this.formModel.type !== "HEAD") {
} else if (this.popClass !== 'foshan-01__systerm' && this.formModel.type !== 'HEAD') {
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: val,
type: this.formModel.type,
serviceNumber: "",
category: "MM",
destinationCode: ""
serviceNumber: '',
category: 'MM',
destinationCode: ''
};
} else if (
this.popClass === "foshan-01__systerm" &&
this.popClass === 'foshan-01__systerm' &&
val.length === 2 &&
this.formModel.serviceNumber.length === 3 &&
this.formModel.type !== "HEAD"
this.formModel.type !== 'HEAD'
) {
this.trainNoChange(val, this.formModel.serviceNumber);
} else if (this.popClass === "foshan-01__systerm" && this.formModel.type !== "HEAD") {
let serviceNumber = this.formModel.serviceNumber;
let destinationCode = this.formModel.destinationCode;
} else if (this.popClass === 'foshan-01__systerm' && this.formModel.type !== 'HEAD') {
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,
category: "MM"
category: 'MM'
};
}
},
"formModel.serviceNumber": function(val) {
if (this.popClass === "foshan-01__systerm" && val.length === 3 && this.formModel.tripNumber.length === 2) {
'formModel.serviceNumber': function(val) {
if (this.popClass === 'foshan-01__systerm' && val.length === 3 && this.formModel.tripNumber.length === 2) {
this.trainNoChange(this.formModel.tripNumber, val);
} else if (this.popClass === "foshan-01__systerm") {
let tripNumber = this.formModel.tripNumber;
let destinationCode = this.formModel.destinationCode;
} else if (this.popClass === 'foshan-01__systerm') {
const tripNumber = this.formModel.tripNumber;
const destinationCode = this.formModel.destinationCode;
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: tripNumber,
destinationCode: destinationCode,
type: this.formModel.type,
serviceNumber: val,
category: "MM"
category: 'MM'
};
}
}
@ -316,40 +317,45 @@ export default {
methods: {
loadInitData(map) {},
doShow(operate, selected) {
this.$root.$emit("dialogOpen", selected);
this.$root.$emit('dialogOpen', selected);
this.selected = selected;
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
const model = this.$store.getters["map/getDeviceByCode"](selected.code);
const model = this.$store.getters['map/getDeviceByCode'](selected.code);
if (model._type === 'TrainWindow') {
const section = this.sectionList.find((elem) => elem.trainWindowCode === selected.code );
this.sectionCode = section.code;
} else {
this.serviceNumber = model.serviceNumber;
this.formModel = {
groupNumber: model.groupNumber,
tripNumber: model.tripNumber,
type: model.type ? model.type : "PLAN",
type: model.type ? model.type : 'PLAN',
serviceNumber: model.serviceNumber,
destinationCode: model.destinationCode,
category: "MM"
category: 'MM'
};
}
/** 加载列车数据*/
this.loadInitData(this.map);
this.dialogShow = true;
this.$nextTick(function() {
this.$store.dispatch("training/emitTipFresh");
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$root.$emit("dialogClose", this.selected);
this.$store.dispatch("training/emitTipFresh");
this.$store.dispatch("map/setTrainWindowShow", false);
this.$root.$emit('dialogClose', this.selected);
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
},
trainNumberChange(groupNumber) {
const operate = {
groupNumber: groupNumber,
operation: ""
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
@ -357,37 +363,37 @@ export default {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
}
this.$store.dispatch("training/nextNew", operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch("menuOperation/handleBreakFlag", { break: true });
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainTypeChange(trainType) {
if (trainType === "HEAD") {
this.formModel.serviceNumber = "";
} else if (trainType === "PLAN" && this.serviceNumber) {
if (trainType === 'HEAD') {
this.formModel.serviceNumber = '';
} else if (trainType === 'PLAN' && this.serviceNumber) {
this.formModel.serviceNumber = this.serviceNumber;
}
const operate = {
type: trainType,
operation: ""
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
}
this.$store.dispatch("training/nextNew", operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch("menuOperation/handleBreakFlag", { break: true });
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainNoChange(tripNumber, serviceNumber) {
const operate = {
tripNumber: tripNumber,
operation: ""
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
@ -396,7 +402,7 @@ export default {
}
Handler.undo(1);
try {
if (this.popClass === "foshan-01__systerm") {
if (this.popClass === 'foshan-01__systerm') {
getTrainDetailByStNumber(this.$route.query.group, {
tripNumber: tripNumber,
serviceNumber: serviceNumber
@ -404,7 +410,7 @@ export default {
if (resp.data) {
this.formModel.destinationCode = resp.data.destinationCode;
} else {
this.$message.error("未找到输入列车信息!");
this.$message.error('未找到输入列车信息!');
}
});
} else {
@ -415,16 +421,16 @@ export default {
this.formModel.serviceNumber = resp.data.serviceNumber;
this.formModel.destinationCode = resp.data.destinationCode;
} else {
this.$message.error("未找到输入列车信息!");
this.$message.error('未找到输入列车信息!');
}
});
}
} catch (e) {
this.$message.error("获取列车信息失败!");
this.$message.error('获取列车信息失败!');
}
this.$store.dispatch("training/nextNew", operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch("menuOperation/handleBreakFlag", { break: true });
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
@ -439,22 +445,24 @@ export default {
},
//
addTrainId() {
this.$refs["form"].validate(valid => {
this.$refs['form'].validate(valid => {
if (valid) {
const params = {
groupNumber: this.formModel.groupNumber,
type: this.formModel.type,
serviceNumber: "",
tripNumber: "",
destinationCode: ""
sectionCode: this.sectionCode,
// type: this.formModel.type,
sn: '',
tn: '',
dn: ''
};
if (this.formModel.type === "PLAN") {
params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === "HEAD") {
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
if (this.formModel.type === 'PLAN') {
params.sn = this.formModel.serviceNumber;
params.tn = this.formModel.tripNumber;
params.dn = this.formModel.destinationCode;
} else if (this.formModel.type === 'HEAD') {
params.tn = this.formModel.tripNumber;
params.dn = this.formModel.destinationCode;
}
commitOperate(menuOperate.TrainWindow.addTrainId, params, 2)
.then(({ valid }) => {
@ -475,20 +483,20 @@ export default {
},
//
editTrainId() {
this.$refs["form"].validate(valid => {
this.$refs['form'].validate(valid => {
if (valid) {
const params = {
groupNumber: this.formModel.groupNumber,
type: this.formModel.type,
serviceNumber: "",
tripNumber: "",
destinationCode: ""
serviceNumber: '',
tripNumber: '',
destinationCode: ''
};
if (this.formModel.type === "PLAN") {
if (this.formModel.type === 'PLAN') {
params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === "HEAD") {
} else if (this.formModel.type === 'HEAD') {
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
}
@ -514,7 +522,7 @@ export default {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store
.dispatch("training/nextNew", operate)
.dispatch('training/nextNew', operate)
.then(({ valid }) => {
if (valid) {
this.doClose();

View File

@ -357,7 +357,7 @@ export const menuOperate = {
},
addTrainId: {
operation: OperationEvent.Train.addTrainId.menu.operation,
cmdType: ''
cmdType: CMD.TrainWindow.CMD_TRAIN_ADD_TRAIN_TRACE
},
destinationTrainId: {
operation: OperationEvent.Train.editTrainId.menu.operation,

View File

@ -12,7 +12,7 @@
>
<el-form ref="form" size="small" label-width="90px" :model="formModel" :rules="rules">
<el-form-item :label="this.$t('menu.groupNumber')+this.$t('global.colon')" prop="groupNumber">
<el-input :id="domIdTrainNumber" v-model="formModel.groupNumber" @change="trainNumberChange" />
<el-input :id="domIdTrainNumber" v-model="formModel.groupNumber" :disabled="true" @change="trainNumberChange" />
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
@ -94,6 +94,7 @@ export default {
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.formModel.groupNumber = selected.groupNumber;
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
@ -107,7 +108,6 @@ export default {
},
trainNumberChange() {
const operate = {
val: `${this.formModel.groupNumber}`,
operation: OperationEvent.Train.delTrainId.trainNumberChange.operation
};
@ -122,13 +122,11 @@ export default {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
over: true,
operation: OperationEvent.Train.delTrainId.menu.operation,
cmdType: CMD.Train.CMD_DEL_TRAIN_ID,
cmdType: CMD.TrainWindow.CMD_TRAIN_REMOVE_TRAIN_TRACE,
val: this.formModel.groupNumber
};
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;

View File

@ -61,16 +61,16 @@ export default {
menuNormal: {
Local: [],
Center: [
// {
// label: this.$t('menu.menuTrain.addTrainId'),
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
// },
// {
// label: this.$t('menu.menuTrain.deleteTrainId'),
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
// },
{
label: this.$t('menu.menuTrain.addTrainId'),
handler: this.addTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_ADD_TRAIN_TRACE
},
{
label: this.$t('menu.menuTrain.deleteTrainId'),
handler: this.delTrainId,
cmdType: CMD.TrainWindow.CMD_TRAIN_REMOVE_TRAIN_TRACE
},
{
label: this.$t('menu.menuTrain.editTrainId'),
handler: this.editTrainId,
@ -464,7 +464,6 @@ export default {
addTrainId() {
const step = {
start: true,
operation: OperationEvent.Train.addTrainId.menu.operation,
param: {
code: this.selected.code
@ -484,7 +483,7 @@ export default {
operation: OperationEvent.Train.delTrainId.menu.operation,
param: {
code: this.selected.code
groupNumber: this.selected.code
}
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {