diff --git a/packages/editor/src/components/NavList.vue b/packages/editor/src/components/NavList.vue index 651b84b..02ccb9e 100644 --- a/packages/editor/src/components/NavList.vue +++ b/packages/editor/src/components/NavList.vue @@ -78,7 +78,6 @@ setup(props) { const { proxy } = getCurrentInstance() as any; const { hisContrl, uiControl, formStore } = inject("control") || {}; - const lastTime = computed(() => formStore?.get("saveTimetemp")); const clearIsDisable = computed(() => formStore?.get("allFormList")?.length == 0); const historyIndex = computed(() => hisContrl?.get("index")); const historyLen = computed(() => hisContrl?.get>("historyList").length || 0); @@ -100,6 +99,7 @@ id: string; label: string; children?: Tree[]; + name?: string; } const initTree = () => { if (allFormList.value && allFormList.value.length > 0) { @@ -115,7 +115,7 @@ if (!item.layout) { return { id: item.id, - label: item.ControlType + "_" + item.data.fieldName, + label: item.nameCn, }; } else { let children; @@ -138,13 +138,13 @@ }); return { id: "", - label: "table_Column", + label: "列", children, }; }); return { id: "", - label: "table_Row", + label: "行", children, }; }); @@ -155,14 +155,14 @@ }); return { id: "", - label: item.ControlType + "_child", + label: item.nameCn + '-child', children, }; }); } return { id: item.id, - label: item.ControlType + "_" + item.data.fieldName, + label: item.nameCn, children, }; } @@ -183,10 +183,7 @@ const setTimeSave = () => { timer = setInterval(() => { - const nowTime = new Date().getTime(); - if (nowTime - lastTime.value > 5 * 60 * 1000) { - handleFormSave("auto"); - } + handleFormSave("auto"); }, 20000); }; diff --git a/packages/editor/src/components/PropsPanel.vue b/packages/editor/src/components/PropsPanel.vue index 77d2740..93e6ff2 100644 --- a/packages/editor/src/components/PropsPanel.vue +++ b/packages/editor/src/components/PropsPanel.vue @@ -168,6 +168,8 @@ const checkValidates = async (formSave = false, type?: string) => { const curControlIndex = formStore?.get("currentIndex"); + // 预览模式下不自动保存 + if(type && preview.value)return; if (preview.value || save.value || formUpdate.value) { const ispreview = await checkFormValidate(allFormList.value); if (ispreview) { @@ -176,8 +178,8 @@ formStore?.setSave(ispreview as boolean); formStore?.setFormUpdate(false); if (ispreview) { - const result: BaseComponentItem[] = initFormToJson(allFormList.value); debugger + const result: BaseComponentItem[] = initFormToJson(allFormList.value); formStore?.set("AllFormResult", result); formStore?.handleDynamicForm(); emit("save"); diff --git a/packages/editor/src/controller/form.ts b/packages/editor/src/controller/form.ts index 65df7cf..9cfd528 100644 --- a/packages/editor/src/controller/form.ts +++ b/packages/editor/src/controller/form.ts @@ -10,7 +10,6 @@ const state = reactive({ preview: false, // 开启预览进行表单验证 previewShow: false, // 预览是否展示 save: false, // 保存 - saveTimetemp: new Date().getTime(), //上一次保存的时间戳 // 下一次保存的时候判断表单是否变更了,而不用变更就改变vuex的save,但是我们监听了save会形成死循环 formUpdate: false, // 判断表单是否更新 AllFormResult: [], // 预览和存储到数据库最终结果 diff --git a/packages/editor/src/shims-vue.d.ts b/packages/editor/src/shims-vue.d.ts index 89fd87b..705ab72 100644 --- a/packages/editor/src/shims-vue.d.ts +++ b/packages/editor/src/shims-vue.d.ts @@ -5,7 +5,6 @@ declare module "*.vue" { export default component; } - declare module 'starfish-form' declare module "jsoneditor"; diff --git a/packages/editor/src/starfish-editor.vue b/packages/editor/src/starfish-editor.vue index e8d54f5..34971a1 100644 --- a/packages/editor/src/starfish-editor.vue +++ b/packages/editor/src/starfish-editor.vue @@ -16,7 +16,7 @@ @@ -85,6 +85,7 @@ }, setup(props:any, { emit }) { const workspace = ref(); + const formPreview = ref(); let dom: HTMLDivElement; const mouseenterHandler = () => { dom?.focus(); @@ -119,6 +120,7 @@ provide("control", control); return { workspace, + formPreview, onSave() { emit("save", formStore?.get("AllFormResult")); }, diff --git a/packages/editor/src/styles/custom-dialog.scss b/packages/editor/src/styles/custom-dialog.scss index 67b9d28..53d17bc 100644 --- a/packages/editor/src/styles/custom-dialog.scss +++ b/packages/editor/src/styles/custom-dialog.scss @@ -104,6 +104,12 @@ text-align: right; padding-top: 3px; border-top: 1px solid #ebeef5; + position: absolute; + bottom: 0; + width: 100%; + display: flex; + align-items: center; + justify-content: flex-end; } } } diff --git a/packages/editor/src/styles/nav-list.scss b/packages/editor/src/styles/nav-list.scss index e699605..1a1d9f7 100644 --- a/packages/editor/src/styles/nav-list.scss +++ b/packages/editor/src/styles/nav-list.scss @@ -28,10 +28,14 @@ width: 20% !important; } } - .codeDialog { - height: auto; - .custom_code { - height: 100%; +} +.codeDialog { + height: auto; + .custom_code { + height: 100%; + flex: 1; + .upload-demo { + margin-top: 20px; } } } diff --git a/packages/editor/src/type.ts b/packages/editor/src/type.ts index 0dbcd80..5b861e9 100644 --- a/packages/editor/src/type.ts +++ b/packages/editor/src/type.ts @@ -128,10 +128,7 @@ export interface FormState { * 保存 */ save: boolean; - /** - * 上一次保存的时间戳 - */ - saveTimetemp: number; + /** * 下一次保存的时候判断表单是否变更了,而不用变更就改变save,但是我们监听了save会形成死循环 * 判断表单是否更新 diff --git a/packages/editor/tsconfig.json b/packages/editor/tsconfig.json index 8114588..98c2b08 100644 --- a/packages/editor/tsconfig.json +++ b/packages/editor/tsconfig.json @@ -2,13 +2,22 @@ "extends": "../../tsconfig.json", "compilerOptions": { "baseUrl": "../..", + "paths": { + "~editor/*": [ + "./src/pages/Editor/components/*" + ], + "@/*": [ + "./src/*" + ] + }, }, - "paths": { - "~editor/*": [ - "src/pages/Editor/components/*" - ], - "@/*": [ - "src/*" - ] - } + + "exclude": [ + "node_modules", + ], + "include": [ + "*", + "./src/env.d.ts", + "./src" + ] } diff --git a/packages/form/src/layout/Info.vue b/packages/form/src/layout/Info.vue index f5f746e..32b39bf 100644 --- a/packages/form/src/layout/Info.vue +++ b/packages/form/src/layout/Info.vue @@ -2,26 +2,43 @@
- +
- +
diff --git a/packages/form/src/layout/collapse.vue b/packages/form/src/layout/collapse.vue index 7506a20..8460ab0 100644 --- a/packages/form/src/layout/collapse.vue +++ b/packages/form/src/layout/collapse.vue @@ -3,21 +3,21 @@
- +