代码调整

This commit is contained in:
joylink_cuiweidong 2021-04-22 14:55:11 +08:00
parent f34617b7db
commit c1356549ec
4 changed files with 92 additions and 63 deletions

View File

@ -2,7 +2,7 @@
<transition name="el-zoom-in-center">
<div class="mapPaint">
<div class="map-view">
<iscs-canvas ref="iscsCanvas" @selected="onSelected" />
<iscs-canvas ref="iscsCanvas" @selected="onSelected" @setStateList="setStateList" />
</div>
<div class="right-card" :class="{'hide': draftShow}">
<div class="btn_draft_box" @click="draftShow = !draftShow"><i :class="draftShow?'el-icon-arrow-right':'el-icon-arrow-left'" /></div>
@ -58,7 +58,7 @@
</el-tabs>
</el-card>
</div>
<status-list ref="statusList" />
<status-list ref="statusList" @setStateList="setStateList" />
</div>
</transition>
</template>
@ -162,9 +162,8 @@ export default {
onSelectCardTab() {
},
saveStateList(stateList) {
setStateList(stateList) {
this.stateList = stateList;
this.onSave();
},
onSelected(em) {
if (em.model) {

View File

@ -97,22 +97,23 @@ export default {
selecting: true,
selectable: true,
reflect: true
}
};
if (this.$route.query.id) {
setTimeout(_ => {
Idb.select('composeTemplateList', this.$route.query.id).then(resp => {
this.$iscs.setMap([], {
elementList: resp.shapeList||[],
composeList: resp.composeList||[]
elementList: resp.shapeList || [],
composeList: resp.composeList || []
}, option);
EventBus.$emit('getComposeElemList');
this.$emit('setStateList', resp.stateList);
}).catch(error => {
this.$iscs.setMap([], {
elementList: [],
composeList: []
}, option);
})
}, 1000)
});
}, 1000);
} else {
this.$iscs.setMap([], {
elementList: [],
@ -138,14 +139,14 @@ export default {
console.log(hook);
},
//
onClick(em={}) {
onClick(em = {}) {
this.$emit('selected', em);
},
onReflect(em={}) {
onReflect(em = {}) {
this.$emit('selected', this.$iscs.getShapeByCode(em.code));
},
//
onContextMenu(em={}) {
onContextMenu(em = {}) {
this.$emit('contextMenu', em.model);
},
//
@ -169,7 +170,7 @@ export default {
this.$iscs = null;
Vue.prototype.$iscs = null;
}
},
}
}
};
</script>

View File

@ -66,6 +66,7 @@
<template slot-scope="scope">
<el-button type="success" size="mini" @click="modifyStatus(scope.$index,scope.row)">编辑状态组合</el-button>
<el-button type="danger" size="mini" style="margin-top:5px;" @click="deleteStatus(scope.$index,scope.row)">删除</el-button>
<el-button type="primary" size="mini" style="margin-top:5px;" @click="previewStatus(scope.$index,scope.row)">预览</el-button>
</template>
</el-table-column>
</el-table>
@ -133,15 +134,16 @@
<!-- 元素 -->
<!-- <div /> -->
<div v-if="scope.row.loop" style="margin-bottom:10px">
<div style="display:inline-block">当前动画帧</div>
<el-input-number
<!-- <div style="display:inline-block">当前动画帧{{ scope.row.frameId }}</div> -->
<el-button type="primary" size="mini" class="addStyle" @click="addElementFrameId(scope.$index,scope.row.frameId)">添加帧</el-button>
<!-- <el-input-number
v-model="scope.row.frameId"
:min="1"
:max="10"
size="mini"
:step="1"
:precision="0"
/>
/> -->
</div>
<el-select
v-model="scope.row.selectedElement"
@ -238,6 +240,8 @@ export default {
this.model.stateList = that.formModel.stateList;
Idb.delete('composeTemplateList', this.model.id);
Idb.write('composeTemplateList', this.model);
that.show = false;
this.$emit('setStateList', that.formModel.stateList);
}
});
},
@ -257,7 +261,7 @@ export default {
},
addCovertStatus() {
if (this.defaultLoop) {
this.statusModel.covertStatusList.push({loop:this.defaultLoop, delay:2, animateTime:10, frameList:[], statusList:[], selectedElement:'', selectedElementStatus:'', frameId:1 });
this.statusModel.covertStatusList.push({loop:this.defaultLoop, delay:2, animateTime:10, frameList:[], statusList:[], selectedElement:'', selectedElementStatus:'', frameId:null });
} else {
this.statusModel.covertStatusList.push({loop:this.defaultLoop, frameList:[], statusList:[], selectedElementStatus:'', selectedElement:'' });
}
@ -276,6 +280,14 @@ export default {
deleteCovertStatus(index, row) {
this.statusModel.covertStatusList.splice(index, 1);
},
addElementFrameId(index, frameId) {
if (frameId) {
this.statusModel.covertStatusList[index].frameId = frameId + 1;
} else {
this.statusModel.covertStatusList[index].frameId = 1;
}
this.statusModel.covertStatusList[index].frameList.push([]);
},
addElementStatus(index, loop) {
const frameList = this.statusModel.covertStatusList[index].frameList || [];
const temp = this.statusModel.covertStatusList[index];
@ -290,7 +302,7 @@ export default {
});
}
if (curFrameIndex < 0) {
this.statusModel.covertStatusList[index].frameList.push([]);
// this.statusModel.covertStatusList[index].frameList.push([]);
this.statusModel.covertStatusList[index].frameList[temp.frameId - 1].push({name:this.statusModel.covertStatusList[index].selectedElement,
status:this.statusModel.covertStatusList[index].selectedElementStatus});
}
@ -321,6 +333,24 @@ export default {
});
}
},
previewStatus(index, row) {
// const that = this;
// if(needDefault)
const list = Object.values(row.covertStatusList);
list.forEach(each=>{
if (each.loop) {
} else {
const frameList = each.frameList;
frameList.forEach(frame=>{
// frame.name;
// frame.status;
// this.$iscs.
});
}
});
// this.show = false;
}
}
};

View File

@ -56,7 +56,6 @@ export default {
source.elementList.length) {
this.composeElemList = source.elementList;
this.statusTab = this.composeElemList[0].code;
debugger;
} else {
this.composeElemList = [];
}