mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 05:32:48 +00:00
优化
This commit is contained in:
parent
07b07b9ad7
commit
0f440cae4c
@ -35,23 +35,23 @@ async function getData(temps?: Eps.Entity[]) {
|
|||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const { code, data, message } = res.data;
|
const { code, data } = res.data;
|
||||||
|
|
||||||
if (code === 1000) {
|
if (code === 1000) {
|
||||||
if (!isEmpty(data) && data) {
|
if (!isEmpty(data) && data) {
|
||||||
merge(list, Object.values(data).flat() as Eps.Entity[]);
|
merge(list, Object.values(data).flat() as Eps.Entity[]);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
error(`[eps] ${message}`);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
error(`[eps] ${url} 服务未启动!!!`);
|
error(`[eps] 服务未启动 ➜ ${url}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 合并其他数据
|
// 合并其他数据
|
||||||
if (isArray(temps)) {
|
if (isArray(temps)) {
|
||||||
temps.forEach((e) => {
|
temps.forEach((e) => {
|
||||||
|
e.isLocal = true;
|
||||||
|
|
||||||
const d = list.find((a) => e.prefix === a.prefix);
|
const d = list.find((a) => e.prefix === a.prefix);
|
||||||
|
|
||||||
if (d) {
|
if (d) {
|
||||||
@ -67,7 +67,9 @@ async function getData(temps?: Eps.Entity[]) {
|
|||||||
|
|
||||||
// 创建 json 文件
|
// 创建 json 文件
|
||||||
function createJson() {
|
function createJson() {
|
||||||
const d = list.map((e) => {
|
const d = list
|
||||||
|
.filter((e) => !e.isLocal)
|
||||||
|
.map((e) => {
|
||||||
return {
|
return {
|
||||||
prefix: e.prefix,
|
prefix: e.prefix,
|
||||||
name: e.name || "",
|
name: e.name || "",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
// 首字母大写
|
// 首字母大写
|
||||||
export function firstUpperCase(value: string): string {
|
export function firstUpperCase(value: string): string {
|
||||||
@ -70,5 +71,5 @@ export function mkdirs(path: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function error(message: 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 || ""}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,9 @@ import { createModule } from "./module";
|
|||||||
export function virtual(): Plugin {
|
export function virtual(): Plugin {
|
||||||
const virtualModuleIds = ["virtual:eps", "virtual:module"];
|
const virtualModuleIds = ["virtual:eps", "virtual:module"];
|
||||||
|
|
||||||
|
// 首次启动加载 Eps
|
||||||
|
createEps();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "vite-cool-virtual",
|
name: "vite-cool-virtual",
|
||||||
enforce: "pre",
|
enforce: "pre",
|
||||||
|
|||||||
@ -80,7 +80,10 @@ export function createModule(app: App) {
|
|||||||
e.components?.forEach(async (c: any) => {
|
e.components?.forEach(async (c: any) => {
|
||||||
const v = await (isFunction(c) ? c() : c);
|
const v = await (isFunction(c) ? c() : c);
|
||||||
const n = v.default || v;
|
const n = v.default || v;
|
||||||
|
|
||||||
|
if (n.name) {
|
||||||
app.component(n.name, n);
|
app.component(n.name, n);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 注册指令
|
// 注册指令
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { TreeData } from "element-plus/es/components/tree/src/tree.type";
|
|||||||
import { ClViewGroup, useViewGroup } from "/$/base";
|
import { ClViewGroup, useViewGroup } from "/$/base";
|
||||||
import { service } from "/@/cool";
|
import { service } from "/@/cool";
|
||||||
import Node from "element-plus/es/components/tree/src/model/node";
|
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>) {
|
export function useDeptViewGroup(options: DeepPartial<ClViewGroup.Options>) {
|
||||||
const { ViewGroup } = useViewGroup({
|
const { ViewGroup } = useViewGroup({
|
||||||
@ -1,2 +1,2 @@
|
|||||||
export * from "../components/view/group/hook";
|
export * from "../components/view/group/hook";
|
||||||
export * from "../components/dept/hook";
|
export * from "./dept";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user