feat: Select defaultValue

pull/19/head
xingyu 2023-05-24 15:14:40 +08:00
parent f4e9d2f5e2
commit d8312d57c5
5 changed files with 48 additions and 26 deletions

View File

@ -130,16 +130,14 @@ export const importTableSearchFormSchema: FormSchema[] = [
{
label: '数据源',
field: 'dataSourceConfigId',
component: 'ApiSelect',
componentProps: ({ formModel }) => {
return {
api: async () => {
const res = await getDataSourceConfigList()
formModel.dataSourceConfigId = res[0].id
return res
},
labelField: 'name',
valueField: 'id'
component: 'Select',
required: true,
defaultValue: dataSourceConfigs[0].id,
componentProps: {
options: dataSourceConfigs,
fieldNames: {
label: 'name',
value: 'id'
}
},
colProps: { span: 8 }

View File

@ -11,15 +11,21 @@ import { getSimpleAccounts } from '@/api/mp/account'
import { deleteFreePublish, getFreePublishPage } from '@/api/mp/freePublish'
import { FormSchema } from '@/components/Form'
const simpleAccountsOptinos = await getSimpleAccounts()
const searchSchema: FormSchema[] = [
{
label: '公众号',
field: 'accountId',
component: 'ApiSelect',
component: 'Select',
required: true,
defaultValue: simpleAccountsOptinos[0].id,
componentProps: {
api: () => getSimpleAccounts(),
labelField: 'name',
valueField: 'id'
options: simpleAccountsOptinos,
fieldNames: {
label: 'name',
value: 'id'
}
},
colProps: { span: 8 }
}

View File

@ -103,15 +103,21 @@ export const columns: BasicColumn[] = [
}
]
const simpleAccountsOptinos = await getSimpleAccounts()
export const searchFormSchema: FormSchema[] = [
{
label: '公众号',
field: 'accountId',
component: 'ApiSelect',
component: 'Select',
required: true,
defaultValue: simpleAccountsOptinos[0].id,
componentProps: {
api: () => getSimpleAccounts(),
labelField: 'name',
valueField: 'id'
options: simpleAccountsOptinos,
fieldNames: {
label: 'name',
value: 'id'
}
},
colProps: { span: 8 }
},

View File

@ -27,15 +27,21 @@ export const columns: BasicColumn[] = [
}
]
const simpleAccountsOptinos = await getSimpleAccounts()
export const searchFormSchema: FormSchema[] = [
{
label: '公众号',
field: 'accountId',
component: 'ApiSelect',
component: 'Select',
required: true,
defaultValue: simpleAccountsOptinos[0].id,
componentProps: {
api: () => getSimpleAccounts(),
labelField: 'name',
valueField: 'id'
options: simpleAccountsOptinos,
fieldNames: {
label: 'name',
value: 'id'
}
},
colProps: { span: 8 }
},

View File

@ -49,15 +49,21 @@ export const columns: BasicColumn[] = [
}
]
const simpleAccountsOptinos = await getSimpleAccounts()
export const searchFormSchema: FormSchema[] = [
{
label: '公众号',
field: 'accountId',
component: 'ApiSelect',
component: 'Select',
required: true,
defaultValue: simpleAccountsOptinos[0].id,
componentProps: {
api: () => getSimpleAccounts(),
labelField: 'name',
valueField: 'id'
options: simpleAccountsOptinos,
fieldNames: {
label: 'name',
value: 'id'
}
},
colProps: { span: 8 }
},