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 33a9ad4a0..8ab9ba0a9 100644 --- a/src/iscs_new/core/form/elementConst.js +++ b/src/iscs_new/core/form/elementConst.js @@ -488,33 +488,33 @@ export const elementConst = { ], value: 50, description: '半径' - }, - { - prop: 'startAngle', - label: '起始弧度', - type: types.Number, - precision: 0, - step:1, - min: 0, - max: Math.PI * 2, + }, + { + prop: 'startAngle', + label: '起始弧度', + type: types.Number, + precision: 0, + step:1, + min: 0, + max: 360, rules:[ { required: true, message:'请输入起始弧度', trigger: 'blur' } ], value: 0, description: '起始弧度' - }, - { - prop: 'endAngle', - label: '终止弧度', - type: types.Number, - precision: 0, - step:1, - min: 0, - max: Math.PI * 2, + }, + { + prop: 'endAngle', + label: '终止弧度', + type: types.Number, + precision: 0, + step:1, + min: 0, + max: 360, rules:[ { required: true, message:'请输入终止弧度', trigger: 'blur' } ], - value: Math.PI, + value: 180, description: '终止弧度' }, { @@ -595,33 +595,33 @@ export const elementConst = { ], value: 30, description: '内半径' - }, - { - prop: 'startAngle', - label: '起始弧度', - type: types.Number, - precision: 0, - step:1, - min: 0, - max: Math.PI * 2, + }, + { + prop: 'startAngle', + label: '起始弧度', + type: types.Number, + precision: 0, + step:1, + min: 0, + max: 360, rules:[ { required: true, message:'请输入起始弧度', trigger: 'blur' } ], value: 0, description: '起始弧度' - }, - { - prop: 'endAngle', - label: '终止弧度', - type: types.Number, - precision: 0, - step:1, - min: 0, - max: Math.PI * 2, + }, + { + prop: 'endAngle', + label: '终止弧度', + type: types.Number, + precision: 0, + step:1, + min: 0, + 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 dbe656677..70ee4a997 100644 --- a/src/iscs_new/core/form/form2Base.js +++ b/src/iscs_new/core/form/form2Base.js @@ -67,5 +67,19 @@ export default [ ], 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 f5d0d639d..8ce26c246 100644 --- a/src/views/iscs_new/components/dataForm.vue +++ b/src/views/iscs_new/components/dataForm.vue @@ -107,12 +107,12 @@ export default { }; }, - mounted() { - }, methods: { checkFieldType(field, type) { return field.type === type; }, + init() { + }, changeNumber(type, index, form, prop) { if (form[prop][index][type] == undefined || parseFloat(form[prop][index][type])) { const newForm = Object.assign([], form[prop]); diff --git a/src/views/iscs_new/iscsDraw/index.vue b/src/views/iscs_new/iscsDraw/index.vue index be0a60f57..a36ef19a9 100644 --- a/src/views/iscs_new/iscsDraw/index.vue +++ b/src/views/iscs_new/iscsDraw/index.vue @@ -2,48 +2,41 @@
- - +
-
+
保存
- +
- 添加 - 修改 - 删除 - 取消 + 添加 + 修改 + 删除
-