This commit is contained in:
神仙都没用 2023-11-24 15:08:24 +08:00
parent 07b07b9ad7
commit 0f440cae4c
6 changed files with 30 additions and 21 deletions

View File

@ -35,23 +35,23 @@ async function getData(temps?: Eps.Entity[]) {
timeout: 5000
})
.then((res) => {
const { code, data, message } = res.data;
const { code, data } = res.data;
if (code === 1000) {
if (!isEmpty(data) && data) {
merge(list, Object.values(data).flat() as Eps.Entity[]);
}
} else {
error(`[eps] ${message}`);
}
})
.catch(() => {
error(`[eps] ${url} 服务未启动!!!`);
error(`[eps] 服务未启动 ➜ ${url}`);
});
// 合并其他数据
if (isArray(temps)) {
temps.forEach((e) => {
e.isLocal = true;
const d = list.find((a) => e.prefix === a.prefix);
if (d) {
@ -67,7 +67,9 @@ async function getData(temps?: Eps.Entity[]) {
// 创建 json 文件
function createJson() {
const d = list.map((e) => {
const d = list
.filter((e) => !e.isLocal)
.map((e) => {
return {
prefix: e.prefix,
name: e.name || "",

View File

@ -1,5 +1,6 @@
import fs from "fs";
import { join } from "path";
import dayjs from "dayjs";
// 首字母大写
export function firstUpperCase(value: string): string {
@ -70,5 +71,5 @@ export function mkdirs(path: string) {
}
export function error(message: string) {
console.log("\x1B[31m%s\x1B[0m", message);
console.log("\x1B[31m%s\x1B[0m", `${dayjs().format("HH:mm:ss")} ${message || ""}`);
}

View File

@ -5,6 +5,9 @@ import { createModule } from "./module";
export function virtual(): Plugin {
const virtualModuleIds = ["virtual:eps", "virtual:module"];
// 首次启动加载 Eps
createEps();
return {
name: "vite-cool-virtual",
enforce: "pre",

View File

@ -80,7 +80,10 @@ export function createModule(app: App) {
e.components?.forEach(async (c: any) => {
const v = await (isFunction(c) ? c() : c);
const n = v.default || v;
if (n.name) {
app.component(n.name, n);
}
});
// 注册指令

View File

@ -2,7 +2,7 @@ import { TreeData } from "element-plus/es/components/tree/src/tree.type";
import { ClViewGroup, useViewGroup } from "/$/base";
import { service } from "/@/cool";
import Node from "element-plus/es/components/tree/src/model/node";
import ClAvatar from "../avatar/index";
import ClAvatar from "../components/avatar/index";
export function useDeptViewGroup(options: DeepPartial<ClViewGroup.Options>) {
const { ViewGroup } = useViewGroup({

View File

@ -1,2 +1,2 @@
export * from "../components/view/group/hook";
export * from "../components/dept/hook";
export * from "./dept";