iscs 绘图代码调整

This commit is contained in:
joylink_cuiweidong 2020-02-06 17:54:37 +08:00
parent cb2fa49f96
commit 6ce533be52
12 changed files with 190 additions and 11 deletions

View File

@ -181,9 +181,8 @@ deviceRender[deviceType.IscsLine] = {
deviceRender[deviceType.IscsRect] = {
_type: deviceType.IscsRect,
zlevel:1,
z: 4
z: 3
};
deviceRender[deviceType.Escalator] = {
_type: deviceType.Escalator,
zlevel:1,

View File

@ -28,7 +28,8 @@ const deviceType = {
IscsText: 'IscsText',
IscsLine: 'IscsLine',
IscsRect: 'IscsRect',
Escalator:'Escalator'
Escalator:'Escalator',
StairControl:'StairControl'
};
export default deviceType;

File diff suppressed because one or more lines are too long

View File

@ -43,6 +43,10 @@ const map = {
Escalator:{
width:335,
path:'M338,202H3V171H3.135v0l47,0V142H21v-6H50.135V108l-47,.161V108H3V4H338V202ZM332,10H9.826v92H232.135V89l-210,0v0H22V27h0.135V26.838L308,27V177H9.826v19H332V10ZM89.135,136V108H56.826v28h32.31Zm-32.31,6v29h32.31V142H56.826Zm57.309-6V108H95.826v28h18.309Zm-18.309,6v29h18.309V142H95.826Zm41.309-6V108H120.826v28h16.309Zm-16.309,6v29h16.309V142H120.826Zm41.309-6V108H143.826v28h18.309Zm-18.309,6v29h18.309V142H143.826Zm42.309-6V108H168.826v28h17.309Zm-17.309,6v29h17.309V142H168.826Zm36.309-6V108H192.826v28h12.309Zm-12.309,6v29h12.309V142H192.826Zm33.309-6V108H211.826v28h14.309Zm-14.309,6v29h14.309V142H211.826Zm0-86V83h14.309V56H211.826Zm14.309-6V33H211.826V50h14.309Zm-33.309,6V83h12.309V56H192.826Zm12.309-6V33H192.826V50h12.309Zm-36.309,6V83h17.309V56H168.826Zm17.309-6V33H168.826V50h17.309Zm-42.309,6V83h18.309V56H143.826Zm18.309-6V33H143.826V50h18.309Zm-41.309,6V83h16.309V56H120.826Zm16.309-6V33H120.826V50h16.309Zm-26.219,6,0.039,10.487L95.826,61.619V83h18.309V56h-3.219Zm3.219-6V33H95.826V43.627l14.953-4.539L110.916,50h3.219Zm-25-4.342V33H56.826V83h32.31V59.466L67.055,52.361ZM50.135,83V33H28.826V83H50.135Zm182.691,25v28H265.25V56H232.826V83h6v25h-6ZM271.25,49.868V50h0.008l0,92H271.25v0l-38.424,0v29H302V33H232.826V50Z'
},
StairControl:{
width:103,
path:'M48,86V85h53V81H45V80h56V55H31V54h70V52H29V51h72V49H27V48h74V46H24V45h6V27H25V44H24V27H19v6H18V6H13V23H12V6H7v6H6V6H3V5h98V2H0V0H103V86H48ZM24,6H19V26h5V6Zm6,0H25V26h5V6Zm6,0H31V26h5V6Zm0,21H31V45h5V27ZM42,6H37V26h5V6Zm0,21H37V45h5V27ZM48,6H43V26h5V6Zm0,21H43V45h5V27ZM54,6H49V26h5V6Zm0,21H49V45h5V27ZM60,6H55V26h5V6Zm0,21H55V45h5V27ZM66,6H61V26h5V6Zm0,21H61V45h5V27ZM72,6H67V26h5V6Zm0,21H67V45h5V27ZM78,6H73V26h5V6Zm0,21H73V45h5V27ZM84,6H79V26h2V23l3,1.333V6Zm0,23-3,1V27H79V45h5V29ZM90,6H85V24.778L90,27l-5,1.667V45h5V6Zm6,0H91V45h5V6Zm5,0H97V45h4V6Z'
}
};

View File

@ -29,6 +29,7 @@ import IscsText from './text';
import IscsLine from './line';
import IscsRect from './rect';
import Escalator from './escalator';
import StairControl from './stairControl';
const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -62,6 +63,7 @@ iscsShape[deviceType.IscsText] = IscsText;
iscsShape[deviceType.IscsLine] = IscsLine;
iscsShape[deviceType.IscsRect] = IscsRect;
iscsShape[deviceType.Escalator] = Escalator;
iscsShape[deviceType.StairControl] = StairControl;
function shapefactory(device, iscs) {
const type = device.model._type;

View File

@ -8,7 +8,7 @@ export default class GasFireControl extends Group {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.z = device.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();

View File

@ -11,7 +11,7 @@ export default class PlatformScreenDoor extends Group {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.z = device.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();

View File

@ -7,7 +7,7 @@ export default class SmokeDetector extends Group {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.z = device.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();

View File

@ -0,0 +1,31 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from './components/pathsvg';
export default class StairControl 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();
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.path = createPathSvg(this.model);
this.add(this.grouper);
if (this.model.isRight) {
this.grouper.origin = [this.model.width / 2, this.model.width * 0.83 / 2 ];
this.grouper.scale = [-1, 1];
}
this.grouper.add(this.path);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -133,7 +133,9 @@ export function parser(data) {
zrUtil.each(data.escalatorList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.Escalator, elem);
});
zrUtil.each(data.stairControlList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.StairControl, elem);
});
}
@ -247,6 +249,9 @@ export function updateIscsData(state, device) {
case deviceType.Escalator:
updateIscsListByDevice(state, 'escalatorList', device);
break;
case deviceType.StairControl:
updateIscsListByDevice(state, 'stairControlList', device);
break;
}
// store.dispatch('iscs/setIscsData', state.iscs);
}

View File

@ -42,6 +42,14 @@
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="楼梯" name="StairControl">
<stair-control
ref="stairControl"
style="width: 90%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="闸机" name="BrakeMachine">
<brake-machine
ref="brakeMachine"
@ -99,6 +107,7 @@
import {deviceFactory} from '@/iscs/utils/parser';
import BrakeMachine from './brakeMachine';
import Escalator from './escalator';
import StairControl from './stairControl';
import ManualAlarmButton from './manualAlarmButton';
import FireHydranAlarmButton from './fireHydranAlarmButton';
import GasFireControl from './gasFireControl';
@ -118,6 +127,7 @@ export default {
TemperatureDetector,
BrakeMachine,
Escalator,
StairControl,
IscsText,
IscsRect,
IscsLine

View File

@ -0,0 +1,127 @@
<template>
<div>
<el-form ref="form" :rule="rules" :model="addModel" label-width="100px">
<el-form-item v-if="isUpdate" label="按钮编号" prop="code">
<el-input v-model="addModel.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="addModel.width" />
</el-form-item>
<el-form-item label="楼梯朝右" prop="isRight">
<el-checkbox v-model="addModel.isRight" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="addModel.x" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-input-number v-model="addModel.y" />
</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 { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'StairControl',
data() {
return {
addModel:{
code: '',
width: 25,
x: 10,
y: 10,
isRight:false
},
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 === 'StairControl' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.addModel.code = model.code;
this.addModel.width = model.width;
this.addModel.x = model.point.x;
this.addModel.y = model.point.y;
this.addModel.isRight = model.isRight;
}
}
},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const stairControlModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
fill:'#fff',
isRight: this.addModel.isRight,
code: this.isUpdate ? this.form.code : getUID('StairControl', this.iscs.stairControlList),
_type: 'StairControl',
width: this.addModel.width
};
this.$emit('createDataModel', stairControlModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const stairControlModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
code: this.addModel.code,
isRight: this.addModel.isRight,
_type: 'StairControl',
width: this.addModel.width
};
this.$emit('deleteDataModel', stairControlModel);
this.initPage();
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.addModel = {
code: '',
width: 25,
x: 10,
y: 10,
isRight:false
};
}
}
};
</script>
<style scoped>
</style>