From 6359ffe7661212aff50dc8eca520950d26ad50ef Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Sat, 11 Mar 2023 15:54:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/dataSourceConfig/index.ts | 30 +-- .../dataSourceConfig/dataSourceConfig.data.ts | 52 ---- src/views/infra/dataSourceConfig/form.vue | 114 +++++++++ src/views/infra/dataSourceConfig/index.vue | 223 +++++++----------- 4 files changed, 215 insertions(+), 204 deletions(-) delete mode 100644 src/views/infra/dataSourceConfig/dataSourceConfig.data.ts create mode 100644 src/views/infra/dataSourceConfig/form.vue 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..e08a6f01 100644 --- a/src/views/infra/dataSourceConfig/index.vue +++ b/src/views/infra/dataSourceConfig/index.vue @@ -1,145 +1,94 @@ From 8eb87481421e42d45bfbf275d6e27a5abd2e8948 Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Sat, 11 Mar 2023 16:00:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=20=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/dataSourceConfig/index.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/infra/dataSourceConfig/index.vue b/src/views/infra/dataSourceConfig/index.vue index e08a6f01..2138033e 100644 --- a/src/views/infra/dataSourceConfig/index.vue +++ b/src/views/infra/dataSourceConfig/index.vue @@ -3,7 +3,11 @@ - + 新增 @@ -28,7 +32,7 @@ link type="primary" @click="openModal('update', scope.row.id)" - v-hasPermi="['infra:config:update']" + v-hasPermi="['infra:data-source-config:update']" > 编辑 @@ -36,7 +40,7 @@ link type="danger" @click="handleDelete(scope.row.id)" - v-hasPermi="['infra:config:delete']" + v-hasPermi="['infra:data-source-config:delete']" > 删除