This commit is contained in:
fan 2021-07-08 15:48:21 +08:00
commit acba981209
10 changed files with 710 additions and 675 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ src/utils/baseUrl.js*
*.njsproj
*.sln
debug.log
.prettierrc

View File

@ -14,48 +14,30 @@
<div>{{ title }}</div>
</div>
<div class="psl-content">
<!-- <div class="content-row">
<div class="btn">
<div class="btn-text">
有滑动门/应急门未关闭且锁紧指示灯
<div class="content-row">
<div class="cell btn">
<div class="btn-text">所有滑动门/应急门关闭且锁紧指示灯</div>
<img :src="getIcon('top', indicators.qbgmLight ? 'on' : 'off')" />
</div>
<img
:src="getIcon('top', indicators.lock ? 'on' : 'off')"
/>
</div>
</div> -->
<div class="content-row">
<div class="cell">
<div class="btn-text">PSL操作指示灯</div>
<img
:src="
getIcon('red', indicators.pslczLight ? 'on' : 'off')
"
/>
<img :src="getIcon('red', indicators.pslczLight ? 'on' : 'off')" />
</div>
<div class="cell">
<div class="btn-text">互锁解除指示灯</div>
<img
:src="
getIcon('red', indicators.hsjcLight ? 'on' : 'off')
"
/>
<img :src="getIcon('red', indicators.hsjcLight ? 'on' : 'off')" />
</div>
</div>
<div class="content-row">
<div class="cell">
<div class="btn-text">开门状态指示灯</div>
<img
:src="getIcon('red', indicators.kmLight ? 'on' : 'off')"
/>
<img :src="getIcon('red', indicators.kmLight ? 'on' : 'off')" />
</div>
<div class="cell">
<div class="btn-text">关门状态指示灯</div>
<img
:src="
getIcon('green', indicators.gmLight ? 'on' : 'off')
"
/>
<img :src="getIcon('green', indicators.gmLight ? 'on' : 'off')" />
</div>
</div>
<div class="content-row">
@ -81,23 +63,18 @@
<div class="content-row">
<div class="cell btn">
<div class="btn-text">开门按钮</div>
<img
:src="getIcon('red', 'btn')"
@click="btnClickHandler('KM')"
/>
<img :src="getIcon('red', 'btn')" @click="btnClickHandler('KM')" />
</div>
<div class="cell btn">
<div class="btn-text">关门按钮</div>
<img
:src="getIcon('green', 'btn')"
@click="btnClickHandler('GM')"
/>
<img :src="getIcon('green', 'btn')" @click="btnClickHandler('GM')" />
</div>
</div>
<div class="content-row">
<div class="cell btn">
<div class="btn-text">试灯按钮</div>
<img class="btn-sd btn-img"
<img
class="btn-sd btn-img"
:src="getIcon('green', 'btn')"
@mousedown.left="btnClickHandler('SD')"
@mouseup.left="btnClickHandler('SD')"
@ -118,7 +95,7 @@ export default {
return {
dialogShow: false,
indicators: {
// lock: false,
qbgmLight: true,
pslczLight: false,
hsjcLight: false,
kmLight: false,
@ -164,9 +141,7 @@ export default {
this.$store.dispatch("training/emitTipFresh");
},
getIcon(type, status) {
return status !== undefined
? icons[`${type}_${status}`]
: icons[type];
return status !== undefined ? icons[`${type}_${status}`] : icons[type];
},
btnClickHandler(btnType) {
pressPslButton(group, standCode, btnType);
@ -175,7 +150,7 @@ export default {
watch: {
"$store.state.socket.simulationPslStatus": function(val) {
if (val && val[standCode]) {
Object.assign(this.indicators, val[standCode])
Object.assign(this.indicators, val[standCode]);
}
}
}

View File

@ -1,7 +1,26 @@
<template>
<el-dialog v-dialogDrag :class="popClass + ' train-control'" :title="title" :visible.sync="show" width="370px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-form ref="form" size="small" label-width="120px" :model="formModel" :rules="rules">
<el-form-item :label="this.$t('menu.groupNumber')+this.$t('global.colon')" prop="groupNumber">
<el-dialog
v-dialogDrag
:class="popClass + ' train-control'"
:title="title"
:visible.sync="show"
width="370px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form
ref="form"
size="small"
label-width="120px"
:model="formModel"
:rules="rulesComputed"
>
<el-form-item
:label="this.$t('menu.groupNumber') + this.$t('global.colon')"
prop="groupNumber"
>
<el-select
:id="domIdTrainNumber"
v-model="formModel.groupNumber"
@ -24,15 +43,17 @@
style="margin-left: 45px;"
@change="trainTypeChange"
>
<el-radio :label="'PLAN'">{{ $t('menu.planTrain') }}</el-radio>
<el-radio :label="'HEAD'">{{ $t('menu.headCodeTrain') }}</el-radio>
<el-radio :label="'MANUAL'" style="margin-top:5px;">{{ $t('menu.artificialTrain') }}</el-radio>
<el-radio :label="'PLAN'">{{ $t("menu.planTrain") }}</el-radio>
<el-radio :label="'HEAD'">{{ $t("menu.headCodeTrain") }}</el-radio>
<el-radio :label="'MANUAL'" style="margin-top:5px;">{{
$t("menu.artificialTrain")
}}</el-radio>
</el-radio-group>
</el-form-item>
<!-- 表号 -->
<el-form-item v-if="formModel.type == 'PLAN'" prop="serviceNumber">
<span slot="label">{{ $t('menu.serviceNumber') + '' }}</span>
<span slot="label">{{ $t("menu.serviceNumber") + "" }}</span>
<el-input
:id="domIdServerNo"
v-model="formModel.serviceNumber"
@ -41,16 +62,20 @@
</el-form-item>
<!-- 车次号 -->
<el-form-item v-if="formModel.type == 'PLAN'|| formModel.type == 'HEAD'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-input
:id="domIdTrainNo"
v-model="formModel.tripNumber"
maxlength="4"
/>
<el-form-item
v-if="formModel.type == 'PLAN' || formModel.type == 'HEAD'"
:label="this.$t('menu.tripNumber') + this.$t('global.colon')"
prop="tripNumber"
>
<el-input :id="domIdTrainNo" v-model="formModel.tripNumber" maxlength="4" />
</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
:id="domIdTargetCode"
v-model="formModel.destinationCode"
@ -59,7 +84,11 @@
</el-form-item>
<!-- 类别 -->
<el-form-item v-if="formModel.type == 'MANUAL'" :label="this.$t('menu.category')+this.$t('global.colon')" prop="category">
<el-form-item
v-if="formModel.type == 'MANUAL'"
:label="this.$t('menu.category') + this.$t('global.colon')"
prop="category"
>
<el-select
:id="domIdTrainNumber"
v-model="formModel.category"
@ -77,10 +106,12 @@
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{ $t('global.confirm') }}</el-button>
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{
$t("global.confirm")
}}</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">{{ $t('global.cancel') }}</el-button>
<el-button :id="domIdCancel" @click="cancel">{{ $t("global.cancel") }}</el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" :pop-class="popClass" />
@ -88,15 +119,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
},
@ -104,48 +135,23 @@ export default {
popClass: {
type: String,
default() {
return '';
return "";
}
}
},
data() {
var validateTripNum = (rule, value, callback) => {
const trip = Number.parseInt(value.substring(1));
if (this.formModel.type === 'HEAD' && this.popClass === 'xian-01__systerm' && (trip < 701 || trip > 749)) {
callback(new Error('头码车车次编号为701至749'));
} else {
callback();
}
};
return {
trainList: [],
serviceNumber:'',
serviceNumber: "",
formModel: {
tripNumber: '',
groupNumber: '',
type: 'PLAN',
serviceNumber: '',
destinationCode: '',
category: 'MM'
},
categoryList: [
{ name: 'MM', value: '01' }
],
rules: {
groupNumber: [
{ required: true, message: '请选择车组号', trigger: 'change' }
],
type: [
{ required: true, message: '请选择列车类型', trigger: 'change' }
],
tripNumber: [
{ required: true, message: '请输入车次号', trigger: 'blur' },
{ validator: validateTripNum, trigger: 'blur' }
],
destinationCode: [
{ required: true, message: '请输入目的地号', trigger: 'blur' }
]
tripNumber: "",
groupNumber: "",
type: "PLAN",
serviceNumber: "",
destinationCode: "",
category: "MM"
},
categoryList: [{ name: "MM", value: "01" }],
operation: null,
dialogShow: false,
loading: false,
@ -154,11 +160,36 @@ export default {
};
},
computed: {
...mapGetters('map', [
'map'
]),
...mapGetters("map", ["map"]),
rulesComputed() {
const validateTripNum = (rule, value, callback) => {
const trip = Number.parseInt(value.substring(1));
if (
this.formModel.type === "HEAD" &&
this.popClass === "xian-01__systerm" &&
(trip < 701 || trip > 749)
) {
callback(new Error("头码车车次编号为701至749"));
} else {
callback();
}
};
return {
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: "blur"
},
{ validator: validateTripNum, trigger: "blur" }
],
destinationCode: [{ required: true, message: "请输入目的地号", trigger: "blur" }]
};
},
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;
@ -168,7 +199,7 @@ export default {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
return '';
return "";
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
@ -183,7 +214,7 @@ export default {
return OperationEvent.Train.editTrainId.trainNumberChange.domId;
}
}
return '';
return "";
},
domIdTrainNo() {
if (this.dialogShow) {
@ -195,7 +226,7 @@ export default {
return OperationEvent.Train.editTrainId.trainNoChange.domId;
}
}
return '';
return "";
},
domIdTrainType() {
if (this.dialogShow) {
@ -207,7 +238,7 @@ export default {
return OperationEvent.Train.editTrainId.trainTypeChange.domId;
}
}
return '';
return "";
},
domIdServerNo() {
if (this.dialogShow) {
@ -219,7 +250,7 @@ export default {
return OperationEvent.Train.editTrainId.serverNoChange.domId;
}
}
return '';
return "";
},
domIdTargetCode() {
if (this.dialogShow) {
@ -231,7 +262,7 @@ export default {
return OperationEvent.Train.editTrainId.targetCodeChange.domId;
}
}
return '';
return "";
},
domIdConfirm() {
if (this.dialogShow) {
@ -243,36 +274,45 @@ 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.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: '',
targetCode: '',
category: 'MM'
serviceNumber: "",
targetCode: "",
category: "MM"
};
} else if (this.popClass === 'foshan-01__systerm' && val.length === 2 && this.formModel.serviceNumber.length === 3 && this.formModel.type !== 'HEAD') {
} else if (
this.popClass === "foshan-01__systerm" &&
val.length === 2 &&
this.formModel.serviceNumber.length === 3 &&
this.formModel.type !== "HEAD"
) {
this.trainNoChange(val, this.formModel.serviceNumber);
} else if (this.popClass === 'foshan-01__systerm' && this.formModel.type !== 'HEAD') {
} else if (this.popClass === "foshan-01__systerm" && this.formModel.type !== "HEAD") {
const serviceNumber = this.formModel.serviceNumber;
const destinationCode = this.formModel.destinationCode;
this.formModel = {
@ -281,15 +321,19 @@ export default {
tripNumber: val,
type: this.formModel.type,
serviceNumber: serviceNumber,
targetCode: '',
category: 'MM'
targetCode: "",
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') {
} else if (this.popClass === "foshan-01__systerm") {
const tripNumber = this.formModel.tripNumber;
const destinationCode = this.formModel.destinationCode;
this.formModel = {
@ -298,8 +342,8 @@ export default {
destinationCode: destinationCode,
type: this.formModel.type,
serviceNumber: val,
targetCode: '',
category: 'MM'
targetCode: "",
category: "MM"
};
}
}
@ -307,40 +351,40 @@ 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);
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.$nextTick(function() {
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;
@ -348,37 +392,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;
@ -387,30 +431,35 @@ export default {
}
Handler.undo(1);
try {
if (this.popClass === 'foshan-01__systerm') {
getTrainDetailByStNumber(this.$route.query.group, {tripNumber: tripNumber, serviceNumber: serviceNumber}).then(resp => {
if (this.popClass === "foshan-01__systerm") {
getTrainDetailByStNumber(this.$route.query.group, {
tripNumber: tripNumber,
serviceNumber: serviceNumber
}).then(resp => {
if (resp.data) {
this.formModel.destinationCode = resp.data.destinationCode;
} else {
this.$message.error('未找到输入列车信息!');
this.$message.error("未找到输入列车信息!");
}
});
} else {
getTrainDetailBytripNumber(this.$route.query.group, {tripNumber:tripNumber}).then(resp => {
getTrainDetailBytripNumber(this.$route.query.group, {
tripNumber: tripNumber
}).then(resp => {
if (resp.data) {
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 });
}
});
},
@ -425,29 +474,31 @@ 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: ''
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;
}
commitOperate(menuOperate.TrainWindow.addTrainId, params, 2).then(({valid})=>{
commitOperate(menuOperate.TrainWindow.addTrainId, params, 2)
.then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
})
.catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
@ -459,29 +510,31 @@ 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;
}
commitOperate(menuOperate.TrainWindow.editTrainId, params, 2).then(({valid})=>{
commitOperate(menuOperate.TrainWindow.editTrainId, params, 2)
.then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
})
.catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
@ -495,11 +548,14 @@ export default {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.$store
.dispatch("training/nextNew", operate)
.then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
})
.catch(() => {
this.doClose();
});
}

View File

@ -199,7 +199,7 @@ export default {
} else {
let newValue = parseInt(value);
if (newValue) {
if (newValue > 0 & newValue < 9) {
if (newValue > 0 & newValue <= 9) {
newValue = '0' + newValue;
}
this.addModel.serviceNumber = newValue;

View File

@ -107,7 +107,7 @@ export default {
} else {
let newValue = parseInt(value);
if (newValue) {
if (newValue > 0 & newValue < 9) {
if (newValue > 0 & newValue <= 9) {
newValue = '0' + newValue;
}
this.model.serviceNumber = newValue;
@ -129,7 +129,7 @@ export default {
this.doClose();
})
.catch(e => {
this.$messageBox(e);
this.$messageBox(e.message);
});
}
});

View File

@ -199,7 +199,7 @@ export default {
} else {
let newValue = parseInt(value);
if (newValue) {
if (newValue > 0 & newValue < 9) {
if (newValue > 0 & newValue <= 9) {
newValue = '0' + newValue;
}
this.addModel.serviceNumber = newValue;

View File

@ -18,10 +18,10 @@
:rules="rules"
>
<el-form-item prop="serviceNumber" label="表号">
<el-input maxlength="2" v-model="model.serviceNumber" />
<el-input v-model="model.serviceNumber" maxlength="2" />
</el-form-item>
<el-form-item prop="tripNumber" label="车次号">
<el-input maxlength="4" v-model="model.tripNumber" />
<el-input v-model="model.tripNumber" maxlength="4" />
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
@ -40,22 +40,22 @@
</template>
<script>
import { sendCommandNew } from "@/api/jmap/training";
import { sendCommandNew } from '@/api/jmap/training';
export default {
name: "DeleteRunplanLine",
name: 'DeleteRunplanLine',
data() {
return {
loading: false,
dialogShow: false,
model: {
serviceNumber: "",
tripNumber: ""
serviceNumber: '',
tripNumber: ''
},
rules: {
serviceNumber: [
{
required: true,
trigger: "blur",
trigger: 'blur',
validator:this.validateService
// message: ""
}
@ -63,8 +63,8 @@ export default {
tripNumber: [
{
required: true,
trigger: "blur",
message: "请输入车次号"
trigger: 'blur',
message: '请输入车次号'
}
]
}
@ -72,12 +72,17 @@ export default {
},
computed: {
title() {
return "抽线";
return '抽线';
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
}
},
watch: {
'$store.state.runPlan': function(oldVal, newVal) {
console.log(newVal);
}
},
methods: {
doShow(operate) {
// this.operate = operate || {};
@ -88,13 +93,13 @@ export default {
// }
this.dialogShow = true;
this.$nextTick(function() {
this.$store.dispatch("training/emitTipFresh");
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
// this.loading = false;
this.dialogShow = false;
this.$store.dispatch("training/emitTipFresh");
this.$store.dispatch('training/emitTipFresh');
},
validateService (rule, value, callback) {
if (typeof value == 'string' && value.trim().length == 0) {
@ -102,7 +107,7 @@ export default {
} else {
let newValue = parseInt(value);
if (newValue) {
if (newValue > 0 & newValue < 9) {
if (newValue > 0 & newValue <= 9) {
newValue = '0' + newValue;
}
this.model.serviceNumber = newValue;
@ -117,23 +122,18 @@ export default {
if (valid) {
const group = this.$route.query.group;
const data = this.model;
sendCommandNew(group, "RunPlan_Delete_Trip", data)
sendCommandNew(group, 'RunPlan_Delete_Trip', data)
.then(resp => {
console.log(resp);
this.$message.success('删除计划车成功');
this.doClose();
})
.catch(e => {
this.$messageBox(e);
this.$messageBox(e.message);
});
}
});
}
},
watch: {
"$store.state.runPlan": function(oldVal, newVal) {
console.log(newVal);
}
}
};
</script>

View File

@ -142,6 +142,8 @@ export const IbpOperation = {
AXLE_PRE_RESET: {operate: '13', event: 'AXLE_PRE_RESET', name: '计轴预复位'},
PRERESET_Z: {operate: '14', event: 'PRERESET_Z', name: '计轴预复零'},
SD: {operate: '15', event: 'SD', name: '试灯'},
XXGM: {operate: '16', event: 'XXGM', name: '下行屏蔽门开门'},
SXGM: {operate: '17', event: 'SXGM', name: '上行屏蔽门开门'},
};
/**

View File

@ -4,7 +4,7 @@ export function getBaseUrl() {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
// BASE_API = 'http://192.168.3.250:9000'; // 旭强 有线
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康

View File

@ -3,7 +3,9 @@
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item :label="this.$t('ibp.buttonCode')" prop="code">
<el-input v-model="form.code" :disabled="true">
<el-button slot="append" :disabled="isUpdate" type="primary" @click="generateCode">{{ $t('ibp.generateCode') }}</el-button>
<el-button slot="append" :disabled="isUpdate" type="primary" @click="generateCode">{{
$t("ibp.generateCode")
}}</el-button>
</el-input>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor">
@ -39,7 +41,7 @@
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code +')'"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
@ -56,67 +58,57 @@
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{
$t("global.delete")
}}</el-button>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t("global.cancel") }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {getSectionListByCenStationCode, getSectionListByMapId } from '@/api/jmap/map';
import { getSectionListByCenStationCode, getSectionListByMapId } from "@/api/jmap/map";
export default {
name: 'ButtonDraft',
components: {
},
name: "ButtonDraft",
components: {},
data() {
return {
isUpdate: false,
buttonText: this.$t('ibp.createNow'),
buttonText: this.$t("ibp.createNow"),
showDeleteButton: false,
operateMeanList: [
{ label: '扣车', value: 'KC' },
{ label: '终止扣车', value: 'ZZKC' },
{ label: '紧急停车', value: 'JJTC' },
{ label: '取消紧急停车', value: 'QXJJTC' },
{ label: '报警切除', value: 'BJQC' },
{ label: '屏蔽门开门', value: 'KM' },
{ label: '计轴复位', value: 'AXLE_RESET' },
{ label: '计轴预复位', value: 'AXLE_PRE_RESET' },
{ label: '计轴预复零', value: 'PRERESET_Z' },
{ label: '试灯', value: 'SD' },
{ label: "扣车", value: "KC" },
{ label: "终止扣车", value: "ZZKC" },
{ label: "紧急停车", value: "JJTC" },
{ label: "取消紧急停车", value: "QXJJTC" },
{ label: "报警切除", value: "BJQC" },
{ label: "屏蔽门开门", value: "KM" },
{ label: "屏蔽门关门", value: "GM" },
{ label: "计轴复位", value: "AXLE_RESET" },
{ label: "计轴预复位", value: "AXLE_PRE_RESET" },
{ label: "计轴预复零", value: "PRERESET_Z" },
{ label: "试灯", value: "SD" }
],
operateWithoutDirections: ['AXLE_RESET', 'AXLE_PRE_RESET', 'PRERESET_Z', 'SD'],
operateWithoutDirections: ["AXLE_RESET", "AXLE_PRE_RESET", "PRERESET_Z", "SD"],
form: {
code: '',
buttonColor: 'red',
code: "",
buttonColor: "red",
buttonWidth: 25,
x: 10,
y: 10,
sectionCode: '',
mean: '',
direction: null,
sectionCode: "",
mean: "",
direction: null
},
rules: {
code: [
{ required: true, message: this.$t('ibp.enterTheButtonCode'), trigger: 'blur' }
],
buttonColor: [
{ required: true, message: this.$t('ibp.selectTheButtonColor'), trigger: 'change'}
],
buttonWidth: [
{ required: true, message: this.$t('ibp.enterTheButtonWidth'), trigger: 'blur' }
],
sectionCode: [
{ required: true, message: '请选择关联区段', trigger: 'blur' }
],
code: [{ required: true, message: this.$t("ibp.enterTheButtonCode"), trigger: "blur" }],
buttonColor: [{ required: true, message: this.$t("ibp.selectTheButtonColor"), trigger: "change" }],
buttonWidth: [{ required: true, message: this.$t("ibp.enterTheButtonWidth"), trigger: "blur" }],
sectionCode: [{ required: true, message: "请选择关联区段", trigger: "blur" }]
},
sectionList: [],
directions: [
{ name: '全部', value: null},
{ name: '上行', value: true},
{ name: '下行', value: false},
],
directions: [{ name: "全部", value: null }, { name: "上行", value: true }, { name: "下行", value: false }]
};
},
computed: {
@ -125,10 +117,10 @@ export default {
}
},
watch: {
'$store.state.ibp.rightClickCount': function (val) {
const model = this.$store.getters['ibp/updateDeviceData'];
if (model._type === 'SquareButton' ) {
this.buttonText = this.$t('global.modify');
"$store.state.ibp.rightClickCount": function(val) {
const model = this.$store.getters["ibp/updateDeviceData"];
if (model._type === "SquareButton") {
this.buttonText = this.$t("global.modify");
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
@ -144,40 +136,44 @@ export default {
},
mounted() {
if (this.$route.query.stationCode) {
getSectionListByCenStationCode(this.$route.query.mapId, this.$route.query.stationCode).then(resp => {
getSectionListByCenStationCode(this.$route.query.mapId, this.$route.query.stationCode)
.then(resp => {
this.sectionList = resp.data;
// console.log(resp.data);
}).catch(() => {
this.$message.error('获取区段列表失败!');
})
.catch(() => {
this.$message.error("获取区段列表失败!");
});
} else {
getSectionListByMapId(this.$route.query.mapId).then(resp => {
getSectionListByMapId(this.$route.query.mapId)
.then(resp => {
this.sectionList = resp.data;
console.log(resp.data);
}).catch(() => {
this.$message.error('获取区段列表失败!');
})
.catch(() => {
this.$message.error("获取区段列表失败!");
});
}
},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
this.$refs[form].validate(valid => {
if (valid) {
const buttonModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'SquareButton',
_type: "SquareButton",
code: this.form.code,
color: this.form.buttonColor,
status: 'off',
status: "off",
width: this.form.buttonWidth,
mean: this.form.mean,
sectionCode: this.form.sectionCode,
direction: this.form.direction,
direction: this.form.direction
};
this.$emit('createData', buttonModel);
this.$emit("createData", buttonModel);
this.initPage();
} else {
return false;
@ -190,40 +186,45 @@ export default {
x: this.form.x,
y: this.form.y
},
_type: 'SquareButton',
_type: "SquareButton",
code: this.form.code,
color: this.form.buttonColor,
status: 'off',
status: "off",
width: this.form.buttonWidth,
mean: this.form.mean,
sectionCode: this.form.sectionCode,
direction: this.form.direction,
direction: this.form.direction
};
this.$emit('deleteDataModel', buttonModel );
this.$emit("deleteDataModel", buttonModel);
this.initPage();
},
initPage() {
this.isUpdate = false;
this.buttonText = this.$t('ibp.createNow');
this.buttonText = this.$t("ibp.createNow");
this.showDeleteButton = false;
this.form = {
code: '',
buttonColor: 'red',
code: "",
buttonColor: "red",
buttonWidth: 25,
x: 10,
y: 10,
mean: '',
sectionCode: '',
direction: null,
mean: "",
sectionCode: "",
direction: null
};
},
generateCode() {
const mydate = new Date();
this.form.code = 'sButton_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
this.form.code =
"sButton_" +
mydate.getDay() +
mydate.getHours() +
mydate.getMinutes() +
mydate.getSeconds() +
mydate.getMilliseconds() +
Math.round(Math.random() * 10000);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
<style rel="stylesheet/scss" lang="scss" scoped></style>