更新开发环境和生产环境的API服务地址,统一后端服务配置,移除不再使用的服务实例,优化请求模块以使用统一的请求方法,调整相关接口以提高代码一致性和可读性。

This commit is contained in:
2026-04-01 15:45:39 +08:00
parent d9b4a012ee
commit e6d75c6660
21 changed files with 200 additions and 206 deletions

View File

@@ -206,11 +206,13 @@ const onRowDel = (row: any) => {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// TODO:
ElMessage.success('删除成功');
getList();
}).catch(() => {});
})
.then(() => {
// TODO:
ElMessage.success('删除成功');
getList();
})
.catch(() => {});
};
onMounted(() => {

View File

@@ -76,9 +76,8 @@
/>
</el-card>
<!-- 新增/编辑弹窗 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="600px" :close-on-click-modal="false">
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px" v-loading="dialog.loading">
<el-form-item label="平台名称" prop="platformName">
<el-input v-model="form.platformName" placeholder="请输入平台名称" />
</el-form-item>
@@ -165,7 +164,7 @@ export default { name: 'cidDatasource' };
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
import { listDatasourcePlatforms, createDatasourcePlatform, updateDatasourcePlatform, deleteDatasourcePlatform } from '/@/api/cid/datasource';
import { listDatasourcePlatforms, createDatasourcePlatform, updateDatasourcePlatform, deleteDatasourcePlatform, getDatasourcePlatform } from '/@/api/cid/datasource';
const queryRef = ref<FormInstance>();
const formRef = ref<FormInstance>();
@@ -188,6 +187,7 @@ const dialog = reactive({
title: '',
saving: false,
isEdit: false,
loading: false,
});
const form = reactive({
@@ -278,27 +278,38 @@ const onOpenAdd = () => {
dialog.visible = true;
};
const onOpenEdit = (row: any) => {
const onOpenEdit = async (row: any) => {
resetForm();
dialog.title = '修改平台';
dialog.isEdit = true;
dialog.visible = true;
form.id = row.id;
form.platformName = row.platformName;
form.platformCode = row.platformCode;
form.apiBaseUrl = row.apiBaseUrl;
form.authType = row.authType;
form.status = row.status;
form.description = row.description || '';
form.token = row.token || '';
form.apiKey = row.apiKey || '';
form.clientId = row.clientId || '';
form.clientSecret = row.clientSecret || '';
form.rateLimitPerMinute = row.rateLimitPerMinute ?? 200;
form.rateLimitPerHour = row.rateLimitPerHour ?? 10000;
form.concurrencyLimit = row.concurrencyLimit ?? 50;
form.requestTimeoutMs = row.requestTimeoutMs ?? 15000;
form.maxRetries = row.maxRetries ?? 3;
form.retryDelayMs = row.retryDelayMs ?? 300;
dialog.loading = true;
try {
const res = await getDatasourcePlatform(row.id);
const detail = res.data || {};
form.id = detail.id || row.id;
form.platformName = detail.platformName || '';
form.platformCode = detail.platformCode || '';
form.apiBaseUrl = detail.apiBaseUrl || '';
form.authType = detail.authType || 'API_KEY';
form.status = detail.status || 'ACTIVE';
form.description = detail.description || '';
form.token = detail.token || '';
form.apiKey = detail.apiKey || '';
form.clientId = detail.clientId || '';
form.clientSecret = detail.clientSecret || '';
form.rateLimitPerMinute = detail.rateLimitPerMinute ?? 200;
form.rateLimitPerHour = detail.rateLimitPerHour ?? 10000;
form.concurrencyLimit = detail.concurrencyLimit ?? 50;
form.requestTimeoutMs = detail.requestTimeoutMs ?? 15000;
form.maxRetries = detail.maxRetries ?? 3;
form.retryDelayMs = detail.retryDelayMs ?? 300;
} catch (_e) {
dialog.visible = false;
ElMessage.error('获取平台详情失败');
} finally {
dialog.loading = false;
}
};
const onSubmit = () => {
@@ -336,20 +347,22 @@ const onRowDel = (row: any) => {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
try {
for (const id of delIds) {
await deleteDatasourcePlatform(id);
})
.then(async () => {
try {
for (const id of delIds) {
await deleteDatasourcePlatform(id);
}
ElMessage.success('删除成功');
getList();
} catch (_e) {
ElMessage.error('删除失败');
}
ElMessage.success('删除成功');
getList();
} catch (_e) {
ElMessage.error('删除失败');
}
}).catch(() => {});
})
.catch(() => {});
};
onMounted(() => {
getList();
});
</script>
</script>

View File

@@ -185,11 +185,13 @@ const onRowDel = (row: any) => {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// TODO:
ElMessage.success('删除成功');
getList();
}).catch(() => {});
})
.then(() => {
// TODO:
ElMessage.success('删除成功');
getList();
})
.catch(() => {});
};
onMounted(() => {