ibp盘按钮增加亮灯颜色字段

This commit is contained in:
yuan 2021-07-12 10:37:14 +08:00
parent efe78c3611
commit 01ed5397ad
5 changed files with 47 additions and 10 deletions

View File

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

View File

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

View File

@ -86,7 +86,12 @@ export default class button extends Group {
} }
getImagePic() { 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; return color;
} }

View File

@ -139,8 +139,8 @@ export const IbpOperation = {
XXYS: {operate: '09', event: 'XXYS', name: '下行钥匙'}, XXYS: {operate: '09', event: 'XXYS', name: '下行钥匙'},
SXYS: {operate: '11', event: 'SXYS', name: '上行钥匙'}, SXYS: {operate: '11', event: 'SXYS', name: '上行钥匙'},
AXLE_RESET: {operate: '12', event: 'AXLE_RESET', name: '计轴复位'}, AXLE_RESET: {operate: '12', event: 'AXLE_RESET', name: '计轴复位'},
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: '下行屏蔽门开门'}, XXGM: {operate: '16', event: 'XXGM', name: '下行屏蔽门开门'},
SXGM: {operate: '17', event: 'SXGM', name: '上行屏蔽门开门'}, SXGM: {operate: '17', event: 'SXGM', name: '上行屏蔽门开门'},

View File

@ -10,11 +10,23 @@
</el-form-item> </el-form-item>
<el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor"> <el-form-item :label="this.$t('ibp.buttonColor')" prop="buttonColor">
<el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')"> <el-select v-model="form.buttonColor" :placeholder="this.$t('ibp.selectTheButtonColor')">
<el-option :label="this.$t('ibp.redButton')" value="red" /> <el-option
<el-option :label="this.$t('ibp.yellowButton')" value="yellow" /> v-for="item in colors"
<el-option :label="this.$t('ibp.greenButton')" value="green" /> :key="`btn${item}`"
<el-option :label="this.$t('ibp.blueButton')" value="blue" /> :label="`${$t(`ibp.${item}`)}${$t('ibp.button')}`"
<el-option :label="this.$t('ibp.grayButton')" value="gray" /> :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-select>
</el-form-item> </el-form-item>
<el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth"> <el-form-item :label="this.$t('ibp.buttonWidth')" prop="buttonWidth">
@ -86,14 +98,16 @@ export default {
{ label: "屏蔽门开门", value: "KM" }, { label: "屏蔽门开门", value: "KM" },
{ label: "屏蔽门关门", value: "GM" }, { label: "屏蔽门关门", value: "GM" },
{ label: "计轴复位", value: "AXLE_RESET" }, { label: "计轴复位", value: "AXLE_RESET" },
{ label: "计轴复位", value: "AXLE_PRE_RESET" }, { label: "计轴区段复位", value: "AXLE_PRE_RESET" },
{ label: "计轴预复", value: "PRERESET_Z" }, { label: "计轴预复", value: "PRERESET_Z" },
{ label: "试灯", value: "SD" } { label: "试灯", value: "SD" }
], ],
colors: ["red", "yellow", "blue", "green", "gray"],
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",
buttonLightColor: "",
buttonWidth: 25, buttonWidth: 25,
x: 10, x: 10,
y: 10, y: 10,
@ -125,6 +139,7 @@ export default {
this.isUpdate = true; this.isUpdate = true;
this.form.code = model.code; this.form.code = model.code;
this.form.buttonColor = model.color; this.form.buttonColor = model.color;
this.form.buttonLightColor = model.lightColor;
this.form.buttonWidth = model.width; this.form.buttonWidth = model.width;
this.form.x = model.point.x; this.form.x = model.point.x;
this.form.y = model.point.y; this.form.y = model.point.y;
@ -167,6 +182,7 @@ export default {
_type: "SquareButton", _type: "SquareButton",
code: this.form.code, code: this.form.code,
color: this.form.buttonColor, color: this.form.buttonColor,
lightColor: this.form.buttonLightColor,
status: "off", status: "off",
width: this.form.buttonWidth, width: this.form.buttonWidth,
mean: this.form.mean, mean: this.form.mean,
@ -189,6 +205,7 @@ export default {
_type: "SquareButton", _type: "SquareButton",
code: this.form.code, code: this.form.code,
color: this.form.buttonColor, color: this.form.buttonColor,
lightColor: this.form.buttonLightColor,
status: "off", status: "off",
width: this.form.buttonWidth, width: this.form.buttonWidth,
mean: this.form.mean, mean: this.form.mean,
@ -205,6 +222,7 @@ export default {
this.form = { this.form = {
code: "", code: "",
buttonColor: "red", buttonColor: "red",
buttonLightColor: "",
buttonWidth: 25, buttonWidth: 25,
x: 10, x: 10,
y: 10, y: 10,