20260716215550
This commit is contained in:
1 parent
5cd4e1e1d2
commit
49dafe524c
21 files changed
+1218
-272
No files matched your search
@@ -1,22 +1,42 @@
|
||||
import { post } from "./http";
|
||||
|
||||
export const authApi = {
|
||||
login(credentials) {
|
||||
return post("/api/auth/login", credentials);
|
||||
},
|
||||
};
|
||||
/**
|
||||
* 机构用户登录。
|
||||
* @param {string} orgId 机构码。
|
||||
* @param {string} userId 用户 ID。
|
||||
* @param {string} password 密码。
|
||||
* @returns {Promise<{token: string, orgid: string, user: {id: string, name: string}}>} 登录会话。
|
||||
*/
|
||||
export function loginApi(orgId, userId, password) {
|
||||
return post("/auth/login", {
|
||||
orgid: orgId,
|
||||
userid: userId,
|
||||
password,
|
||||
});
|
||||
}
|
||||
|
||||
export const dataApi = {
|
||||
loadData(params) {
|
||||
return post("/api/data/loaddata", params);
|
||||
},
|
||||
loadDataBySql(sql) {
|
||||
return post("/api/data/loaddatabysql", { sql });
|
||||
},
|
||||
page(params) {
|
||||
return post("/api/data/page", params);
|
||||
},
|
||||
saveObject(tables) {
|
||||
return post("/api/data/saveobjt", { tables });
|
||||
},
|
||||
};
|
||||
/**
|
||||
* 按表或视图加载数据。
|
||||
* @param {string} viewName 表名或视图名,必填。
|
||||
* @param {string} [searchCondition] 查询条件,不包含 WHERE。
|
||||
* @param {string} [orderField] 排序字段,可带 ASC 或 DESC。
|
||||
* @param {string[]} [searchColumns] 需要返回的字段列表,省略时返回全部字段。
|
||||
* @returns {Promise<object[]>} 查询结果行。
|
||||
*/
|
||||
export function loadDataApi(viewName, searchCondition, orderField, searchColumns) {
|
||||
return post("/data/loaddata", {
|
||||
view_name: viewName,
|
||||
search_condition: searchCondition,
|
||||
order_field: orderField,
|
||||
search_columns: searchColumns,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行只读 SQL 查询。
|
||||
* @param {string} sql 完整的 SELECT 或 WITH 查询语句。
|
||||
* @returns {Promise<object[]>} 查询结果行。
|
||||
*/
|
||||
export function loadDataBySqlApi(sql) {
|
||||
return post("/data/loaddatabysql", { sql });
|
||||
}
|
||||
Reference in new issue
Block a user