ibp代码调整
This commit is contained in:
parent
f065661cd4
commit
8df4cfd6e1
@ -141,6 +141,14 @@ class IbpPan {
|
|||||||
(list || []).forEach(elem => {
|
(list || []).forEach(elem => {
|
||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
const type = elem._type;
|
const type = elem._type;
|
||||||
|
if (type === deviceType.Background) {
|
||||||
|
this.canvasSize = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: elem.width,
|
||||||
|
height: elem.height
|
||||||
|
};
|
||||||
|
}
|
||||||
updateIbpData(elem);
|
updateIbpData(elem);
|
||||||
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
|
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
|
||||||
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||||
import Group from 'zrender/src/container/Group';
|
import Group from 'zrender/src/container/Group';
|
||||||
import {arrow} from '@/jmap/shape/utils/ShapePoints';
|
import {arrow} from './utils';
|
||||||
// import { updateIbpData } from '@/ibp/utils/parser';
|
// import { updateIbpData } from '@/ibp/utils/parser';
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
|
|
||||||
|
11
src/ibp/shape/utils.js
Normal file
11
src/ibp/shape/utils.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export function arrow(modelX, modelY, length, radius) {
|
||||||
|
return [
|
||||||
|
[modelX, modelY],
|
||||||
|
[modelX + radius /1.5, modelY - radius/1.5],
|
||||||
|
[modelX + radius /1.5, modelY - radius/3],
|
||||||
|
[modelX + length, modelY - radius/3],
|
||||||
|
[modelX + length, modelY + radius/3],
|
||||||
|
[modelX + radius /1.5, modelY + radius/3],
|
||||||
|
[modelX + radius /1.5, modelY + radius/1.5]
|
||||||
|
];
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
|
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
|
||||||
<el-form-item label="箭头编号" prop="code">
|
<el-form-item label="箭头编号" prop="code">
|
||||||
<el-input :disabled="true" v-model="form.code" >
|
<el-input :disabled="true" v-model="form.code" >
|
||||||
<el-button slot="append" :disabled="isUpdate" type="primary" @click="generateCode">生成编号</el-button>
|
<el-button slot="append" :disabled="isUpdate" type="primary" @click="generateCode">生成编号</el-button>
|
||||||
@ -23,6 +23,12 @@
|
|||||||
<el-form-item label="箭头颜色" prop="fillColor">
|
<el-form-item label="箭头颜色" prop="fillColor">
|
||||||
<el-input v-model="form.fillColor"></el-input>
|
<el-input v-model="form.fillColor"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="顶点X轴坐标">
|
||||||
|
<el-input-number v-model="form.x" controls-position="right" :min="1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="顶点Y轴坐标">
|
||||||
|
<el-input-number v-model="form.y" controls-position="right" :min="1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
|
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
|
||||||
<el-button v-show="showDeleteButton" @click="deleteDevice" type="danger">删除</el-button>
|
<el-button v-show="showDeleteButton" @click="deleteDevice" type="danger">删除</el-button>
|
||||||
@ -42,16 +48,14 @@
|
|||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
buttonText: '立即创建',
|
buttonText: '立即创建',
|
||||||
showDeleteButton: false,
|
showDeleteButton: false,
|
||||||
point: {
|
|
||||||
x: 10,
|
|
||||||
y: 10
|
|
||||||
},
|
|
||||||
form: {
|
form: {
|
||||||
code: '',
|
code: '',
|
||||||
orientation: '',
|
orientation: '',
|
||||||
arrowWidth: '',
|
arrowWidth: '',
|
||||||
arrowLength: '',
|
arrowLength: '',
|
||||||
fillColor: ''
|
fillColor: '',
|
||||||
|
x: 10,
|
||||||
|
y: 10
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
code: [
|
code: [
|
||||||
@ -87,7 +91,8 @@
|
|||||||
this.form.arrowLength = model.length;
|
this.form.arrowLength = model.length;
|
||||||
this.form.arrowWidth = model.width;
|
this.form.arrowWidth = model.width;
|
||||||
this.form.fillColor = model.fill;
|
this.form.fillColor = model.fill;
|
||||||
this.point = model.point;
|
this.form.x = model.point.x;
|
||||||
|
this.form.y = model.point.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -98,7 +103,10 @@
|
|||||||
this.$refs[form].validate((valid) => {
|
this.$refs[form].validate((valid) => {
|
||||||
if (valid){
|
if (valid){
|
||||||
const arrowModel = {
|
const arrowModel = {
|
||||||
point: this.point,
|
point: {
|
||||||
|
x: this.form.x,
|
||||||
|
y: this.form.y
|
||||||
|
},
|
||||||
_type: 'Arrow',
|
_type: 'Arrow',
|
||||||
code: this.form.code,
|
code: this.form.code,
|
||||||
orientation: this.form.orientation,
|
orientation: this.form.orientation,
|
||||||
@ -116,7 +124,10 @@
|
|||||||
},
|
},
|
||||||
deleteDevice() {
|
deleteDevice() {
|
||||||
const arrowModel = {
|
const arrowModel = {
|
||||||
point: this.point,
|
point: {
|
||||||
|
x: this.form.x,
|
||||||
|
y: this.form.y
|
||||||
|
},
|
||||||
_type: 'Arrow',
|
_type: 'Arrow',
|
||||||
code: this.form.code,
|
code: this.form.code,
|
||||||
orientation: this.form.orientation,
|
orientation: this.form.orientation,
|
||||||
@ -136,9 +147,7 @@
|
|||||||
orientation: '',
|
orientation: '',
|
||||||
arrowWidth: '',
|
arrowWidth: '',
|
||||||
arrowLength: '',
|
arrowLength: '',
|
||||||
fillColor: ''
|
fillColor: '',
|
||||||
};
|
|
||||||
this.point = {
|
|
||||||
x: 10,
|
x: 10,
|
||||||
y: 10
|
y: 10
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user