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