form-create:移除自带的下拉选择器组件,使用 currencySelectRule 替代
parent
0076236280
commit
769b63d9ca
@ -1,3 +1,4 @@
|
||||
import { useFormCreateDesigner } from './src/useFormCreateDesigner'
|
||||
import CurrencySelect from './src/CurrencySelect/index.vue'
|
||||
|
||||
export { useFormCreateDesigner }
|
||||
export { useFormCreateDesigner, CurrencySelect }
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
import { generateUUID } from '@/utils'
|
||||
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
|
||||
import selectRule from '@/components/FormCreate/src/config/selectRule'
|
||||
|
||||
export const useCurrencySelectRule = () => {
|
||||
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,25 +0,0 @@
|
||||
import { generateUUID } from '@/utils'
|
||||
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
|
||||
import selectRule from '@/components/FormCreate/src/config/selectRule'
|
||||
|
||||
export const useUserSelectRule = () => {
|
||||
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])
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
<!-- TODO puhui999: 先单独一个后面封装成通用选择组件 -->
|
||||
<template>
|
||||
<el-select class="w-1/1" v-bind="attrs">
|
||||
<el-option
|
||||
v-for="(dict, index) in userOptions"
|
||||
:key="index"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
defineOptions({ name: 'UserSelect' })
|
||||
|
||||
const attrs = useAttrs()
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户下拉数据
|
||||
|
||||
onMounted(async () => {
|
||||
const data = await UserApi.getSimpleUserList()
|
||||
if (!data || data.length === 0) {
|
||||
return
|
||||
}
|
||||
userOptions.value = data
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue