desc: 增加状态

This commit is contained in:
zyy 2020-02-07 18:19:56 +08:00
parent f944e90380
commit 13fcc80c41
9 changed files with 203 additions and 4 deletions

View File

@ -215,4 +215,10 @@ deviceRender[deviceType.SingleStaircase] = {
z: 4
};
deviceRender[deviceType.ArcStatus] = {
_type: deviceType.ArcStatus,
zlevel: 1,
z: 4
}
export default deviceRender;

View File

@ -32,7 +32,8 @@ const deviceType = {
StairControl:'StairControl',
FasBrakeMachine:'FasBrakeMachine',
Staircase:'Staircase',
SingleStaircase: 'SingleStaircase'
SingleStaircase: 'SingleStaircase',
ArcStatus: 'ArcStatus'
};
export default deviceType;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,39 @@
import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle';
export default class ArcStatus extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.iscsCircle = new Circle({
zlevel: model.zlevel,
z: model.z,
shape: {
cx: this.model.point.x,
cy: this.model.point.y,
r: this.model.r
},
style: {
fill: this.model.fillColor
}
});
this.grouper.add(this.iscsCircle);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -32,7 +32,8 @@ import Escalator from './escalator';
import StairControl from './stairControl';
import FasBrakeMachine from './fasBrakeMachine';
import Staircase from './staircase';
import SingleStaircase from './singleStaircase'
import SingleStaircase from './singleStaircase';
import ArcStatus from './ArcStatus';
const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -70,6 +71,7 @@ iscsShape[deviceType.StairControl] = StairControl;
iscsShape[deviceType.FasBrakeMachine] = FasBrakeMachine;
iscsShape[deviceType.Staircase] = Staircase;
iscsShape[deviceType.SingleStaircase] = SingleStaircase;
iscsShape[deviceType.ArcStatus] = ArcStatus;
function shapefactory(device, iscs) {
const type = device.model._type;

View File

@ -145,6 +145,9 @@ export function parser(data) {
zrUtil.each(data.singleStaircaseList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.SingleStaircase, elem);
});
zrUtil.each(data.arcStatusList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.ArcStatusList, elem);
});
}
return iscsDevice;

View File

@ -115,6 +115,13 @@ const iscs = {
} else {
return [];
}
},
arcStatusList:(state)=>{
if (state.iscs.arcStatusList) {
return state.iscs.arcStatusList;
} else {
return [];
}
}
},

View File

@ -0,0 +1,131 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="半径" prop="r">
<el-input-number v-model="form.r" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="填充色" prop="fillColor">
<el-color-picker v-model="form.fillColor" show-alpha></el-color-picker>
</el-form-item>
<el-form-item label="X轴坐标">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</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">删除</el-button>
<el-button v-show="showDeleteButton" @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: 'Text',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
fillColor: '',
r: 7,
x: 10,
y: 10
},
rules: {
r: [
{ 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 === 'ArcStatus' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.fillColor = model.fillColor;
this.form.r = model.r;
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('ArcStatus', this.iscs.arcStatusList),
_type: 'ArcStatus',
fillColor: this.form.fillColor,
r: this.form.r,
};
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: 'ArcStatus',
fillColor: this.form.fillColor,
r: this.form.r,
};
this.$emit('deleteDataModel', rectModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
fillColor: '',
r: 7,
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

@ -33,6 +33,14 @@
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="状态标识" name="ArcStatus">
<arc-status
ref="ArcStatus"
style="width: 90%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="文字" name="IscsText">
<iscs-text
@ -71,6 +79,7 @@ import BorderRadius from './borderRadius';
import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect';
import ArcStatus from './ArcStatus';
export default {
name: 'IscsOperate',
@ -78,6 +87,7 @@ export default {
PlatformScreenDoor,
EndDoor,
BorderRadius,
ArcStatus,
IscsRect,
IscsLine,
IscsText