From 53008131c657ed17f613d4fdd8db5dae1bac536e Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 11:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs_new/controller.js | 3 +- src/iscs_new/core/abstractShape.js | 13 ++- src/iscs_new/core/form/elementConst.js | 12 +-- src/iscs_new/core/form/form2Base.js | 18 +++- src/iscs_new/factory/compose.js | 16 ++-- src/iscs_new/factory/element.js | 22 +++-- src/iscs_new/map.js | 2 - src/views/iscs_new/components/dataForm.vue | 7 +- src/views/iscs_new/iscsDraw/index.vue | 102 ++++++++------------- src/views/iscs_new/iscsDraw/iscsCanvas.vue | 70 ++++---------- 10 files changed, 115 insertions(+), 150 deletions(-) diff --git a/src/iscs_new/controller.js b/src/iscs_new/controller.js index 9d26c4d9b..0da85f409 100644 --- a/src/iscs_new/controller.js +++ b/src/iscs_new/controller.js @@ -24,7 +24,8 @@ class MouseEvent { composeCode = compose.model.composeCode; } - this.code = compose? compose.model.code: shape.code; + this.code = compose? compose.code: shape.code; + this.type = compose? compose.type: shape.type; } if (shape.subType) { diff --git a/src/iscs_new/core/abstractShape.js b/src/iscs_new/core/abstractShape.js index 8a53ebe88..5aaada06d 100644 --- a/src/iscs_new/core/abstractShape.js +++ b/src/iscs_new/core/abstractShape.js @@ -10,6 +10,7 @@ function shapeStyleBuilder({subType, model}) { subType: subType, ...shapeRender, code: model.code, + type: model.type, z: 9998, cursor: 'pointer', shape: { @@ -39,15 +40,19 @@ class AbstractShape extends Group { // 拖动 drift({dx, dy}) { - this.model.position[0] = this.model.position[0] + dx; - this.model.position[1] = this.model.position[1] + dy; + this.model.base.position[0] = this.model.base.position[0] + dx; + this.model.base.position[1] = this.model.base.position[1] + dy; this.instance.origin = utils.createOrigin(this.instance); - this.instance.transform = utils.createTransform({scale: this.model.scale, position: this.model.position, rotation: this.model.rotation}); + this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180}); } // 修改属性 attr(attrs) { - this.instance.attr(attrs); + if (this.instance) { + this.instance.attr(attrs); + } else { + super.attr(attrs); + } } // 设置显隐 diff --git a/src/iscs_new/core/form/elementConst.js b/src/iscs_new/core/form/elementConst.js index 372c3c59c..3944902ea 100644 --- a/src/iscs_new/core/form/elementConst.js +++ b/src/iscs_new/core/form/elementConst.js @@ -448,7 +448,7 @@ export const elementConst = { precision: 0, step:1, min: 0, - max: Math.PI*2, + max: 360, rules:[ { required: true, message:'请输入起始弧度', trigger: 'blur' } ], @@ -462,11 +462,11 @@ export const elementConst = { precision: 0, step:1, min: 0, - max: Math.PI*2, + max: 360, rules:[ { required: true, message:'请输入终止弧度', trigger: 'blur' } ], - value: Math.PI, + value: 180, description: '终止弧度' }, { @@ -555,7 +555,7 @@ export const elementConst = { precision: 0, step:1, min: 0, - max: Math.PI*2, + max: 360, rules:[ { required: true, message:'请输入起始弧度', trigger: 'blur' } ], @@ -569,11 +569,11 @@ export const elementConst = { precision: 0, step:1, min: 0, - max: Math.PI*2, + max: 360, rules:[ { required: true, message:'请输入终止弧度', trigger: 'blur' } ], - value: Math.PI, + value: 180, description: '终止弧度' }, { diff --git a/src/iscs_new/core/form/form2Base.js b/src/iscs_new/core/form/form2Base.js index 3405b3bd3..cad2b4612 100644 --- a/src/iscs_new/core/form/form2Base.js +++ b/src/iscs_new/core/form/form2Base.js @@ -49,7 +49,7 @@ export default [ rules:[ { required: true, message:'请输入位置', trigger: 'blur' } ], - value: 0, + value: [0,0], description: '控制图形的位置。' }, { @@ -63,7 +63,21 @@ export default [ rules:[ { required: true, message:'请输入缩放', trigger: 'blur' } ], - value: 1, + value: [1,1], description: '控制图形的缩放。' + }, + { + prop: 'rotation', + label: '旋转', + type: types.Number, + precision: 0, + min:0, + max:360, + step:1, + rules:[ + { required: true, message:'请输入旋转', trigger: 'blur' } + ], + value: 0, + description: '控制图形的旋转。' } ]; diff --git a/src/iscs_new/factory/compose.js b/src/iscs_new/factory/compose.js index b31532f01..47faf680d 100644 --- a/src/iscs_new/factory/compose.js +++ b/src/iscs_new/factory/compose.js @@ -29,7 +29,11 @@ class Compose extends AbstractShape { this.instance = new Group({ ...shapeRender, - ...this.model, + ...this.model.base, + code: this.model.code, + type: this.model.type, + shape: {...this.model.shape}, + style: {...this.model.style}, onmouseover, onmousemove, onmouseout @@ -42,11 +46,11 @@ class Compose extends AbstractShape { this.instance.add(el); } }) - this.instance.scale = this.model.scale; - this.instance.rotation = this.model.rotation; - this.instance.position = this.model.position; + this.instance.scale = this.model.base.scale; + this.instance.position = this.model.base.position; + this.instance.rotation = this.model.base.rotation*Math.PI/180; this.instance.origin = utils.createOrigin(this.instance); - this.instance.transform = utils.createTransform({scale: this.model.scale, position: this.model.position, rotation: this.model.rotation}); + this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180}); this.add(this.instance); this.setInvisible(this.model.sightless) } @@ -77,7 +81,7 @@ class Compose extends AbstractShape { el.model) { this.shapeFactory.removeFromLayer(el.type)(el); this.instance.add(el); - el.model.composeCode = this.model.code; + el.model.composeCode = this.type; el.attr(el.model); } }) diff --git a/src/iscs_new/factory/element.js b/src/iscs_new/factory/element.js index b70de154b..82ec1d5ca 100644 --- a/src/iscs_new/factory/element.js +++ b/src/iscs_new/factory/element.js @@ -13,7 +13,7 @@ class Element extends AbstractShape { create() { const that = this; - const elementBuilder = graphic[this.model.type]; + const elementBuilder = graphic[this.type]; if (elementBuilder) { // mouse进入事件 function onmouseover(e) { @@ -32,17 +32,21 @@ class Element extends AbstractShape { this.instance = new elementBuilder({ ...shapeRender, - ...this.model, + ...this.model.base, + code: this.model.code, + type: this.model.type, + shape: {...this.model.shape}, + style: {...this.model.style}, onmouseover, onmousemove, onmouseout }); - this.instance.scale = this.model.scale; - this.instance.rotation = this.model.rotation; - this.instance.position = this.model.position; + this.instance.scale = this.model.base.scale; + this.instance.position = this.model.base.position; + this.instance.rotation = this.model.base.rotation*Math.PI/180; this.instance.origin = utils.createOrigin(this.instance); - this.instance.transform = utils.createTransform({scale: this.model.scale, position: this.model.position, rotation: this.model.rotation}); + this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180}); this.add(this.instance); this.setInvisible(this.model.sightless) } @@ -72,9 +76,9 @@ class Element extends AbstractShape { if (compose && compose.model && compose.model.elementCodes) { - const index = compose.model.elementCodes.findIndex(this.model.code); + const index = compose.model.elementCodes.findIndex(this.type); if (index < 0) { - compose.model.elementCodes.push(this.model.code); + compose.model.elementCodes.push(this.type); this.shapeFactory.removeFormLayer(el.type, this); compose.add(this); } @@ -89,7 +93,7 @@ class Element extends AbstractShape { if (compose && compose.model && compose.model.elementCodes) { - const index = compose.model.elementCodes.findIndex(this.model.code); + const index = compose.model.elementCodes.findIndex(this.type); if (index >= 0) { compose.model.elementCodes.splice(index, 1); compose.remove(this); diff --git a/src/iscs_new/map.js b/src/iscs_new/map.js index e183d5ca6..925588ec8 100644 --- a/src/iscs_new/map.js +++ b/src/iscs_new/map.js @@ -46,8 +46,6 @@ class JMap { this.$zr.dom.setAttribute('tabIndex', -1); this.$zr.dom.style.cursor = 'auto'; - console.log(this.$zr, 111); - // 实例化缩放偏移缩放参数 this.$option = new Option({ scaleRate: 1, offsetX: 0, offsetY: 0, ...utils.deepClone(opts.option||{})}, (dataZoom) => { this.$controller.trigger(events.DataZoom, dataZoom); }); // 缩放 diff --git a/src/views/iscs_new/components/dataForm.vue b/src/views/iscs_new/components/dataForm.vue index c04397a85..8fae87a78 100644 --- a/src/views/iscs_new/components/dataForm.vue +++ b/src/views/iscs_new/components/dataForm.vue @@ -87,12 +87,13 @@ export default { }; }, - mounted() { - }, methods: { checkFieldType(field, type) { return field.type === type; - } + }, + init() { + + } } }; diff --git a/src/views/iscs_new/iscsDraw/index.vue b/src/views/iscs_new/iscsDraw/index.vue index e8e94ad8c..d70e300cb 100644 --- a/src/views/iscs_new/iscsDraw/index.vue +++ b/src/views/iscs_new/iscsDraw/index.vue @@ -2,48 +2,41 @@
- - +
-
+
保存
- +
- 添加 - 修改 - 删除 - 取消 + 添加 + 修改 + 删除
-
diff --git a/src/views/iscs_new/iscsDraw/iscsCanvas.vue b/src/views/iscs_new/iscsDraw/iscsCanvas.vue index 737f831e3..ceb6b26a0 100644 --- a/src/views/iscs_new/iscsDraw/iscsCanvas.vue +++ b/src/views/iscs_new/iscsDraw/iscsCanvas.vue @@ -1,13 +1,5 @@ @@ -15,15 +7,11 @@