From da883ac7a3de1db2af3adee1e4da3583f8824c18 Mon Sep 17 00:00:00 2001 From: du <13220750630.163.com> Date: 星期二, 17 六月 2025 11:11:00 +0800 Subject: [PATCH] 表单设计器 --- ruoyi-ui/apps/web-antd/src/bootstrap.ts | 10 +++++++--- ruoyi-ui/apps/web-antd/package.json | 3 +++ ruoyi-ui/apps/web-antd/src/views/tool/dynamicForm/index.vue | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui/apps/web-antd/package.json b/ruoyi-ui/apps/web-antd/package.json index 633fb20..2138a2a 100644 --- a/ruoyi-ui/apps/web-antd/package.json +++ b/ruoyi-ui/apps/web-antd/package.json @@ -27,6 +27,8 @@ }, "dependencies": { "@ant-design/icons-vue": "^7.0.1", + "@form-create/designer": "^3.2.11", + "@form-create/element-ui": "^3.2.25", "@tinymce/tinymce-vue": "^6.0.1", "@vben/access": "workspace:*", "@vben/common-ui": "workspace:*", @@ -48,6 +50,7 @@ "crypto-js": "^4.2.0", "dayjs": "catalog:", "echarts": "^5.5.1", + "element-plus": "^2.10.2", "jsencrypt": "^3.3.2", "lodash-es": "^4.17.21", "pinia": "catalog:", diff --git a/ruoyi-ui/apps/web-antd/src/bootstrap.ts b/ruoyi-ui/apps/web-antd/src/bootstrap.ts index 35b9924..f76df08 100644 --- a/ruoyi-ui/apps/web-antd/src/bootstrap.ts +++ b/ruoyi-ui/apps/web-antd/src/bootstrap.ts @@ -9,14 +9,16 @@ import '@vben/styles/antd'; import { useTitle } from '@vueuse/core'; - +import ElementPlus from 'element-plus'; +import 'element-plus/dist/index.css'; // 鏍峰紡鏂囦欢 import { setupGlobalComponent } from '#/components/global'; import { $t, setupI18n } from '#/locales'; import { initComponentAdapter } from './adapter/component'; import App from './app.vue'; import { router } from './router'; - +import formCreate from '@form-create/element-ui'; +import FcDesigner from '@form-create/designer'; async function bootstrap(namespace: string) { // 鍒濆鍖栫粍浠堕�傞厤鍣� await initComponentAdapter(); @@ -57,7 +59,9 @@ // 閰嶇疆Motion鎻掍欢 app.use(MotionPlugin); - + app.use(ElementPlus); + app.use(formCreate); + app.use(FcDesigner); // 鍔ㄦ�佹洿鏂版爣棰� watchEffect(() => { if (preferences.app.dynamicTitle) { diff --git a/ruoyi-ui/apps/web-antd/src/views/tool/dynamicForm/index.vue b/ruoyi-ui/apps/web-antd/src/views/tool/dynamicForm/index.vue new file mode 100644 index 0000000..0bd9f76 --- /dev/null +++ b/ruoyi-ui/apps/web-antd/src/views/tool/dynamicForm/index.vue @@ -0,0 +1,19 @@ +<template> + <fc-designer ref="designer" /> +</template> + +<script setup> +import { ref } from 'vue'; + +const designer = ref(); + +// 鑾峰彇琛ㄥ崟 JSON 閰嶇疆 +const getJson = () => { + console.log(designer.value.getJson()); +}; + +// 鍔犺浇宸叉湁閰嶇疆 +const loadJson = (json) => { + designer.value.setJson(json); +}; +</script> -- Gitblit v1.9.3