1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import {dataSourceListData} from "@/views/dataSourceManage/dataSource/dataSourceData";
import {connectListData} from "@/views/dataSourceManage/connect/connectData";
/** 获取数据源列表信息*/
export const getDataSourceListByPage = (params?: any) => {
console.log("数据源-连接列表查询参数:", params)
return new Promise((resolve) => {
setTimeout(() => {
const start = (params.page - 1) * params.pageSize
const end = start + params.pageSize
const response = {
pageNum: params.page, // 页码
pageSize: params.pageSize, // 每页大小
pages: 1, // 总页数
total: dataSourceListData.length, // 总记录数
code: 200, // 假设 0 表示成功
message: 'success', // 成功的消息
data: dataSourceListData.slice(start, end) // 模拟分页,只取前10条数据
};
resolve(response); // 解析 Promise
}, Math.floor(Math.random() * 1500) + 1); // 随机延迟1到1500毫秒
});
};
/** 根据 数据源id 删除*/
export const deleteById = (params?: any) => {
return new Promise((resolve) => {
setTimeout(() => {
const response = {
code: 200, // 假设 0 表示成功
message: 'success', // 成功的消息
data: []
};
resolve(response); // 解析 Promise
}, Math.floor(Math.random() * 1000) + 1); // 随机延迟1到1500毫秒
});
};
/** 新增 数据源 */
export const addDataSource = (params?: any) => {
return new Promise((resolve) => {
setTimeout(() => {
const response = {
code: 200, // 假设 0 表示成功
message: 'success', // 成功的消息
data: []
};
resolve(response); // 解析 Promise
}, Math.floor(Math.random() * 1000) + 1); // 随机延迟1到1500毫秒
});
};
/** 修改 数据源 */
export const updateDataSource = (params?: any) => {
return new Promise((resolve) => {
setTimeout(() => {
const response = {
code: 200, // 假设 0 表示成功
message: 'success', // 成功的消息
data: []
};
resolve(response); // 解析 Promise
}, Math.floor(Math.random() * 1000) + 1); // 随机延迟1到1500毫秒
});
};
/** 根据数据源连接类型查找对应的连接 */
export const findConnectByDataSource = (params?: any) => {
return new Promise((resolve) => {
const connectInfo = connectListData.find(item => item.connectType === params?.connectType);
setTimeout(() => {
const response = {
code: 200, // 假设 0 表示成功
message: 'success', // 成功的消息
data: connectInfo
};
resolve(response); // 解析 Promise
}, Math.floor(Math.random() * 1000) + 1); // 随机延迟1到1500毫秒
});
};