This commit is contained in:
zyy 2020-01-17 17:48:15 +08:00
commit 0bee3cc61d
14 changed files with 159 additions and 80 deletions

View File

@ -99,37 +99,37 @@ deviceRender[deviceType.BorderRadius] = {
z: 4 z: 4
}; };
/** 圆角边框渲染配置 */ /** 空调机 */
deviceRender[deviceType.AirConditioner] = { deviceRender[deviceType.AirConditioner] = {
_type: deviceType.AirConditioner, _type: deviceType.AirConditioner,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 圆角边框渲染配置 */ /** 轨道排风机 */
deviceRender[deviceType.OrbitalVentilator] = { deviceRender[deviceType.OrbitalVentilator] = {
_type: deviceType.OrbitalVentilator, _type: deviceType.OrbitalVentilator,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 圆角边框渲染配置 */ /** 射流风机 */
deviceRender[deviceType.JetFan] = { deviceRender[deviceType.JetFan] = {
_type: deviceType.JetFan, _type: deviceType.JetFan,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 圆角边框渲染配置 */ /** 隧道风机 */
deviceRender[deviceType.TunnelFan] = { deviceRender[deviceType.TunnelFan] = {
_type: deviceType.TunnelFan, _type: deviceType.TunnelFan,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 圆角边框渲染配置 */ /** 防火阀 */
deviceRender[deviceType.FireDamper] = { deviceRender[deviceType.FireDamper] = {
_type: deviceType.FireDamper, _type: deviceType.FireDamper,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 圆角边框渲染配置 */ /** 防烟防火阀 */
deviceRender[deviceType.SmookProofFd] = { deviceRender[deviceType.SmookProofFd] = {
_type: deviceType.SmookProofFd, _type: deviceType.SmookProofFd,
zlevel: 1, zlevel: 1,

View File

@ -1,5 +1,5 @@
export function getUID(type, list) { export function getUID(type, list) {
if (list.length) { if (list && list.length > 0) {
const lastCode = list[list.length - 1].code; const lastCode = list[list.length - 1].code;
const num = lastCode.split(type + '_')[1]; const num = lastCode.split(type + '_')[1];
return type + `_${num + 1}`; return type + `_${num + 1}`;

View File

@ -3,6 +3,7 @@ import * as matrix from 'zrender/src/core/matrix';
import deviceType from '../constant/deviceType'; import deviceType from '../constant/deviceType';
import deviceRender from '../constant/deviceRender'; import deviceRender from '../constant/deviceRender';
import store from '@/store'; import store from '@/store';
import { deepClone } from '@/utils/index';
export function createTransform(opts) { export function createTransform(opts) {
let transform = matrix.create(); let transform = matrix.create();
@ -87,22 +88,22 @@ export function parser(data) {
iscsDevice[elem.code] = deviceFactory(deviceType.BorderRadius, elem); iscsDevice[elem.code] = deviceFactory(deviceType.BorderRadius, elem);
} ); } );
zrUtil.each(data.AirConditioner || [], elem =>{ zrUtil.each(data.airConditionerList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.AirConditioner, elem); iscsDevice[elem.code] = deviceFactory(deviceType.AirConditioner, elem);
} ); } );
zrUtil.each(data.OrbitalVentilator || [], elem =>{ zrUtil.each(data.orbitalVentilatorList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.OrbitalVentilator, elem); iscsDevice[elem.code] = deviceFactory(deviceType.OrbitalVentilator, elem);
} ); } );
zrUtil.each(data.JetFan || [], elem =>{ zrUtil.each(data.jetFanList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.JetFan, elem); iscsDevice[elem.code] = deviceFactory(deviceType.JetFan, elem);
} ); } );
zrUtil.each(data.TunnelFan || [], elem =>{ zrUtil.each(data.tunnelFanList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.TunnelFan, elem); iscsDevice[elem.code] = deviceFactory(deviceType.TunnelFan, elem);
} ); } );
zrUtil.each(data.FireDamper || [], elem =>{ zrUtil.each(data.fireDamperList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.FireDamper, elem); iscsDevice[elem.code] = deviceFactory(deviceType.FireDamper, elem);
} ); } );
zrUtil.each(data.SmookProofFd || [], elem =>{ zrUtil.each(data.smookProofFdList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.SmookProofFd, elem); iscsDevice[elem.code] = deviceFactory(deviceType.SmookProofFd, elem);
} ); } );
@ -116,9 +117,9 @@ function updateIscsListByDevice(iscs, name, device) {
if (list) { if (list) {
const index = list.findIndex(elem => { return elem.code == device.code; }); const index = list.findIndex(elem => { return elem.code == device.code; });
if (index >= 0) { if (index >= 0) {
device._dispose ? list.splice(index, 1) : list[index] = device; device._dispose ? list.splice(index, 1) : list[index] = deepClone(device);
} else { } else {
list.push(device); list.push(deepClone(device));
} }
} else { } else {
iscs[name] = [device]; iscs[name] = [device];
@ -127,7 +128,7 @@ function updateIscsListByDevice(iscs, name, device) {
} }
export function updateIscsData(device) { export function updateIscsData(device) {
const iscsData = store.getters['iscs/iscs']; const iscsData = store.state.iscs;
switch (device._type) { switch (device._type) {
case deviceType.vidiconList : case deviceType.vidiconList :
updateIscsListByDevice(iscsData, 'vidiconList', device); updateIscsListByDevice(iscsData, 'vidiconList', device);

View File

@ -1,5 +1,5 @@
import Vue from 'vue'; import Vue from 'vue';
import {updateIscsData } from '@/iscs/utils/parser';
/** /**
* iscs状态数据 * iscs状态数据
*/ */
@ -45,12 +45,89 @@ const iscs = {
} else { } else {
return []; return [];
} }
},
frozenPumpList:(state)=>{
if (state.iscs && state.iscs.frozenPumpList) {
return state.iscs.frozenPumpList;
} else {
return [];
}
},
airConditionerList:(state)=>{
if (state.iscs && state.iscs.airConditionerList) {
return state.iscs.airConditionerList;
} else {
return [];
}
},
tunnelFanList:(state)=>{
if (state.iscs && state.iscs.tunnelFanList) {
return state.iscs.tunnelFanList;
} else {
return [];
}
},
orbitalVentilatorList:(state)=>{
if (state.iscs && state.iscs.orbitalVentilatorList) {
return state.iscs.orbitalVentilatorList;
} else {
return [];
}
},
smookProofFdList:(state)=>{
if (state.iscs && state.iscs.smookProofFdList) {
return state.iscs.smookProofFdList;
} else {
return [];
}
},
chillerList:(state)=>{
if (state.iscs && state.iscs.chillerList) {
return state.iscs.chillerList;
} else {
return [];
}
},
coolTowerList:(state)=>{
if (state.iscs && state.iscs.coolTowerList) {
return state.iscs.coolTowerList;
} else {
return [];
}
},
fireDamperList:(state)=>{
if (state.iscs && state.iscs.fireDamperList) {
return state.iscs.fireDamperList;
} else {
return [];
}
},
jetFanList:(state)=>{
if (state.iscs && state.iscs.jetFanList) {
return state.iscs.jetFanList;
} else {
return [];
}
},
ventilatorList:(state)=>{
if (state.iscs && state.iscs.ventilatorList) {
return state.iscs.ventilatorList;
} else {
return [];
}
} }
}, },
mutations: { mutations: {
iscsRender: (state, devices) => { iscsRender: (state, devices) => {
Vue.prototype.$iscs && Vue.prototype.$iscs.render(devices); if (devices && devices.length) {
if (state.iscs) {
devices.forEach(elem => { updateIscsData(elem); });
}
if (Vue.prototype.$iscs) {
Vue.prototype.$iscs.render(devices);
}
}
}, },
setIscsData: (state, iscs) => { setIscsData: (state, iscs) => {
state.iscs = iscs; state.iscs = iscs;
@ -73,8 +150,10 @@ const iscs = {
if (!(models instanceof Array)) { if (!(models instanceof Array)) {
models = [models]; models = [models];
} }
commit('iscsRender', models); commit('iscsRender', models);
resolve(models); resolve(models);
}); });
}, },
setUpdateDeviceData: ({ commit }, models) => { setUpdateDeviceData: ({ commit }, models) => {

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'AirConditioner', name:'AirConditioner',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'airConditionerList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'AirConditioner', _type: 'AirConditioner',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('AirConditioner', this.airConditionerList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', airConditionerModel ); this.$emit('deleteDataModel', airConditionerModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'airConditioner_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'Chiller', name:'Chiller',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'chillerList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'Chiller', _type: 'Chiller',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('Chiller', this.chillerList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', chillerModel ); this.$emit('deleteDataModel', chillerModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'chiller_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'CoolTower', name:'CoolTower',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'coolTowerList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'CoolTower', _type: 'CoolTower',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('CoolTower', this.coolTowerList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', chillerModel ); this.$emit('deleteDataModel', chillerModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'coolTower_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'FireDamper', name:'FireDamper',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'fireDamperList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'FireDamper', _type: 'FireDamper',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('FireDamper', this.fireDamperList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', fireDamperModel ); this.$emit('deleteDataModel', fireDamperModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'fireDamper_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -28,6 +28,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'FrozenPump', name:'FrozenPump',
data() { data() {
@ -62,7 +64,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'frozenPumpList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -92,7 +96,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'FrozenPump', _type: 'FrozenPump',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('FrozenPump', this.frozenPumpList),
width: this.form.width, width: this.form.width,
color:'#00ff00', color:'#00ff00',
pumpType:this.form.type pumpType:this.form.type
@ -132,10 +136,6 @@ export default {
}; };
this.$emit('deleteDataModel', frozenPumpModel ); this.$emit('deleteDataModel', frozenPumpModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'frozenPump_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'JetFan', name:'JetFan',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'jetFanList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'JetFan', _type: 'JetFan',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('JetFan', this.jetFanList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', jetFanModel ); this.$emit('deleteDataModel', jetFanModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'jetFan_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'OrbitalVentilator', name:'OrbitalVentilator',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'orbitalVentilatorList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'OrbitalVentilator', _type: 'OrbitalVentilator',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('OrbitalVentilator', this.orbitalVentilatorList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', orbitalVentilatorModel ); this.$emit('deleteDataModel', orbitalVentilatorModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'orbitalVentilator_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'SmookProofFd', name:'SmookProofFd',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters('iscs', [
'smookProofFdList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'SmookProofFd', _type: 'SmookProofFd',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('SmookProofFd', this.smookProofFdList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', smookProofFdModel ); this.$emit('deleteDataModel', smookProofFdModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'smookProofFd_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'TunnelFan', name:'TunnelFan',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'tunnelFanList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'TunnelFan', _type: 'TunnelFan',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('TunnelFan', this.tunnelFanList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -91,7 +95,6 @@ export default {
return false; return false;
} }
}); });
}, },
initPage() { initPage() {
this.isUpdate = false; this.isUpdate = false;
@ -118,10 +121,6 @@ export default {
}; };
this.$emit('deleteDataModel', tunnelFanModel ); this.$emit('deleteDataModel', tunnelFanModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'tunnelFan_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };

View File

@ -22,6 +22,8 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default { export default {
name:'Ventilator', name:'Ventilator',
data() { data() {
@ -52,7 +54,9 @@ export default {
}; };
}, },
computed:{ computed:{
...mapGetters('iscs', [
'ventilatorList'
])
}, },
watch:{ watch:{
'$store.state.ibp.rightClickCount': function (val) { '$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'Ventilator', _type: 'Ventilator',
code: this.isUpdate ? this.form.code : this.generateCode(), code: this.isUpdate ? this.form.code : getUID('Ventilator', this.ventilatorList),
width: this.form.width, width: this.form.width,
color:'#00ff00' color:'#00ff00'
}; };
@ -118,10 +122,6 @@ export default {
}; };
this.$emit('deleteDataModel', chillerModel ); this.$emit('deleteDataModel', chillerModel );
this.initPage(); this.initPage();
},
generateCode() {
const mydate = new Date();
return 'ventilator_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
} }
} }
}; };