修复了画布属性无法编辑bug编辑

This commit is contained in:
猴赛雷 2024-05-23 17:23:38 +08:00
parent a0ab6692de
commit 2c6b55c775
3 changed files with 88 additions and 55 deletions

View File

@ -93,6 +93,10 @@ export default {
max:{
type: Number,
default: 0
},
beforeCloseFile:{
type: Function,
default: null
}
, editor: {
type: DDeiEditor,
@ -105,7 +109,7 @@ export default {
openIndex: 0,
//
maxOpenSize: 1,
tempFile: null,
// tempFile: null,
unitFileWidth: 160,
// user: null,
forceRefresh:true
@ -123,8 +127,6 @@ export default {
for (let i = 0; i < this.editor.files.length; i++) {
if (this.editor.files[i].active == DDeiActiveType.ACTIVE) {
activeIndex = i;
// this.applyFilePromise(this.editor.files[i])
this.editor.bus.push(DDeiEditorEnumBusCommandType.RefreshEditorParts, {
parts: ["toolbox", "property"]
});
@ -227,6 +229,7 @@ export default {
this.editor.addFile(file);
this.editor.currentFileIndex = this.editor.files.length - 1;
let sheets = file?.sheets;
if (file && sheets && ddInstance) {
let stage = sheets[0].stage;
stage.ddInstance = ddInstance;
@ -254,6 +257,11 @@ export default {
this.editor.changeState(DDeiEditorState.DESIGNING);
ddInstance?.bus?.executeAll();
}
if (this.editor.files.length == 0) {
ddInstance.disabled = true
} else {
ddInstance.disabled = false
}
}
},
@ -486,66 +494,78 @@ export default {
ddInstance.bus.push(DDeiEditorEnumBusCommandType.RefreshEditorParts, {});
ddInstance.bus.executeAll();
}
},
/**
* 放弃并关闭确认弹框
*/
abortAndCloseFileConfirmDialog() {
this.tempFile.state = DDeiFileState.NONE;
this.closeFile(this.tempFile);
},
/**
* 保存
* @param evt
*/
saveAndCloseFileConfirmDialog() {
if (this.tempFile) {
//json
let file = this.tempFile;
if (file) {
let json = file.toJSON();
if (json) {
//
let storeIns = new DDeiStoreLocal();
json.state = DDeiFileState.NONE;
storeIns.save(file.id, json).then((data) => {
//ID
file.id = data;
file.state = DDeiFileState.NONE;
this.closeFile(this.tempFile);
});
}
}
if (this.editor.files.length == 0) {
ddInstance.disabled = true
} else {
ddInstance.disabled = false
}
},
// /**
// *
// */
// abortAndCloseFileConfirmDialog() {
// this.tempFile.state = DDeiFileState.NONE;
// this.closeFile(this.tempFile);
// },
// /**
// *
// * @param evt
// */
// saveAndCloseFileConfirmDialog() {
// if (this.tempFile) {
// //json
// let file = this.tempFile;
// if (file) {
// let json = file.toJSON();
// if (json) {
// //
// let storeIns = new DDeiStoreLocal();
// json.state = DDeiFileState.NONE;
// storeIns.save(file.id, json).then((data) => {
// //ID
// file.id = data;
// file.state = DDeiFileState.NONE;
// this.closeFile(this.tempFile);
// });
// }
// }
// }
// },
/**
* 关闭文件
* @param instance
*/
closeFile(file, evt) {
//
if (
file.state == DDeiFileState.NEW ||
file.state == DDeiFileState.MODIFY
) {
DDeiEditorUtil.showDialog(this.editor, "ddei-core-dialog-closefile", {
msg: '是否保存对"' + file.name + '"的更改?',
callback: {
abort: this.abortAndCloseFileConfirmDialog,
ok: this.saveAndCloseFileConfirmDialog,
},
background: "white",
opacity: "1%",
event: -1
})
this.tempFile = file;
} else {
let canClose = true;
if (this.beforeCloseFile){
canClose = this.beforeCloseFile(file)
}
if(canClose){
// if (
// file.state == DDeiFileState.NEW ||
// file.state == DDeiFileState.MODIFY
// ) {
// DDeiEditorUtil.showDialog(this.editor, "ddei-core-dialog-closefile", {
// msg: '"' + file.name + '"',
// callback: {
// abort: this.abortAndCloseFileConfirmDialog,
// ok: this.saveAndCloseFileConfirmDialog,
// },
// background: "white",
// opacity: "1%",
// event: -1
// })
// this.tempFile = file;
// } else {
//
let index = this.editor.files.indexOf(file);
this.editor.removeFile(file);
@ -571,6 +591,7 @@ export default {
}
}
}
// }
},
/**
* 在存在显示隐藏的情况下移动tab

View File

@ -179,10 +179,21 @@ export default {
firstControlDefine = this.editor.currentControlDefine
}
}
//
if (firstControlDefine) {
let topGroups = null;
if (firstControlDefine.type == "DDeiStage") {
firstControlDefine.attrDefineMap.forEach((attrDefine, attrKey) => {
//
attrDefine.value = DDeiUtil.getDataByPathList(
firstModel,
attrDefine.code,
attrDefine.mapping
);
attrDefine.model = firstModel;
});
//layer
let layerControlDefine = cloneDeep(
this.editor.controls.get("DDeiLayer")
@ -190,6 +201,7 @@ export default {
let layer = firstModel.layers[firstModel.layerIndex];
layerControlDefine.attrDefineMap.forEach((attrDefine, attrKey) => {
//
attrDefine.value = DDeiUtil.getDataByPathList(
layer,
attrDefine.code,

View File

@ -34,7 +34,7 @@ export default defineComponent({
})
const options1 = markRaw({
config: {
"readonly":true,
// "readonly":true,
"mark": "水印文本",
"grid": 2,
"paper": {type:"A6",direct:1},