diff --git a/src/components/FormCreate/index.ts b/src/components/FormCreate/index.ts
index 66fc7e6f..9da34889 100644
--- a/src/components/FormCreate/index.ts
+++ b/src/components/FormCreate/index.ts
@@ -1,4 +1,4 @@
import { useFormCreateDesigner } from './src/useFormCreateDesigner'
-import CurrencySelect from './src/CurrencySelect/index.vue'
+import { useCurrencySelect } from './src/components/useCurrencySelect'
-export { useFormCreateDesigner, CurrencySelect }
+export { useFormCreateDesigner, useCurrencySelect }
diff --git a/src/components/FormCreate/src/CurrencySelect/index.vue b/src/components/FormCreate/src/CurrencySelect/index.vue
deleted file mode 100644
index 3591a935..00000000
--- a/src/components/FormCreate/src/CurrencySelect/index.vue
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/components/FormCreate/src/components/useCurrencySelect.tsx b/src/components/FormCreate/src/components/useCurrencySelect.tsx
new file mode 100644
index 00000000..ae9636a3
--- /dev/null
+++ b/src/components/FormCreate/src/components/useCurrencySelect.tsx
@@ -0,0 +1,59 @@
+import request from '@/config/axios'
+import { isEmpty } from '@/utils/is'
+import { CurrencySelectProps } from '@/components/FormCreate/src/type'
+
+export const useCurrencySelect = (option: CurrencySelectProps) => {
+ return defineComponent({
+ name: option.name,
+ props: {
+ // 字典类型
+ labelField: {
+ type: String,
+ default: () => option.labelField ?? ''
+ },
+ // 字典值类型
+ valueField: {
+ type: String,
+ default: () => option.valueField ?? ''
+ },
+ // api 接口
+ restful: {
+ type: String,
+ default: () => option.restful ?? ''
+ }
+ },
+ setup(props) {
+ const attrs = useAttrs()
+ const options = ref([]) // 下拉数据
+ const getOptions = async () => {
+ options.value = []
+ if (isEmpty(props.restful)) {
+ return
+ }
+ // TODO 只支持 GET 查询,复杂下拉构建条件请使用业务表单
+ const data = await request.get({ url: props.restful })
+ if (Array.isArray(data)) {
+ options.value = data.map((item: any) => ({
+ label: item[props.labelField],
+ value: item[props.valueField]
+ }))
+ return
+ }
+ console.log(`接口[${props.restful}] 返回结果不是一个数组`)
+ }
+
+ onMounted(async () => {
+ await getOptions()
+ })
+ return () => (
+ <>
+
+ {options.value.map((item, index) => (
+
+ ))}
+
+ >
+ )
+ }
+ })
+}
diff --git a/src/components/FormCreate/src/config/index.ts b/src/components/FormCreate/src/config/index.ts
index 078bc803..c34d831a 100644
--- a/src/components/FormCreate/src/config/index.ts
+++ b/src/components/FormCreate/src/config/index.ts
@@ -4,6 +4,8 @@ import { useUploadImgsRule } from './useUploadImgsRule'
import { useDictSelectRule } from './useDictSelectRule'
import { useCurrencySelectRule } from './useCurrencySelectRule'
import { useEditorRule } from './useEditorRule'
+import { useUserSelectRule } from './useUserSelectRule'
+import { useDeptSelectRule } from './useDeptSelectRule'
export {
useUploadFileRule,
@@ -11,5 +13,7 @@ export {
useUploadImgsRule,
useDictSelectRule,
useCurrencySelectRule,
- useEditorRule
+ useEditorRule,
+ useUserSelectRule,
+ useDeptSelectRule
}
diff --git a/src/components/FormCreate/src/config/useCurrencySelectRule.ts b/src/components/FormCreate/src/config/useCurrencySelectRule.ts
index 7a7b2031..3ac65a66 100644
--- a/src/components/FormCreate/src/config/useCurrencySelectRule.ts
+++ b/src/components/FormCreate/src/config/useCurrencySelectRule.ts
@@ -1,8 +1,9 @@
import { generateUUID } from '@/utils'
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
import selectRule from '@/components/FormCreate/src/config/selectRule'
+import { DragRule } from '@/components/FormCreate/src/type'
-export const useCurrencySelectRule = () => {
+export const useCurrencySelectRule = (): DragRule => {
const label = '通用选择器'
const name = 'CurrencySelect'
return {
diff --git a/src/components/FormCreate/src/config/useDeptSelectRule.ts b/src/components/FormCreate/src/config/useDeptSelectRule.ts
new file mode 100644
index 00000000..e46165c1
--- /dev/null
+++ b/src/components/FormCreate/src/config/useDeptSelectRule.ts
@@ -0,0 +1,26 @@
+import { generateUUID } from '@/utils'
+import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
+import selectRule from '@/components/FormCreate/src/config/selectRule'
+import { DragRule } from '@/components/FormCreate/src/type'
+
+export const useDeptSelectRule = (): DragRule => {
+ const label = '部门选择器'
+ const name = 'DeptSelect'
+ return {
+ icon: 'icon-select',
+ label,
+ name,
+ rule() {
+ return {
+ type: name,
+ field: generateUUID(),
+ title: label,
+ info: '',
+ $required: false
+ }
+ },
+ props(_, { t }) {
+ return localeProps(t, name + '.props', [makeRequiredRule(), ...selectRule])
+ }
+ }
+}
diff --git a/src/components/FormCreate/src/config/useUserSelectRule.ts b/src/components/FormCreate/src/config/useUserSelectRule.ts
new file mode 100644
index 00000000..ff5bc869
--- /dev/null
+++ b/src/components/FormCreate/src/config/useUserSelectRule.ts
@@ -0,0 +1,26 @@
+import { generateUUID } from '@/utils'
+import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
+import selectRule from '@/components/FormCreate/src/config/selectRule'
+import { DragRule } from '@/components/FormCreate/src/type'
+
+export const useUserSelectRule = (): DragRule => {
+ const label = '用户选择器'
+ const name = 'UserSelect'
+ return {
+ icon: 'icon-select',
+ label,
+ name,
+ rule() {
+ return {
+ type: name,
+ field: generateUUID(),
+ title: label,
+ info: '',
+ $required: false
+ }
+ },
+ props(_, { t }) {
+ return localeProps(t, name + '.props', [makeRequiredRule(), ...selectRule])
+ }
+ }
+}
diff --git a/src/components/FormCreate/src/type/index.ts b/src/components/FormCreate/src/type/index.ts
new file mode 100644
index 00000000..38205073
--- /dev/null
+++ b/src/components/FormCreate/src/type/index.ts
@@ -0,0 +1,41 @@
+import { Rule } from '@form-create/element-ui' //左侧拖拽按钮
+
+//左侧拖拽按钮
+export interface MenuItem {
+ label: string
+ name: string
+ icon: string
+}
+
+//左侧拖拽按钮分类
+export interface Menu {
+ title: string
+ name: string
+ list: MenuItem[]
+}
+
+export interface MenuList extends Array