ics 扶梯绘图代码调整

This commit is contained in:
joylink_cuiweidong 2020-02-07 09:52:47 +08:00
parent 197f3936a4
commit 52d62a8e4f
9 changed files with 193 additions and 6 deletions

View File

@ -183,13 +183,13 @@ deviceRender[deviceType.IscsRect] = {
zlevel:1, zlevel:1,
z: 3 z: 3
}; };
/** 梯 */ /** 梯 */
deviceRender[deviceType.Escalator] = { deviceRender[deviceType.Escalator] = {
_type: deviceType.Escalator, _type: deviceType.Escalator,
zlevel:1, zlevel:1,
z: 4 z: 4
}; };
/** 楼梯 */ /** 通道 */
deviceRender[deviceType.StairControl] = { deviceRender[deviceType.StairControl] = {
_type: deviceType.StairControl, _type: deviceType.StairControl,
zlevel:1, zlevel:1,
@ -202,4 +202,11 @@ deviceRender[deviceType.FasBrakeMachine] = {
z: 4 z: 4
}; };
/** 扶梯 */
deviceRender[deviceType.Staircase] = {
_type: deviceType.Staircase,
zlevel:1,
z: 4
};
export default deviceRender; export default deviceRender;

View File

@ -30,7 +30,8 @@ const deviceType = {
IscsRect: 'IscsRect', IscsRect: 'IscsRect',
Escalator:'Escalator', Escalator:'Escalator',
StairControl:'StairControl', StairControl:'StairControl',
FasBrakeMachine:'FasBrakeMachine' FasBrakeMachine:'FasBrakeMachine',
Staircase:'Staircase'
}; };
export default deviceType; export default deviceType;

View File

@ -51,6 +51,10 @@ const map = {
FasBrakeMachine:{ FasBrakeMachine:{
width:65, width:65,
path:'M0,29V21H1.474L9,14.732v-0.7L1.474,7.869H0V0H65V7.869H31.669L22,14.339v0.083L31.669,21H65v8H0ZM62,5.9V1.967H3V5.9H62ZM28.113,7.869H4.53l6,4.918H20.764ZM20.764,16H10.533l-6,5H28.113ZM62,23H3v4H62V23Z' path:'M0,29V21H1.474L9,14.732v-0.7L1.474,7.869H0V0H65V7.869H31.669L22,14.339v0.083L31.669,21H65v8H0ZM62,5.9V1.967H3V5.9H62ZM28.113,7.869H4.53l6,4.918H20.764ZM20.764,16H10.533l-6,5H28.113ZM62,23H3v4H62V23Z'
},
Staircase:{
width:133,
path:'M12,131l25-11v8H97v6H37v8ZM3,186V155H132V108H3V77H17V47H10V41h7V24H3V4H136V186H3ZM132,8H7V20H132V8ZM28,41V24H21V41h7Zm-7,6V77h7V47H21Zm19-6V24H32V41h8Zm-8,6V77h8V47H32Zm19-6V24H44V41h7Zm-7,6V77h7V47H44Zm19-6V24H55V41h8Zm-8,6V77h8V47H55Zm15-6V33l4,1.76V24H67V41h3Zm-3,6V77h7V53.24L70,55V47H67Zm19-6.96V24H78V36.52ZM78,51.48V77h8V47.96ZM90,46.2V77h7V24H90V41.8L95,44ZM101,24V77h7V24h-7Zm11,0V77h8V24h-8Zm20,0h-8V77h8V24Zm0,57H7v6H132V81Zm0,10H7v4H132V91Zm0,8H7v5H132V99Zm0,60H7v6H132v-6Zm0,10H7v4H132v-4Zm0,8H7v5H132v-5Z'
} }
}; };

View File

@ -31,6 +31,7 @@ import IscsRect from './rect';
import Escalator from './escalator'; import Escalator from './escalator';
import StairControl from './stairControl'; import StairControl from './stairControl';
import FasBrakeMachine from './fasBrakeMachine'; import FasBrakeMachine from './fasBrakeMachine';
import Staircase from './staircase';
const iscsShape = {}; const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton; iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -66,6 +67,7 @@ iscsShape[deviceType.IscsRect] = IscsRect;
iscsShape[deviceType.Escalator] = Escalator; iscsShape[deviceType.Escalator] = Escalator;
iscsShape[deviceType.StairControl] = StairControl; iscsShape[deviceType.StairControl] = StairControl;
iscsShape[deviceType.FasBrakeMachine] = FasBrakeMachine; iscsShape[deviceType.FasBrakeMachine] = FasBrakeMachine;
iscsShape[deviceType.Staircase] = Staircase;
function shapefactory(device, iscs) { function shapefactory(device, iscs) {
const type = device.model._type; const type = device.model._type;

View File

@ -0,0 +1,31 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from './components/pathsvg';
export default class Staircase 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 * 1.368 / 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

@ -139,6 +139,9 @@ export function parser(data) {
zrUtil.each(data.fasBrakeMachineList || [], elem=> { zrUtil.each(data.fasBrakeMachineList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.FasBrakeMachine, elem); iscsDevice[elem.code] = deviceFactory(deviceType.FasBrakeMachine, elem);
}); });
zrUtil.each(data.staircaseList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.Staircase, elem);
});
} }
@ -258,6 +261,9 @@ export function updateIscsData(state, device) {
case deviceType.FasBrakeMachine: case deviceType.FasBrakeMachine:
updateIscsListByDevice(state, 'fasBrakeMachineList', device); updateIscsListByDevice(state, 'fasBrakeMachineList', device);
break; break;
case deviceType.Staircase:
updateIscsListByDevice(state, 'staircaseList', device);
break;
} }
// store.dispatch('iscs/setIscsData', state.iscs); // store.dispatch('iscs/setIscsData', state.iscs);
} }

View File

@ -34,7 +34,7 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="梯" name="Escalator"> <el-tab-pane label="梯" name="Escalator">
<escalator <escalator
ref="escalator" ref="escalator"
style="width: 90%;" style="width: 90%;"
@ -42,7 +42,7 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="楼梯" name="StairControl"> <el-tab-pane label="通道" name="StairControl">
<stair-control <stair-control
ref="stairControl" ref="stairControl"
style="width: 90%;" style="width: 90%;"
@ -50,6 +50,14 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="扶梯" name="Staircase">
<staircase
ref="staircase"
style="width: 90%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="闸机" name="FasBrakeMachine"> <el-tab-pane label="闸机" name="FasBrakeMachine">
<fas-brake-machine <fas-brake-machine
ref="fasBrakeMachine" ref="fasBrakeMachine"
@ -108,6 +116,7 @@ import {deviceFactory} from '@/iscs/utils/parser';
import FasBrakeMachine from './brakeMachine'; import FasBrakeMachine from './brakeMachine';
import Escalator from './escalator'; import Escalator from './escalator';
import StairControl from './stairControl'; import StairControl from './stairControl';
import Staircase from './staircase';
import ManualAlarmButton from './manualAlarmButton'; import ManualAlarmButton from './manualAlarmButton';
import FireHydranAlarmButton from './fireHydranAlarmButton'; import FireHydranAlarmButton from './fireHydranAlarmButton';
import GasFireControl from './gasFireControl'; import GasFireControl from './gasFireControl';
@ -128,6 +137,7 @@ export default {
FasBrakeMachine, FasBrakeMachine,
Escalator, Escalator,
StairControl, StairControl,
Staircase,
IscsText, IscsText,
IscsRect, IscsRect,
IscsLine 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: 'Staircase',
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 === 'Staircase' ) {
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 staircaseModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
fill:'#fff',
isRight: this.addModel.isRight,
code: this.isUpdate ? this.addModel.code : getUID('Staircase', this.iscs.staircaseList),
_type: 'Staircase',
width: this.addModel.width
};
this.$emit('createDataModel', staircaseModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const staircaseModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
code: this.addModel.code,
isRight: this.addModel.isRight,
_type: 'Staircase',
width: this.addModel.width
};
this.$emit('deleteDataModel', staircaseModel);
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>

View File

@ -103,7 +103,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.$emit('iscsChange', this.$route.params.id);
}, },
beforeDestroy() { beforeDestroy() {