diff --git a/src/api/infra/dataSourceConfig/index.ts b/src/api/infra/dataSourceConfig/index.ts index c0f9f624..b413f345 100644 --- a/src/api/infra/dataSourceConfig/index.ts +++ b/src/api/infra/dataSourceConfig/index.ts @@ -1,35 +1,35 @@ import request from '@/config/axios' export interface DataSourceConfigVO { - id: number + id: number | undefined name: string url: string username: string password: string - createTime: Date -} - -// 查询数据源配置列表 -export const getDataSourceConfigListApi = () => { - return request.get({ url: '/infra/data-source-config/list' }) -} - -// 查询数据源配置详情 -export const getDataSourceConfigApi = (id: number) => { - return request.get({ url: '/infra/data-source-config/get?id=' + id }) + createTime?: Date } // 新增数据源配置 -export const createDataSourceConfigApi = (data: DataSourceConfigVO) => { +export const createDataSourceConfig = (data: DataSourceConfigVO) => { return request.post({ url: '/infra/data-source-config/create', data }) } // 修改数据源配置 -export const updateDataSourceConfigApi = (data: DataSourceConfigVO) => { +export const updateDataSourceConfig = (data: DataSourceConfigVO) => { return request.put({ url: '/infra/data-source-config/update', data }) } // 删除数据源配置 -export const deleteDataSourceConfigApi = (id: number) => { +export const deleteDataSourceConfig = (id: number) => { return request.delete({ url: '/infra/data-source-config/delete?id=' + id }) } + +// 查询数据源配置详情 +export const getDataSourceConfig = (id: number) => { + return request.get({ url: '/infra/data-source-config/get?id=' + id }) +} + +// 查询数据源配置列表 +export const getDataSourceConfigList = () => { + return request.get({ url: '/infra/data-source-config/list' }) +} diff --git a/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts b/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts deleted file mode 100644 index a790ad17..00000000 --- a/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' -// 国际化 -const { t } = useI18n() -// 表单校验 -export const rules = reactive({ - name: [required], - url: [required], - username: [required], - password: [required] -}) -// 新增 + 修改 -const crudSchemas = reactive({ - 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) diff --git a/src/views/infra/dataSourceConfig/form.vue b/src/views/infra/dataSourceConfig/form.vue new file mode 100644 index 00000000..e0cac78b --- /dev/null +++ b/src/views/infra/dataSourceConfig/form.vue @@ -0,0 +1,114 @@ + + diff --git a/src/views/infra/dataSourceConfig/index.vue b/src/views/infra/dataSourceConfig/index.vue index 1e3db49d..2138033e 100644 --- a/src/views/infra/dataSourceConfig/index.vue +++ b/src/views/infra/dataSourceConfig/index.vue @@ -1,145 +1,98 @@