# Conflicts:
#	src/iscs/constant/deviceRender.js
#	src/iscs/constant/iscsData.js
This commit is contained in:
zyy 2020-02-06 16:58:09 +08:00
commit f7a0f54376
17 changed files with 327 additions and 12 deletions

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ export default class BrakeMachine extends Group {
});
this.path = createPathSvg(this.model);
if (this.model.isRight) {
this.grouper.origin = [this.model.width / 2, this.model.width / 2 ];
this.grouper.origin = [this.model.width / 2, this.model.width * 0.61 / 2 ];
this.grouper.rotation = Math.PI;
}
this.add(this.grouper);

View File

@ -39,6 +39,10 @@ const map = {
TunnelFan:{
width:68,
path:'M40,112L5,94V91H73v3ZM6,26H73V89H6V26Zm4,59H69V30H10V85Zm29.5-1A26.5,26.5,0,1,1,66,57.5,26.5,26.5,0,0,1,39.5,84ZM52,77l7-7-2-2-7,7ZM36,66l-5-4-2,2,5,4ZM27,77l2-2-8-7-2,2Zm0-38-9,8,3,2,8-7Zm7,10-5,5,3,2,5-5Zm9,6H37v6h6V55Zm2,13,5-5-2-2-5,5ZM44,49l5,5,2-3-5-5Zm9-12-3,2,8,8,2-2ZM5,22L40,4,73,22v3H5V22Z'
},
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'
}
};

View File

@ -0,0 +1,27 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from './components/pathsvg';
export default class Escalator 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);
this.grouper.add(this.path);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -28,6 +28,7 @@ import VolumeControlDamper from './bas/volumeControlDamper';
import IscsText from './text';
import IscsLine from './line';
import IscsRect from './rect';
import Escalator from './escalator';
const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -60,6 +61,7 @@ iscsShape[deviceType.VolumeControlDamper] = VolumeControlDamper;
iscsShape[deviceType.IscsText] = IscsText;
iscsShape[deviceType.IscsLine] = IscsLine;
iscsShape[deviceType.IscsRect] = IscsRect;
iscsShape[deviceType.Escalator] = Escalator;
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

@ -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

@ -130,6 +130,11 @@ export function parser(data) {
zrUtil.each(data.iscsRectList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.IscsRect, elem);
});
zrUtil.each(data.escalatorList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.Escalator, elem);
});
}
return iscsDevice;
@ -239,7 +244,9 @@ export function updateIscsData(state, device) {
case deviceType.IscsLine:
updateIscsListByDevice(state, 'iscsLineList', device);
break;
case deviceType.Escalator:
updateIscsListByDevice(state, 'escalatorList', device);
break;
}
// store.dispatch('iscs/setIscsData', state.iscs);
}

View File

@ -73,7 +73,7 @@ export default {
x: this.addModel.x,
y: this.addModel.y
},
code: this.isUpdate ? this.form.code : getUID('EntranceGuard', this.iscs.entranceGuardList),
code: this.isUpdate ? this.addModel.code : getUID('EntranceGuard', this.iscs.entranceGuardList),
_type: 'EntranceGuard',
width: this.addModel.width
};

View File

@ -79,7 +79,7 @@ export default {
y: this.addModel.y
},
isRight: this.addModel.isRight,
code: this.isUpdate ? this.form.code : getUID('BrakeMachine', this.iscs.brakeMachineList),
code: this.isUpdate ? this.addModel.code : getUID('BrakeMachine', this.iscs.brakeMachineList),
_type: 'BrakeMachine',
width: this.addModel.width
};

View File

@ -73,7 +73,7 @@ export default {
x: this.addModel.x,
y: this.addModel.y
},
code: this.isUpdate ? this.form.code : getUID('SemiAutomaticTicketMachine', this.iscs.semiAutomaticTicketMachineList),
code: this.isUpdate ? this.addModel.code : getUID('SemiAutomaticTicketMachine', this.iscs.semiAutomaticTicketMachineList),
_type: 'SemiAutomaticTicketMachine',
width: this.addModel.width
};

View File

@ -73,7 +73,7 @@ export default {
x: this.addModel.x,
y: this.addModel.y
},
code: this.isUpdate ? this.form.code : getUID('TicketMachine', this.iscs.ticketMachineList),
code: this.isUpdate ? this.addModel.code : getUID('TicketMachine', this.iscs.ticketMachineList),
_type: 'TicketMachine',
width: this.addModel.width
};

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: 'BrakeMachine',
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 === 'BrakeMachine' ) {
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 maButtonModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
fill:'#fff',
isRight: this.addModel.isRight,
code: this.isUpdate ? this.form.code : getUID('BrakeMachine', this.iscs.brakeMachineList),
_type: 'BrakeMachine',
width: this.addModel.width
};
this.$emit('createDataModel', maButtonModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const maButtonModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
code: this.addModel.code,
isRight: this.addModel.isRight,
_type: 'BrakeMachine',
width: this.addModel.width
};
this.$emit('deleteDataModel', maButtonModel);
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

@ -0,0 +1,119 @@
<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="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: 'Escalator',
data() {
return {
addModel:{
code: '',
width: 25,
x: 10,
y: 10
},
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 === 'Escalator' ) {
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;
}
}
},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const escalatorModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
code: this.isUpdate ? this.addModel.code : getUID('Escalator', this.iscs.escalatorList),
_type: 'Escalator',
width: this.addModel.width,
fill:'#fff'
};
this.$emit('createDataModel', escalatorModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const escalatorModel = {
point: {
x: this.addModel.x,
y: this.addModel.y
},
code: this.addModel.code,
_type: 'Escalator',
width: this.addModel.width
};
this.$emit('deleteDataModel', escalatorModel);
this.initPage();
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.addModel = {
code: '',
width: 25,
x: 10,
y: 10
};
}
}
};
</script>
<style scoped>
</style>

View File

@ -34,6 +34,22 @@
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="扶梯" name="Escalator">
<escalator
ref="escalator"
style="width: 90%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="闸机" name="BrakeMachine">
<brake-machine
ref="brakeMachine"
style="width: 90%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="烟感探测器" name="SmokeDetector">
<smoke-detector
ref="smokeDetector"
@ -81,6 +97,8 @@
</template>
<script>
import {deviceFactory} from '@/iscs/utils/parser';
import BrakeMachine from './brakeMachine';
import Escalator from './escalator';
import ManualAlarmButton from './manualAlarmButton';
import FireHydranAlarmButton from './fireHydranAlarmButton';
import GasFireControl from './gasFireControl';
@ -98,6 +116,8 @@ export default {
GasFireControl,
SmokeDetector,
TemperatureDetector,
BrakeMachine,
Escalator,
IscsText,
IscsRect,
IscsLine