20260721173401
This commit is contained in:
1 parent
fd161dd302
commit
bab8e2972f
32 files changed
+1207
-3171
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import axios from "axios";
|
||||
import { useAuthStore } from "../stores/auth";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
|
||||
const AUTH_ERROR_CODE = 401;
|
||||
const SESSION_REPLACED_CODE = 40101;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import { loadDataApi, nextIdApi, saveObjectApi } from "./api";
|
||||
|
||||
export const MODULE_ID = "M_MODULE";
|
||||
export const LOCALES = [
|
||||
{ value: "zh-CN", label: "简体中文" },
|
||||
{ value: "en-US", label: "English" },
|
||||
{ value: "zh-TW", label: "繁體中文" },
|
||||
];
|
||||
|
||||
export async function loadModuleConfiguration() {
|
||||
const [modules, fields, powers, translations, userModules, userPowers] = await Promise.all([
|
||||
loadDataApi("b_module", null, "b_xh ASC"),
|
||||
loadDataApi("b_module_field", null, "b_xh ASC"),
|
||||
loadDataApi("b_module_power", null, "b_xh ASC"),
|
||||
loadDataApi("b_i18n", null, "b_key ASC"),
|
||||
loadDataApi("b_user_module", null, "b_id ASC"),
|
||||
loadDataApi("b_user_power", null, "b_id ASC"),
|
||||
]);
|
||||
return {
|
||||
modules: modules.data,
|
||||
fields: fields.data,
|
||||
powers: powers.data,
|
||||
translations: translations.data,
|
||||
userModules: userModules.data,
|
||||
userPowers: userPowers.data,
|
||||
};
|
||||
}
|
||||
|
||||
export async function nextIds(count) {
|
||||
const ids = [];
|
||||
for (let index = 0; index < count; index += 1) {
|
||||
const response = await nextIdApi();
|
||||
ids.push(String(response.data));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
export function tableRequest(table, changes, keyField = "b_id") {
|
||||
return {
|
||||
table,
|
||||
key_field: keyField,
|
||||
inserts: changes.inserts || [],
|
||||
updates: changes.updates || [],
|
||||
deletes: changes.deletes || [],
|
||||
};
|
||||
}
|
||||
|
||||
export function saveChanges(requests) {
|
||||
return saveObjectApi(
|
||||
requests.filter(
|
||||
(request) => request.inserts.length || request.updates.length || request.deletes.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user