提交 | 用户 | 时间
820397 1 import type { App } from 'vue'
H 2 // 👇使用 form-create 需额外全局引入 element plus 组件
3 import {
3e359e 4   // ElAutocomplete,
H 5   // ElButton,
6   // ElCascader,
7   // ElCheckbox,
8   // ElCheckboxButton,
9   // ElCheckboxGroup,
10   // ElCol,
11   // ElColorPicker,
12   // ElDatePicker,
13   // ElDialog,
14   // ElForm,
15   // ElInput,
16   // ElInputNumber,
17   // ElPopover,
18   // ElRadio,
19   // ElRadioButton,
20   // ElRadioGroup,
21   // ElRate,
22   // ElRow,
23   // ElSelect,
24   // ElSlider,
25   // ElSwitch,
26   // ElTimePicker,
27   // ElTooltip,
28   // ElTree,
29   // ElUpload,
30   // ElIcon,
31   // ElProgress,
32   // 以上会由 @form-create/element-ui/auto-import 自动引入
820397 33   ElAlert,
3e359e 34   ElTransfer,
820397 35   ElAside,
H 36   ElContainer,
37   ElDivider,
38   ElHeader,
39   ElMain,
40   ElPopconfirm,
41   ElTable,
42   ElTableColumn,
43   ElTabPane,
44   ElTabs,
3e359e 45   ElDropdown,
H 46   ElDropdownMenu,
47   ElDropdownItem,
48   ElBadge,
49   ElTag,
50   ElText,
51   ElMenu,
52   ElMenuItem,
53   ElFooter,
54   ElMessage,
55   ElCollapse,
56   ElCollapseItem,
57   ElCard,
58   // ElFormItem,
59   // ElOption
820397 60 } from 'element-plus'
H 61 import FcDesigner from '@form-create/designer'
62 import formCreate from '@form-create/element-ui'
63 import install from '@form-create/element-ui/auto-import'
64
65 //======================= 自定义组件 =======================
66 import { UploadFile, UploadImg, UploadImgs } from '@/components/UploadFile'
67 import { useApiSelect } from '@/components/FormCreate'
68 import { Editor } from '@/components/Editor'
69 import DictSelect from '@/components/FormCreate/src/components/DictSelect.vue'
70
71 const UserSelect = useApiSelect({
72   name: 'UserSelect',
73   labelField: 'nickname',
74   valueField: 'id',
75   url: '/system/user/simple-list'
76 })
77 const DeptSelect = useApiSelect({
78   name: 'DeptSelect',
79   labelField: 'name',
80   valueField: 'id',
81   url: '/system/dept/simple-list'
82 })
83 const ApiSelect = useApiSelect({
84   name: 'ApiSelect'
85 })
86
87 const components = [
3e359e 88   ElAlert,
H 89   ElTransfer,
820397 90   ElAside,
H 91   ElContainer,
92   ElDivider,
3e359e 93   ElHeader,
H 94   ElMain,
95   ElPopconfirm,
820397 96   ElTable,
H 97   ElTableColumn,
98   ElTabPane,
3e359e 99   ElTabs,
H 100   ElDropdown,
101   ElDropdownMenu,
102   ElDropdownItem,
103   ElBadge,
104   ElTag,
105   ElText,
106   ElMenu,
107   ElMenuItem,
108   ElFooter,
109   ElMessage,
110   // ElFormItem,
111   // ElOption,
820397 112   UploadImg,
H 113   UploadImgs,
114   UploadFile,
115   DictSelect,
116   UserSelect,
117   DeptSelect,
118   ApiSelect,
3e359e 119   Editor,
H 120   ElCollapse,
121   ElCollapseItem,
122   ElCard,
820397 123 ]
H 124
125 // 参考 http://www.form-create.com/v3/element-ui/auto-import.html 文档
126 export const setupFormCreate = (app: App<Element>) => {
127   components.forEach((component) => {
128     app.component(component.name, component)
129   })
130   formCreate.use(install)
131   app.use(formCreate)
132   app.use(FcDesigner)
133 }