Files
ipms-sjy/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts

56 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-07-18 19:06:37 +08:00
import { reactive } from 'vue'
import { required } from '@/utils/formRules'
import { useI18n } from '@/hooks/web/useI18n'
2022-11-22 15:46:32 +08:00
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
2022-07-18 19:06:37 +08:00
// 国际化
const { t } = useI18n()
// 表单校验
export const rules = reactive({
name: [required],
url: [required],
username: [required],
password: [required]
})
// 新增 + 修改
2022-11-22 15:46:32 +08:00
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
action: true,
columns: [
{
title: '数据源名称',
field: 'name'
2022-07-18 19:06:37 +08:00
},
2022-11-22 15:46:32 +08:00
{
title: '数据源连接',
field: 'url',
form: {
component: 'Input',
componentProps: {
type: 'textarea',
rows: 4
},
colProps: {
span: 24
}
2022-07-18 19:06:37 +08:00
}
},
2022-11-22 15:46:32 +08:00
{
title: '用户名',
field: 'username'
},
{
title: '密码',
field: 'password',
isTable: false
2022-07-18 19:06:37 +08:00
},
2022-11-22 15:46:32 +08:00
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isForm: false
2022-07-18 19:06:37 +08:00
}
2022-11-22 15:46:32 +08:00
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)