iscs 代码调整
This commit is contained in:
parent
1a017ceed0
commit
2e45db73e5
@ -39,7 +39,7 @@
|
||||
<template v-else-if="checkFieldType(item, 'NumberArray')">
|
||||
<el-input-number
|
||||
v-for="count in item.length"
|
||||
:key="count"
|
||||
:key="parentProp+'.'+item.prop+''+count"
|
||||
v-model="data[item.prop][count-1]"
|
||||
style="margin:6px 0px 0px 5px"
|
||||
size="small"
|
||||
@ -97,6 +97,7 @@
|
||||
:maxlength="item.maxlength"
|
||||
/>
|
||||
</template>
|
||||
<span class="el-icon-error deleteCurrent" @click="deleteCurrent(item.prop)" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<script>
|
||||
@ -140,7 +141,23 @@ export default {
|
||||
methods:{
|
||||
checkFieldType(field, type) {
|
||||
return field.type === type;
|
||||
},
|
||||
deleteCurrent(prop) {
|
||||
this.$emit('deleteShape', {styleType:this.styleType, data:this.data, prop:prop});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.deleteCurrent{
|
||||
font-size: 20px;
|
||||
color: #f00;
|
||||
margin-left: 15px;
|
||||
vertical-align: top;
|
||||
display: inline-flex;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
margin-top: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
@ -24,21 +24,35 @@
|
||||
</div>
|
||||
<div v-if="props.row.style" class="styleInList">
|
||||
<div v-for="(eachStyleInfo,index) in Object.keys(props.row.style)" :key="index" class="eachStyleInfo">
|
||||
<each-form-item :prop="eachStyleInfo" :data="props.row.style" :type="formModel.type" style-type="style" :parent-prop="'stateList.'+props.$index+'.style'" />
|
||||
<each-form-item
|
||||
:prop="eachStyleInfo"
|
||||
:data="formModel.stateList[props.$index].style"
|
||||
:type="formModel.type"
|
||||
style-type="style"
|
||||
:parent-prop="'stateList.'+props.$index+'.style'"
|
||||
@deleteShape="deleteShape"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shapeList">
|
||||
<div class="shapeListName">绘图</div>
|
||||
<div class="addStyleForm">
|
||||
<el-select v-model="defaultShapeSelect" size="mini">
|
||||
<el-select v-model="props.row.defaultShapeSelect" size="mini">
|
||||
<el-option v-for="(eachShape) in shapeSelectList" :key="eachShape.value" :label="eachShape.label" :value="eachShape.value" />
|
||||
</el-select>
|
||||
<el-button type="primary" size="mini" class="addStyle" @click="addShape(props.$index)">添加</el-button>
|
||||
</div>
|
||||
<div v-if="props.row.Shape" class="styleInList">
|
||||
<div v-for="(eachShapeInfo,index) in Object.keys(props.row.Shape)" :key="index" class="eachStyleInfo">
|
||||
<each-form-item :prop="eachShapeInfo" :data="props.row.Shape" :type="formModel.type" style-type="shape" :parent-prop="'stateList.'+props.$index+'.shape'" />
|
||||
<each-form-item
|
||||
:prop="eachShapeInfo"
|
||||
:data="formModel.stateList[props.$index].shape"
|
||||
:type="formModel.type"
|
||||
style-type="shape"
|
||||
:parent-prop="'stateList.'+props.$index+'.shape'"
|
||||
@deleteShape="deleteShape"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -92,11 +106,10 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formModel:{stateList:this.composeElem.stateList, style:this.composeElem.style, type:this.composeElem.type, shape:this.composeElem.shape},
|
||||
formModel:this.composeElem,
|
||||
// {stateList:this.composeElem.stateList, style:this.composeElem.style, type:this.composeElem.type, shape:this.composeElem.shape}
|
||||
styleSelectList:[],
|
||||
shapeSelectList:[],
|
||||
// defaultStyleSelect:'',
|
||||
defaultShapeSelect:'',
|
||||
expandKeys:[]
|
||||
};
|
||||
},
|
||||
@ -107,7 +120,6 @@ export default {
|
||||
const eachStyle = style.find(each=>{ return each.prop == eachStyleName; });
|
||||
this.styleSelectList.push({value:eachStyleName, label:eachStyle.label});
|
||||
});
|
||||
// this.defaultStyleSelect = this.styleSelectList[0].value;
|
||||
|
||||
const shapeNameList = Object.keys(this.formModel.shape);
|
||||
const shape = elementConst[this.formModel.type]['formList']['shape'];
|
||||
@ -115,13 +127,17 @@ export default {
|
||||
const eachShape = shape.find(each=>{ return each.prop == eachShapeName; });
|
||||
this.shapeSelectList.push({value:eachShapeName, label:eachShape.label});
|
||||
});
|
||||
this.defaultShapeSelect = this.shapeSelectList[0].value;
|
||||
this.formModel.stateList.forEach(each=>{
|
||||
each.defaultStyleSelect = this.styleSelectList[0].value;
|
||||
each.defaultShapeSelect = this.shapeSelectList[0].value;
|
||||
});
|
||||
|
||||
},
|
||||
methods:{
|
||||
addStatus() {
|
||||
const length = this.formModel.stateList.length;
|
||||
this.formModel.stateList.push({id:length + 1, status:'', description:'', defaultStyleSelect:this.styleSelectList[0].value});
|
||||
this.formModel.stateList.push({id:length + 1, status:'', description:'', defaultStyleSelect:this.styleSelectList[0].value,
|
||||
defaultShapeSelect:this.shapeSelectList[0].value});
|
||||
this.expandKeys.push(length + 1);
|
||||
},
|
||||
deleteStatus(index, row) {
|
||||
@ -135,8 +151,9 @@ export default {
|
||||
this.$set(this.formModel.stateList[index], 'style', {});
|
||||
}
|
||||
const data = this.formModel.stateList[index];
|
||||
if (!data.style[data.defaultStyleSelect]) {
|
||||
this.$set(this.formModel.stateList[index].style, data.defaultStyleSelect, this.formModel.style[data.defaultStyleSelect]);
|
||||
if (!data.style[data.defaultStyleSelect] && data.defaultStyleSelect) {
|
||||
const other = this.formModel.style[data.defaultStyleSelect];
|
||||
this.$set(this.formModel.stateList[index].style, data.defaultStyleSelect, other);
|
||||
}
|
||||
},
|
||||
addShape(index) {
|
||||
@ -145,8 +162,9 @@ export default {
|
||||
this.$set(this.formModel.stateList[index], 'shape', {});
|
||||
}
|
||||
const data = this.formModel.stateList[index];
|
||||
if (!data.shape[data.defaultStyleSelect]) {
|
||||
this.$set(this.formModel.stateList[index].style, data.defaultStyleSelect, this.formModel.shape[data.defaultStyleSelect]);
|
||||
if (!data.shape[data.defaultShapeSelect] && data.defaultShapeSelect) {
|
||||
const other = this.formModel.shape[data.defaultShapeSelect];
|
||||
this.$set(this.formModel.stateList[index].shape, data.defaultShapeSelect, other);
|
||||
}
|
||||
},
|
||||
expandChange(row, expandedRows) {
|
||||
@ -154,6 +172,9 @@ export default {
|
||||
expandedRows.forEach(each=>{
|
||||
this.expandKeys.push(each.id);
|
||||
});
|
||||
},
|
||||
deleteShape({styleType, data, prop}) {
|
||||
this.$delete(data, prop);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -196,6 +217,7 @@ export default {
|
||||
margin-top: 15px;
|
||||
padding-left: 30px;
|
||||
}
|
||||
// .eachStyleInfo .el-form-item{border-bottom: 1px #dedede solid;}
|
||||
</style>
|
||||
<style lang="sass">
|
||||
.eachStatusTable .el-table__expanded-cell{padding: 20px;}
|
||||
|
@ -201,8 +201,10 @@ export default {
|
||||
onSaveStatus() {
|
||||
this.$refs['tableform' + this.statusTab][0].$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const formModel = this.$refs['tableform' + this.statusTab][0].formModel;
|
||||
formModel.stateList.map(state=>{ delete state.defaultStyleSelect; });
|
||||
const model = utils.deepClone(this.$refs['tableform' + this.statusTab][0].formModel);
|
||||
model.stateList.map(state=>{ delete state.defaultStyleSelect; delete state.defaultShapeSelect; });
|
||||
debugger;
|
||||
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.Update}}]);
|
||||
this.onSave();
|
||||
}
|
||||
});
|
||||
|
@ -10,6 +10,7 @@ import Iscs from '@/iscs_new/map';
|
||||
import Idb from '../utils/indexedDb.js';
|
||||
import ShapeBuilder from '@/iscs_new/plugins/shapeBuilder';
|
||||
import ShapeProperty from '@/iscs_new/plugins/shapeProperty';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import ShapeContextMenu from '@/iscs_new/plugins/shapeContextMenu';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
@ -104,6 +105,7 @@ export default {
|
||||
elementList: resp.elementList||[],
|
||||
composeList: resp.composeList||[]
|
||||
}, option);
|
||||
EventBus.$emit('getComposeElemList');
|
||||
}).catch(error => {
|
||||
this.$iscs.setMap([], {
|
||||
elementList: [],
|
||||
|
Loading…
Reference in New Issue
Block a user