This commit is contained in:
joylink_cuiweidong 2020-09-25 17:15:40 +08:00
commit bc10b0cbb2
10 changed files with 245 additions and 4 deletions

View File

@ -168,6 +168,12 @@ deviceRender[deviceType.AirConditioner] = {
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 电源渲染配置 */
deviceRender[deviceType.IscsPower] = {
_type: deviceType.IscsPower,
zlevel: 1,
z: 5
};
/** 风量调节阀 */ /** 风量调节阀 */
deviceRender[deviceType.VolumeControlDamper] = { deviceRender[deviceType.VolumeControlDamper] = {
_type: deviceType.VolumeControlDamper, _type: deviceType.VolumeControlDamper,

View File

@ -30,6 +30,7 @@ const deviceType = {
IscsLine: 'IscsLine', IscsLine: 'IscsLine',
IscsPicture: 'IscsPicture', IscsPicture: 'IscsPicture',
IscsRect: 'IscsRect', IscsRect: 'IscsRect',
IscsPower: 'IscsPower',
IscsRhombus: 'IscsRhombus', IscsRhombus: 'IscsRhombus',
IscsTick: 'IscsTick', IscsTick: 'IscsTick',
IscsArrow: 'IscsArrow', IscsArrow: 'IscsArrow',

View File

@ -29,6 +29,7 @@ import BalancedElectric from './bas/balancedElectric';
import IscsText from './text'; import IscsText from './text';
import IscsLine from './line'; import IscsLine from './line';
import IscsRect from './rect'; import IscsRect from './rect';
import IscsPower from './power';
import IscsPicture from './picture'; import IscsPicture from './picture';
import IscsRhombus from './rhombus'; import IscsRhombus from './rhombus';
import IscsTick from './tick'; import IscsTick from './tick';
@ -92,6 +93,7 @@ iscsShape[deviceType.VolumeControlDamper] = VolumeControlDamper;
iscsShape[deviceType.IscsText] = IscsText; iscsShape[deviceType.IscsText] = IscsText;
iscsShape[deviceType.IscsLine] = IscsLine; iscsShape[deviceType.IscsLine] = IscsLine;
iscsShape[deviceType.IscsRect] = IscsRect; iscsShape[deviceType.IscsRect] = IscsRect;
iscsShape[deviceType.IscsPower] = IscsPower;
iscsShape[deviceType.IscsRhombus] = IscsRhombus; iscsShape[deviceType.IscsRhombus] = IscsRhombus;
iscsShape[deviceType.IscsTick] = IscsTick; iscsShape[deviceType.IscsTick] = IscsTick;
iscsShape[deviceType.IscsArrow] = IscsArrow; iscsShape[deviceType.IscsArrow] = IscsArrow;

73
src/iscs/shape/power.js Normal file
View File

@ -0,0 +1,73 @@
import Group from 'zrender/src/container/Group';
import Polyline from 'zrender/src/graphic/shape/Polyline';
export default class Tick extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.iscsLine1 = new Polyline({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[-model.fontSize, 0],
[model.fontSize, 0]
]
},
style: {
stroke: this.model.fillColor,
lineWidth: this.model.borderWidth || 1
}
});
this.iscsLine2 = new Polyline({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[-model.fontSize + 3, model.borderWidth + 3],
[model.fontSize - 3, model.borderWidth + 3]
]
},
style: {
stroke: this.model.fillColor,
lineWidth: this.model.borderWidth || 1
}
});
this.iscsLine3 = new Polyline({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[-model.fontSize + 6, model.borderWidth * 2 + 6],
[model.fontSize - 6, model.borderWidth * 2 + 6]
]
},
style: {
stroke: this.model.fillColor,
lineWidth: this.model.borderWidth || 1
}
});
this.grouper.add(this.iscsLine1);
this.grouper.add(this.iscsLine2);
this.grouper.add(this.iscsLine3);
this.grouper.origin = [0, 0];
this.grouper.rotation = Math.PI / 180 * (model.rotate || 0);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -130,6 +130,9 @@ export function parser(data) {
zrUtil.each(data.iscsTextList || [], elem=> { zrUtil.each(data.iscsTextList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.IscsText, elem); iscsDevice[elem.code] = deviceFactory(deviceType.IscsText, elem);
}); });
zrUtil.each(data.iscsPowerList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.IscsPower, elem);
});
zrUtil.each(data.iscsLineList || [], elem=> { zrUtil.each(data.iscsLineList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.IscsLine, elem); iscsDevice[elem.code] = deviceFactory(deviceType.IscsLine, elem);
}); });

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.175:9000'; // 张赛 // BASE_API = 'http://192.168.3.175:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -0,0 +1,146 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="大小:" prop="fontSize">
<el-input-number v-model="form.fontSize" controls-position="right" :min="8" size="small" />
</el-form-item>
<el-form-item label="颜色:" prop="fillColor">
<el-color-picker v-model="form.fillColor" show-alpha size="small" />
</el-form-item>
<el-form-item label="线宽度:" prop="borderWidth">
<el-input-number v-model="form.borderWidth" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="旋转角度:" prop="rotate">
<el-input-number v-model="form.rotate" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'IscsPower',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
fillColor: '',
borderWidth: 1,
fontSize: 10,
rotate: 0,
x: 10,
y: 10
},
rules: {
strokeColor: [
{ required: true, message: '请选择边框颜色', trigger: 'change' }
],
fillColor: [
{ required: true, message: '请选择矩形填充颜色', trigger: 'change'}
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'IscsPower' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.fillColor = model.fillColor;
this.form.borderWidth = model.borderWidth;
this.form.fontSize = model.fontSize;
this.form.rotate = model.rotate;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('IscsPower', this.iscs.iscsPowerList),
_type: 'IscsPower',
fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth,
fontSize: this.form.fontSize,
rotate: this.form.rotate
};
this.$emit('createDataModel', rectModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'IscsPower',
fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth,
fontSize: this.form.fontSize
};
this.$emit('deleteDataModel', rectModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
fillColor: '',
borderWidth: 1,
fontSize: 10,
rotate: 0,
x: 10,
y: 10
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>

View File

@ -104,7 +104,7 @@ export default {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
}, },
code: this.isUpdate ? this.form.code : getUID('IscsRhombus', this.iscs.iscsRectList), code: this.isUpdate ? this.form.code : getUID('IscsRhombus', this.iscs.iscsRhombusList),
_type: 'IscsRhombus', _type: 'IscsRhombus',
fillColor: this.form.fillColor, fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth, borderWidth: this.form.borderWidth,

View File

@ -86,7 +86,7 @@ export default {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
}, },
code: this.isUpdate ? this.form.code : getUID('IscsTick', this.iscs.iscsRectList), code: this.isUpdate ? this.form.code : getUID('IscsTick', this.iscs.iscsTickList),
_type: 'IscsTick', _type: 'IscsTick',
fillColor: this.form.fillColor, fillColor: this.form.fillColor,
borderWidth: this.form.borderWidth, borderWidth: this.form.borderWidth,

View File

@ -74,6 +74,14 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="电源" name="IscsPower">
<iscs-power
ref="iscsPower"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="对勾" name="IscsTick"> <el-tab-pane label="对勾" name="IscsTick">
<iscs-tick <iscs-tick
ref="iscsTick" ref="iscsTick"
@ -115,6 +123,7 @@ import IscsStateTable from '../icscComponents/stateTable';
import IscsArrow from '../icscComponents/arrow'; import IscsArrow from '../icscComponents/arrow';
import IscsCircle from '../icscComponents/circle'; import IscsCircle from '../icscComponents/circle';
import IscsPicture from '../icscComponents/picture'; import IscsPicture from '../icscComponents/picture';
import IscsPower from '../icscComponents/power';
import IscsRadioText from './radioText'; import IscsRadioText from './radioText';
export default { export default {
@ -130,6 +139,7 @@ export default {
IscsArrow, IscsArrow,
IscsRadioText, IscsRadioText,
IscsCircle, IscsCircle,
IscsPower,
IscsPicture IscsPicture
}, },
mixins: [ mixins: [