iscs 代码调整

This commit is contained in:
joylink_cuiweidong 2021-04-07 13:54:55 +08:00
parent e1a75e68a1
commit 8e13a2190b
6 changed files with 382 additions and 345 deletions

View File

@ -5,7 +5,7 @@ class BuilderFactory {
this.formList = [];
}
getFormList() {
const elementList = elementConst.elementsList;
const elementList = Object.values(elementConst);
elementList.forEach(element=>{
const temp = Object.assign({}, element);
@ -14,13 +14,32 @@ class BuilderFactory {
temp.rules = {};
// 添加通用配置
temp.formGroup.push({name:'通用配置', code:'base', styleList:form2Base});
temp.model['base'] = {};
temp.rules['base'] = {};
form2Base.forEach(each=>{
temp.model[each.prop] = each.defValue;
temp.rules[each.prop] = each.rules;
temp.model['base'][each.prop] = each.value;
if (each.rules) {
each.required = true;
temp.rules['base'][each.prop] = each.rules;
}
});
temp.formGroup.push({name:'通用配置', code:'base', styleList:form2Base});
// 添加样式配置 样式
temp.model['style'] = {};
temp.rules['style'] = {};
const styleList = element.formList.style;
styleList.forEach(each=>{
temp.model['style'][each.prop] = each.value;
if (each.rules) {
each.required = true;
temp.rules['style'][each.prop] = each.rules;
}
});
temp.formGroup.push({name:'样式配置', code:'style', styleList:styleList});
// shape
// element
// 添加绘图配置 shape
// temp.formGroup.push({name:'绘图配置', code:'shape', styleList:form2Base});
// temp.rules
// let ClassName=element.code;

View File

@ -1,6 +1,6 @@
import * as graphic from '../../core/graphic';
import form2ShapeStyle from './form2ShapeStyle';
const graphicType = Object.fromEntries(Object.keys(graphic).map(type => [type, type]));
export const elementConst = {
@ -9,10 +9,14 @@ export const elementConst = {
name:'线段',
formList: {
style: [
...form2ShapeStyle
],
shape: [
// opts.shape.x1 number 0 起始点横坐标。
// opts.shape.y1 number 0 起始点纵坐标。
// opts.shape.x2 number 0 终止点横坐标。
// opts.shape.y2 number 0 终止点纵坐标。
// opts.shape.percent number 1 已显示的百分比,用于绘制动画。
]
}
},
@ -33,7 +37,7 @@ export const elementConst = {
name:'矩形',
formList: {
style: [
...form2ShapeStyle
],
shape: [
@ -45,7 +49,7 @@ export const elementConst = {
name:'圆形',
formList:{
style: [
...form2ShapeStyle
],
shape: [
@ -57,7 +61,7 @@ export const elementConst = {
name:'多边形',
formList: {
style: [
...form2ShapeStyle
],
shape: [
@ -81,7 +85,7 @@ export const elementConst = {
name:'多边形折线段',
formList: {
style: [
...form2ShapeStyle
],
shape: [
@ -93,7 +97,7 @@ export const elementConst = {
name:'正多边形',
formList: {
style: [
...form2ShapeStyle
],
shape:[
@ -105,7 +109,7 @@ export const elementConst = {
name:'椭圆',
formList: {
style: [
...form2ShapeStyle
],
shape:[
@ -117,7 +121,7 @@ export const elementConst = {
name:'圆弧',
formList: {
style: [
...form2ShapeStyle
],
shape: [
@ -129,7 +133,7 @@ export const elementConst = {
name:'扇形',
formList: {
style: [
...form2ShapeStyle
],
shape: [
@ -141,7 +145,7 @@ export const elementConst = {
name:'心形',
formList: {
style: [
...form2ShapeStyle
],
shape: [
@ -153,7 +157,7 @@ export const elementConst = {
name:'水滴',
formList: {
style: [
...form2ShapeStyle
],
shape: [

View File

@ -4,7 +4,7 @@ export default [
{
prop: 'fill',
label: '填充样式',
type: types.String,
type: types.Color,
rules:[
{ required: true, message:'请输入填充样式', trigger: 'blur' }
],
@ -14,7 +14,7 @@ export default [
{
prop: 'stroke',
label: '描边样式',
type: types.String,
type: types.Color,
rules:[
{ required: true, message:'请输入描边样式', trigger: 'blur' }
],
@ -23,7 +23,7 @@ export default [
},
{
prop: 'opacity',
label: '描边样式',
label: '不透明度',
type: types.Number,
min: 0,
max: 1,
@ -37,7 +37,7 @@ export default [
},
{
prop: 'lineDash',
label: '描边样式',
label: '描边虚线',
type: types.NumberArray,
min: 0,
max: 100,
@ -60,7 +60,7 @@ export default [
rules:[
{ required: true, message:'请输入描边虚线偏移', trigger: 'blur' }
],
value: [0,0],
value: [0, 0],
description: '描边虚线偏移,参考 SVG stroke-dashoffset。'
},
{
@ -149,4 +149,4 @@ export default [
value: '',
description: '混合模式,同 Canvas globalCompositeOperation。'
}
]
];

View File

@ -5,8 +5,9 @@
{{ styleGroup.name }}
</div>
<template v-for="item in styleGroup.styleList">
<template v-if="checkFieldType(item, 'number')">
<el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required" class="formName">
<!-- {{ tempModel=styleGroup.code?formModel[styleGroup.code]:formModel }} -->
<template v-if="checkFieldType(item, 'Number')">
<el-input-number
v-if="item.precisionFlag"
v-model="formModel[styleGroup.code][item.prop]"
@ -24,17 +25,15 @@
:max="isNaN(item.max)? Infinity : item.max"
:step="isNaN(item.step) ? -Infinity : item.step"
/>
</el-form-item>
</template>
<template v-else-if="checkFieldType(item, 'switch')">
<el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required">
<template v-else-if="checkFieldType(item, 'Boolean')">
<el-switch
v-model="formModel[styleGroup.code][item.prop]"
:active-color="item.activeColor || '#409eff'"
:inactive-color="item.inactiveColor || '#dcdfe6'"
/>
</el-form-item>
</template>
</el-form-item>
</template>
</div>
</el-form>

View File

@ -14,10 +14,7 @@
@click="handleSave"
>保存</el-button>
</div>
<!-- <el-tabs v-model="enabledTab" class="mapEdit" type="card" @tab-click="handleTabClick">
<el-tab-pane v-for="(element,index) in elementList" :key="index" :label="element.name" :name="element.code">{{ element.name }}</el-tab-pane>
</el-tabs> -->
<el-tabs v-model="enabledTab" class="mapEdit" type="card" @tab-click="handleTabClick">
<el-tabs v-model="enabledTab" class="card" type="card" @tab-click="handleTabClick">
<el-tab-pane v-for="(element,index) in elementList" :key="index" :label="element.name" :name="element.code">
<data-form :ref="'dataform'+index" :form="element" :form-model="element.model" :rules="element.rules" />
</el-tab-pane>
@ -36,7 +33,7 @@ import IscsPlate from '@/views/iscsSystem/index';
// import {allElements} from '@/iscs_new/core/form/allElments';
import BuilderFactory from '@/iscs_new/core/form/builderFactory';
import DataForm from '../components/dataForm';
import { saveIscsElement } from '@/api/iscs';
// import { saveIscsElement } from '@/api/iscs';
export default {
name: 'IscsView',
@ -113,11 +110,22 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.card{
height: 100%;
display:flex;width: 100%;flex-direction: column
}
.card .el-tab-pane{
flex:1;
height: 100%;
overflow: auto;
}
.map-view {
float: left;
width: 100%;
}
.heightClass{height:100%;overflow:hidden;display:flex;width: 100%;flex-direction: column;}
.mapPaint{
height: 100%;
@ -169,3 +177,10 @@ export default {
}
}
</style>
<style lang="scss">
.heightClass .el-card__body{
flex:1;
height: 100%;
overflow: hidden;
}
</style>