Merge branch 'iscs' of https://git.code.tencent.com/lian-cbtc/jl-client into iscs
This commit is contained in:
commit
bbba502ba7
@ -197,6 +197,7 @@ export default class Controller extends Eventful {
|
|||||||
mousemove(e) {
|
mousemove(e) {
|
||||||
const oldX = this._x;
|
const oldX = this._x;
|
||||||
const oldY = this._y;
|
const oldY = this._y;
|
||||||
|
const target = this._target||{}
|
||||||
const dx = Math.round(e.offsetX - this._x);
|
const dx = Math.round(e.offsetX - this._x);
|
||||||
const dy = Math.round(e.offsetY - this._y);
|
const dy = Math.round(e.offsetY - this._y);
|
||||||
|
|
||||||
@ -218,7 +219,7 @@ export default class Controller extends Eventful {
|
|||||||
if (this.limitDrag({dx, dy})) {
|
if (this.limitDrag({dx, dy})) {
|
||||||
this.trigger(this.events.__Dragging, { dx, dy });
|
this.trigger(this.events.__Dragging, { dx, dy });
|
||||||
if (this._reflectEnable) {
|
if (this._reflectEnable) {
|
||||||
this.trigger(events.Reflect, {dx, dy});
|
this.trigger(events.Reflect, {dx, dy, code: target.code});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._x = oldX;
|
this._x = oldX;
|
||||||
@ -325,6 +326,7 @@ export default class Controller extends Eventful {
|
|||||||
clear() {
|
clear() {
|
||||||
this.storage.clear();
|
this.storage.clear();
|
||||||
this.storage.clearClipboard();
|
this.storage.clearClipboard();
|
||||||
|
this._target = null;
|
||||||
this._pan = false;
|
this._pan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@ class BuilderFactory {
|
|||||||
getFormList() {
|
getFormList() {
|
||||||
const elementList = Object.values(elementConst);
|
const elementList = Object.values(elementConst);
|
||||||
elementList.forEach(element=>{
|
elementList.forEach(element=>{
|
||||||
const temp = Object.assign({}, element);
|
const temp = {};
|
||||||
|
temp.code = element.code;
|
||||||
|
temp.name = element.name;
|
||||||
temp.formGroup = [];
|
temp.formGroup = [];
|
||||||
temp.model = {};
|
temp.model = {};
|
||||||
// 添加通用配置
|
// 添加通用配置
|
||||||
|
@ -152,7 +152,7 @@ export const elementConst = {
|
|||||||
rules:[
|
rules:[
|
||||||
{ required: true, message:'请输入圆角矩形半径', trigger: 'blur' }
|
{ required: true, message:'请输入圆角矩形半径', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
value: [5, 5, 5, 5],
|
value: [0, 0, 0, 0],
|
||||||
description: '用于创建圆角矩形。左上、右上、右下、左下角的半径依次为 r1、 r2、 r3、 r4。[1, 1, 1, 1]'
|
description: '用于创建圆角矩形。左上、右上、右下、左下角的半径依次为 r1、 r2、 r3、 r4。[1, 1, 1, 1]'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
import types from './types';
|
import types from './types';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{ prop: 'z1',
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
type: types.String,
|
||||||
|
rules:[
|
||||||
|
{ required: true, message:'请输入名称', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
value: '<名称>',
|
||||||
|
description: '控制图形的前后顺序。'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'z1',
|
||||||
label: '层级z1',
|
label: '层级z1',
|
||||||
type: types.Number,
|
type: types.Number,
|
||||||
precision: 0,
|
precision: 0,
|
||||||
@ -30,7 +41,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'sightless',
|
prop: 'sightless',
|
||||||
label: '图形是否不可见',
|
label: '是否隐藏',
|
||||||
type: types.Boolean,
|
type: types.Boolean,
|
||||||
rules:[
|
rules:[
|
||||||
{ required: true, message:'请选择图形是否不可见', trigger: 'blur' }
|
{ required: true, message:'请选择图形是否不可见', trigger: 'blur' }
|
||||||
|
@ -101,7 +101,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'strokeNoScale',
|
prop: 'strokeNoScale',
|
||||||
label: '描边粗细不随缩放而改变',
|
label: '描边不缩放',
|
||||||
type: types.Boolean,
|
type: types.Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
description: '描边粗细不随缩放而改变,不选中时则会根据缩放同比例缩放描边粗细。'
|
description: '描边粗细不随缩放而改变,不选中时则会根据缩放同比例缩放描边粗细。'
|
||||||
|
@ -1 +0,0 @@
|
|||||||
// export function coverse
|
|
@ -56,7 +56,7 @@ function update2List(source, model, action, name='') {
|
|||||||
i >= 0 && list.splice(i, 1);
|
i >= 0 && list.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
case orders.UPDATE:
|
case orders.UPDATE:
|
||||||
Object.assign(list[i]||{}, model)
|
updateModel = Object.assign(list[i]||{}, model)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +166,7 @@ class JMap {
|
|||||||
let newShape = null;
|
let newShape = null;
|
||||||
|
|
||||||
if (updateModel) {
|
if (updateModel) {
|
||||||
|
this.$controller.clear()
|
||||||
switch(action.order) {
|
switch(action.order) {
|
||||||
case orders.BINDING:
|
case orders.BINDING:
|
||||||
case orders.ADD:
|
case orders.ADD:
|
||||||
@ -180,6 +181,7 @@ class JMap {
|
|||||||
if (updateModel) {
|
if (updateModel) {
|
||||||
curShape = this.$shapeFactory.getShapeByCode(updateModel.code);
|
curShape = this.$shapeFactory.getShapeByCode(updateModel.code);
|
||||||
oldShape = this.$shapeFactory.removeShape(curShape);
|
oldShape = this.$shapeFactory.removeShape(curShape);
|
||||||
|
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
|
||||||
this.$painter.remove(oldShape);
|
this.$painter.remove(oldShape);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -188,12 +190,15 @@ class JMap {
|
|||||||
updateModel = this.isDrawing() ? this.$shapeFactory.updateSource(model, action): model;
|
updateModel = this.isDrawing() ? this.$shapeFactory.updateSource(model, action): model;
|
||||||
oldShape = this.$shapeFactory.removeShape(curShape);
|
oldShape = this.$shapeFactory.removeShape(curShape);
|
||||||
newShape = this.$shapeFactory.createShape(updateModel, action.shapeType);
|
newShape = this.$shapeFactory.createShape(updateModel, action.shapeType);
|
||||||
|
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
|
||||||
|
this.$painter.removeFromLayer(oldShape.type, newShape.instanceHightLight);
|
||||||
this.$painter.remove(oldShape);
|
this.$painter.remove(oldShape);
|
||||||
this.$shapeFactory.storageShape(newShape)
|
this.$shapeFactory.storageShape(newShape)
|
||||||
this.$painter.add(newShape);
|
this.$painter.add(newShape);
|
||||||
break;
|
break;
|
||||||
case orders.UNBINDING:
|
case orders.UNBINDING:
|
||||||
oldShape = this.$shapeFactory.removeShape(curShape);
|
oldShape = this.$shapeFactory.removeShape(curShape);
|
||||||
|
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
|
||||||
this.$painter.remove(oldShape);
|
this.$painter.remove(oldShape);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -84,22 +84,29 @@ export default {
|
|||||||
onSave(data) {
|
onSave(data) {
|
||||||
},
|
},
|
||||||
onSelectTab() {
|
onSelectTab() {
|
||||||
|
this.selected = null;
|
||||||
},
|
},
|
||||||
onSelected(val) {
|
onSelected(em) {
|
||||||
if (val) {
|
if (em.model) {
|
||||||
this.selected = JSON.parse(JSON.stringify(val));
|
this.selected = JSON.parse(JSON.stringify(em.model));
|
||||||
} else {
|
const elem = this.elementList.find(el => el.code == this.selected.type);
|
||||||
this.selected = null;
|
if (elem) {
|
||||||
}
|
elem.model = this.selected;
|
||||||
},
|
}
|
||||||
onSubmit() {
|
} else {
|
||||||
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
|
this.selected = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSubmit(){
|
||||||
|
this.$refs['dataform'+this.enabledTab][0].$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
|
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
|
||||||
const newModel = JSON.parse(JSON.stringify(formModel));
|
const newModel = JSON.parse(JSON.stringify(formModel));
|
||||||
newModel.type = this.enabledTab;
|
newModel.type = this.enabledTab;
|
||||||
newModel.code = utils.getUID(this.enabledTab);
|
newModel.code = utils.getUID(this.enabledTab);
|
||||||
|
newModel.stateList = [];
|
||||||
this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]);
|
this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]);
|
||||||
|
this.clear(this.enabledTab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -110,6 +117,7 @@ export default {
|
|||||||
model.code = this.selected.code;
|
model.code = this.selected.code;
|
||||||
model.type = this.selected.type;
|
model.type = this.selected.type;
|
||||||
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.UPDATE}}]);
|
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.UPDATE}}]);
|
||||||
|
this.clear(this.enabledTab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -120,11 +128,14 @@ export default {
|
|||||||
model.code = this.selected.code;
|
model.code = this.selected.code;
|
||||||
model.type = this.selected.type;
|
model.type = this.selected.type;
|
||||||
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.DELETE}}]);
|
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.DELETE}}]);
|
||||||
this.$refs['dataform' + this.enabledTab][0].init();
|
this.clear(this.enabledTab);
|
||||||
this.selected = null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
clear(enabledTab) {
|
||||||
|
this.$refs['dataform' + enabledTab][0].init();
|
||||||
|
this.selected = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -96,6 +96,7 @@ export default {
|
|||||||
this.$iscs.on('viewLoaded', this.onViewLoaded, this);
|
this.$iscs.on('viewLoaded', this.onViewLoaded, this);
|
||||||
this.$iscs.on('contextmenu', this.onContextMenu, this);
|
this.$iscs.on('contextmenu', this.onContextMenu, this);
|
||||||
this.$iscs.on('selected', this.onSelected, this);
|
this.$iscs.on('selected', this.onSelected, this);
|
||||||
|
this.$iscs.on('reflect', this.onReflect, this);
|
||||||
this.$iscs.on('keyboard', this.onKeyboard, this);
|
this.$iscs.on('keyboard', this.onKeyboard, this);
|
||||||
window.document.oncontextmenu = function () {
|
window.document.oncontextmenu = function () {
|
||||||
return false;
|
return false;
|
||||||
@ -110,8 +111,11 @@ export default {
|
|||||||
},
|
},
|
||||||
// 点击选择事件
|
// 点击选择事件
|
||||||
onSelected(em={}) {
|
onSelected(em={}) {
|
||||||
this.$emit('selected', em.model);
|
this.$emit('selected', em);
|
||||||
},
|
},
|
||||||
|
onReflect(em={}) {
|
||||||
|
this.$emit('selected', this.$iscs.getShapeByCode(em.code));
|
||||||
|
},
|
||||||
// 右键点击事件
|
// 右键点击事件
|
||||||
onContextMenu(em={}) {
|
onContextMenu(em={}) {
|
||||||
this.$emit('contextMenu', em.model);
|
this.$emit('contextMenu', em.model);
|
||||||
|
Loading…
Reference in New Issue
Block a user