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 *.njsproj
*.sln *.sln
debug.log debug.log
.prettierrc

View File

@ -1,111 +1,88 @@
<template> <template>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
class="xian-01__systerm psl-panel" class="xian-01__systerm psl-panel"
:title="title" :title="title"
:visible.sync="show" :visible.sync="show"
width="500px" width="500px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
:modal="false" :modal="false"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="psl-title"> <div class="psl-title">
<div>{{ title }}</div> <div>{{ title }}</div>
</div> </div>
<div class="psl-content"> <div class="psl-content">
<!-- <div class="content-row"> <div class="content-row">
<div class="btn"> <div class="cell btn">
<div class="btn-text"> <div class="btn-text">所有滑动门/应急门关闭且锁紧指示灯</div>
有滑动门/应急门未关闭且锁紧指示灯 <img :src="getIcon('top', indicators.qbgmLight ? 'on' : 'off')" />
</div> </div>
<img </div>
:src="getIcon('top', indicators.lock ? 'on' : 'off')" <div class="content-row">
/> <div class="cell">
</div> <div class="btn-text">PSL操作指示灯</div>
</div> --> <img :src="getIcon('red', indicators.pslczLight ? 'on' : 'off')" />
<div class="content-row"> </div>
<div class="cell"> <div class="cell">
<div class="btn-text">PSL操作指示灯</div> <div class="btn-text">互锁解除指示灯</div>
<img <img :src="getIcon('red', indicators.hsjcLight ? 'on' : 'off')" />
:src=" </div>
getIcon('red', indicators.pslczLight ? 'on' : 'off') </div>
" <div class="content-row">
/> <div class="cell">
</div> <div class="btn-text">开门状态指示灯</div>
<div class="cell"> <img :src="getIcon('red', indicators.kmLight ? 'on' : 'off')" />
<div class="btn-text">互锁解除指示灯</div> </div>
<img <div class="cell">
:src=" <div class="btn-text">关门状态指示灯</div>
getIcon('red', indicators.hsjcLight ? 'on' : 'off') <img :src="getIcon('green', indicators.gmLight ? 'on' : 'off')" />
" </div>
/> </div>
</div> <div class="content-row">
</div> <div class="cell btn">
<div class="content-row"> <div class="btn-text">禁止</div>
<div class="cell"> <img
<div class="btn-text">开门状态指示灯</div> :src="getIcon('key')"
<img :class="['key', { 'key-on': indicators.yxjzKey }]"
:src="getIcon('red', indicators.kmLight ? 'on' : 'off')" @click="btnClickHandler('YXJZ')"
/> />
</div> <div class="btn-text-opt">允许</div>
<div class="cell"> </div>
<div class="btn-text">关门状态指示灯</div> <div class="cell btn">
<img <div class="btn-text">禁止</div>
:src=" <img
getIcon('green', indicators.gmLight ? 'on' : 'off') :src="getIcon('key')"
" :class="['key', { 'key-on': indicators.hsjcKey }]"
/> @click="btnClickHandler('HSJC')"
</div> />
</div> <div class="btn-text-opt">互锁解除</div>
<div class="content-row"> </div>
<div class="cell btn"> </div>
<div class="btn-text">禁止</div> <div class="content-row">
<img <div class="cell btn">
:src="getIcon('key')" <div class="btn-text">开门按钮</div>
:class="['key', { 'key-on': indicators.yxjzKey }]" <img :src="getIcon('red', 'btn')" @click="btnClickHandler('KM')" />
@click="btnClickHandler('YXJZ')" </div>
/> <div class="cell btn">
<div class="btn-text-opt">允许</div> <div class="btn-text">关门按钮</div>
</div> <img :src="getIcon('green', 'btn')" @click="btnClickHandler('GM')" />
<div class="cell btn"> </div>
<div class="btn-text">禁止</div> </div>
<img <div class="content-row">
:src="getIcon('key')" <div class="cell btn">
:class="['key', { 'key-on': indicators.hsjcKey }]" <div class="btn-text">试灯按钮</div>
@click="btnClickHandler('HSJC')" <img
/> class="btn-sd btn-img"
<div class="btn-text-opt">互锁解除</div> :src="getIcon('green', 'btn')"
</div> @mousedown.left="btnClickHandler('SD')"
</div> @mouseup.left="btnClickHandler('SD')"
<div class="content-row"> />
<div class="cell btn"> </div>
<div class="btn-text">开门按钮</div> </div>
<img </div>
:src="getIcon('red', 'btn')" </el-dialog>
@click="btnClickHandler('KM')"
/>
</div>
<div class="cell btn">
<div class="btn-text">关门按钮</div>
<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"
:src="getIcon('green', 'btn')"
@mousedown.left="btnClickHandler('SD')"
@mouseup.left="btnClickHandler('SD')"
/>
</div>
</div>
</div>
</el-dialog>
</template> </template>
<script> <script>
@ -113,111 +90,109 @@ import icons from "@/assets/psl_images/psl_icons";
import { getPslStatus, pressPslButton } from "@/api/simulation"; import { getPslStatus, pressPslButton } from "@/api/simulation";
let standCode, group; let standCode, group;
export default { export default {
name: "PSL", name: "PSL",
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
indicators: { indicators: {
// lock: false, qbgmLight: true,
pslczLight: false, pslczLight: false,
hsjcLight: false, hsjcLight: false,
kmLight: false, kmLight: false,
gmLight: false, gmLight: false,
yxjzKey: false, yxjzKey: false,
hsjcKey: false hsjcKey: false
} }
}; };
}, },
computed: { computed: {
title() { title() {
return "PSL"; return "PSL";
}, },
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
} }
}, },
methods: { methods: {
doShow(selected) { doShow(selected) {
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function() { this.$nextTick(function() {
this.$store.dispatch("training/emitTipFresh"); this.$store.dispatch("training/emitTipFresh");
}); });
standCode = selected.code; standCode = selected.code;
group = this.$route.query.group; group = this.$route.query.group;
this.initData(group, standCode); this.initData(group, standCode);
}, },
initData(group, standCode) { initData(group, standCode) {
getPslStatus(group, standCode) getPslStatus(group, standCode)
.then(resp => { .then(resp => {
if (resp.data) { if (resp.data) {
this.indicators = resp.data; this.indicators = resp.data;
} }
}) })
.catch(err => {}); .catch(err => {});
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch("training/emitTipFresh"); this.$store.dispatch("training/emitTipFresh");
}, },
getIcon(type, status) { getIcon(type, status) {
return status !== undefined return status !== undefined ? icons[`${type}_${status}`] : icons[type];
? icons[`${type}_${status}`] },
: icons[type]; btnClickHandler(btnType) {
}, pressPslButton(group, standCode, btnType);
btnClickHandler(btnType) { }
pressPslButton(group, standCode, btnType); },
} watch: {
}, "$store.state.socket.simulationPslStatus": function(val) {
watch: { if (val && val[standCode]) {
"$store.state.socket.simulationPslStatus": function(val) { Object.assign(this.indicators, val[standCode]);
if (val && val[standCode]) { }
Object.assign(this.indicators, val[standCode]) }
} }
}
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.psl-title { .psl-title {
display: flex; display: flex;
justify-content: center; justify-content: center;
color: #000; color: #000;
font-size: 18px; font-size: 18px;
margin: 30px 0; margin: 30px 0;
} }
.psl-content { .psl-content {
.content-row { .content-row {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
margin: 10px 0; margin: 10px 0;
.cell { .cell {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 120px; width: 120px;
height: 100px; height: 100px;
.key { .key {
transition: 0.1s; transition: 0.1s;
} }
.key-on { .key-on {
transform: rotate(90deg); transform: rotate(90deg);
} }
.btn-text-opt { .btn-text-opt {
position: absolute; position: absolute;
left: 80%; left: 80%;
top: 35%; top: 35%;
width: 100%; width: 100%;
} }
} }
.btn { .btn {
cursor: pointer; cursor: pointer;
} }
} }
} }
</style> </style>

View File

@ -1,102 +1,133 @@
<template> <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-dialog
<el-form ref="form" size="small" label-width="120px" :model="formModel" :rules="rules"> v-dialogDrag
<el-form-item :label="this.$t('menu.groupNumber')+this.$t('global.colon')" prop="groupNumber"> :class="popClass + ' train-control'"
<el-select :title="title"
:id="domIdTrainNumber" :visible.sync="show"
v-model="formModel.groupNumber" width="370px"
filterable :before-close="doClose"
:disabled="trainNumberIsDisabled" :z-index="2000"
@change="trainNumberChange" :modal="false"
:close-on-click-modal="false"
>
<el-form
ref="form"
size="small"
label-width="120px"
:model="formModel"
:rules="rulesComputed"
> >
<el-option <el-form-item
v-for="train in trainList" :label="this.$t('menu.groupNumber') + this.$t('global.colon')"
:key="train.groupNumber" prop="groupNumber"
:label="train.groupNumber" >
:value="train.groupNumber" <el-select
/> :id="domIdTrainNumber"
</el-select> v-model="formModel.groupNumber"
</el-form-item> filterable
<el-form-item prop="type" label-width="0px"> :disabled="trainNumberIsDisabled"
<el-radio-group @change="trainNumberChange"
:id="domIdTrainType" >
v-model="formModel.type" <el-option
style="margin-left: 45px;" v-for="train in trainList"
@change="trainTypeChange" :key="train.groupNumber"
> :label="train.groupNumber"
<el-radio :label="'PLAN'">{{ $t('menu.planTrain') }}</el-radio> :value="train.groupNumber"
<el-radio :label="'HEAD'">{{ $t('menu.headCodeTrain') }}</el-radio> />
<el-radio :label="'MANUAL'" style="margin-top:5px;">{{ $t('menu.artificialTrain') }}</el-radio> </el-select>
</el-radio-group> </el-form-item>
</el-form-item> <el-form-item prop="type" label-width="0px">
<el-radio-group
:id="domIdTrainType"
v-model="formModel.type"
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-group>
</el-form-item>
<!-- 表号 --> <!-- 表号 -->
<el-form-item v-if="formModel.type == 'PLAN'" prop="serviceNumber"> <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 <el-input
:id="domIdServerNo" :id="domIdServerNo"
v-model="formModel.serviceNumber" v-model="formModel.serviceNumber"
:disabled="serverNoIsDisabled" :disabled="serverNoIsDisabled"
/> />
</el-form-item> </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-form-item
<el-input v-if="formModel.type == 'PLAN' || formModel.type == 'HEAD'"
:id="domIdTrainNo" :label="this.$t('menu.tripNumber') + this.$t('global.colon')"
v-model="formModel.tripNumber" prop="tripNumber"
maxlength="4" >
/> <el-input :id="domIdTrainNo" v-model="formModel.tripNumber" maxlength="4" />
</el-form-item> </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
<el-input v-if="formModel.type == 'PLAN' || formModel.type == 'HEAD'"
:id="domIdTargetCode" :label="this.$t('menu.targetCode') + this.$t('global.colon')"
v-model="formModel.destinationCode" prop="destinationCode"
:disabled="formModel.type !== 'HEAD'" >
/> <el-input
</el-form-item> :id="domIdTargetCode"
v-model="formModel.destinationCode"
:disabled="formModel.type !== 'HEAD'"
/>
</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
<el-select v-if="formModel.type == 'MANUAL'"
:id="domIdTrainNumber" :label="this.$t('menu.category') + this.$t('global.colon')"
v-model="formModel.category" prop="category"
filterable >
:disabled="true" <el-select
> :id="domIdTrainNumber"
<el-option v-model="formModel.category"
v-for="item in categoryList" filterable
:key="item.value" :disabled="true"
:label="item.name" >
:value="item.value" <el-option
/> v-for="item in categoryList"
</el-select> :key="item.value"
</el-form-item> :label="item.name"
</el-form> :value="item.value"
<el-row justify="center" class="button-group"> />
<el-col :span="10" :offset="2"> </el-select>
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{ $t('global.confirm') }}</el-button> </el-form-item>
</el-col> </el-form>
<el-col :span="8" :offset="4"> <el-row justify="center" class="button-group">
<el-button :id="domIdCancel" @click="cancel">{{ $t('global.cancel') }}</el-button> <el-col :span="10" :offset="2">
</el-col> <el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{
</el-row> $t("global.confirm")
<notice-info ref="noticeInfo" :pop-class="popClass" /> }}</el-button>
</el-dialog> </el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">{{ $t("global.cancel") }}</el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" :pop-class="popClass" />
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from "vuex";
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from "@/scripts/cmdPlugin/OperationHandler";
import Handler from '@/scripts/cmdPlugin/Handler'; import Handler from "@/scripts/cmdPlugin/Handler";
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import { menuOperate, commitOperate } from "@/jmapNew/theme/components/utils/menuOperate";
import {getTrainDetailBytripNumber, getTrainDetailByStNumber} from '@/api/simulation'; import { getTrainDetailBytripNumber, getTrainDetailByStNumber } from "@/api/simulation";
import NoticeInfo from '../childDialog/noticeInfo'; import NoticeInfo from "../childDialog/noticeInfo";
export default { export default {
name: 'TrainControl', name: "TrainControl",
components: { components: {
NoticeInfo NoticeInfo
}, },
@ -104,48 +135,23 @@ export default {
popClass: { popClass: {
type: String, type: String,
default() { default() {
return ''; return "";
} }
} }
}, },
data() { 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 { return {
trainList: [], trainList: [],
serviceNumber:'', serviceNumber: "",
formModel: { formModel: {
tripNumber: '', tripNumber: "",
groupNumber: '', groupNumber: "",
type: 'PLAN', type: "PLAN",
serviceNumber: '', serviceNumber: "",
destinationCode: '', destinationCode: "",
category: 'MM' 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' }
]
}, },
categoryList: [{ name: "MM", value: "01" }],
operation: null, operation: null,
dialogShow: false, dialogShow: false,
loading: false, loading: false,
@ -154,11 +160,36 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters("map", ["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() { serverNoIsDisabled() {
if (this.popClass === 'foshan-01__systerm' && this.formModel.type === 'PLAN') { if (this.popClass === "foshan-01__systerm" && this.formModel.type === "PLAN") {
return false; return false;
} else { } else {
return true; return true;
@ -168,7 +199,7 @@ export default {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) { if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true; return true;
} }
return ''; return "";
}, },
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
@ -183,7 +214,7 @@ export default {
return OperationEvent.Train.editTrainId.trainNumberChange.domId; return OperationEvent.Train.editTrainId.trainNumberChange.domId;
} }
} }
return ''; return "";
}, },
domIdTrainNo() { domIdTrainNo() {
if (this.dialogShow) { if (this.dialogShow) {
@ -195,7 +226,7 @@ export default {
return OperationEvent.Train.editTrainId.trainNoChange.domId; return OperationEvent.Train.editTrainId.trainNoChange.domId;
} }
} }
return ''; return "";
}, },
domIdTrainType() { domIdTrainType() {
if (this.dialogShow) { if (this.dialogShow) {
@ -207,7 +238,7 @@ export default {
return OperationEvent.Train.editTrainId.trainTypeChange.domId; return OperationEvent.Train.editTrainId.trainTypeChange.domId;
} }
} }
return ''; return "";
}, },
domIdServerNo() { domIdServerNo() {
if (this.dialogShow) { if (this.dialogShow) {
@ -219,7 +250,7 @@ export default {
return OperationEvent.Train.editTrainId.serverNoChange.domId; return OperationEvent.Train.editTrainId.serverNoChange.domId;
} }
} }
return ''; return "";
}, },
domIdTargetCode() { domIdTargetCode() {
if (this.dialogShow) { if (this.dialogShow) {
@ -231,7 +262,7 @@ export default {
return OperationEvent.Train.editTrainId.targetCodeChange.domId; return OperationEvent.Train.editTrainId.targetCodeChange.domId;
} }
} }
return ''; return "";
}, },
domIdConfirm() { domIdConfirm() {
if (this.dialogShow) { if (this.dialogShow) {
@ -243,36 +274,45 @@ export default {
return OperationEvent.Train.editTrainId.menu.domId; return OperationEvent.Train.editTrainId.menu.domId;
} }
} }
return ''; return "";
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : "";
}, },
title() { title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return '添加列车识别号'; return "添加列车识别号";
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return '修改列车识别号'; return "修改列车识别号";
} }
return ''; return "";
} }
}, },
watch: { watch: {
'formModel.tripNumber': function(val) { "formModel.tripNumber": function(val) {
if (this.popClass !== 'foshan-01__systerm' && val.length === 4 && this.formModel.type !== 'HEAD') { if (
this.popClass !== "foshan-01__systerm" &&
val.length === 4 &&
this.formModel.type !== "HEAD"
) {
this.trainNoChange(val); 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 = { this.formModel = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
tripNumber: val, tripNumber: val,
type: this.formModel.type, type: this.formModel.type,
serviceNumber: '', serviceNumber: "",
targetCode: '', targetCode: "",
category: 'MM' 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); 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 serviceNumber = this.formModel.serviceNumber;
const destinationCode = this.formModel.destinationCode; const destinationCode = this.formModel.destinationCode;
this.formModel = { this.formModel = {
@ -281,15 +321,19 @@ export default {
tripNumber: val, tripNumber: val,
type: this.formModel.type, type: this.formModel.type,
serviceNumber: serviceNumber, serviceNumber: serviceNumber,
targetCode: '', targetCode: "",
category: 'MM' category: "MM"
}; };
} }
}, },
'formModel.serviceNumber': function(val) { "formModel.serviceNumber": function(val) {
if (this.popClass === 'foshan-01__systerm' && val.length === 3 && this.formModel.tripNumber.length === 2) { if (
this.popClass === "foshan-01__systerm" &&
val.length === 3 &&
this.formModel.tripNumber.length === 2
) {
this.trainNoChange(this.formModel.tripNumber, 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 tripNumber = this.formModel.tripNumber;
const destinationCode = this.formModel.destinationCode; const destinationCode = this.formModel.destinationCode;
this.formModel = { this.formModel = {
@ -298,8 +342,8 @@ export default {
destinationCode: destinationCode, destinationCode: destinationCode,
type: this.formModel.type, type: this.formModel.type,
serviceNumber: val, serviceNumber: val,
targetCode: '', targetCode: "",
category: 'MM' category: "MM"
}; };
} }
} }
@ -307,40 +351,40 @@ export default {
methods: { methods: {
loadInitData(map) {}, loadInitData(map) {},
doShow(operate, selected) { doShow(operate, selected) {
this.$root.$emit('dialogOpen', selected); this.$root.$emit("dialogOpen", selected);
this.selected = selected; this.selected = selected;
// //
if (!this.dialogShow) { if (!this.dialogShow) {
this.operation = operate.operation; 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.serviceNumber = model.serviceNumber;
this.formModel = { this.formModel = {
groupNumber: model.groupNumber, groupNumber: model.groupNumber,
tripNumber: model.tripNumber, tripNumber: model.tripNumber,
type: model.type ? model.type : 'PLAN', type: model.type ? model.type : "PLAN",
serviceNumber: model.serviceNumber, serviceNumber: model.serviceNumber,
destinationCode: model.destinationCode, destinationCode: model.destinationCode,
category: 'MM' category: "MM"
}; };
/** 加载列车数据*/ /** 加载列车数据*/
this.loadInitData(this.map); this.loadInitData(this.map);
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function() {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch("training/emitTipFresh");
}); });
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$root.$emit('dialogClose', this.selected); this.$root.$emit("dialogClose", this.selected);
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch("training/emitTipFresh");
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch("map/setTrainWindowShow", false);
}, },
trainNumberChange(groupNumber) { trainNumberChange(groupNumber) {
const operate = { const operate = {
groupNumber: groupNumber, groupNumber: groupNumber,
operation: '' operation: ""
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
@ -348,37 +392,37 @@ export default {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation; 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) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch("menuOperation/handleBreakFlag", { break: true });
} }
}); });
}, },
trainTypeChange(trainType) { trainTypeChange(trainType) {
if (trainType === 'HEAD') { if (trainType === "HEAD") {
this.formModel.serviceNumber = ''; this.formModel.serviceNumber = "";
} else if (trainType === 'PLAN' && this.serviceNumber) { } else if (trainType === "PLAN" && this.serviceNumber) {
this.formModel.serviceNumber = this.serviceNumber; this.formModel.serviceNumber = this.serviceNumber;
} }
const operate = { const operate = {
type: trainType, type: trainType,
operation: '' operation: ""
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.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) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch("menuOperation/handleBreakFlag", { break: true });
} }
}); });
}, },
trainNoChange(tripNumber, serviceNumber) { trainNoChange(tripNumber, serviceNumber) {
const operate = { const operate = {
tripNumber: tripNumber, tripNumber: tripNumber,
operation: '' operation: ""
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
@ -387,30 +431,35 @@ 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, {tripNumber: tripNumber, serviceNumber: serviceNumber}).then(resp => { getTrainDetailByStNumber(this.$route.query.group, {
tripNumber: tripNumber,
serviceNumber: serviceNumber
}).then(resp => {
if (resp.data) { if (resp.data) {
this.formModel.destinationCode = resp.data.destinationCode; this.formModel.destinationCode = resp.data.destinationCode;
} else { } else {
this.$message.error('未找到输入列车信息!'); this.$message.error("未找到输入列车信息!");
} }
}); });
} else { } else {
getTrainDetailBytripNumber(this.$route.query.group, {tripNumber:tripNumber}).then(resp => { getTrainDetailBytripNumber(this.$route.query.group, {
tripNumber: tripNumber
}).then(resp => {
if (resp.data) { if (resp.data) {
this.formModel.serviceNumber = resp.data.serviceNumber; this.formModel.serviceNumber = resp.data.serviceNumber;
this.formModel.destinationCode = resp.data.destinationCode; this.formModel.destinationCode = resp.data.destinationCode;
} else { } else {
this.$message.error('未找到输入列车信息!'); this.$message.error("未找到输入列车信息!");
} }
}); });
} }
} catch (e) { } 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) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch("menuOperation/handleBreakFlag", { break: true });
} }
}); });
}, },
@ -425,33 +474,35 @@ export default {
}, },
// //
addTrainId() { addTrainId() {
this.$refs['form'].validate((valid) => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
const params = { const params = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
type: this.formModel.type, type: this.formModel.type,
serviceNumber: '', serviceNumber: "",
tripNumber: '', tripNumber: "",
destinationCode: '' destinationCode: ""
}; };
if (this.formModel.type === 'PLAN') { if (this.formModel.type === "PLAN") {
params.serviceNumber = this.formModel.serviceNumber; params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber; params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode; params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === 'HEAD') { } else if (this.formModel.type === "HEAD") {
params.tripNumber = this.formModel.tripNumber; params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode; params.destinationCode = this.formModel.destinationCode;
} }
commitOperate(menuOperate.TrainWindow.addTrainId, params, 2).then(({valid})=>{ commitOperate(menuOperate.TrainWindow.addTrainId, params, 2)
this.loading = false; .then(({ valid }) => {
if (valid) { this.loading = false;
if (valid) {
this.doClose();
}
})
.catch(() => {
this.loading = false;
this.doClose(); this.doClose();
} this.$refs.noticeInfo.doShow();
}).catch(() => { });
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
} else { } else {
return false; return false;
} }
@ -459,33 +510,35 @@ export default {
}, },
// //
editTrainId() { editTrainId() {
this.$refs['form'].validate((valid) => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
const params = { const params = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
type: this.formModel.type, type: this.formModel.type,
serviceNumber: '', serviceNumber: "",
tripNumber: '', tripNumber: "",
destinationCode: '' destinationCode: ""
}; };
if (this.formModel.type === 'PLAN') { if (this.formModel.type === "PLAN") {
params.serviceNumber = this.formModel.serviceNumber; params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber; params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode; params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === 'HEAD') { } else if (this.formModel.type === "HEAD") {
params.tripNumber = this.formModel.tripNumber; params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode; params.destinationCode = this.formModel.destinationCode;
} }
commitOperate(menuOperate.TrainWindow.editTrainId, params, 2).then(({valid})=>{ commitOperate(menuOperate.TrainWindow.editTrainId, params, 2)
this.loading = false; .then(({ valid }) => {
if (valid) { this.loading = false;
if (valid) {
this.doClose();
}
})
.catch(() => {
this.loading = false;
this.doClose(); this.doClose();
} this.$refs.noticeInfo.doShow();
}).catch(() => { });
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
} else { } else {
return false; return false;
} }
@ -495,13 +548,16 @@ export default {
const operate = { const operate = {
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store
if (valid) { .dispatch("training/nextNew", operate)
.then(({ valid }) => {
if (valid) {
this.doClose();
}
})
.catch(() => {
this.doClose(); this.doClose();
} });
}).catch(() => {
this.doClose();
});
} }
} }
}; };

View File

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

View File

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

View File

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

View File

@ -1,108 +1,113 @@
<template> <template>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
class="xian-01__systerm stand-stop-time" class="xian-01__systerm stand-stop-time"
:title="title" :title="title"
:visible.sync="show" :visible.sync="show"
width="320px" width="320px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
:modal="false" :modal="false"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form
ref="form" ref="form"
size="small" size="small"
label-width="100px" label-width="100px"
:model="model" :model="model"
:rules="rules" :rules="rules"
> >
<el-form-item prop="serviceNumber" label="表号"> <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>
<el-form-item prop="tripNumber" label="车次号"> <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-item>
</el-form> </el-form>
<el-row justify="center" class="button-group"> <el-row justify="center" class="button-group">
<el-col :span="10" :offset="2"> <el-col :span="10" :offset="2">
<el-button type="primary" :loading="loading" @click="commit">{{ <el-button type="primary" :loading="loading" @click="commit">{{
$t("menu.menuDialog.confirm") $t("menu.menuDialog.confirm")
}}</el-button> }}</el-button>
</el-col> </el-col>
<el-col :span="8" :offset="4"> <el-col :span="8" :offset="4">
<el-button @click="doClose">{{ <el-button @click="doClose">{{
$t("menu.menuDialog.cancel") $t("menu.menuDialog.cancel")
}}</el-button> }}</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { sendCommandNew } from "@/api/jmap/training"; import { sendCommandNew } from '@/api/jmap/training';
export default { export default {
name: "DeleteRunplanLine", name: 'DeleteRunplanLine',
data() { data() {
return { return {
loading: false, loading: false,
dialogShow: false, dialogShow: false,
model: { model: {
serviceNumber: "", serviceNumber: '',
tripNumber: "" tripNumber: ''
}, },
rules: { rules: {
serviceNumber: [ serviceNumber: [
{ {
required: true, required: true,
trigger: "blur", trigger: 'blur',
validator:this.validateService validator:this.validateService
// message: "" // message: ""
} }
], ],
tripNumber: [ tripNumber: [
{ {
required: true, required: true,
trigger: "blur", trigger: 'blur',
message: "请输入车次号" message: '请输入车次号'
} }
] ]
} }
}; };
}, },
computed: { computed: {
title() { title() {
return "抽线"; return '抽线';
}, },
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
} }
}, },
methods: { watch: {
doShow(operate) { '$store.state.runPlan': function(oldVal, newVal) {
// this.operate = operate || {}; console.log(newVal);
// this.operation = operate.operation; }
// // },
// if (!this.dialogShow) { methods: {
// this.loading = false; doShow(operate) {
// } // this.operate = operate || {};
this.dialogShow = true; // this.operation = operate.operation;
this.$nextTick(function() { // //
this.$store.dispatch("training/emitTipFresh"); // if (!this.dialogShow) {
}); // this.loading = false;
}, // }
doClose() { this.dialogShow = true;
// this.loading = false; this.$nextTick(function() {
this.dialogShow = false; this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch("training/emitTipFresh"); });
}, },
validateService (rule, value, callback) { doClose() {
// this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
validateService (rule, value, callback) {
if (typeof value == 'string' && value.trim().length == 0) { if (typeof value == 'string' && value.trim().length == 0) {
return callback(new Error('请输入表号')); return callback(new Error('请输入表号'));
} else { } else {
let newValue = parseInt(value); let newValue = parseInt(value);
if (newValue) { if (newValue) {
if (newValue > 0 & newValue < 9) { if (newValue > 0 & newValue <= 9) {
newValue = '0' + newValue; newValue = '0' + newValue;
} }
this.model.serviceNumber = newValue; this.model.serviceNumber = newValue;
@ -112,29 +117,24 @@ export default {
} }
} }
}, },
commit() { commit() {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
const group = this.$route.query.group; const group = this.$route.query.group;
const data = this.model; const data = this.model;
sendCommandNew(group, "RunPlan_Delete_Trip", data) sendCommandNew(group, 'RunPlan_Delete_Trip', data)
.then(resp => { .then(resp => {
console.log(resp); console.log(resp);
this.$message.success('删除计划车成功'); this.$message.success('删除计划车成功');
this.doClose(); this.doClose();
}) })
.catch(e => { .catch(e => {
this.$messageBox(e); this.$messageBox(e.message);
}); });
} }
}); });
} }
}, }
watch: {
"$store.state.runPlan": function(oldVal, newVal) {
console.log(newVal);
}
}
}; };
</script> </script>

View File

@ -142,6 +142,8 @@ export const IbpOperation = {
AXLE_PRE_RESET: {operate: '13', event: 'AXLE_PRE_RESET', name: '计轴预复位'}, AXLE_PRE_RESET: {operate: '13', event: 'AXLE_PRE_RESET', name: '计轴预复位'},
PRERESET_Z: {operate: '14', event: 'PRERESET_Z', name: '计轴预复零'}, PRERESET_Z: {operate: '14', event: 'PRERESET_Z', name: '计轴预复零'},
SD: {operate: '15', event: 'SD', 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://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪 // 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.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.3.120:9000'; // 张赛 // BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://192.168.8.140:9000'; // 杜康

View File

@ -1,122 +1,114 @@
<template> <template>
<div> <div>
<el-form ref="form" :rules="rules" :model="form" label-width="80px"> <el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item :label="this.$t('ibp.buttonCode')" prop="code"> <el-form-item :label="this.$t('ibp.buttonCode')" prop="code">
<el-input v-model="form.code" :disabled="true"> <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">{{
</el-input> $t("ibp.generateCode")
</el-form-item> }}</el-button>
<el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor"> </el-input>
<el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')"> </el-form-item>
<el-option :label="this.$t('ibp.redButton')" value="red" /> <el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor">
<el-option :label="this.$t('ibp.yellowButton')" value="yellow" /> <el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')">
<el-option :label="this.$t('ibp.greenButton')" value="green" /> <el-option :label="this.$t('ibp.redButton')" value="red" />
<el-option :label="this.$t('ibp.blueButton')" value="blue" /> <el-option :label="this.$t('ibp.yellowButton')" value="yellow" />
<el-option :label="this.$t('ibp.grayButton')" value="gray" /> <el-option :label="this.$t('ibp.greenButton')" value="green" />
</el-select> <el-option :label="this.$t('ibp.blueButton')" value="blue" />
</el-form-item> <el-option :label="this.$t('ibp.grayButton')" value="gray" />
<el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth"> </el-select>
<el-input-number v-model="form.buttonWidth" controls-position="right" :min="1" /> </el-form-item>
</el-form-item> <el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth">
<el-form-item :label="this.$t('ibp.xCoordinate')"> <el-input-number v-model="form.buttonWidth" controls-position="right" :min="1" />
<el-input-number v-model="form.x" controls-position="right" :min="1" /> </el-form-item>
</el-form-item> <el-form-item :label="this.$t('ibp.xCoordinate')">
<el-form-item :label="this.$t('ibp.yCoordinate')"> <el-input-number v-model="form.x" controls-position="right" :min="1" />
<el-input-number v-model="form.y" controls-position="right" :min="1" /> </el-form-item>
</el-form-item> <el-form-item :label="this.$t('ibp.yCoordinate')">
<el-form-item label="操作"> <el-input-number v-model="form.y" controls-position="right" :min="1" />
<el-select v-model="form.mean" placeholder="请选择"> </el-form-item>
<el-option <el-form-item label="操作">
v-for="item in operateMeanList" <el-select v-model="form.mean" placeholder="请选择">
:key="item.value" <el-option
:label="item.label" v-for="item in operateMeanList"
:value="item.value" :key="item.value"
/> :label="item.label"
</el-select> :value="item.value"
</el-form-item> />
<el-form-item v-if="'AXLE_PRE_RESET' === form.mean" label="关联区段" prop="sectionCode"> </el-select>
<el-select v-model="form.sectionCode" filterable placeholder="请选择"> </el-form-item>
<el-option <el-form-item v-if="'AXLE_PRE_RESET' === form.mean" label="关联区段" prop="sectionCode">
v-for="item in sectionList" <el-select v-model="form.sectionCode" filterable placeholder="请选择">
:key="item.code" <el-option
:label="item.name + '(' + item.code +')'" v-for="item in sectionList"
:value="item.code" :key="item.code"
/> :label="item.name + '(' + item.code + ')'"
</el-select> :value="item.code"
</el-form-item> />
<el-form-item v-if="needDirectionItem" label="方向"> </el-select>
<el-select v-model="form.direction" placeholder="请选择"> </el-form-item>
<el-option <el-form-item v-if="needDirectionItem" label="方向">
v-for="(item, i) in directions" <el-select v-model="form.direction" placeholder="请选择">
:key="i" <el-option
:label="item.name" v-for="(item, i) in directions"
:value="item.value" :key="i"
></el-option> :label="item.name"
</el-select> :value="item.value"
</el-form-item> ></el-option>
<el-form-item> </el-select>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button> </el-form-item>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button> <el-form-item>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button> <el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
</el-form-item> <el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{
</el-form> $t("global.delete")
</div> }}</el-button>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t("global.cancel") }}</el-button>
</el-form-item>
</el-form>
</div>
</template> </template>
<script> <script>
import {getSectionListByCenStationCode, getSectionListByMapId } from '@/api/jmap/map'; import { getSectionListByCenStationCode, getSectionListByMapId } from "@/api/jmap/map";
export default { export default {
name: 'ButtonDraft', name: "ButtonDraft",
components: { components: {},
},
data() { data() {
return { return {
isUpdate: false, isUpdate: false,
buttonText: this.$t('ibp.createNow'), buttonText: this.$t("ibp.createNow"),
showDeleteButton: false, showDeleteButton: false,
operateMeanList: [ operateMeanList: [
{ label: '扣车', value: 'KC' }, { label: "扣车", value: "KC" },
{ label: '终止扣车', value: 'ZZKC' }, { label: "终止扣车", value: "ZZKC" },
{ label: '紧急停车', value: 'JJTC' }, { label: "紧急停车", value: "JJTC" },
{ label: '取消紧急停车', value: 'QXJJTC' }, { label: "取消紧急停车", value: "QXJJTC" },
{ label: '报警切除', value: 'BJQC' }, { label: "报警切除", value: "BJQC" },
{ label: '屏蔽门开门', value: 'KM' }, { label: "屏蔽门开门", value: "KM" },
{ label: '计轴复位', value: 'AXLE_RESET' }, { label: "屏蔽门关门", value: "GM" },
{ label: '计轴预复位', value: 'AXLE_PRE_RESET' }, { label: "计轴复位", value: "AXLE_RESET" },
{ label: '计轴预复零', value: 'PRERESET_Z' }, { label: "计轴预复位", value: "AXLE_PRE_RESET" },
{ label: '试灯', value: 'SD' }, { 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: { form: {
code: '', code: "",
buttonColor: 'red', buttonColor: "red",
buttonWidth: 25, buttonWidth: 25,
x: 10, x: 10,
y: 10, y: 10,
sectionCode: '', sectionCode: "",
mean: '', mean: "",
direction: null, direction: null
}, },
rules: { rules: {
code: [ code: [{ required: true, message: this.$t("ibp.enterTheButtonCode"), trigger: "blur" }],
{ 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" }],
buttonColor: [ sectionCode: [{ required: true, message: "请选择关联区段", trigger: "blur" }]
{ 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: [], sectionList: [],
directions: [ directions: [{ name: "全部", value: null }, { name: "上行", value: true }, { name: "下行", value: false }]
{ name: '全部', value: null},
{ name: '上行', value: true},
{ name: '下行', value: false},
],
}; };
}, },
computed: { computed: {
@ -125,10 +117,10 @@ export default {
} }
}, },
watch: { watch: {
'$store.state.ibp.rightClickCount': function (val) { "$store.state.ibp.rightClickCount": function(val) {
const model = this.$store.getters['ibp/updateDeviceData']; const model = this.$store.getters["ibp/updateDeviceData"];
if (model._type === 'SquareButton' ) { if (model._type === "SquareButton") {
this.buttonText = this.$t('global.modify'); this.buttonText = this.$t("global.modify");
this.showDeleteButton = true; this.showDeleteButton = true;
this.isUpdate = true; this.isUpdate = true;
this.form.code = model.code; this.form.code = model.code;
@ -144,40 +136,44 @@ export default {
}, },
mounted() { mounted() {
if (this.$route.query.stationCode) { 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)
this.sectionList = resp.data; .then(resp => {
// console.log(resp.data); this.sectionList = resp.data;
}).catch(() => { // console.log(resp.data);
this.$message.error('获取区段列表失败!'); })
}); .catch(() => {
this.$message.error("获取区段列表失败!");
});
} else { } else {
getSectionListByMapId(this.$route.query.mapId).then(resp => { getSectionListByMapId(this.$route.query.mapId)
this.sectionList = resp.data; .then(resp => {
console.log(resp.data); this.sectionList = resp.data;
}).catch(() => { console.log(resp.data);
this.$message.error('获取区段列表失败!'); })
}); .catch(() => {
this.$message.error("获取区段列表失败!");
});
} }
}, },
methods: { methods: {
onSubmit(form) { onSubmit(form) {
this.$refs[form].validate((valid) => { this.$refs[form].validate(valid => {
if (valid) { if (valid) {
const buttonModel = { const buttonModel = {
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
}, },
_type: 'SquareButton', _type: "SquareButton",
code: this.form.code, code: this.form.code,
color: this.form.buttonColor, color: this.form.buttonColor,
status: 'off', status: "off",
width: this.form.buttonWidth, width: this.form.buttonWidth,
mean: this.form.mean, mean: this.form.mean,
sectionCode: this.form.sectionCode, sectionCode: this.form.sectionCode,
direction: this.form.direction, direction: this.form.direction
}; };
this.$emit('createData', buttonModel); this.$emit("createData", buttonModel);
this.initPage(); this.initPage();
} else { } else {
return false; return false;
@ -190,40 +186,45 @@ export default {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
}, },
_type: 'SquareButton', _type: "SquareButton",
code: this.form.code, code: this.form.code,
color: this.form.buttonColor, color: this.form.buttonColor,
status: 'off', status: "off",
width: this.form.buttonWidth, width: this.form.buttonWidth,
mean: this.form.mean, mean: this.form.mean,
sectionCode: this.form.sectionCode, sectionCode: this.form.sectionCode,
direction: this.form.direction, direction: this.form.direction
}; };
this.$emit('deleteDataModel', buttonModel ); this.$emit("deleteDataModel", buttonModel);
this.initPage(); this.initPage();
}, },
initPage() { initPage() {
this.isUpdate = false; this.isUpdate = false;
this.buttonText = this.$t('ibp.createNow'); this.buttonText = this.$t("ibp.createNow");
this.showDeleteButton = false; this.showDeleteButton = false;
this.form = { this.form = {
code: '', code: "",
buttonColor: 'red', buttonColor: "red",
buttonWidth: 25, buttonWidth: 25,
x: 10, x: 10,
y: 10, y: 10,
mean: '', mean: "",
sectionCode: '', sectionCode: "",
direction: null, direction: null
}; };
}, },
generateCode() { generateCode() {
const mydate = new Date(); 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> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped></style>
</style>