代码调整

This commit is contained in:
joylink_cuiweidong 2021-04-08 17:56:45 +08:00
parent 04a0560339
commit e5249cf4b3
3 changed files with 90 additions and 83 deletions

View File

@ -30,6 +30,7 @@
<template v-else-if="checkFieldType(item, 'Boolean')">
<el-switch
v-model="formModel[styleGroup.code][item.prop]"
style="vertical-align: top;"
size="small"
:active-color="item.activeColor || '#409eff'"
:inactive-color="item.inactiveColor || '#dcdfe6'"

View File

@ -83,18 +83,18 @@ export default {
},
onSave() {
const id = this.$route.query.id;
const name = this.$route.query.name||"<模型名称>";
const type = this.$route.query.type||"<模型类型>";
const name = this.$route.query.name || '<模型名称>';
const type = this.$route.query.type || '<模型类型>';
const source = this.$iscs.getSource();
if (id && source) {
const shapeList = source.elementList.map(el => {
return this.$iscs.getShapeByCode(el.code);
});
const rect = shapeList.reduce(
(temp,el) => el&&temp? temp.union(el.getBoundingRect().clone()): el.getBoundingRect(), null);
const position = [(rect.x + rect.width)/2, (rect.y + rect.height)/2];
(temp, el) => el && temp ? temp.union(el.getBoundingRect().clone()) : el.getBoundingRect(), null);
const position = [(rect.x + rect.width) / 2, (rect.y + rect.height) / 2];
const model = { id, name, type, shapeList, position };
console.log(model)
console.log(model);
}
},
onSelectTab() {
@ -111,8 +111,8 @@ export default {
this.selected = null;
}
},
onSubmit(){
this.$refs['dataform'+this.enabledTab][0].$refs['form'].validate((valid) => {
onSubmit() {
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
if (valid) {
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
const newModel = JSON.parse(JSON.stringify(formModel));
@ -179,6 +179,9 @@ export default {
.mapPaint{
height: 100%;
overflow: hidden;
width:100%;
position:absolute;
left:0;top:0;
}
.right-card{

View File

@ -86,18 +86,18 @@ export default {
},
onSave() {
const id = this.$route.query.id;
const name = this.$route.query.name||"<模型名称>";
const type = this.$route.query.type||"<模型类型>";
const name = this.$route.query.name || '<模型名称>';
const type = this.$route.query.type || '<模型类型>';
const source = this.$iscs.getSource();
if (id && source) {
const shapeList = source.elementList.map(el => {
return this.$iscs.getShapeByCode(el.code);
});
const rect = shapeList.reduce(
(temp,el) => el&&temp? temp.union(el.getBoundingRect().clone()): el.getBoundingRect(), null);
const position = [(rect.x + rect.width)/2, (rect.y + rect.height)/2];
(temp, el) => el && temp ? temp.union(el.getBoundingRect().clone()) : el.getBoundingRect(), null);
const position = [(rect.x + rect.width) / 2, (rect.y + rect.height) / 2];
const model = { id, name, type, shapeList, position };
console.log(model)
console.log(model);
}
},
onSelectTab() {
@ -109,14 +109,14 @@ export default {
const elem = this.elementList.find(el => el.code == this.selected.type);
if (elem) {
elem.model = this.selected;
this.enabledTab=this.selected.type;
this.enabledTab = this.selected.type;
}
} else {
this.selected = null;
}
},
onSubmit(){
this.$refs['dataform'+this.enabledTab][0].$refs['form'].validate((valid) => {
onSubmit() {
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
if (valid) {
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
const newModel = JSON.parse(JSON.stringify(formModel));
@ -183,6 +183,9 @@ export default {
.mapPaint{
height: 100%;
overflow: hidden;
width:100%;
position:absolute;
left:0;top:0;
}
.right-card{