This commit is contained in:
joylink_cuiweidong 2020-09-21 16:00:41 +08:00
commit 0945448549
17 changed files with 1056 additions and 29 deletions

View File

@ -1,5 +1,5 @@
export default class defaultStyle {
constructor() {
super();
}
// constructor() {
// // super();
// }
}

View File

@ -0,0 +1,17 @@
const mapDeviceStyle = {
'01': 'chengdu_01',
'02': 'fuzhou_01',
'03': 'bejing_01',
'04': 'chengdu_03',
'06': 'ningbo_01',
'07': 'haerbin_01',
'08': 'foshan_01',
'09': 'xian_02',
'10': 'xian_01', // 西安一号线
'11': 'xian_01', // 西安三号线
'12': 'ningbo_03' // 宁波三号线
};
export function selectLineCode(code) {
return Object.assign({}, require(`./skinCode/${mapDeviceStyle[code || '02']}`).default);
}

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.lineCode = '02';
}
}
export default new SkinCode();

View File

@ -4,9 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this[deviceType.EntranceGuard] = {
};
this.lineCode = '07';
}
}
export default new SkinCode();

View File

@ -8,6 +8,7 @@ import KeyboardController from './keyboardController';
import {calculateDCenter, createBoundingRect, deviceFactory} from './utils/parser';
import { updateIscsData } from './utils/parser';
import store from '@/store/index_APP_TARGET';
import { selectLineCode } from './constant/defaultStyle';
const renderer = 'canvas';
const devicePixelRatio = 1;
@ -55,7 +56,6 @@ class Iscs {
this.$options.offsetX = config.origin.x;
this.$options.offsetY = config.origin.y;
}
// 保存原始数据
this.data = config;
@ -110,7 +110,9 @@ class Iscs {
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); }
}
loadStyle(lineCode) {
return selectLineCode(lineCode);
}
setCenter(deviceCode) {
const device = this.iscsDevice[deviceCode];
if (device && device.instance) {

50
src/iscs/shape/machine.js Normal file
View File

@ -0,0 +1,50 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import Machine_Blue from '@/assets/iscs_icon/afc_machine_blue.png';
import Machine_Green from '@/assets/iscs_icon/afc_machine_green.png';
import Machine_Red from '@/assets/iscs_icon/afc_machine_red.png';
export default class Machine extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();
this.setState(this.model);
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.machineImage = new Image({
zlevel: this.zlevel,
z: this.z,
style: {
image: Machine_Green,
x: 0,
y: 0,
width: this.model.width,
height: this.model.width / 43 * 54
}
});
this.grouper.add(this.machineImage);
this.add(this.grouper);
}
setState(state) {
if (state.status === 'normal') {
this.machineImage.setStyle({image: Machine_Green});
} else if (state.status === 'alarm') {
this.machineImage.setStyle({image: Machine_Red});
} else if (state.status === 'unKnown') {
this.machineImage.setStyle({image: Machine_Blue});
}
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -0,0 +1,176 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="100px" style="width: 100%;padding: 10px 50px;">
<el-form-item v-if="isUpdate" label="按钮编号:" prop="code">
<el-input v-model="form.code" size="small" :disabled="true" />
</el-form-item>
<el-form-item label="X轴坐标:" prop="x">
<el-input-number v-model="form.x" size="small" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标:" prop="y">
<el-input-number v-model="form.y" size="small" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="按钮文字:" prop="context">
<el-input v-model="form.context" size="small" />
</el-form-item>
<el-form-item label="文字大小:" prop="fontSize">
<el-input-number v-model="form.fontSize" size="small" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="左右内距:" prop="levelPadding">
<el-input-number v-model="form.levelPadding" size="small" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="上下内距:" prop="verticalPadding">
<el-input-number v-model="form.verticalPadding" size="small" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="按钮功能:" prop="function">
<el-select v-model="form.function" size="small">
<el-option
v-for="item in functionList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'IscsButton',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
functionList: [
{label: '图元说明', value: 'GraphicEle'},
{label: '公共区域', value: 'PublicArea'},
{label: '操作按钮', value: 'OperatingButton'},
{label: '返回', value: 'GoBack'},
{label: '至EPS系统及导向照明', value: 'GoEPS'},
{label: '射流风机图', value: 'GoJetFan'},
{label: '至B端小系统', value: 'GoBMiniSystem'},
{label: '至A端小系统(一)', value: 'GoAMiniSystem1'},
{label: '至A端小系统(二)', value: 'GoAMiniSystem2'}
],
form: {
code: '',
levelPadding: 10,
verticalPadding: 5,
fontSize: 10,
x: 10,
y: 10,
context: '',
function: ''
},
rules: {
context: [
{ required: true, message: '请填写按钮文字', trigger: 'blur' }
],
function: [
{ required: true, message: '请选择按钮功能', trigger: 'change'}
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'IscsButton' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
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;
this.form.fontSize = model.fontSize;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('IscsButton', this.iscs.iscsButtonList),
_type: 'IscsButton',
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();
} else {
return false;
}
});
},
deleteDevice() {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'IscsButton',
levelPadding: this.form.levelPadding,
verticalPadding: this.form.verticalPadding,
context: this.form.context,
function: this.form.function,
fontSize: this.form.fontSize
};
this.$emit('deleteDataModel', rectModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
levelPadding: 10,
verticalPadding: 2,
fontSize: 10,
x: 10,
y: 10,
context: '',
function: ''
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,175 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="100px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="线段宽度:" prop="lineWidth">
<el-input-number v-model="form.lineWidth" controls-position="right" :min="1" :max="50" size="small" />
</el-form-item>
<el-form-item label="类型:" prop="type">
<el-select v-model="form.classify" placeholder="请选择类型" size="small">
<el-option label="实线:" value="solid" />
<el-option label="虚线:" value="dashed" />
</el-select>
</el-form-item>
<el-form-item label="线段颜色:" prop="fillColor">
<el-color-picker v-model="form.fillColor" size="small" />
</el-form-item>
<el-form-item label="箭头显示:" prop="arrowShow">
<el-select v-model="form.arrowShow" placeholder="请选择" size="small">
<el-option label="无" value="none" />
<el-option label="始端" value="star" />
<el-option label="终端" value="end" />
</el-select>
</el-form-item>
<el-form-item v-if="form.arrowShow != 'none'" label="箭头大小:" prop="arrowSize">
<el-input-number v-model="form.arrowSize" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="起始X轴坐标:">
<el-input-number v-model="form.x1" controls-position="right" :min="0" size="small" />
</el-form-item>
<el-form-item label="起始Y轴坐标:">
<el-input-number v-model="form.y1" controls-position="right" :min="0" size="small" />
</el-form-item>
<el-form-item label="终止X轴坐标:">
<el-input-number v-model="form.x2" controls-position="right" :min="0" size="small" />
</el-form-item>
<el-form-item label="终止Y轴坐标:">
<el-input-number v-model="form.y2" controls-position="right" :min="0" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'IscsLine',
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
classify:'solid',
code: '',
lineWidth: '',
fillColor: '#fff',
arrowShow: 'none',
arrowSize: 5,
x1: 10,
y1: 10,
x2: 20,
y2: 10
},
rules: {
lineWidth: [
{ required: true, message: '请输入线段宽度', trigger: 'blur' }
],
fillColor: [
{ required: true, message: '请输入线段颜色', trigger: 'blur' }
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'IscsLine' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.lineWidth = model.lineWidth;
this.form.fillColor = model.fillColor;
this.form.x1 = model.point1.x;
this.form.y1 = model.point1.y;
this.form.x2 = model.point2.x;
this.form.y2 = model.point2.y;
this.form.classify = model.classify;
this.form.arrowShow = model.arrowShow || 'none';
this.form.arrowSize = model.arrowSize || 5;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const lineModel = {
point1: {
x: this.form.x1,
y: this.form.y1
},
point2: {
x: this.form.x2,
y: this.form.y2
},
code: this.isUpdate ? this.form.code : getUID('IscsLine', this.iscs.iscsLineList),
_type: 'IscsLine',
lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor,
classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
};
this.$emit('createDataModel', lineModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const lineModel = {
point1: {
x: this.form.x1,
y: this.form.y1
},
point2: {
x: this.form.x2,
y: this.form.y2
},
code: this.form.code,
_type: 'IscsLine',
lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor,
classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
};
this.$emit('deleteDataModel', lineModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
lineWidth: '',
fillColor: '#fff',
arrowShow: 'none',
arrowSize: 5,
x1: 10,
y1: 10,
x2: 20,
y2: 10,
classify:'solid'
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -0,0 +1,165 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="宽度:" prop="width">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="高度:" prop="height">
<el-input-number v-model="form.height" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="填充色:" prop="fillColor">
<el-color-picker v-model="form.fillColor" show-alpha size="small" />
</el-form-item>
<el-form-item label="边框宽度:" prop="borderWidth">
<el-input-number v-model="form.borderWidth" controls-position="right" :min="0" size="small" />
</el-form-item>
<el-form-item label="类型:" prop="type">
<el-select v-model="form.type" placeholder="请选择类型" size="small">
<el-option label="实线:" value="solid" />
<el-option label="虚线:" value="dashed" />
</el-select>
</el-form-item>
<el-form-item label="边框色:" prop="strokeColor">
<el-color-picker v-model="form.strokeColor" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'IscsRect',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
fillColor: '',
borderWidth: '',
strokeColor: '',
type: 'solid',
width: 1,
height: 1,
x: 10,
y: 10
},
rules: {
strokeColor: [
{ required: true, message: '请选择边框颜色', trigger: 'change' }
],
fillColor: [
{ required: true, message: '请选择矩形填充颜色', trigger: 'change'}
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'IscsRect' ) {
this.buttonText = '修改';
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.type = model.type || 'solid';
this.form.height = model.height;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('IscsRect', this.iscs.iscsRectList),
_type: 'IscsRect',
fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth,
strokeColor: this.form.strokeColor,
width: this.form.width,
height: this.form.height,
type: this.form.type
};
this.$emit('createDataModel', rectModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'IscsRect',
fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth,
strokeColor: this.form.strokeColor,
width: this.form.width,
height: this.form.height
};
this.$emit('deleteDataModel', rectModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
fillColor: '',
borderWidth: '',
strokeColor: '',
type: 'solid',
width: 1,
height: 1,
x: 10,
y: 10
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,285 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rule="rules" :model="addModel" label-width="120px" size="small" style="width: 100%;padding: 10px 50px;">
<el-form-item v-if="isUpdate" label="表格编号:" prop="code">
<el-input v-model="addModel.code" :disabled="true" />
</el-form-item>
<el-form-item label="x坐标:" prop="x">
<el-input-number v-model="addModel.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="y坐标:" prop="y">
<el-input-number v-model="addModel.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="列数:" prop="columnNum">
<el-input-number v-model="addModel.columnNum" controls-position="right" :min="1" size="small" @change="changeColumnNum" />
</el-form-item>
<el-form-item label="列宽:" prop="width">
<template v-for="(item, index) in addModel.columnWidthList">
<el-input-number :key="index" v-model="addModel.columnWidthList[index]" style="display: block; margin-bottom: 5px" controls-position="right" :min="1" size="small" />
</template>
</el-form-item>
<el-form-item label="行数:" prop="rowNum">
<el-input-number v-model="addModel.rowNum" controls-position="right" :min="1" size="small" @change="changeRowNum" />
</el-form-item>
<el-form-item label="行高:" prop="rowHeight">
<el-input-number v-model="addModel.rowHeight" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="表头类型:" prop="headerType">
<el-select v-model="addModel.headerType" size="small">
<el-option
v-for="item in headerTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="表头内容:" prop="headerContextList">
<div v-if="addModel.headerType === 'normal'">
<template v-for="(item, index) in addModel.columnWidthList">
<el-input :key="index" v-model="addModel.headerContextList[index]" size="small" />
</template>
</div>
<div v-else-if="addModel.headerType === 'merge'">
<el-input v-model="addModel.headerContextList[0]" size="small" />
</div>
</el-form-item>
<el-form-item label="表头字体大小:" prop="headerFontSize">
<el-input-number v-model="addModel.headerFontSize" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="表格字体大小:" prop="fontSize">
<el-input-number v-model="addModel.fontSize" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="表格内容:" prop="tableData">
<el-table :data="addModel.tableData" border style="width: 100%;">
<template v-for="(item, i) in addModel.columnWidthList">
<el-table-column :key="i" :label="'列'+(i + 1)" :prop="'column'+ (i + 1)">
<template slot-scope="scope">
<el-input v-if="i === 0" v-model="addModel.tableData[scope.$index]['column'+ (i + 1)]" size="small" />
<el-select v-else v-model="addModel.tableData[scope.$index]['column'+ (i + 1)]" filterable size="small">
<el-option
v-for="it in stateList"
:key="it.value"
:label="it.label"
:value="it.value"
/>
</el-select>
</template>
</el-table-column>
</template>
</el-table>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">{{ $t('global.cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'FasBrakeMachine',
data() {
return {
addModel:{
code: '',
rowHeight: 25,
x: 10,
y: 10,
columnNum: 2,
rowNum: 2,
columnWidthList: [50, 50],
headerType: 'normal',
tableData: [{}],
headerContextList: [],
headerFontSize: 14,
fontSize: 12
},
headerTypeList: [
{label: '单列表头', value: 'merge'},
{label: '多列表头', value: 'normal'},
{label: '无表头', value: 'none'}
],
stateList: [
{label: '火灾系统故障', value: 'fasSystemFailure'},
{label: 'FACP自动状态', value: 'facpAutoMode'},
{label: '气灭控制系统状态', value: 'gesControlStatus'},
{label: '消火栓泵启动状态', value: 'hydrantStartupStatus'},
{label: '感温电缆火警状态', value: 'tscFireCondition'},
{label: '站厅A端设备区点型火灾探测器', value: 'aEquipmentAreaFireDetector'},
{label: '站厅B端设备区点型火灾探测器', value: 'bEquipmentAreaFireDetector'},
{label: '站台公共区点型火灾探测器', value: 'pcaFireDetector'},
{label: '站厅公共区点型火灾探测器', value: 'scaFireDetector'},
{label: '站内垂直电梯切非站台B消', value: 'elevatorCutFirePowerSupply'},
{label: '其他切非回路站台B消', value: 'otherCutFirePowerSupply'},
{label: '站内下行左线手动报警按钮', value: 'inDownLeftManualAlarm'},
{label: '站内上行右线手动报警按钮', value: 'inUpRightManualAlarm'},
{label: '站间下行左线手动报警按钮', value: 'outDownLeftManualAlarm'},
{label: '站间上行右线手动报警按钮', value: 'outUpRightManualAlarm'},
{label: '站内下行左线消火栓按钮', value: 'inDownLeftHydrant'},
{label: '站内上行右线消火栓按钮', value: 'inUpRightHydrant'},
{label: '站间下行左线消火栓按钮', value: 'outDownLeftHydrant'},
{label: '站间上行右线消火栓按钮', value: 'outUpRightHydrant'},
{label: '视屏服务器状态', value: 'videoServerStatus'},
{label: '数据服务器状态', value: 'dataServerStatus'},
{label: '媒体交换服务区状态', value: 'mediaServerStatus'},
{label: '解码器状态', value: 'decoderState'},
{label: '四路解码器状态', value: 'quadDecoderState'},
{label: '四路解码器模式状态', value: 'quadDecoderModeState'},
{label: '控制键盘状态', value: 'controlKeyboardState'},
{label: '进线电源', value: 'coilInPower'},
{label: '旁路开关状态', value: 'bypassSwitchStatus'},
{label: '电源欠压报警', value: 'powerUnderVoltageAlarm'},
{label: '风扇运行状态', value: 'fanRunningState'},
{label: '总报警信号', value: 'generalAlarmSignal'},
{label: '电池容量', value: 'batteryCapacity'},
{label: '充电时间', value: 'chargingTime'},
{label: '放电时间', value: 'dischargeTime'},
{label: '交流输出电压', value: 'acOutputVoltage'},
{label: '直流电压信号', value: 'dcVoltageSignal'}
],
rules: {
width:[{ required: true, message:'请输入设备图形宽度', trigger: 'blur' }],
x: [{ required: true, message: '请输入设备图形的X轴坐标', trigger: 'blur' }],
y: [{ required: true, message: '请输入设备图形的Y轴坐标', trigger: 'blur' }]
},
isUpdate:false,
showDeleteButton: false,
buttonText: '立即创建'
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'StateTable' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.addModel.code = model.code;
this.addModel.rowHeight = model.rowHeight;
this.addModel.x = model.point.x;
this.addModel.y = model.point.y;
this.addModel.columnNum = model.columnNum;
this.addModel.rowNum = model.rowNum;
this.addModel.columnWidthList = model.columnWidthList;
this.addModel.headerType = model.headerType;
this.addModel.tableData = model.tableData;
this.addModel.headerFontSize = model.headerFontSize;
this.addModel.fontSize = model.fontSize;
this.addModel.headerContextList = model.headerContextList;
}
}
},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
columnNum: this.addModel.columnNum,
rowNum: this.addModel.rowNum,
rowHeight: this.addModel.rowHeight,
columnWidthList: this.addModel.columnWidthList,
headerType: this.addModel.headerType,
tableData: this.addModel.tableData,
_type: 'StateTable',
headerFontSize: this.addModel.headerFontSize,
fontSize: this.addModel.fontSize,
headerContextList: this.addModel.headerContextList,
code: this.isUpdate ? this.addModel.code : getUID('StateTable', this.iscs.stateTableList)
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const model = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
code: this.addModel.code,
columnNum: this.addModel.columnNum,
rowNum: this.addModel.rowNum,
rowHeight: this.addModel.rowHeight,
columnWidthList: this.addModel.columnWidthList,
headerType: this.addModel.headerType,
tableData: this.addModel.tableData,
headerFontSize: this.addModel.headerFontSize,
fontSize: this.addModel.fontSize,
headerContextList: this.addModel.headerContextList,
_type: 'StateTable'
};
this.$emit('deleteDataModel', model);
this.initPage();
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.addModel = {
code: '',
rowHeight: 25,
x: 10,
y: 10,
columnNum: 2,
rowNum: 2,
columnWidthList: [50, 50],
headerType: 'normal',
tableData: [{}, {}],
headerFontSize: 14,
fontSize: 12,
headerContextList: []
};
},
changeColumnNum(num) {
const length = this.addModel.columnWidthList.length;
if (length > num) {
this.addModel.columnWidthList.splice(num - 1, length - num);
this.addModel.headerContextList.splice(num - 1, length - num);
this.addModel.tableData.forEach(item => {
for (let i = 0; i < length - num; i++) {
delete item['column' + (num - i + 1)];
}
});
} else if (length < num) {
for (let i = 0; i < num - length; i++) {
this.addModel.columnWidthList.push(50);
this.addModel.headerContextList.push('');
}
}
},
changeRowNum(num) {
const length = this.addModel.tableData.length;
if (length + 1 > num) {
this.addModel.tableData.splice(num - 2, length + 1 - num);
} else if (length + 1 < num) {
for (let i = 0; i < num - length - 1; i++) {
this.addModel.tableData.push({});
}
}
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,158 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="120px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="文字内容:" prop="context">
<el-input v-model="form.context" type="textarea" size="small" />
</el-form-item>
<el-form-item label="文字颜色:" prop="textFill">
<el-color-picker v-model="form.textFill" size="small" />
</el-form-item>
<el-form-item label="文字大小:" prop="fontSize">
<el-input-number v-model="form.fontSize" controls-position="right" :min="1" :max="100" size="small" />
</el-form-item>
<el-form-item label="文字粗细:" prop="fontWeight">
<el-input-number v-model="form.fontWeight" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'IscsText',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
context: '',
textFill: '',
fontSize: 14,
fontWeight: 450,
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message: '请输入文字编号', trigger: 'blur' }
],
context: [
{ required: true, message: '请输入文字内容', trigger: 'blur' }
],
textFill: [
{ required: true, message: '请输入文字颜色', trigger: 'blur' }
],
fontSize: [
{ required: true, message: '请输入文字大小', trigger: 'blur' }
],
fontWeight: [
{ required: true, message: '请输入文字粗细', trigger: 'blur' }
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'IscsText' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.context = model.context;
this.form.fontSize = model.fontSize;
this.form.fontWeight = model.fontWeight;
this.form.textFill = model.textFill;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const textModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('IscsText', this.iscs.iscsTextList),
_type: 'IscsText',
context: this.form.context,
textFill: this.form.textFill,
fontSize: this.form.fontSize,
fontWeight: this.form.fontWeight,
fontFamily: 'consolas'
};
this.$emit('createDataModel', textModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const textModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'IscsText',
context: this.form.context,
textFill: this.form.textFill,
fontSize: this.form.fontSize,
fontWeight: this.form.fontWeight,
fontFamily: 'consolas'
};
this.$emit('deleteDataModel', textModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
context: '',
textFill: '',
fontSize: 14,
fontWeight: 450,
x: 10,
y: 10
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -49,10 +49,10 @@
</template>
<script>
import {deviceFactory} from '@/iscs/utils/parser';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import IscsButton from '../iscsCommonElem/button';
import IscsLine from '../icscComponents/line';
import IscsText from '../icscComponents/text';
import IscsRect from '../icscComponents/rect';
import IscsButton from '../icscComponents/button';
export default {
name: 'IscsOperate',

View File

@ -49,10 +49,10 @@
</template>
<script>
import {deviceFactory} from '@/iscs/utils/parser';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import IscsButton from '../iscsCommonElem/button';
import IscsLine from '../icscComponents/line';
import IscsText from '../icscComponents/text';
import IscsRect from '../icscComponents/rect';
import IscsButton from '../icscComponents/button';
export default {
name: 'IscsOperate',

View File

@ -49,10 +49,10 @@
</template>
<script>
import {deviceFactory} from '@/iscs/utils/parser';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import IscsButton from '../iscsCommonElem/button';
import IscsLine from '../icscComponents/line';
import IscsText from '../icscComponents/text';
import IscsRect from '../icscComponents/rect';
import IscsButton from '../icscComponents/button';
export default {
name: 'IscsOperate',

View File

@ -49,10 +49,10 @@
</template>
<script>
import {deviceFactory} from '@/iscs/utils/parser';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import IscsButton from '../iscsCommonElem/button';
import IscsLine from '../icscComponents/line';
import IscsText from '../icscComponents/text';
import IscsRect from '../icscComponents/rect';
import IscsButton from '../icscComponents/button';
export default {
name: 'IscsOperate',

View File

@ -49,10 +49,10 @@
</template>
<script>
import {deviceFactory} from '@/iscs/utils/parser';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import IscsButton from '../iscsCommonElem/button';
import IscsLine from '../icscComponents/line';
import IscsText from '../icscComponents/text';
import IscsRect from '../icscComponents/rect';
import IscsButton from '../icscComponents/button';
export default {
name: 'IscsOperate',

View File

@ -138,7 +138,7 @@ export default {
this.setIscs(parserData, data);
this.$store.dispatch('iscs/setIscsData', data);
} else {
const data = {};
const data = {};
const parserData = parser(data, {width: this.canvasWidth, height: this.canvasHeight});
this.setIscs(parserData, data);
this.$store.dispatch('iscs/setIscsData', data);