2025-04-22 23:31:13 +08:00
|
|
|
|
import type { App } from 'vue';
|
|
|
|
|
|
|
|
|
|
|
|
// import install from '@form-create/ant-design-vue/auto-import';
|
|
|
|
|
|
import FcDesigner from '@form-create/antd-designer';
|
|
|
|
|
|
import Antd from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
|
|
|
// ======================= 自定义组件 =======================
|
2025-04-23 22:37:33 +08:00
|
|
|
|
import { useApiSelect } from '#/components/form-create';
|
|
|
|
|
|
import DictSelect from '#/components/form-create/components/dict-select.vue';
|
|
|
|
|
|
import { useImagesUpload } from '#/components/form-create/components/use-images-upload';
|
2025-04-22 23:31:13 +08:00
|
|
|
|
import { Tinymce } from '#/components/tinymce';
|
2025-04-23 02:01:12 +08:00
|
|
|
|
import { FileUpload, ImageUpload } from '#/components/upload';
|
2025-04-22 23:31:13 +08:00
|
|
|
|
|
|
|
|
|
|
const UserSelect = useApiSelect({
|
|
|
|
|
|
name: 'UserSelect',
|
|
|
|
|
|
labelField: 'nickname',
|
|
|
|
|
|
valueField: 'id',
|
|
|
|
|
|
url: '/system/user/simple-list',
|
|
|
|
|
|
});
|
|
|
|
|
|
const DeptSelect = useApiSelect({
|
|
|
|
|
|
name: 'DeptSelect',
|
|
|
|
|
|
labelField: 'name',
|
|
|
|
|
|
valueField: 'id',
|
|
|
|
|
|
url: '/system/dept/simple-list',
|
|
|
|
|
|
});
|
|
|
|
|
|
const ApiSelect = useApiSelect({
|
|
|
|
|
|
name: 'ApiSelect',
|
|
|
|
|
|
});
|
2025-04-23 02:01:12 +08:00
|
|
|
|
const ImagesUpload = useImagesUpload();
|
2025-04-22 23:31:13 +08:00
|
|
|
|
|
|
|
|
|
|
const components = [
|
|
|
|
|
|
ImageUpload,
|
|
|
|
|
|
ImagesUpload,
|
|
|
|
|
|
FileUpload,
|
|
|
|
|
|
Tinymce,
|
|
|
|
|
|
DictSelect,
|
|
|
|
|
|
UserSelect,
|
|
|
|
|
|
DeptSelect,
|
|
|
|
|
|
ApiSelect,
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: @dhb52 按需导入,而不是app.use(Antd);
|
|
|
|
|
|
// 参考 http://www.form-create.com/v3/ant-design-vue/auto-import.html 文档
|
|
|
|
|
|
export const setupFormCreate = (app: App) => {
|
|
|
|
|
|
components.forEach((component) => {
|
|
|
|
|
|
app.component(component.name as string, component);
|
|
|
|
|
|
});
|
|
|
|
|
|
app.use(Antd);
|
|
|
|
|
|
app.use(FcDesigner);
|
|
|
|
|
|
app.use(FcDesigner.formCreate);
|
|
|
|
|
|
};
|