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:{
|
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
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user