mirror of
https://gitee.com/hoslay/ddei-editor.git
synced 2025-12-07 17:48:32 +08:00
修复了画布属性无法编辑bug编辑
This commit is contained in:
parent
a0ab6692de
commit
2c6b55c775
@ -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,43 +494,48 @@ export default {
|
||||
ddInstance.bus.push(DDeiEditorEnumBusCommandType.RefreshEditorParts, {});
|
||||
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);
|
||||
},
|
||||
// /**
|
||||
// * 放弃并关闭确认弹框
|
||||
// */
|
||||
// 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) {
|
||||
// /**
|
||||
// * 保存
|
||||
// * @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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// //执行保存
|
||||
// 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);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
/**
|
||||
* 关闭文件
|
||||
@ -530,22 +543,29 @@ export default {
|
||||
*/
|
||||
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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -34,7 +34,7 @@ export default defineComponent({
|
||||
})
|
||||
const options1 = markRaw({
|
||||
config: {
|
||||
"readonly":true,
|
||||
// "readonly":true,
|
||||
"mark": "水印文本",
|
||||
"grid": 2,
|
||||
"paper": {type:"A6",direct:1},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user