Merge remote-tracking branch 'origin/test'

This commit is contained in:
joylink_zhangsai 2021-07-12 18:26:15 +08:00
commit bf9684e6af
11 changed files with 397 additions and 408 deletions

View File

@ -36,6 +36,13 @@ export default {
backgroundHeight: 'backgroundHeight',
buttonCode: 'Button code',
buttonColor: 'Button color',
buttonLightColor: 'Button Light Color',
red: 'Red',
blue: 'Blue',
yellow: 'Yellow',
green: 'Green',
gray: 'White',
button: 'Button',
buttonWidth: 'Button width',
redButton: 'Red button',
blueButton: 'Blue button',

View File

@ -41,6 +41,13 @@ export default {
backgroundHeight: '背景板高度',
buttonCode: '按钮编号',
buttonColor: '按钮颜色',
buttonLightColor: '按钮灯颜色',
red: '红色',
blue: '蓝色',
yellow: '黄色',
green: '绿色',
gray: '白色',
button: '按钮',
buttonWidth: '按钮宽度',
redButton: '红色按钮',
blueButton: '蓝色按钮',

View File

@ -86,7 +86,12 @@ export default class button extends Group {
}
getImagePic() {
const color = colors.get(`${this.model.color}${this.model.pressed ? '_pressed' : ''}_${this.model.status}`);
let color;
if (this.model.status === 'on') {
color = colors.get(`${this.model.lightColor || this.model.color}${this.model.pressed ? '_pressed' : ''}_on`)
} else if (this.model.status === 'off') {
color = colors.get(`${this.model.color}${this.model.pressed ? '_pressed' : ''}_off`)
}
return color;
}

View File

@ -93,6 +93,7 @@ export default class Train extends Group {
turnBackStrategy: model.turnBackStrategy,
turnBackStatus: model.turnBackStatus,
stationCode: model.stationCode,
runLevel: model.runLevel,
model: model
});
const rect = this.trainB.getBoundingRectOfFont().clone();

View File

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

View File

@ -10,17 +10,8 @@
: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-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"
@ -45,20 +36,14 @@
>
<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="'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>
<el-input
:id="domIdServerNo"
v-model="formModel.serviceNumber"
:disabled="serverNoIsDisabled"
/>
<el-input :id="domIdServerNo" v-model="formModel.serviceNumber" :disabled="serverNoIsDisabled" />
</el-form-item>
<!-- 车次号 -->
@ -89,18 +74,8 @@
:label="this.$t('menu.category') + this.$t('global.colon')"
prop="category"
>
<el-select
:id="domIdTrainNumber"
v-model="formModel.category"
filterable
:disabled="true"
>
<el-option
v-for="item in categoryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
<el-select :id="domIdTrainNumber" v-model="formModel.category" filterable :disabled="true">
<el-option v-for="item in categoryList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</el-form-item>
</el-form>
@ -181,11 +156,11 @@ export default {
{
required: !(this.formModel.type === "HEAD" && this.popClass === "xian-01__systerm"),
message: "请输入车次号",
trigger: "blur"
trigger: "change"
},
{ validator: validateTripNum, trigger: "blur" }
{ validator: validateTripNum, trigger: "change" }
],
destinationCode: [{ required: true, message: "请输入目的地号", trigger: "blur" }]
destinationCode: [{ required: true, message: "请输入目的地号", trigger: "change" }]
};
},
serverNoIsDisabled() {
@ -290,11 +265,7 @@ export default {
},
watch: {
"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);
} else if (this.popClass !== "foshan-01__systerm" && this.formModel.type !== "HEAD") {
this.formModel = {
@ -302,8 +273,8 @@ export default {
tripNumber: val,
type: this.formModel.type,
serviceNumber: "",
targetCode: "",
category: "MM"
category: "MM",
destinationCode: ""
};
} else if (
this.popClass === "foshan-01__systerm" &&
@ -313,36 +284,30 @@ export default {
) {
this.trainNoChange(val, this.formModel.serviceNumber);
} else if (this.popClass === "foshan-01__systerm" && this.formModel.type !== "HEAD") {
const serviceNumber = this.formModel.serviceNumber;
const destinationCode = this.formModel.destinationCode;
let serviceNumber = this.formModel.serviceNumber;
let destinationCode = this.formModel.destinationCode;
this.formModel = {
groupNumber: this.formModel.groupNumber,
destinationCode: destinationCode,
tripNumber: val,
type: this.formModel.type,
serviceNumber: serviceNumber,
targetCode: "",
category: "MM"
};
}
},
"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);
} else if (this.popClass === "foshan-01__systerm") {
const tripNumber = this.formModel.tripNumber;
const destinationCode = this.formModel.destinationCode;
let tripNumber = this.formModel.tripNumber;
let destinationCode = this.formModel.destinationCode;
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: tripNumber,
destinationCode: destinationCode,
type: this.formModel.type,
serviceNumber: val,
targetCode: "",
category: "MM"
};
}

View File

@ -138,7 +138,7 @@ export default {
operate.operation = OperationEvent.StationControl.forcedStationControl.passwordConfirm.operation;
}
if (this.model.password == '123456') {
if (this.model.password == '12') {
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;

View File

@ -139,9 +139,11 @@ export const IbpOperation = {
XXYS: {operate: '09', event: 'XXYS', name: '下行钥匙'},
SXYS: {operate: '11', event: 'SXYS', name: '上行钥匙'},
AXLE_RESET: {operate: '12', event: 'AXLE_RESET', name: '计轴复位'},
AXLE_PRE_RESET: {operate: '13', event: 'AXLE_PRE_RESET', name: '计轴复位'},
PRERESET_Z: {operate: '14', event: 'PRERESET_Z', name: '计轴预复'},
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

@ -1,122 +1,128 @@
<template>
<div>
<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-input>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor">
<el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')">
<el-option :label="this.$t('ibp.redButton')" value="red" />
<el-option :label="this.$t('ibp.yellowButton')" value="yellow" />
<el-option :label="this.$t('ibp.greenButton')" value="green" />
<el-option :label="this.$t('ibp.blueButton')" value="blue" />
<el-option :label="this.$t('ibp.grayButton')" value="gray" />
</el-select>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth">
<el-input-number v-model="form.buttonWidth" controls-position="right" :min="1" />
</el-form-item>
<el-form-item :label="this.$t('ibp.xCoordinate')">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item :label="this.$t('ibp.yCoordinate')">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="操作">
<el-select v-model="form.mean" placeholder="请选择">
<el-option
v-for="item in operateMeanList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item v-if="'AXLE_PRE_RESET' === form.mean" label="关联区段" prop="sectionCode">
<el-select v-model="form.sectionCode" filterable placeholder="请选择">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code +')'"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item v-if="needDirectionItem" label="方向">
<el-select v-model="form.direction" placeholder="请选择">
<el-option
v-for="(item, i) in directions"
:key="i"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</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-form-item>
</el-form>
</div>
<div>
<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-input>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor">
<el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')">
<el-option
v-for="item in colors"
:key="`btn${item}`"
:label="`${$t(`ibp.${item}`)}${$t('ibp.button')}`"
:value="item"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonLightColor')" prop="buttonLightColor">
<el-select v-model="form.buttonLightColor">
<el-option label="默认" value=""></el-option>
<el-option
v-for="item in colors"
:key="`light${item}`"
:label="`${$t(`ibp.${item}`)}`"
:value="item"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth">
<el-input-number v-model="form.buttonWidth" controls-position="right" :min="1" />
</el-form-item>
<el-form-item :label="this.$t('ibp.xCoordinate')">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item :label="this.$t('ibp.yCoordinate')">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="操作">
<el-select v-model="form.mean" placeholder="请选择">
<el-option
v-for="item in operateMeanList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item v-if="'AXLE_PRE_RESET' === form.mean" label="关联区段" prop="sectionCode">
<el-select v-model="form.sectionCode" filterable placeholder="请选择">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item v-if="needDirectionItem" label="方向">
<el-select v-model="form.direction" placeholder="请选择">
<el-option
v-for="(item, i) in directions"
:key="i"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</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-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'],
colors: ["red", "yellow", "blue", "green", "gray"],
operateWithoutDirections: ["AXLE_RESET", "AXLE_PRE_RESET", "PRERESET_Z", "SD"],
form: {
code: '',
buttonColor: 'red',
code: "",
buttonColor: "red",
buttonLightColor: "",
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,14 +131,15 @@ 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;
this.form.buttonColor = model.color;
this.form.buttonLightColor = model.lightColor;
this.form.buttonWidth = model.width;
this.form.x = model.point.x;
this.form.y = model.point.y;
@ -144,40 +151,45 @@ export default {
},
mounted() {
if (this.$route.query.stationCode) {
getSectionListByCenStationCode(this.$route.query.mapId, this.$route.query.stationCode).then(resp => {
this.sectionList = resp.data;
// console.log(resp.data);
}).catch(() => {
this.$message.error('获取区段列表失败!');
});
getSectionListByCenStationCode(this.$route.query.mapId, this.$route.query.stationCode)
.then(resp => {
this.sectionList = resp.data;
// console.log(resp.data);
})
.catch(() => {
this.$message.error("获取区段列表失败!");
});
} else {
getSectionListByMapId(this.$route.query.mapId).then(resp => {
this.sectionList = resp.data;
console.log(resp.data);
}).catch(() => {
this.$message.error('获取区段列表失败!');
});
getSectionListByMapId(this.$route.query.mapId)
.then(resp => {
this.sectionList = resp.data;
console.log(resp.data);
})
.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',
lightColor: this.form.buttonLightColor,
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 +202,47 @@ export default {
x: this.form.x,
y: this.form.y
},
_type: 'SquareButton',
_type: "SquareButton",
code: this.form.code,
color: this.form.buttonColor,
status: 'off',
lightColor: this.form.buttonLightColor,
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",
buttonLightColor: "",
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>

View File

@ -2,7 +2,7 @@
<div>
<div class="schema" :style="{top: offset+'px'}">
<select-station v-if="isLocalStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<el-select v-if="isAdmin" v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-select v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-option
v-for="item in speedList"
:key="item.value"
@ -84,18 +84,6 @@ export default {
swch: '02',
isScriptCommand:false,
faultMode: false,
speedList:[
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' },
{ value: 6, label: '6倍速' },
{ value: 7, label: '7倍速' },
{ value: 8, label: '8倍速' },
{ value: 9, label: '9倍速' },
{ value: 10, label: '10倍速' }
],
speed: 1
// firstLoad: true
};
@ -133,6 +121,26 @@ export default {
},
isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
speedList() {
return this.isAdmin ? [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' },
{ value: 6, label: '6倍速' },
{ value: 7, label: '7倍速' },
{ value: 8, label: '8倍速' },
{ value: 9, label: '9倍速' },
{ value: 10, label: '10倍速' }
] : [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' }
];
}
},
watch: {