修复了画布属性无法编辑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:{ max:{
type: Number, type: Number,
default: 0 default: 0
},
beforeCloseFile:{
type: Function,
default: null
} }
, editor: { , editor: {
type: DDeiEditor, type: DDeiEditor,
@ -105,7 +109,7 @@ export default {
openIndex: 0, openIndex: 0,
// //
maxOpenSize: 1, maxOpenSize: 1,
tempFile: null, // tempFile: null,
unitFileWidth: 160, unitFileWidth: 160,
// user: null, // user: null,
forceRefresh:true forceRefresh:true
@ -123,8 +127,6 @@ export default {
for (let i = 0; i < this.editor.files.length; i++) { for (let i = 0; i < this.editor.files.length; i++) {
if (this.editor.files[i].active == DDeiActiveType.ACTIVE) { if (this.editor.files[i].active == DDeiActiveType.ACTIVE) {
activeIndex = i; activeIndex = i;
// this.applyFilePromise(this.editor.files[i])
this.editor.bus.push(DDeiEditorEnumBusCommandType.RefreshEditorParts, { this.editor.bus.push(DDeiEditorEnumBusCommandType.RefreshEditorParts, {
parts: ["toolbox", "property"] parts: ["toolbox", "property"]
}); });
@ -227,6 +229,7 @@ export default {
this.editor.addFile(file); this.editor.addFile(file);
this.editor.currentFileIndex = this.editor.files.length - 1; this.editor.currentFileIndex = this.editor.files.length - 1;
let sheets = file?.sheets; let sheets = file?.sheets;
if (file && sheets && ddInstance) { if (file && sheets && ddInstance) {
let stage = sheets[0].stage; let stage = sheets[0].stage;
stage.ddInstance = ddInstance; stage.ddInstance = ddInstance;
@ -254,6 +257,11 @@ export default {
this.editor.changeState(DDeiEditorState.DESIGNING); this.editor.changeState(DDeiEditorState.DESIGNING);
ddInstance?.bus?.executeAll(); 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.push(DDeiEditorEnumBusCommandType.RefreshEditorParts, {});
ddInstance.bus.executeAll(); ddInstance.bus.executeAll();
} }
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);
});
}
}
} }
}, },
// /**
// *
// */
// 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 * @param instance
*/ */
closeFile(file, evt) { closeFile(file, evt) {
// //
if ( let canClose = true;
file.state == DDeiFileState.NEW || if (this.beforeCloseFile){
file.state == DDeiFileState.MODIFY canClose = this.beforeCloseFile(file)
) { }
DDeiEditorUtil.showDialog(this.editor, "ddei-core-dialog-closefile", { if(canClose){
msg: '是否保存对"' + file.name + '"的更改?',
callback: {
abort: this.abortAndCloseFileConfirmDialog, // if (
ok: this.saveAndCloseFileConfirmDialog, // file.state == DDeiFileState.NEW ||
}, // file.state == DDeiFileState.MODIFY
background: "white", // ) {
opacity: "1%", // DDeiEditorUtil.showDialog(this.editor, "ddei-core-dialog-closefile", {
event: -1 // msg: '"' + file.name + '"',
}) // callback: {
this.tempFile = file; // abort: this.abortAndCloseFileConfirmDialog,
} else { // ok: this.saveAndCloseFileConfirmDialog,
// },
// background: "white",
// opacity: "1%",
// event: -1
// })
// this.tempFile = file;
// } else {
// //
let index = this.editor.files.indexOf(file); let index = this.editor.files.indexOf(file);
this.editor.removeFile(file); this.editor.removeFile(file);
@ -571,6 +591,7 @@ export default {
} }
} }
} }
// }
}, },
/** /**
* 在存在显示隐藏的情况下移动tab * 在存在显示隐藏的情况下移动tab

View File

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

View File

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