Skip to content

Commit a1292fb

Browse files
committed
重构:微调【数据源菜单】的重构
1 parent a8bbccf commit a1292fb

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

src/api/infra/config/index.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ export interface ConfigVO {
1212
createTime: Date
1313
}
1414

15-
export interface ConfigExportReqVO {
16-
name?: string
17-
key?: string
18-
type?: number
19-
createTime?: Date[]
20-
}
21-
2215
// 查询参数列表
2316
export const getConfigPage = (params: PageParam) => {
2417
return request.get({ url: '/infra/config/page', params })
@@ -50,6 +43,6 @@ export const deleteConfig = (id: number) => {
5043
}
5144

5245
// 导出参数
53-
export const exportConfigApi = (params: ConfigExportReqVO) => {
46+
export const exportConfigApi = (params) => {
5447
return request.download({ url: '/infra/config/export', params })
5548
}

src/views/infra/dataSourceConfig/form.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
<script setup lang="ts">
3232
import * as DataSourceConfigApi from '@/api/infra/dataSourceConfig'
3333
import { DataSourceConfigVO } from '@/api/infra/dataSourceConfig'
34-
import { isNullOrUnDef } from '@/utils/is'
35-
import { omit } from 'lodash-es'
3634
3735
const { t } = useI18n() // 国际化
3836
const message = useMessage() // 消息弹窗
@@ -63,7 +61,7 @@ const openModal = async (type: string, id?: number) => {
6361
formType.value = type
6462
resetForm()
6563
// 修改时,设置数据
66-
if (!isNullOrUnDef(id)) {
64+
if (id) {
6765
formLoading.value = true
6866
try {
6967
formData.value = await DataSourceConfigApi.getDataSourceConfig(id)
@@ -84,7 +82,7 @@ const submitForm = async () => {
8482
// 提交请求
8583
formLoading.value = true
8684
try {
87-
const data = omit(unref(formData), 'createTime')
85+
const data = formData.value as DataSourceConfigApi.DataSourceConfigVO
8886
if (formType.value === 'create') {
8987
await DataSourceConfigApi.createDataSourceConfig(data)
9088
message.success(t('common.createSuccess'))

src/views/infra/dataSourceConfig/index.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<content-wrap>
33
<!-- 搜索工作栏 -->
4-
<el-form :inline="true" label-width="68px">
4+
<el-form class="-mb-15px" :inline="true">
55
<el-form-item>
66
<el-button
77
type="primary"
@@ -12,8 +12,10 @@
1212
</el-button>
1313
</el-form-item>
1414
</el-form>
15+
</content-wrap>
1516

16-
<!-- 列表 -->
17+
<!-- 列表 -->
18+
<content-wrap>
1719
<el-table v-loading="loading" :data="list" align="center">
1820
<el-table-column label="主键编号" align="center" prop="id" />
1921
<el-table-column label="数据源名称" align="center" prop="name" />
@@ -33,6 +35,7 @@
3335
type="primary"
3436
@click="openModal('update', scope.row.id)"
3537
v-hasPermi="['infra:data-source-config:update']"
38+
:disabled="scope.row.id === 0"
3639
>
3740
编辑
3841
</el-button>
@@ -41,6 +44,7 @@
4144
type="danger"
4245
@click="handleDelete(scope.row.id)"
4346
v-hasPermi="['infra:data-source-config:delete']"
47+
:disabled="scope.row.id === 0"
4448
>
4549
删除
4650
</el-button>

0 commit comments

Comments
 (0)