This commit is contained in:
zyy 2020-05-07 16:14:55 +08:00
commit d5740a991f
8 changed files with 264 additions and 98 deletions

View File

@ -9,6 +9,7 @@ export default class Button extends Group {
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this._function = device.model.function;
this.z = device.model.z;
this.create();
}
@ -18,36 +19,37 @@ export default class Button extends Group {
id: model.code,
position: [model.point.x, model.point.y]
});
this.buttonText = new Text({
zlevel: model.zlevel,
z: model.z + 1,
style: {
x: 0,
y: 0,
fontWeight: 'normal',
fontSize: model.fontSize,
fontFamily: 'consolas',
text: model.context,
textFill: '#FFF',
textAlign: 'center',
textPosition: 'inside',
textVerticalAlign: 'bottom'
}
});
const textRect = this.buttonText.getBoundingRect();
this.buttonText.setStyle('textLineHeight', textRect.height);
this.buttonRect = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: 0,
y: 0,
width: model.width,
height: model.height
x: textRect.x - model.levelPadding,
y: textRect.y - model.verticalPadding,
width: textRect.width + 2 * model.levelPadding,
height: textRect.height + 2 * model.verticalPadding
},
style: {
fill: model.fillColor,
stroke: model.strokeColor,
lineWidth: model.borderWidth
}
});
this.buttonText = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.width / 2,
y: model.height / 2,
fontWeight: 'normal',
fontSize: model.height - 2,
fontFamily: 'consolas',
text: model.context,
textFill: model.textFill,
textAlign: 'center',
textPosition: 'inside',
textVerticalAlign: 'middle',
textLineHeight: model.height
fill: '#879096',
stroke: '#132E48',
lineWidth: 1
}
});
this.grouper.add(this.buttonRect);

View File

@ -34,6 +34,7 @@ import FasBrakeMachine from './fasBrakeMachine';
import Staircase from './staircase';
import SingleStaircase from './singleStaircase';
import ArcStatus from './ArcStatus';
import IscsButton from './button';
const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -72,6 +73,7 @@ iscsShape[deviceType.FasBrakeMachine] = FasBrakeMachine;
iscsShape[deviceType.Staircase] = Staircase;
iscsShape[deviceType.SingleStaircase] = SingleStaircase;
iscsShape[deviceType.ArcStatus] = ArcStatus;
iscsShape[deviceType.IscsButton] = IscsButton;
function shapefactory(device, iscs) {
const type = device.model._type;

View File

@ -1,25 +1,28 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item v-if="isUpdate" label="按钮编号" prop="code">
<el-input v-model="from.code" :disabled="true" />
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item v-if="isUpdate" label="按钮编号:" prop="code">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="宽度" prop="width">
<el-input-number v-model="form.width" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="高度" prop="height">
<el-input-number v-model="form.height" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-form-item label="X轴坐标:" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-form-item label="Y轴坐标:" prop="y">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="按钮文字" prop="context">
<el-form-item label="按钮文字:" prop="context">
<el-input v-model="form.context" />
</el-form-item>
<el-form-item label="按钮功能" prop="function">
<el-form-item label="文字大小:" prop="fontSize">
<el-input-number v-model="form.fontSize" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="左右内距:" prop="levelPadding">
<el-input-number v-model="form.levelPadding" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="上下内距:" prop="verticalPadding">
<el-input-number v-model="form.verticalPadding" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="按钮功能:" prop="function">
<el-select v-model="form.function">
<el-option
v-for="item in functionList"
@ -42,7 +45,7 @@
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'Text',
name: 'IscsButton',
components: {
},
data() {
@ -57,20 +60,20 @@ export default {
],
form: {
code: '',
fillColor: '',
borderWidth: '',
strokeColor: '',
width: 1,
height: 1,
levelPadding: 10,
verticalPadding: 2,
fontSize: 10,
x: 10,
y: 10
y: 10,
context: '',
function: ''
},
rules: {
strokeColor: [
{ required: true, message: '请选择边框颜色', trigger: 'change' }
context: [
{ required: true, message: '请填写按钮文字', trigger: 'blur' }
],
fillColor: [
{ required: true, message: '请选择矩形填充颜色', trigger: 'change'}
function: [
{ required: true, message: '请选择按钮功能', trigger: 'change'}
]
}
};
@ -88,13 +91,12 @@ export default {
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.fillColor = model.fillColor;
this.form.borderWidth = model.borderWidth;
this.form.strokeColor = model.strokeColor;
this.form.width = model.width;
this.form.height = model.height;
this.form.levelPadding = model.levelPadding;
this.form.verticalPadding = model.verticalPadding;
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.context = model.context;
this.form.function = model.function;
}
}
},
@ -110,11 +112,11 @@ export default {
},
code: this.isUpdate ? this.form.code : getUID('IscsButton', this.iscs.iscsButtonList),
_type: 'IscsButton',
fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth,
strokeColor: this.form.strokeColor,
width: this.form.width,
height: this.form.height
levelPadding: this.form.levelPadding,
verticalPadding: this.form.verticalPadding,
context: this.form.context,
function: this.form.function,
fontSize: this.form.fontSize
};
this.$emit('createDataModel', rectModel);
this.initPage();
@ -131,11 +133,11 @@ export default {
},
code: this.form.code,
_type: 'IscsButton',
fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth,
strokeColor: this.form.strokeColor,
width: this.form.width,
height: this.form.height
levelPadding: this.form.levelPadding,
verticalPadding: this.form.verticalPadding,
context: this.form.context,
function: this.form.function,
fontSize: this.form.fontSize
};
this.$emit('deleteDataModel', rectModel);
},
@ -145,13 +147,13 @@ export default {
this.showDeleteButton = false;
this.form = {
code: '',
fillColor: '',
borderWidth: '',
strokeColor: '',
width: 1,
height: 1,
levelPadding: 10,
verticalPadding: 2,
fontSize: 10,
x: 10,
y: 10
y: 10,
context: '',
function: ''
};
}
}

View File

@ -32,7 +32,7 @@
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'Line',
name: 'IscsLine',
data() {
return {
isUpdate: false,

View File

@ -35,7 +35,7 @@
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'Text',
name: 'IscsRect',
components: {
},
data() {

View File

@ -32,7 +32,7 @@
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'Text',
name: 'IscsText',
components: {
},
data() {

View File

@ -82,6 +82,14 @@
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="按钮" name="IscsButton">
<iscs-button
ref="iscsButton"
style="width: 90%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="文字" name="IscsText">
<iscs-text
ref="iscsText"
@ -125,6 +133,7 @@ import TemperatureDetector from './temperatureDetector';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import IscsButton from '../iscsCommonElem/button';
export default {
name: 'IscsOperate',
@ -140,7 +149,8 @@ export default {
Staircase,
IscsText,
IscsRect,
IscsLine
IscsLine,
IscsButton
},
mixins: [
],
@ -151,11 +161,6 @@ export default {
stationCode: ''
};
},
computed: {
height() {
return this.$store.state.config.height;
}
},
watch: {
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];

View File

@ -13,11 +13,46 @@
<th class="imitateTD2">湿度 <span>%</span></th>
</tr>
<tr v-for="(imitate,index) in sensorDataA.imitateList" :key="index">
<td class="imitateTD1">{{ imitate.temperature }}</td>
<td class="imitateTD2">{{ imitate.temperature }}</td>
<td class="imitateTD2">{{ imitate.humidity }}</td>
<td class="imitateTD1"><span class="imitateName">{{ imitate.name }}</span><span class="imitateCode">{{ imitate.code }}</span></td>
<td class="imitateTD2"><span class="imitateNum">{{ imitate.temperature }}</span></td>
<td class="imitateTD2"><span class="imitateNum">{{ imitate.humidity }}</span></td>
</tr>
</table>
<div class="co2SensorList">
<div class="co2SensorListT">二氧化碳传感器</div>
<div v-for="(co2Sensor,index) in sensorDataA.co2SensorList" :key="index" class="eachCo2">
<div class="eachCo2L">{{ co2Sensor.name }}</div>
<div class="eachCo2M">{{ co2Sensor.number }}</div>
<div class="eachCo2R">{{ co2Sensor.type }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="sensorDataB">
<div class="sensorDataBTitle">B端</div>
<div class="sensorDataBList">
<div class="sensorDataBImitate">
<table class="imitate">
<tr>
<th class="imitateTD1">模拟量</th>
<th class="imitateTD2">温度 <span></span></th>
<th class="imitateTD2">湿度 <span>%</span></th>
</tr>
<tr v-for="(imitate,index) in sensorDataB.imitateList" :key="index">
<td class="imitateTD1"><span class="imitateName">{{ imitate.name }}</span><span class="imitateCode">{{ imitate.code }}</span></td>
<td class="imitateTD2"><span class="imitateNum">{{ imitate.temperature }}</span></td>
<td class="imitateTD2"><span class="imitateNum">{{ imitate.humidity }}</span></td>
</tr>
</table>
<div class="co2SensorList">
<div class="co2SensorListT">二氧化碳传感器</div>
<div v-for="(co2Sensor,index) in sensorDataA.co2SensorList" :key="index" class="eachCo2">
<div class="eachCo2L">{{ co2Sensor.name }}</div>
<div class="eachCo2M">{{ co2Sensor.number }}</div>
<div class="eachCo2R">{{ co2Sensor.type }}</div>
</div>
</div>
</div>
</div>
</div>
@ -31,15 +66,48 @@ export default {
return {
sensorDataA:{
imitateList:[
{name:'站厅新风道', temperature:'17.6', humidity:'25.0', code:'H_212_1'},
{name:'站厅回风道', temperature:'18.7', humidity:'30.5', code:'H_212_2'},
{name:'站厅排热凝风室送风管', temperature:'18.9', humidity:'24.1', code:'H_212_3'},
{name:'站厅公共区', temperature:'18.6', humidity:'23.7', code:'H_212_7'},
{name:'站台公共区', temperature:'17.2', humidity:'25.4', code:'H_212_9'},
{name:'站厅环控机房送风室', temperature:'19.0', humidity:'29.7', code:'H_212_B101'},
{name:'站厅环控机房回风室', temperature:'17.4', humidity:'27.7', code:'H_212_B102'},
{name:'站厅环控电控室', temperature:'18.7', humidity:'26.6', code:'H_212_B103'},
{name:'站厅警用通信设备室', temperature:'17.6', humidity:'24.6', code:'H_212_B104'},
{name:'站厅专用通信设备室', temperature:'17.7', humidity:'28.2', code:'H_212_B105'},
{name:'站厅信号设备室', temperature:'17.5', humidity:'28.1', code:'H_212_B106'},
{name:'站厅控制室', temperature:'17.7', humidity:'37.5', code:'H_212_B107'},
{name:'站厅环控机房送风道', temperature:'17.5', humidity:'35.0', code:'H_212_B201'},
{name:'站厅环控机房回风室', temperature:'19.0', humidity:'42.0', code:'H_212_B202'},
{name:'集水区出水总管', humidity:'', temperature:'0.0', code:'T_212_1'},
{name:'分水器供水总管', humidity:'', temperature:'0.0', code:'T_212_2'},
{name:'站厅专业通信电源室', humidity:'', temperature:'20.7', code:'T_212_B101'},
{name:'站厅信号电源室', humidity:'', temperature:'17.0', code:'T_212_B102'},
{name:'站台35KV开关柜室', humidity:'', temperature:'16.6', code:'T_212_B201'},
{name:'站台0.4KV开关柜室', humidity:'', temperature:'17.7', code:'T_212_B202'},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
co2SensorList:[
{name:'C_212_1\n站厅公共区', number:'488.0', type:'ppp'},
{name:'C_212_3\n站台公共区', number:'475.2', type:'ppp'},
{}
]
},
sensorDataB:{
imitateList:[
{name:'站厅新风道', temperature:'15.9', humidity:'40.2', code:'H_212_4'},
{name:'站厅回风道', temperature:'17.9', humidity:'37.9', code:'H_212_5'},
{name:'站厅环控机房送风管', temperature:'18.2', humidity:'33.7', code:'H_212_6'},
{name:'站厅公共区', temperature:'18.0', humidity:'28.2', code:'H_212_9'},
{name:'站台公共区', temperature:'18.2', humidity:'29.2', code:'H_212_10'},
{name:'站厅小系统机房送风道', temperature:'17.2', humidity:'32.0', code:'H_212_B501'},
{name:'站厅小系统机房回风道', temperature:'17.6', humidity:'37.5', code:'H_212_B502'},
{name:'站厅环控电控室', temperature:'16.0', humidity:'37.2', code:'H_212_B503'},
{name:'站厅商用通信设备室', temperature:'17.4', humidity:'33.2', code:'H_212_B504'},
{},
{},
{},
@ -56,9 +124,11 @@ export default {
{},
{}
],
co2SensorList:[]
},
sensorDataB:{
co2SensorList:[
{name:'C_212_2\n站厅公共区', number:'488.0', type:'ppp'},
{name:'C_212_4\n站台公共区', number:'475.2', type:'ppp'},
{}
]
}
};
}
@ -73,17 +143,25 @@ export default {
color: #56E5DE;
}
.sensorList{
width: 1300px;
height: 627px;
width: 1302px;
border: 1px #8b939c solid;
margin: 8px auto;
margin: 8px auto 30px auto;
display: inline-block;
margin-left: 50%;
transform: translateX(-50%);
}
.sensorDataA{
width: 650px;
border-right: 1px #8b939c solid;
height: 100%;
float: left;
}
.sensorDataATitle{
.sensorDataB{
display: inline-block;
height: 100%;
width: 650px;
}
.sensorDataATitle,.sensorDataBTitle{
padding:5px 0px;
text-align:center;
color: #56E5DE;
@ -93,30 +171,107 @@ export default {
.imitate{
width:400px;
border-spacing: 0;
display: inline-block;
}
.imitate th{
padding: 3px 0px;
border-right: 1px #8b939c solid;
font-size:14px;
color:#fff;
height:27px;
}
.imitate th span {
color: #56E5DE;
}
.imitateTD1{
width:200px
width:220px
}
.imitateTD2{
width:100px
width:90px
}
.imitate tr:not(:last-child){
border-bottom: 1px #8b939c solid;
}
.imitate tr{
border-bottom: 1px #8b939c solid;
display: inline-block;
height:27px;
}
.imitate tr td{
height: 23px;
height: 27px;
border-right: 1px #8b939c solid;
line-height: 23px;
font-size: 14px;
}
.imitateNum{
width: 60px;
background: #fff;
color: #6a54ff;
text-align: center;
display: inline-block;
font-size: 14px;
margin-left: 15px;
line-height: 15px;
}
.imitateName{
font-size: 13px;
color: #fff;
margin-left: 5px;
width: 135px;
display: inline-block;
}
.imitateCode{
display: inline-block;
font-size: 12px;
color: #fff;
}
.co2SensorList{
display: inline-block;
vertical-align: top;
width: 249px;
}
.eachCo2{
height: 54px;
border-bottom: 1px #8b939c solid;
width: 100%;
}
.eachCo2L{
font-size: 12px;
color: #fff;
width: 64px;
text-align: center;
line-height: 20px;
margin-top: 5px;
display: inline-block;
margin-left: 20px;
}
.eachCo2M{
width: 60px;
background: #fff;
color: #6a54ff;
text-align: center;
display: inline-block;
font-size: 14px;
margin-left: 15px;
line-height: 15px;
vertical-align: top;
margin-top: 18px;
}
.eachCo2R{
display: inline-block;
font-size: 13px;
vertical-align: top;
color: #54dfdb;
margin-left: 30px;
margin-top: 17px;
}
.co2SensorListT{
padding: 3px 0px;
text-align: center;
font-size: 14px;
color: #fff;
height:27px;
border-bottom: 1px #8b939c solid;
}
.sensorDataAImitate,.sensorDataBImitate{font-size:0}
</style>