add 增加在线表单构建(大体实现,细节正在处理。。),增加全局引入ele,移除vform3包管理,增加lib包存放表单构建所需文件。增加vite预编译

This commit is contained in:
ahao 2023-09-17 00:10:17 +08:00
parent 6c16d023f4
commit 893279630e
8 changed files with 1609 additions and 19 deletions

16
lib/designer.style.css Normal file

File diff suppressed because one or more lines are too long

1531
lib/designer.umd.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -23,19 +23,18 @@
"animate.css": "4.1.1", "animate.css": "4.1.1",
"await-to-js": "^3.0.0", "await-to-js": "^3.0.0",
"axios": "^1.3.4", "axios": "^1.3.4",
"crypto-js": "^4.1.1",
"echarts": "5.4.0", "echarts": "5.4.0",
"element-plus": "2.2.27", "element-plus": "2.2.27",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"fuse.js": "6.6.2", "fuse.js": "6.6.2",
"js-cookie": "3.0.1", "js-cookie": "3.0.1",
"jsencrypt": "3.3.1", "jsencrypt": "3.3.1",
"crypto-js": "^4.1.1",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"path-browserify": "1.0.1", "path-browserify": "1.0.1",
"path-to-regexp": "6.2.0", "path-to-regexp": "6.2.0",
"pinia": "2.0.22", "pinia": "2.0.22",
"screenfull": "6.0.0", "screenfull": "6.0.0",
"vform3-builds": "3.0.8",
"vue": "3.2.45", "vue": "3.2.45",
"vue-cropper": "1.0.3", "vue-cropper": "1.0.3",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
@ -73,10 +72,10 @@
"unplugin-auto-import": "0.13.0", "unplugin-auto-import": "0.13.0",
"unplugin-icons": "0.15.1", "unplugin-icons": "0.15.1",
"unplugin-vue-components": "0.23.0", "unplugin-vue-components": "0.23.0",
"unplugin-vue-setup-extend-plus": "0.4.9",
"vite": "4.3.1", "vite": "4.3.1",
"vite-plugin-compression": "0.5.1", "vite-plugin-compression": "0.5.1",
"vite-plugin-svg-icons": "2.0.1", "vite-plugin-svg-icons": "2.0.1",
"unplugin-vue-setup-extend-plus": "0.4.9",
"vitest": "^0.29.7", "vitest": "^0.29.7",
"vue-eslint-parser": "9.1.0", "vue-eslint-parser": "9.1.0",
"vue-tsc": "0.35.0" "vue-tsc": "0.35.0"

View File

@ -7,7 +7,7 @@
@import './ruoyi.scss'; @import './ruoyi.scss';
@import 'animate.css'; @import 'animate.css';
@import 'element-plus/dist/index.css'; @import 'element-plus/dist/index.css';
@import '../../../lib/designer.style.css';
body { body {
height: 100%; height: 100%;
margin: 0; margin: 0;

View File

@ -1,4 +1,14 @@
<!-- 代码构建 --> <!-- 代码构建 -->
<template>
<div class="reset">
<v-form-designer class="build" ref="buildRef" :designer-config="designerConfig">
<template #customToolButtons v-if="showBtn">
<el-button link type="primary" icon="Select" @click="getJson">保存</el-button>
</template>
</v-form-designer>
</div>
</template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps({ const props = defineProps({
@ -11,6 +21,17 @@ const props = defineProps({
default: undefined default: undefined
} }
}) })
const designerConfig = reactive({
languageMenu: true,
toolbarMaxWidth: 450,
// importJsonButton: false,
// exportJsonButton: false,
exportCodeButton: false,
// generateSFCButton: false,
formTemplates: true
})
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const buildRef = ref(); const buildRef = ref();
const emits = defineEmits(['reJson', 'saveDesign']); const emits = defineEmits(['reJson', 'saveDesign']);
@ -34,20 +55,6 @@ onMounted(() => {
}) })
</script> </script>
<template>
<div>
<v-form-designer
class="build"
ref="buildRef"
:designer-config="{ importJsonButton: true, exportJsonButton: true, exportCodeButton: true, generateSFCButton: true, formTemplates: true }"
>
<template #customToolButtons v-if="showBtn">
<el-button link type="primary" icon="Select" @click="getJson">保存</el-button>
</template>
</v-form-designer>
</div>
</template>
<style lang="scss"> <style lang="scss">
.build { .build {
margin: 0 !important; margin: 0 !important;
@ -60,5 +67,8 @@ onMounted(() => {
& .right-toolbar-con { & .right-toolbar-con {
text-align: right !important; text-align: right !important;
} }
}
.reset {
} }
</style> </style>

View File

@ -46,10 +46,16 @@ app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.selectDictLabels = selectDictLabels; app.config.globalProperties.selectDictLabels = selectDictLabels;
app.config.globalProperties.animate = animate; app.config.globalProperties.animate = animate;
// vform3
import ElementPlus from 'element-plus';
import VForm3 from '@/../lib/designer.umd.js';
app.use(ElementIcons); app.use(ElementIcons);
app.use(router); app.use(router);
app.use(store); app.use(store);
app.use(i18n); app.use(i18n);
app.use(VForm3);
app.use(ElementPlus);
app.use(plugins); app.use(plugins);
// 自定义指令 // 自定义指令
directive(app); directive(app);

File diff suppressed because one or more lines are too long

View File

@ -53,6 +53,11 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
] ]
} }
}, },
build: {
commonjsOptions: {
// include: /node_modules|lib/
}
},
// 预编译 // 预编译
optimizeDeps: { optimizeDeps: {
include: [ include: [
@ -68,6 +73,7 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
'vue-i18n', 'vue-i18n',
'@vueup/vue-quill', '@vueup/vue-quill',
'@iconify/iconify', '@iconify/iconify',
'@/../lib/designer.umd.js',
'element-plus/es/components/form/style/css', 'element-plus/es/components/form/style/css',
'element-plus/es/components/form-item/style/css', 'element-plus/es/components/form-item/style/css',