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