组件模块代码调整
This commit is contained in:
parent
a9a08c74d3
commit
226595ea84
@ -38,14 +38,13 @@ export default {
|
||||
const res = await getCircuitryDraftDataById(this.$route.params.id);
|
||||
const resp = await getModelListUnpage();
|
||||
this.modelList = resp.data;
|
||||
this.modelList.forEach(item => {
|
||||
this.composeMap[item.code] = item;
|
||||
});
|
||||
if (res.data.drawData) {
|
||||
const data = JSON.parse(res.data.drawData);
|
||||
this.model = data.model || [];
|
||||
data.compose.forEach(item => {
|
||||
const compose = this.modelList.find(elem => elem.code === item);
|
||||
this.composeMap[item] = compose;
|
||||
});
|
||||
this.$refs.jlPictureBuilder.setMap(this.model, this.composeMap);
|
||||
this.$refs.jlPictureBuilder.setMap(this.model);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -55,7 +54,8 @@ export default {
|
||||
save(model) {
|
||||
const data = {
|
||||
id: this.$route.params.id,
|
||||
drawData: JSON.stringify({ model:this.model, compose: Object.keys(this.composeMap) })
|
||||
// compose: Object.keys(this.composeMap)
|
||||
drawData: JSON.stringify({ model:this.model })
|
||||
};
|
||||
updateCircuitryDraft(this.$route.params.id, data).then(resp => {
|
||||
this.$message.success('保存草稿数据成功!');
|
||||
@ -64,9 +64,9 @@ export default {
|
||||
});
|
||||
},
|
||||
addModel(model) {
|
||||
if (!this.composeMap[model.code]) {
|
||||
this.composeMap[model.code] = JSON.parse(model.jsonData);
|
||||
}
|
||||
// if (!this.composeMap[model.code]) {
|
||||
// this.composeMap[model.code] = JSON.parse(model.jsonData);
|
||||
// }
|
||||
const addModel = {
|
||||
code: this.getUID(model.code),
|
||||
position: [100, 100],
|
||||
@ -74,7 +74,8 @@ export default {
|
||||
name: model.name,
|
||||
rotation: 0,
|
||||
scale: [1, 1],
|
||||
shapeList: this.composeMap[model.code].shapeList
|
||||
modifyAttritubes:{}
|
||||
// shapeList: this.composeMap[model.code].shapeList
|
||||
};
|
||||
this.model.push(addModel);
|
||||
this.$refs.jlPictureBuilder.update([{model: addModel, action:{order:'&Add', shapeType: 'Compose'}}]);
|
||||
@ -106,8 +107,8 @@ export default {
|
||||
type: model.type,
|
||||
name: model.name,
|
||||
rotation: model.rotation,
|
||||
scale: model.scale,
|
||||
shapeList: this.composeMap[model.code].shapeList
|
||||
scale: model.scale
|
||||
// shapeList: this.composeMap[model.code].shapeList
|
||||
};
|
||||
const index = this.model.findIndex(item => item.code === model.code);
|
||||
this.model.splice(index, 1, updateModel);
|
||||
|
Loading…
Reference in New Issue
Block a user