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
};
/** 圆角边框渲染配置 */
/** 空调机 */
deviceRender[deviceType.AirConditioner] = {
_type: deviceType.AirConditioner,
zlevel: 1,
z: 4
};
/** 圆角边框渲染配置 */
/** 轨道排风机 */
deviceRender[deviceType.OrbitalVentilator] = {
_type: deviceType.OrbitalVentilator,
zlevel: 1,
z: 4
};
/** 圆角边框渲染配置 */
/** 射流风机 */
deviceRender[deviceType.JetFan] = {
_type: deviceType.JetFan,
zlevel: 1,
z: 4
};
/** 圆角边框渲染配置 */
/** 隧道风机 */
deviceRender[deviceType.TunnelFan] = {
_type: deviceType.TunnelFan,
zlevel: 1,
z: 4
};
/** 圆角边框渲染配置 */
/** 防火阀 */
deviceRender[deviceType.FireDamper] = {
_type: deviceType.FireDamper,
zlevel: 1,
z: 4
};
/** 圆角边框渲染配置 */
/** 防烟防火阀 */
deviceRender[deviceType.SmookProofFd] = {
_type: deviceType.SmookProofFd,
zlevel: 1,

View File

@ -1,5 +1,5 @@
export function getUID(type, list) {
if (list.length) {
if (list && list.length > 0) {
const lastCode = list[list.length - 1].code;
const num = lastCode.split(type + '_')[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 deviceRender from '../constant/deviceRender';
import store from '@/store';
import { deepClone } from '@/utils/index';
export function createTransform(opts) {
let transform = matrix.create();
@ -87,22 +88,22 @@ export function parser(data) {
iscsDevice[elem.code] = deviceFactory(deviceType.BorderRadius, elem);
} );
zrUtil.each(data.AirConditioner || [], elem =>{
zrUtil.each(data.airConditionerList || [], 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);
} );
zrUtil.each(data.JetFan || [], elem =>{
zrUtil.each(data.jetFanList || [], 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);
} );
zrUtil.each(data.FireDamper || [], elem =>{
zrUtil.each(data.fireDamperList || [], 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);
} );
@ -116,9 +117,9 @@ function updateIscsListByDevice(iscs, name, device) {
if (list) {
const index = list.findIndex(elem => { return elem.code == device.code; });
if (index >= 0) {
device._dispose ? list.splice(index, 1) : list[index] = device;
device._dispose ? list.splice(index, 1) : list[index] = deepClone(device);
} else {
list.push(device);
list.push(deepClone(device));
}
} else {
iscs[name] = [device];
@ -127,7 +128,7 @@ function updateIscsListByDevice(iscs, name, device) {
}
export function updateIscsData(device) {
const iscsData = store.getters['iscs/iscs'];
const iscsData = store.state.iscs;
switch (device._type) {
case deviceType.vidiconList :
updateIscsListByDevice(iscsData, 'vidiconList', device);

View File

@ -1,5 +1,5 @@
import Vue from 'vue';
import {updateIscsData } from '@/iscs/utils/parser';
/**
* iscs状态数据
*/
@ -45,12 +45,89 @@ const iscs = {
} else {
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: {
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) => {
state.iscs = iscs;
@ -73,8 +150,10 @@ const iscs = {
if (!(models instanceof Array)) {
models = [models];
}
commit('iscsRender', models);
resolve(models);
});
},
setUpdateDeviceData: ({ commit }, models) => {

View File

@ -22,6 +22,8 @@
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'AirConditioner',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'airConditionerList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'AirConditioner',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('AirConditioner', this.airConditionerList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', airConditionerModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'Chiller',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'chillerList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'Chiller',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('Chiller', this.chillerList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', chillerModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'CoolTower',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'coolTowerList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'CoolTower',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('CoolTower', this.coolTowerList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', chillerModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'FireDamper',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'fireDamperList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'FireDamper',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('FireDamper', this.fireDamperList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', fireDamperModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'FrozenPump',
data() {
@ -62,7 +64,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'frozenPumpList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -92,7 +96,7 @@ export default {
y: this.form.y
},
_type: 'FrozenPump',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('FrozenPump', this.frozenPumpList),
width: this.form.width,
color:'#00ff00',
pumpType:this.form.type
@ -132,10 +136,6 @@ export default {
};
this.$emit('deleteDataModel', frozenPumpModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'JetFan',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'jetFanList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'JetFan',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('JetFan', this.jetFanList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', jetFanModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'OrbitalVentilator',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'orbitalVentilatorList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'OrbitalVentilator',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('OrbitalVentilator', this.orbitalVentilatorList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', orbitalVentilatorModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'SmookProofFd',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed: {
...mapGetters('iscs', [
'smookProofFdList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'SmookProofFd',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('SmookProofFd', this.smookProofFdList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', smookProofFdModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'TunnelFan',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'tunnelFanList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'TunnelFan',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('TunnelFan', this.tunnelFanList),
width: this.form.width,
color:'#00ff00'
};
@ -91,7 +95,6 @@ export default {
return false;
}
});
},
initPage() {
this.isUpdate = false;
@ -118,10 +121,6 @@ export default {
};
this.$emit('deleteDataModel', tunnelFanModel );
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>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name:'Ventilator',
data() {
@ -52,7 +54,9 @@ export default {
};
},
computed:{
...mapGetters('iscs', [
'ventilatorList'
])
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
@ -81,7 +85,7 @@ export default {
y: this.form.y
},
_type: 'Ventilator',
code: this.isUpdate ? this.form.code : this.generateCode(),
code: this.isUpdate ? this.form.code : getUID('Ventilator', this.ventilatorList),
width: this.form.width,
color:'#00ff00'
};
@ -118,10 +122,6 @@ export default {
};
this.$emit('deleteDataModel', chillerModel );
this.initPage();
},
generateCode() {
const mydate = new Date();
return 'ventilator_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
}
}
};