From 92ae61ba1cbffa4f56862f0bbe3815f2ff9874ff Mon Sep 17 00:00:00 2001 From: yangchunlong <292345300@qq.com> Date: Fri, 12 Sep 2025 17:55:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=9A=80=20=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 ++ src/components.d.ts | 4 + .../EpicDesigner/businessUi/Test/index.ts | 56 +++ .../EpicDesigner/businessUi/Test/index.vue | 345 ++++++++++++++++++ .../src/modules/rightSidebar/index.vue | 1 - .../EpicDesigner/components/node/src/node.vue | 1 - .../EpicDesigner/components/tree/src/tree.vue | 2 +- .../extensions/EOptionsEditor/index.vue | 1 + .../EpicDesigner/extensions/index.ts | 8 +- .../EpicDesigner/ui/button/button.ts | 2 +- src/components/EpicDesigner/ui/card/card.ts | 1 + src/components/EpicDesigner/ui/index.ts | 3 - src/views/home/index.vue | 9 + 13 files changed, 455 insertions(+), 10 deletions(-) create mode 100644 src/components/EpicDesigner/businessUi/Test/index.ts create mode 100644 src/components/EpicDesigner/businessUi/Test/index.vue diff --git a/README.md b/README.md index 66eed70..c51e226 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,35 @@ dev(开发分支,用于开环境、解决冲突,来源于其他开发分支) 分支拉取请从 pro 分支进行拉取! 冲突请在 dev 分支解决,解决冲突后再合并测试分支 + +# EpicDesigner + +├── index.ts # 入口文件,导出核心组件并初始化 +├── index.less # 全局样式 +├── components/ # 核心组件目录 +│ ├── builder/ # 构建器组件(EBuilder) +│ ├── designer/ # 设计器主组件(EDesigner) +│ │ └── src/ +│ │ ├── modules/ # 设计器模块(组件面板、属性面板等) +│ ├── node/ # 节点组件(ENode,用于渲染设计元素) +│ └── tree/ # 树形组件(ETree,用于展示结构大纲) +├── extensions/ # 扩展组件目录 +│ ├── EInputSize/ # 输入尺寸组件 +│ ├── MonacoEditor/ # 代码编辑器组件 +│ ├── Page/ # 页面组件 +│ └── index.ts # 扩展组件注册逻辑 +├── ui/ # 基础 UI 组件目录 +│ ├── dept/ # 部门/人员选择组件 +│ ├── form/ # 表单组件 +│ ├── input/ # 输入框组件 +│ ├── row/ # 栅格布局组件 +│ ├── upload-file/ # 文件上传组件 +│ └── upload-image/ # 图片上传组件 +├── utils/ # 工具函数目录 +│ ├── manager/ # 管理器(插件、页面状态等) +│ ├── common/ # 通用工具(数据处理、DOM 操作等) +│ └── shareStore/ # 共享状态管理 +├── types/ # 类型定义目录 +│ └── epic-designer.ts # 核心类型(组件结构、设计器状态等) +├── theme/ # 主题相关(推测) +└── static/ # 静态资源(推测) diff --git a/src/components.d.ts b/src/components.d.ts index e14c367..6d1db32 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -7,6 +7,7 @@ export {} declare module "vue" { export interface GlobalComponents { + Dept: typeof import("./components/EpicDesigner/extensions/Dept/index.vue")["default"]; ElAside: typeof import("element-plus/es")["ElAside"]; ElAutocomplete: typeof import("element-plus/es")["ElAutocomplete"]; ElAvatar: typeof import("element-plus/es")["ElAvatar"]; @@ -65,5 +66,8 @@ declare module "vue" { IEpSwitchButton: typeof import("~icons/ep/switch-button")["default"]; RouterLink: typeof import("vue-router")["RouterLink"]; RouterView: typeof import("vue-router")["RouterView"]; + TagInput: typeof import("./components/EpicDesigner/extensions/TagInput/index.vue")["default"]; + Test: typeof import("./components/EpicDesigner/businessUi/test/index.vue")["default"]; + User: typeof import("./components/EpicDesigner/ui/dept/user.vue")["default"]; } } diff --git a/src/components/EpicDesigner/businessUi/Test/index.ts b/src/components/EpicDesigner/businessUi/Test/index.ts new file mode 100644 index 0000000..1322524 --- /dev/null +++ b/src/components/EpicDesigner/businessUi/Test/index.ts @@ -0,0 +1,56 @@ +import $Bus from "@/utils/mittBus"; +export default { + component: () => import("./index.vue"), + groupName: "扩展组件", //分组 + icon: "epic-icon-dept", //图标 + defaultSchema: { + label: "部门", //组件名称 + type: "epic-dept-select", //组件类型 + field: "epic-dept-select", + input: true, + componentProps: { + placeholder: "请选择人员" + } + }, + config: { + attribute: [ + { + label: "字段名", + type: "input", + field: "field" + }, + { + label: "标签文字", + type: "input", + field: "label" + }, + { + label: "占位内容", + type: "input", + field: "componentProps.placeholder" + }, + { + label: "弹窗择值", + type: "button", + field: "componentProps.openModal", + componentProps: { + onClick: () => { + $Bus.emit("trigger-dept-select-modal"); + } + } + } + ] + + // event: [ + // { + // type: "change", + // describe: "选择值变化时" + // }, + // // 添加按钮点击事件定义 + // { + // type: "buttonClick", // 自定义事件名,避免冲突 + // describe: "点击选择人员按钮时" + // } + // ] + } +} as any; diff --git a/src/components/EpicDesigner/businessUi/Test/index.vue b/src/components/EpicDesigner/businessUi/Test/index.vue new file mode 100644 index 0000000..cc7a31b --- /dev/null +++ b/src/components/EpicDesigner/businessUi/Test/index.vue @@ -0,0 +1,345 @@ + + + + + diff --git a/src/components/EpicDesigner/components/designer/src/modules/rightSidebar/index.vue b/src/components/EpicDesigner/components/designer/src/modules/rightSidebar/index.vue index d66f848..51a0e47 100644 --- a/src/components/EpicDesigner/components/designer/src/modules/rightSidebar/index.vue +++ b/src/components/EpicDesigner/components/designer/src/modules/rightSidebar/index.vue @@ -42,7 +42,6 @@ import EIcon from "../../../../icon"; const hideRightMain = ref(false); const rightSidebars = computed(() => { - console.log(pluginManager.viewsContainers.rightSidebars.value); return pluginManager.viewsContainers.rightSidebars.value.filter(item => item.visible); }); diff --git a/src/components/EpicDesigner/components/node/src/node.vue b/src/components/EpicDesigner/components/node/src/node.vue index 99339bc..431c35d 100644 --- a/src/components/EpicDesigner/components/node/src/node.vue +++ b/src/components/EpicDesigner/components/node/src/node.vue @@ -313,7 +313,6 @@ async function initComponent() { return; } - console.log(innerSchema.type, "=innerSchema.type="); // 内置组件 const cmp = pluginManager.getComponent(innerSchema.type); // 内部不存在组件 diff --git a/src/components/EpicDesigner/components/tree/src/tree.vue b/src/components/EpicDesigner/components/tree/src/tree.vue index f199d8d..e0ba5fb 100644 --- a/src/components/EpicDesigner/components/tree/src/tree.vue +++ b/src/components/EpicDesigner/components/tree/src/tree.vue @@ -72,7 +72,7 @@ const getTreeData = computed({ console.log(e); } }); - +console.log(getTreeData, "=getTreeData="); /** * 通过label 过滤节点 * @param tree 节点树 diff --git a/src/components/EpicDesigner/extensions/EOptionsEditor/index.vue b/src/components/EpicDesigner/extensions/EOptionsEditor/index.vue index b3c4294..6706474 100644 --- a/src/components/EpicDesigner/extensions/EOptionsEditor/index.vue +++ b/src/components/EpicDesigner/extensions/EOptionsEditor/index.vue @@ -50,6 +50,7 @@ function handleAdd() { label: "", value: "" }; + console.log("1232323"); modelValueComputed.value?.push(option); } diff --git a/src/components/EpicDesigner/extensions/index.ts b/src/components/EpicDesigner/extensions/index.ts index a44fc97..cc4a7b7 100644 --- a/src/components/EpicDesigner/extensions/index.ts +++ b/src/components/EpicDesigner/extensions/index.ts @@ -2,6 +2,10 @@ import { type PluginManager } from "@/components/EpicDesigner/utils"; import MonacoEditor from "./MonacoEditor"; import Page from "./Page"; +import Test from "../businessUi/Test"; + +// import TagInput from "./TagInput/index.vue"; +// 1. 注册【配置类组件】:用于属性面板,不渲染到画布 export function setupComponent(pluginManager: PluginManager): void { pluginManager.component("EInputSize", async () => await import("./EInputSize/index.vue")); pluginManager.component("EColEditor", async () => await import("./EColEditor/index.vue")); @@ -9,7 +13,6 @@ export function setupComponent(pluginManager: PluginManager): void { pluginManager.component("ERuleEditor", async () => await import("./ERuleEditor/index.vue")); pluginManager.component("EOptionsEditor", async () => await import("./EOptionsEditor/index.vue")); pluginManager.component("ENode", async () => await import("../components/node")); - // 左侧菜单初始化 pluginManager.registerActivitybar({ id: "component_view", @@ -54,8 +57,7 @@ export function setupComponent(pluginManager: PluginManager): void { // component: async () => await import("../components/designer/src/modules/attributeView/dataView.vue") // }); - const componentArray = [MonacoEditor, Page]; - console.log(Page, "=============>"); + const componentArray = [MonacoEditor, Page, Test]; componentArray.forEach(item => { pluginManager.registerComponent(item); }); diff --git a/src/components/EpicDesigner/ui/button/button.ts b/src/components/EpicDesigner/ui/button/button.ts index 89792f7..9e2d1e4 100644 --- a/src/components/EpicDesigner/ui/button/button.ts +++ b/src/components/EpicDesigner/ui/button/button.ts @@ -16,7 +16,7 @@ export default defineComponent({ const componentProps: Record = { ...props.componentSchema?.componentProps }; - + console.log(componentProps, "=========componentProps============"); return h(ElButton, componentProps, { default: () => renderSlot(slots, "default", {}, () => [props.componentSchema?.label]) }); diff --git a/src/components/EpicDesigner/ui/card/card.ts b/src/components/EpicDesigner/ui/card/card.ts index b654041..ffaee5d 100644 --- a/src/components/EpicDesigner/ui/card/card.ts +++ b/src/components/EpicDesigner/ui/card/card.ts @@ -16,6 +16,7 @@ export default defineComponent({ header: props.componentSchema?.label ?? "" } as ComponentSchema; console.log(attrs); + const children = componentSchema.children ?? []; delete componentSchema.children; diff --git a/src/components/EpicDesigner/ui/index.ts b/src/components/EpicDesigner/ui/index.ts index 98d852a..6cc8119 100644 --- a/src/components/EpicDesigner/ui/index.ts +++ b/src/components/EpicDesigner/ui/index.ts @@ -26,8 +26,6 @@ import Modal from "./modal"; import { ElFormItem, ElTabs, ElTabPane, ElCollapse, ElCollapseItem } from "element-plus"; export function setupElementPlus(pluginManager: PluginManager = pManager): void { - // console.log(pluginManager, "=pluginManager="); - console.log(1232323); pluginManager.component("FormItem", ElFormItem); pluginManager.component("Tabs", ElTabs); pluginManager.component("TabPane", ElTabPane); @@ -63,7 +61,6 @@ export function setupElementPlus(pluginManager: PluginManager = pManager): void pluginManager.registerComponent(item); pluginManager.addBaseComponentTypes(item.defaultSchema.type); }); - console.log(1232323); // ui初始化完成。 pluginManager.setInitialized(true); } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 470776f..6c2cbe7 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -39,6 +39,15 @@ const pageSchema = ref({ label: "输入框", type: "input", id: "input_4wujh0i3" + }, + { + id: "epic-dept-select_qwefi7l4", + type: "input", + label: "人员选择11", + componentProps: { + placeholder: "请输入" + }, + field: "epic-dept-select_qwefi7l4" } ] }