form-create: 封装通用选择器 hook
parent
51e6887bde
commit
c1c21d826d
@ -1,37 +0,0 @@
|
|||||||
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 = (): DragRule => {
|
|
||||||
const label = '通用选择器'
|
|
||||||
const name = 'CurrencySelect'
|
|
||||||
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(),
|
|
||||||
{
|
|
||||||
type: 'input',
|
|
||||||
field: 'restful',
|
|
||||||
title: 'restful api 接口',
|
|
||||||
value: '/system/user/simple-list'
|
|
||||||
},
|
|
||||||
{ type: 'input', field: 'labelField', title: 'label 属性', value: 'nickname' },
|
|
||||||
{ type: 'input', field: 'valueField', title: 'value 属性', value: 'id' },
|
|
||||||
...selectRule
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
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])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue