feat: 办事大厅前端源码首次入库(事项列表/详情/申报/管理端)
build / build (push) Successful in 1m55s

This commit is contained in:
chenxing
2026-09-15 11:00:57 +08:00
parent 7a2ea27f1e
commit 22dfb70377
328 changed files with 26089 additions and 0 deletions
+111
View File
@@ -0,0 +1,111 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import layout from "./components/layout.vue";
import { useRouter } from "vue-router";
import config from "@/assets/config/host.config";
import { baseApi } from "@/api/module/base";
import { resolveMenuPage } from "@/utils/menuRoute";
import { Message } from "view-ui-plus";
const router = useRouter();
const isLogin = ref(false);
const layoutData = reactive({
appName: "办事大厅",
baseHost: config.baseHost,
ssoHost: config.ssoHost,
appList: [] as any[],
userInfo: null as any,
modList: [] as any[],
isAlone: false,
});
onMounted(async () => {
try {
// 1. 获取当前用户信息
const user: any = await baseApi.getUserInfo().send();
const { id, name, profilePicture } = user || {};
// 2. 获取当前用户已授权的模块列表
const modList: any[] = await baseApi.getUserMod().send();
layoutData.userInfo = { id, name: name || "管理员", avatar: profilePicture || "" };
layoutData.modList = modList || [];
// 开发环境打印平台原始模块配置,便于排查菜单路径解析问题
if (import.meta.env.DEV) {
console.table(
(modList || []).map((m: any) => ({
name: m.name,
id: m.id,
modId: m.modId,
path: m.page,
}))
);
}
// 有子菜单时不算「单模块独占」模式
const hasChildren = (modList || []).some((m: any) => m.children && m.children.length > 0);
layoutData.isAlone = (modList || []).length <= 1 && !hasChildren;
isLogin.value = true;
// 登录后跳转第一个可用模块("/" 本身即已收到页,无需跳转)
if (router.currentRoute.value.path === "/") {
const firstModule = (modList || [])[0];
const firstRaw = firstModule?.children?.length
? firstModule.children[0]
: firstModule;
const first = resolveMenuPage(firstRaw?.page, firstRaw?.modId ?? firstRaw?.id, firstRaw?.name);
if (!first.external && first.path && first.path !== "/") {
router.replace(first.path);
}
}
} catch (error: any) {
console.error("加载用户信息失败", error);
if (error?.message !== "redirect") {
Message.error("载入用户信息失败,请检查后端服务是否正常!");
}
// 降级:使用默认值("/" 即已收到页,无需跳转)
layoutData.userInfo = { name: "管理员", avatar: "" };
layoutData.modList = [];
layoutData.isAlone = true;
isLogin.value = true;
}
});
</script>
<template>
<layout v-if="isLogin" :layoutData="layoutData" />
<div v-if="isLogin" class="base-wrap-main" :class="{ 'alone-page': layoutData.isAlone }">
<div class="main-wrapper">
<!-- key=fullPath:详情页仅 query 变化(id/serid)时强制重渲染,避免显示上一条数据 -->
<router-view :key="$route.fullPath" />
</div>
</div>
</template>
<style lang="scss">
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
#app {
height: 100%;
}
/* 页面级滚动容器:main-wrapper 只有 min-height 时内容超一屏会被 body 的
overflow:hidden 直接裁掉(如发通知页),无任何滚动条。定高 + 纵向滚动,
放得下的列表页(表格高度由 Utils.useTableHeight 算好)不受影响 */
.base-wrap-main .main-wrapper {
height: 100%;
overflow-y: auto;
}
/* 表格操作列(operatingHandle 渲染的 Tooltip 包裹层)横排且随单元格居中 */
.ivu-table-cell > .ivu-tooltip {
display: inline-block;
vertical-align: middle;
margin: 0 2px;
}
</style>
+26
View File
@@ -0,0 +1,26 @@
import { Method } from "alova";
import { alovaInstance } from "@/utils/alova/alova-iview";
import type { SchoolTreeNode } from "@/types/svc";
/**
* 基础平台接口(Notice baseApi 平移):用户信息与已授权模块列表(菜单渲染数据源)。
* 模块清单在 UserBase 按本应用 appKey 配置(app_module),按登录人过滤下发。
*/
const BASE = "/api/base";
function get<T = any>(url: string, params?: Record<string, any>): Method<T> {
return new Method<T>("GET", alovaInstance, url, { params });
}
class BaseApi {
/** 当前登录用户信息 */
getUserInfo() {
return get<SchoolTreeNode>(`${BASE}/GetUserInfo`);
}
/** 当前用户已授权的模块列表(左侧菜单数据源) */
getUserMod() {
return get<SchoolTreeNode[]>(`${BASE}/GetUserMod`);
}
}
export const baseApi = new BaseApi();
+192
View File
@@ -0,0 +1,192 @@
import { Method } from "alova";
import { alovaInstance } from "@/utils/alova/alova-iview";
import type {
ApplySubmitRequest,
ApplyVo,
FlowSummary,
PageResult,
SiteOption,
SvcDeptVo,
SvcDictSaveRequest,
SvcDictVo,
SvcFormSaveRequest,
SvcFormVo,
SvcItemAttachmentVo,
SvcItemEditVo,
SvcItemPageItem,
SvcItemSaveRequest,
} from "@/types/svc";
/**
* 办事大厅接口封装(V2.0 Part B 契约)。
* siteCode 为一切管理面/用户面定位键;conf.serviceHost 本地为空(走 vite 代理)。
*/
const SVC = "/api/svc";
const APPLY = "/api/apply";
const FILE = "/api/file";
/** GET 请求 */
function get<T = any>(url: string, params?: Record<string, any>): Method<T> {
return new Method<T>("GET", alovaInstance, url, { params });
}
/** POST JSON body */
function postJSON<T = any>(url: string, data?: Record<string, any> | any[]): Method<T> {
return new Method<T>(
"POST",
alovaInstance,
url,
{ headers: { "Content-Type": "application/json;charset=UTF-8" } },
data ? JSON.stringify(data) : undefined
);
}
/** POST 表单(@RequestParam) */
function postForm<T = any>(url: string, data?: Record<string, any>): Method<T> {
const form = data
? Object.entries(data)
.filter(([, v]) => v !== undefined && v !== null)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`)
.join("&")
: undefined;
return new Method<T>(
"POST",
alovaInstance,
url,
{ headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" } },
form
);
}
class SiteApi {
/** 管理端站点选择器(CMS 站点目录代理) */
options() {
return get<SiteOption[]>(`${SVC}/site/options`);
}
}
class SvcItemApi {
page(params: Record<string, any>) {
return get<PageResult<SvcItemPageItem>>(`${SVC}/item/page`, params);
}
get(siteCode: string, id: number) {
return get<SvcItemEditVo>(`${SVC}/item/get`, { siteCode, id });
}
save(data: SvcItemSaveRequest) {
return postJSON<number>(`${SVC}/item/save`, data);
}
publish(siteCode: string, id: number) {
return postForm<void>(`${SVC}/item/publish/${id}`, { siteCode });
}
offline(siteCode: string, id: number) {
return postForm<void>(`${SVC}/item/offline/${id}`, { siteCode });
}
delete(siteCode: string, id: number) {
return postJSON<void>(`${SVC}/item/delete`, { siteCode, id });
}
sort(siteCode: string, items: { id: number; sortNo: number }[]) {
return postJSON<void>(`${SVC}/item/sort?siteCode=${encodeURIComponent(siteCode)}`, items);
}
syncDeptName(siteCode: string) {
return postForm<{ updated: number }>(`${SVC}/item/syncDeptName`, { siteCode });
}
attList(siteCode: string, id: number) {
return get<SvcItemAttachmentVo[]>(`${SVC}/item/attList`, { siteCode, id });
}
}
class SvcDictApi {
list(siteCode: string, dictType?: string) {
return get<SvcDictVo[]>(`${SVC}/dict/list`, { siteCode, dictType });
}
save(data: SvcDictSaveRequest) {
return postJSON<number>(`${SVC}/dict/save`, data);
}
delete(siteCode: string, id: number) {
return postJSON<void>(`${SVC}/dict/delete`, { siteCode, id });
}
deptTree(siteCode: string) {
return get<SvcDeptVo[]>(`${SVC}/dept/tree`, { siteCode });
}
}
class SvcFormApi {
list(siteCode: string) {
return get<SvcFormVo[]>(`${SVC}/form/list`, { siteCode });
}
versions(siteCode: string, code: string) {
return get<SvcFormVo[]>(`${SVC}/form/versions`, { siteCode, code });
}
get(siteCode: string, id: number) {
return get<SvcFormVo>(`${SVC}/form/get`, { siteCode, id });
}
save(siteCode: string, data: SvcFormSaveRequest) {
return postJSON<number>(`${SVC}/form/save?siteCode=${encodeURIComponent(siteCode)}`, data);
}
publish(siteCode: string, id: number) {
return postForm<void>(`${SVC}/form/publish/${id}`, { siteCode });
}
delete(siteCode: string, code: string) {
return postForm<void>(`${SVC}/form/delete`, { siteCode, code });
}
}
class SvcFlowApi {
/** 已发布流程列表(流程中心未接入时后端报业务错,页面降级提示) */
list(siteCode: string) {
return get<FlowSummary[]>(`${SVC}/flow/list`, { siteCode });
}
}
class ApplyApi {
/** 发起(用户面) */
submit(data: ApplySubmitRequest) {
return postJSON<ApplyVo>(`${APPLY}`, data);
}
retry(id: number) {
return postForm<ApplyVo>(`${APPLY}/${id}/retry`);
}
/** 一键重提(仅驳回/撤回态;同 bizId,flow-center R4 重启推进) */
resubmit(id: number) {
return postForm<ApplyVo>(`${APPLY}/${id}/resubmit`);
}
my(params?: Record<string, any>) {
return get<PageResult<ApplyVo>>(`${APPLY}/my`, params);
}
/** 发起页数据(事项要点+表单 schema) */
item(siteCode: string, itemCode: string) {
return get<Record<string, any>>(`${APPLY}/item`, { siteCode, itemCode });
}
detail(id: number) {
return get<ApplyVo>(`${APPLY}/${id}`);
}
adminPage(params: Record<string, any>) {
return get<PageResult<ApplyVo>>(`${SVC}/apply/page`, params);
}
}
class FileApi {
/** 上传(返回完整 URL 与附件行 id;绑定在保存/提交动作完成) */
upload(file: File, type: "image" | "file", siteCode?: string) {
const form = new FormData();
form.append("file", file);
form.append("type", type);
if (siteCode) form.append("siteCode", siteCode);
return new Method<{ id: number; fileName: string; fileUrl: string; fileSize: number }>(
"POST",
alovaInstance,
`${FILE}/upload`,
{ headers: {} },
form
);
}
}
export const siteApi = new SiteApi();
export const svcItemApi = new SvcItemApi();
export const svcDictApi = new SvcDictApi();
export const svcFormApi = new SvcFormApi();
export const svcFlowApi = new SvcFlowApi();
export const applyApi = new ApplyApi();
export const fileApi = new FileApi();
+43
View File
@@ -0,0 +1,43 @@
import config from "./host.config";
import { AxiosRequestConfig } from "axios";
import { PcDebugUser } from "@/types/Basics";
const serviceUrl = config.isMock ? "" : config.serviceHost,
timeout: number = 15000;
let baseConfig: AxiosRequestConfig = {
baseURL: serviceUrl + "/",
headers: {
// "Content-Type": "application/x-www-form-urlencoded",
"Content-Type": "application/json;charset=urf-8",
yschapirequest: "1",
"Access-Control-Allow-Headers": "Set-Cookie",
"X-Requested-With": "XMLHttpRequest",
},
params: {},
data: {},
timeout, // 接口超时限制(ms)
withCredentials: true,
responseType: "json",
// transformRequest: [
// function (data) {
// if (typeof data == "string") return data;
// let ret = "";
// for (let it in data) {
// ret += encodeURIComponent(it) + "=" + encodeURIComponent(data[it]) + "&";
// }
// return ret;
// },
// ],
// maxContentLength: 2000,
validateStatus(status) {
return status >= 200 && status < 300; // default
},
};
let debugUser: PcDebugUser = {
DebugUser: "zhd",
AppType: "ChildOptCourse",
};
export { baseConfig, debugUser };
+88
View File
@@ -0,0 +1,88 @@
import { BaseConf } from "@/types/Basics";
/**
* 配置优先级(高 → 低):
* ① window.__APP_CONFIG__:线上运行时配置,index.html 引导脚本在应用模块加载前同步拉取
* /<contextPath>/api/env-config?target=<部署目录名>(本应用部署于 /{contextPath}/front/,
* 故为 front,对应后端键 yh.env-config.source.front,projman 配置管理维护)写入
* ② import.meta.env.VITE_*:仅本地开发/演示(vite dev --mode dev 读 .env.dev、--mode mock 读 .env.mock);
* build 产物不读任何 .env.*(.env.base/.env.ld/.env.prod 已删),VITE_* 恒为 undefined,
* 本层自动跳过,产物不含任何环境值
* ③ 同域推导兜底:env-config 未配置/拉取失败时框架至少能渲染并调通同源 API;
* ssoHost 为空 → 登出跳转不可用——与后端未就绪状态一致,可接受。
*/
const env = import.meta.env;
// ③ 同域推导兜底:context 段取当前路径首段(/{contextPath}/front/ → contextPath,即后端上下文),
// 与服务端 context-path 对齐(本地无、base/prod /notice);本地 dev/mock 在根路径运行(无段),
// serviceHost 留空走 vite 同源代理(规避 CAS 过滤器不回 CORS 头)
const seg = window.location.pathname.split("/").filter(Boolean);
const origin = window.location.origin;
let conf: BaseConf = {
baseHost: origin,
ssoHost: "",
serviceHost: seg.length >= 2 ? `${origin}/${seg[0]}` : "",
// 流程中心基址(BP-R2-1:我的办件/办件详情"撤回"直调 flow-center /api/flow/instance/{id}/withdraw):
// 生产同主域 Caddy 路由 /flow-center/;本地 dev 由 VITE_FLOW_HOST 指向 http://localhost:8085
// (flow-center CORS 已收 8087,同 Notice host.config 同款约定)
flowHost: seg.length >= 2 ? `${origin}/flow-center` : "",
relayConf: {
ziyuankuHost: "",
zhuanxiangHost: "",
},
isMock: false,
isDebug: env.DEV,
};
// 逐键覆盖:只覆盖来源里实际出现且非空的键,未出现的键沿用底层值
const applyConf = (target: any, source: any) => {
if (!source || typeof source !== "object") return;
Object.keys(source).forEach(key => {
if (source[key] !== undefined && source[key] !== null && source[key] !== "") {
(target as any)[key] = source[key];
}
});
};
// ② 本地开发/演示(build 产物中恒 undefined → 自动跳过)
applyConf(conf, {
baseHost: env.VITE_BASE_HOST,
ssoHost: env.VITE_SSO_HOST,
serviceHost: env.VITE_IS_MOCK === "true" ? "" : env.VITE_SERVICE_HOST,
flowHost: env.VITE_FLOW_HOST,
relayConf: {
ziyuankuHost: env.VITE_ZIYUANKU_HOST,
zhuanxiangHost: env.VITE_ZHUANXIANG_HOST,
},
isMock: env.VITE_IS_MOCK === "true",
});
// ① 线上运行时配置(最高优先,覆盖前面所有);relayConf 为嵌套对象,按子键合并,
// 运行时 JSON 只配部分资源库地址时未配的键沿用兜底值
const runtime = (window as any).__APP_CONFIG__;
applyConf(conf, runtime);
if (runtime && typeof runtime === "object" && runtime.relayConf) {
applyConf(conf.relayConf, runtime.relayConf);
}
// HTTPS 自动升级:当前页面是 https 时,将所有 http:// 配置项升级为 https://
var ishttps = "https:" == document.location.protocol ? true : false;
if (ishttps) {
Object.keys(conf).forEach(element => {
if (typeof conf[element] === "string" && conf[element].indexOf("http://") > -1) {
conf[element] = conf[element].replace("http://", "https://");
}
});
// relayConf 内部也需要处理
if (conf.relayConf) {
Object.keys(conf.relayConf).forEach(key => {
const val = (conf.relayConf as any)[key];
if (typeof val === "string" && val.indexOf("http://") > -1) {
(conf.relayConf as any)[key] = val.replace("http://", "https://");
}
});
}
}
export default conf;
+16
View File
@@ -0,0 +1,16 @@
import type { IModule } from "@/store";
/**
* 通知公告左侧菜单数据(对照后端 GetUserMod 现行模块)。
* 当前由 layout 直接使用;接入后端 GetUserMod 后,以接口返回为准。
*/
export function getMenuList(): Promise<IModule[]> {
const menu: IModule[] = [
{ id: 1, modId: 1, name: "已收到", page: "/" },
{ id: 2, modId: 2, name: "已发送", page: "/list" },
{ id: 3, modId: 3, name: "全部通知", page: "/noticelist" },
{ id: 4, modId: 4, name: "通知统计", page: "/stats" },
{ id: 21, modId: 21, name: "应用设置", page: "/setting" },
];
return Promise.resolve(menu);
}
+4
View File
@@ -0,0 +1,4 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M41.65 64.5995C42.942 65.8915 45.05 66.2995 46.75 65.4495C49.742 64.1575 52.292 62.8995 54.842 60.7575C56.134 59.4655 56.984 57.7995 56.542 55.6575C56.1 53.1075 56.542 50.1155 57.834 47.5655C59.126 45.0155 61.642 43.3155 64.226 42.4655C65.926 42.0235 67.184 40.3235 67.626 38.6575C68.068 35.6655 68.068 32.2655 67.626 29.3075C67.184 27.6075 65.926 25.9075 64.226 25.4655C61.676 24.6155 59.126 22.9155 57.834 20.3655C56.542 17.8155 56.134 14.8235 56.542 12.2735C56.984 10.5735 56.1 8.43153 54.842 7.17353C52.292 5.06553 49.742 3.77353 46.75 2.48153C45.05 1.63153 42.942 2.03953 41.65 3.33153C37.4 7.24153 30.6 7.24153 26.35 3.39953C25.058 2.10753 22.95 1.69953 21.25 2.54953C18.292 3.80753 15.708 5.09953 13.158 7.24153C11.458 8.53353 11.016 10.2335 11.458 12.3415C12.75 17.8495 9.35 23.7995 3.842 25.4995C1.7 25.9415 0.442 27.6415 0.442 29.3415C0 31.0415 0 32.2995 0 33.9995C0 35.6995 0 36.9915 0.442 38.6915C0.442 40.3915 1.734 42.0915 3.842 42.4995C6.392 43.3495 8.942 45.0495 10.234 47.5995C11.526 50.1495 11.934 53.1415 11.492 55.6915C11.05 57.3915 11.934 59.4995 13.192 60.7915C15.742 62.9335 18.292 64.1915 21.284 65.4835C22.984 66.3335 25.126 65.9255 26.384 64.6335C30.6 60.3495 37.4 60.3495 41.65 64.5995Z" fill="#919BF2"/>
<path d="M24.208 34C24.208 35.2859 24.4613 36.5592 24.9534 37.7472C25.4455 38.9353 26.1667 40.0147 27.076 40.924C27.9853 41.8333 29.0647 42.5545 30.2528 43.0466C31.4408 43.5387 32.7141 43.792 34 43.792C35.2859 43.792 36.5592 43.5387 37.7472 43.0466C38.9353 42.5545 40.0147 41.8333 40.924 40.924C41.8333 40.0147 42.5545 38.9353 43.0466 37.7472C43.5387 36.5592 43.792 35.2859 43.792 34C43.792 32.7141 43.5387 31.4408 43.0466 30.2528C42.5545 29.0648 41.8333 27.9853 40.924 27.076C40.0147 26.1667 38.9353 25.4455 37.7472 24.9534C36.5592 24.4613 35.2859 24.208 34 24.208C32.7141 24.208 31.4408 24.4613 30.2528 24.9534C29.0647 25.4455 27.9853 26.1667 27.076 27.076C26.1667 27.9853 25.4455 29.0648 24.9534 30.2528C24.4613 31.4408 24.208 32.7141 24.208 34Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7245_84837)">
<path d="M52.5096 4.53333H43.443V2.26667C43.443 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2942 0 23.043 0C21.7918 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70484 4.53333 2.64297 8.5952 2.64297 13.6V54.4C2.64297 59.4048 6.70484 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.519 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.243 48.8512 16.243 47.6C16.243 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9654 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.243 35.2512 16.243 34C16.243 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9654 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.243 21.6512 16.243 20.4C16.243 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9654 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M58.5962 56.782C57.2642 55.486 56.1722 54.142 55.3202 52.75C54.2762 54.346 52.8962 55.678 51.1802 56.746L50.4602 55.576C52.2602 54.532 53.6462 53.182 54.6182 51.526C53.8502 50.062 53.2622 48.478 52.8542 46.774C52.5182 47.434 52.1162 48.064 51.6482 48.664L50.8742 47.692C52.1462 45.856 53.0102 43.384 53.4662 40.276L54.7442 40.492C54.6122 41.332 54.4382 42.184 54.2222 43.048H58.8482V44.29H57.7322C57.6482 47.122 57.0722 49.564 56.0042 51.616C56.9162 53.164 58.0442 54.508 59.3882 55.648L58.5962 56.782ZM53.8622 44.29L53.5022 45.28C53.9342 47.128 54.5222 48.796 55.2662 50.284C56.0342 48.532 56.4542 46.534 56.5262 44.29H53.8622ZM43.8542 42.004H46.2122V40.402H47.4542V42.004H49.3802V43.156H47.4542V44.992H48.4982C49.4342 43.804 50.2562 42.502 50.9642 41.086L51.9722 41.608C51.3122 42.856 50.6282 43.984 49.9202 44.992H51.2522V46.198H49.0022C48.4862 46.81 47.9942 47.35 47.5262 47.818H50.5862V48.754C49.9742 49.474 49.2542 50.194 48.4262 50.914V51.796C49.5422 51.628 50.6102 51.406 51.6302 51.13V52.336C50.6942 52.588 49.6262 52.798 48.4262 52.966V55.054C48.4262 56.098 47.9162 56.62 46.8962 56.62H45.0962L44.7722 55.45C45.5282 55.51 46.0682 55.54 46.3922 55.54C46.9082 55.54 47.1662 55.264 47.1662 54.712V53.146C45.8342 53.302 44.5142 53.44 43.2062 53.56L43.0262 52.318C44.3342 52.258 45.7142 52.144 47.1662 51.976V50.662C47.8382 50.158 48.4682 49.594 49.0562 48.97H46.2662C45.3182 49.75 44.3882 50.392 43.4762 50.896L42.6662 49.978C43.1942 49.678 43.7342 49.342 44.2862 48.97H43.8722V47.818H45.7802C46.3682 47.326 46.9322 46.786 47.4722 46.198H43.0082V44.992H46.2122V43.156H43.8542V42.004Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7245_84837">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7245_84837)">
<path d="M52.5096 4.53333H43.443V2.26667C43.443 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2942 0 23.043 0C21.7918 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70484 4.53333 2.64297 8.5952 2.64297 13.6V54.4C2.64297 59.4048 6.70484 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.519 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.243 48.8512 16.243 47.6C16.243 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9654 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.243 35.2512 16.243 34C16.243 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9654 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.243 21.6512 16.243 20.4C16.243 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9654 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M58.5962 56.782C57.2642 55.486 56.1722 54.142 55.3202 52.75C54.2762 54.346 52.8962 55.678 51.1802 56.746L50.4602 55.576C52.2602 54.532 53.6462 53.182 54.6182 51.526C53.8502 50.062 53.2622 48.478 52.8542 46.774C52.5182 47.434 52.1162 48.064 51.6482 48.664L50.8742 47.692C52.1462 45.856 53.0102 43.384 53.4662 40.276L54.7442 40.492C54.6122 41.332 54.4382 42.184 54.2222 43.048H58.8482V44.29H57.7322C57.6482 47.122 57.0722 49.564 56.0042 51.616C56.9162 53.164 58.0442 54.508 59.3882 55.648L58.5962 56.782ZM53.8622 44.29L53.5022 45.28C53.9342 47.128 54.5222 48.796 55.2662 50.284C56.0342 48.532 56.4542 46.534 56.5262 44.29H53.8622ZM43.8542 42.004H46.2122V40.402H47.4542V42.004H49.3802V43.156H47.4542V44.992H48.4982C49.4342 43.804 50.2562 42.502 50.9642 41.086L51.9722 41.608C51.3122 42.856 50.6282 43.984 49.9202 44.992H51.2522V46.198H49.0022C48.4862 46.81 47.9942 47.35 47.5262 47.818H50.5862V48.754C49.9742 49.474 49.2542 50.194 48.4262 50.914V51.796C49.5422 51.628 50.6102 51.406 51.6302 51.13V52.336C50.6942 52.588 49.6262 52.798 48.4262 52.966V55.054C48.4262 56.098 47.9162 56.62 46.8962 56.62H45.0962L44.7722 55.45C45.5282 55.51 46.0682 55.54 46.3922 55.54C46.9082 55.54 47.1662 55.264 47.1662 54.712V53.146C45.8342 53.302 44.5142 53.44 43.2062 53.56L43.0262 52.318C44.3342 52.258 45.7142 52.144 47.1662 51.976V50.662C47.8382 50.158 48.4682 49.594 49.0562 48.97H46.2662C45.3182 49.75 44.3882 50.392 43.4762 50.896L42.6662 49.978C43.1942 49.678 43.7342 49.342 44.2862 48.97H43.8722V47.818H45.7802C46.3682 47.326 46.9322 46.786 47.4722 46.198H43.0082V44.992H46.2122V43.156H43.8542V42.004Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7245_84837">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7245_84837)">
<path d="M52.5096 4.53333H43.443V2.26667C43.443 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2942 0 23.043 0C21.7918 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70484 4.53333 2.64297 8.5952 2.64297 13.6V54.4C2.64297 59.4048 6.70484 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.519 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.243 48.8512 16.243 47.6C16.243 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9654 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.243 35.2512 16.243 34C16.243 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9654 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.243 21.6512 16.243 20.4C16.243 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9654 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M58.5962 56.782C57.2642 55.486 56.1722 54.142 55.3202 52.75C54.2762 54.346 52.8962 55.678 51.1802 56.746L50.4602 55.576C52.2602 54.532 53.6462 53.182 54.6182 51.526C53.8502 50.062 53.2622 48.478 52.8542 46.774C52.5182 47.434 52.1162 48.064 51.6482 48.664L50.8742 47.692C52.1462 45.856 53.0102 43.384 53.4662 40.276L54.7442 40.492C54.6122 41.332 54.4382 42.184 54.2222 43.048H58.8482V44.29H57.7322C57.6482 47.122 57.0722 49.564 56.0042 51.616C56.9162 53.164 58.0442 54.508 59.3882 55.648L58.5962 56.782ZM53.8622 44.29L53.5022 45.28C53.9342 47.128 54.5222 48.796 55.2662 50.284C56.0342 48.532 56.4542 46.534 56.5262 44.29H53.8622ZM43.8542 42.004H46.2122V40.402H47.4542V42.004H49.3802V43.156H47.4542V44.992H48.4982C49.4342 43.804 50.2562 42.502 50.9642 41.086L51.9722 41.608C51.3122 42.856 50.6282 43.984 49.9202 44.992H51.2522V46.198H49.0022C48.4862 46.81 47.9942 47.35 47.5262 47.818H50.5862V48.754C49.9742 49.474 49.2542 50.194 48.4262 50.914V51.796C49.5422 51.628 50.6102 51.406 51.6302 51.13V52.336C50.6942 52.588 49.6262 52.798 48.4262 52.966V55.054C48.4262 56.098 47.9162 56.62 46.8962 56.62H45.0962L44.7722 55.45C45.5282 55.51 46.0682 55.54 46.3922 55.54C46.9082 55.54 47.1662 55.264 47.1662 54.712V53.146C45.8342 53.302 44.5142 53.44 43.2062 53.56L43.0262 52.318C44.3342 52.258 45.7142 52.144 47.1662 51.976V50.662C47.8382 50.158 48.4682 49.594 49.0562 48.97H46.2662C45.3182 49.75 44.3882 50.392 43.4762 50.896L42.6662 49.978C43.1942 49.678 43.7342 49.342 44.2862 48.97H43.8722V47.818H45.7802C46.3682 47.326 46.9322 46.786 47.4722 46.198H43.0082V44.992H46.2122V43.156H43.8542V42.004Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7245_84837">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7245_84837)">
<path d="M52.5096 4.53333H43.443V2.26667C43.443 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2942 0 23.043 0C21.7918 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70484 4.53333 2.64297 8.5952 2.64297 13.6V54.4C2.64297 59.4048 6.70484 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.519 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.243 48.8512 16.243 47.6C16.243 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9654 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.243 35.2512 16.243 34C16.243 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9654 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.243 21.6512 16.243 20.4C16.243 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9654 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M58.5962 56.782C57.2642 55.486 56.1722 54.142 55.3202 52.75C54.2762 54.346 52.8962 55.678 51.1802 56.746L50.4602 55.576C52.2602 54.532 53.6462 53.182 54.6182 51.526C53.8502 50.062 53.2622 48.478 52.8542 46.774C52.5182 47.434 52.1162 48.064 51.6482 48.664L50.8742 47.692C52.1462 45.856 53.0102 43.384 53.4662 40.276L54.7442 40.492C54.6122 41.332 54.4382 42.184 54.2222 43.048H58.8482V44.29H57.7322C57.6482 47.122 57.0722 49.564 56.0042 51.616C56.9162 53.164 58.0442 54.508 59.3882 55.648L58.5962 56.782ZM53.8622 44.29L53.5022 45.28C53.9342 47.128 54.5222 48.796 55.2662 50.284C56.0342 48.532 56.4542 46.534 56.5262 44.29H53.8622ZM43.8542 42.004H46.2122V40.402H47.4542V42.004H49.3802V43.156H47.4542V44.992H48.4982C49.4342 43.804 50.2562 42.502 50.9642 41.086L51.9722 41.608C51.3122 42.856 50.6282 43.984 49.9202 44.992H51.2522V46.198H49.0022C48.4862 46.81 47.9942 47.35 47.5262 47.818H50.5862V48.754C49.9742 49.474 49.2542 50.194 48.4262 50.914V51.796C49.5422 51.628 50.6102 51.406 51.6302 51.13V52.336C50.6942 52.588 49.6262 52.798 48.4262 52.966V55.054C48.4262 56.098 47.9162 56.62 46.8962 56.62H45.0962L44.7722 55.45C45.5282 55.51 46.0682 55.54 46.3922 55.54C46.9082 55.54 47.1662 55.264 47.1662 54.712V53.146C45.8342 53.302 44.5142 53.44 43.2062 53.56L43.0262 52.318C44.3342 52.258 45.7142 52.144 47.1662 51.976V50.662C47.8382 50.158 48.4682 49.594 49.0562 48.97H46.2662C45.3182 49.75 44.3882 50.392 43.4762 50.896L42.6662 49.978C43.1942 49.678 43.7342 49.342 44.2862 48.97H43.8722V47.818H45.7802C46.3682 47.326 46.9322 46.786 47.4722 46.198H43.0082V44.992H46.2122V43.156H43.8542V42.004Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7245_84837">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7245_84837)">
<path d="M52.5096 4.53333H43.443V2.26667C43.443 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2942 0 23.043 0C21.7918 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70484 4.53333 2.64297 8.5952 2.64297 13.6V54.4C2.64297 59.4048 6.70484 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.519 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.243 48.8512 16.243 47.6C16.243 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9654 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.243 35.2512 16.243 34C16.243 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9654 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.243 21.6512 16.243 20.4C16.243 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9654 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M58.5962 56.782C57.2642 55.486 56.1722 54.142 55.3202 52.75C54.2762 54.346 52.8962 55.678 51.1802 56.746L50.4602 55.576C52.2602 54.532 53.6462 53.182 54.6182 51.526C53.8502 50.062 53.2622 48.478 52.8542 46.774C52.5182 47.434 52.1162 48.064 51.6482 48.664L50.8742 47.692C52.1462 45.856 53.0102 43.384 53.4662 40.276L54.7442 40.492C54.6122 41.332 54.4382 42.184 54.2222 43.048H58.8482V44.29H57.7322C57.6482 47.122 57.0722 49.564 56.0042 51.616C56.9162 53.164 58.0442 54.508 59.3882 55.648L58.5962 56.782ZM53.8622 44.29L53.5022 45.28C53.9342 47.128 54.5222 48.796 55.2662 50.284C56.0342 48.532 56.4542 46.534 56.5262 44.29H53.8622ZM43.8542 42.004H46.2122V40.402H47.4542V42.004H49.3802V43.156H47.4542V44.992H48.4982C49.4342 43.804 50.2562 42.502 50.9642 41.086L51.9722 41.608C51.3122 42.856 50.6282 43.984 49.9202 44.992H51.2522V46.198H49.0022C48.4862 46.81 47.9942 47.35 47.5262 47.818H50.5862V48.754C49.9742 49.474 49.2542 50.194 48.4262 50.914V51.796C49.5422 51.628 50.6102 51.406 51.6302 51.13V52.336C50.6942 52.588 49.6262 52.798 48.4262 52.966V55.054C48.4262 56.098 47.9162 56.62 46.8962 56.62H45.0962L44.7722 55.45C45.5282 55.51 46.0682 55.54 46.3922 55.54C46.9082 55.54 47.1662 55.264 47.1662 54.712V53.146C45.8342 53.302 44.5142 53.44 43.2062 53.56L43.0262 52.318C44.3342 52.258 45.7142 52.144 47.1662 51.976V50.662C47.8382 50.158 48.4682 49.594 49.0562 48.97H46.2662C45.3182 49.75 44.3882 50.392 43.4762 50.896L42.6662 49.978C43.1942 49.678 43.7342 49.342 44.2862 48.97H43.8722V47.818H45.7802C46.3682 47.326 46.9322 46.786 47.4722 46.198H43.0082V44.992H46.2122V43.156H43.8542V42.004Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7245_84837">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7186_97095)">
<path d="M52.5096 4.53333H43.443V2.26667C43.443 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2942 0 23.043 0C21.7918 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70484 4.53333 2.64297 8.5952 2.64297 13.6V54.4C2.64297 59.4048 6.70484 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.519 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.243 48.8512 16.243 47.6C16.243 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9654 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.243 35.2512 16.243 34C16.243 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9654 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.243 21.6512 16.243 20.4C16.243 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9654 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M44.1242 40.672C45.2522 41.032 46.2482 41.452 47.1122 41.932L46.4282 42.976C45.4922 42.424 44.5142 41.98 43.4942 41.644L44.1242 40.672ZM51.1982 40.402C51.0062 40.93 50.8502 41.314 50.7302 41.554H57.9842V42.328C57.7682 43.228 57.4802 44.104 57.1202 44.956L55.8782 44.578C56.1662 44.05 56.4242 43.42 56.6522 42.688H53.5922C53.5202 43.12 53.4122 43.516 53.2682 43.876C54.2042 45.256 56.0582 46.21 58.8302 46.738L58.3622 47.89C55.7222 47.35 53.8502 46.366 52.7462 44.938C52.5182 45.286 52.2782 45.592 52.0262 45.856C51.1262 46.696 49.6802 47.35 47.6882 47.818L47.2022 46.666C48.9782 46.282 50.2562 45.754 51.0362 45.082C51.6962 44.47 52.1342 43.672 52.3502 42.688H50.0462C49.5422 43.336 48.9482 43.93 48.2642 44.47L47.5082 43.462C48.6722 42.61 49.4762 41.536 49.9202 40.24L51.1982 40.402ZM56.7602 48.304V53.65H55.4642V49.51H46.4822V53.794H45.1862V48.304H56.7602ZM51.7562 50.302C51.5042 52.582 50.9582 54.118 50.1182 54.91C49.1702 55.894 47.0822 56.512 43.8542 56.764L43.3502 55.612C46.2182 55.444 48.1082 54.952 49.0202 54.136C49.8362 53.356 50.3162 52.042 50.4602 50.194L51.7562 50.302ZM47.3822 44.938C46.4822 45.874 45.3662 46.756 44.0342 47.584L43.1702 46.576C44.5262 45.808 45.6782 44.968 46.6262 44.056L47.3822 44.938ZM52.1702 53.596C54.4982 54.208 56.6282 54.946 58.5602 55.81L57.8582 56.89C55.7822 55.906 53.6642 55.138 51.5042 54.586L52.1702 53.596Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7186_97095">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7186_97102)">
<path d="M52.5096 4.53333H43.4429V2.26667C43.4429 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2941 0 23.0429 0C21.7917 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70481 4.53333 2.64294 8.5952 2.64294 13.6V54.4C2.64294 59.4048 6.70481 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.5189 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.2429 48.8512 16.2429 47.6C16.2429 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9653 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.2429 35.2512 16.2429 34C16.2429 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9653 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.2429 21.6512 16.2429 20.4C16.2429 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9653 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M46.2482 45.172H47.4902V47.962H49.3082V49.15H47.4902V51.67C48.1742 51.526 48.8222 51.382 49.4342 51.238V52.444L47.4902 52.894V56.818H46.2482V53.128C45.2402 53.308 44.1362 53.47 42.9362 53.614L42.7742 52.354C44.2382 52.186 45.3962 52.03 46.2482 51.886V49.15H43.2602L42.9902 48.016C43.5062 46.888 43.9862 45.484 44.4302 43.804H42.8282V42.562H44.7362C44.9402 41.65 45.0962 40.894 45.2042 40.294L46.4282 40.492L45.9962 42.562H49.2542V43.804H45.6902C45.2702 45.424 44.8142 46.81 44.3222 47.962H46.2482V45.172ZM49.8302 42.58H53.6822V40.366H54.9062V42.58H57.3002C56.9042 42.04 56.4182 41.464 55.8422 40.852L56.7062 40.312C57.3662 41.008 57.8762 41.608 58.2362 42.112L57.5702 42.58H59.2082V43.804H54.9062V45.46H58.5962V55.234C58.5962 56.218 58.1462 56.71 57.2462 56.71H56.0042L55.6802 55.486L56.8322 55.54C57.2042 55.54 57.3902 55.354 57.3902 54.982V52.84H54.9062V56.674H53.6822V52.84H51.3242V56.782H50.1182V45.46H53.6822V43.804H49.8302V42.58ZM53.6822 46.612H51.3242V48.646H53.6822V46.612ZM51.3242 49.762V51.724H53.6822V49.762H51.3242ZM57.3902 51.724V49.762H54.9062V51.724H57.3902ZM57.3902 48.646V46.612H54.9062V48.646H57.3902Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7186_97102">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7186_97108)">
<path d="M52.5096 4.53333H43.4429V2.26667C43.4429 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2941 0 23.0429 0C21.7917 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70481 4.53333 2.64294 8.5952 2.64294 13.6V54.4C2.64294 59.4048 6.70481 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.5189 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.2429 48.8512 16.2429 47.6C16.2429 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9653 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.2429 35.2512 16.2429 34C16.2429 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9653 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.2429 21.6512 16.2429 20.4C16.2429 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9653 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M55.2302 55.288C56.7302 55.288 58.0802 55.264 59.2802 55.216L59.0642 56.512H55.5182C51.2102 56.512 48.5162 56.278 47.4362 55.81C46.5002 55.414 45.6542 54.688 44.8982 53.632C44.5742 54.784 44.1242 55.846 43.5482 56.818L42.6122 55.99C43.5722 54.358 44.1002 52.516 44.1962 50.464L45.3482 50.608C45.3122 51.256 45.2522 51.826 45.1682 52.318C45.6362 53.05 46.1522 53.626 46.7162 54.046V49.672H43.1522V48.484H50.7842V49.672H47.8682V51.58H50.3342V52.732H47.8682V54.694C47.9762 54.73 48.0662 54.766 48.1382 54.802C49.1822 55.126 51.5462 55.288 55.2302 55.288ZM43.9622 40.996H50.1002V47.278H43.9622V40.996ZM48.8402 46.198V44.668H45.2222V46.198H48.8402ZM45.2222 43.66H48.8402V42.076H45.2222V43.66ZM51.0362 41.014H58.8122V42.202H55.5722C55.5122 42.73 55.4342 43.21 55.3382 43.642H58.3082V50.914H57.1022V44.758H52.7462V50.914H51.5942V43.642H54.1682C54.2642 43.234 54.3422 42.754 54.4022 42.202H51.0362V41.014ZM56.2202 50.968C57.3362 51.832 58.2722 52.696 59.0282 53.56L58.1102 54.46C57.4142 53.596 56.4962 52.708 55.3562 51.796L56.2202 50.968ZM54.3302 45.604H55.5182V48.142C55.4822 49.834 55.1522 51.202 54.5282 52.246C53.9282 53.182 52.9322 53.926 51.5402 54.478L50.8382 53.362C52.1222 52.894 53.0282 52.252 53.5562 51.436C54.0362 50.572 54.2942 49.474 54.3302 48.142V45.604Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7186_97108">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7186_97114)">
<path d="M52.5096 4.53333H43.4429V2.26667C43.4429 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2941 0 23.0429 0C21.7917 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70481 4.53333 2.64294 8.5952 2.64294 13.6V54.4C2.64294 59.4048 6.70481 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.5189 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.2429 48.8512 16.2429 47.6C16.2429 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9653 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.2429 35.2512 16.2429 34C16.2429 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9653 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.2429 21.6512 16.2429 20.4C16.2429 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9653 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M50.4602 48.826H48.7682V47.62H53.4302V48.826H51.7382V53.704C52.5902 53.512 53.3702 53.314 54.0782 53.11V54.316C52.5182 54.76 50.8322 55.138 49.0202 55.45L48.6962 54.226C49.3082 54.154 49.8962 54.064 50.4602 53.956V48.826ZM57.2822 56.53C56.6582 56.53 56.1122 56.062 55.6442 55.126C55.1042 54.046 54.7082 52.576 54.4562 50.716C54.2642 49.192 54.1322 47.218 54.0602 44.794H48.3542V43.534H54.0242C54.0002 42.838 53.9882 41.74 53.9882 40.24H55.2482C55.2482 41.752 55.2602 42.85 55.2842 43.534H58.8662V44.794H55.3022C55.3862 47.83 55.5782 50.218 55.8782 51.958C56.2742 53.998 56.7422 55.054 57.2822 55.126C57.6542 55.054 58.0202 53.95 58.3802 51.814L59.4062 52.642C58.8182 55.234 58.1102 56.53 57.2822 56.53ZM56.7962 40.222C57.5522 41.062 58.1522 41.818 58.5962 42.49L57.6962 43.12C57.2762 42.472 56.6702 41.692 55.8782 40.78L56.7962 40.222ZM44.9162 40.474C46.0442 41.374 47.0102 42.298 47.8142 43.246L46.9322 44.146C46.2002 43.246 45.2282 42.316 44.0162 41.356L44.9162 40.474ZM42.7562 45.802H46.5362V53.65C46.9682 53.23 47.5202 52.654 48.1922 51.922L48.5342 53.29C47.5262 54.382 46.4762 55.336 45.3842 56.152L44.8802 55C45.1442 54.772 45.2762 54.526 45.2762 54.262V47.044H42.7562V45.802Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7186_97114">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7186_97120)">
<path d="M52.5096 4.53333H43.4429V2.26667C43.4429 1.01547 42.4275 0 41.1763 0C39.9251 0 38.9096 1.01547 38.9096 2.26667V4.53333H25.3096V2.26667C25.3096 1.01547 24.2941 0 23.0429 0C21.7917 0 20.7763 1.01547 20.7763 2.26667V4.53333H11.7096C6.70481 4.53333 2.64294 8.5952 2.64294 13.6V54.4C2.64294 59.4048 6.70481 63.4667 11.7096 63.4667H52.5096C57.5144 63.4667 61.5763 59.4048 61.5763 54.4V13.6C61.5763 8.5952 57.5189 4.53333 52.5096 4.53333ZM45.7096 49.8667H18.5096C17.2584 49.8667 16.2429 48.8512 16.2429 47.6C16.2429 46.3488 17.2584 45.3333 18.5096 45.3333H45.7096C46.9608 45.3333 47.9763 46.3488 47.9763 47.6C47.9763 48.8512 46.9653 49.8667 45.7096 49.8667ZM45.7096 36.2667H18.5096C17.2584 36.2667 16.2429 35.2512 16.2429 34C16.2429 32.7488 17.2584 31.7333 18.5096 31.7333H45.7096C46.9608 31.7333 47.9763 32.7488 47.9763 34C47.9763 35.2512 46.9653 36.2667 45.7096 36.2667ZM45.7096 22.6667H18.5096C17.2584 22.6667 16.2429 21.6512 16.2429 20.4C16.2429 19.1488 17.2584 18.1333 18.5096 18.1333H45.7096C46.9608 18.1333 47.9763 19.1488 47.9763 20.4C47.9763 21.6512 46.9653 22.6667 45.7096 22.6667Z" fill="#A0CDF2"/>
<circle cx="51.5" cy="48.5" r="18.5" fill="white"/>
<circle cx="51.6914" cy="48.6912" r="14.6912" fill="#A0CDF2"/>
<path d="M42.9181 45.784H48.0661C48.2221 45.196 48.4081 44.452 48.6241 43.552H44.1421V42.346H48.8941C49.0021 41.854 49.1521 41.128 49.3441 40.168L50.6761 40.276L50.2621 42.346H58.0201V43.552H49.9921C49.8241 44.296 49.6441 45.04 49.4521 45.784H59.0821V47.044H49.1101C48.9421 47.62 48.6841 48.412 48.3361 49.42H56.9041V50.536C56.0161 51.904 54.6601 53.242 52.8361 54.55C53.8321 54.91 54.8701 55.348 55.9501 55.864L55.2301 56.998C52.5661 55.678 49.7821 54.628 46.8781 53.848L47.5621 52.84C48.7621 53.164 50.0581 53.566 51.4501 54.046C53.0941 52.966 54.4021 51.826 55.3741 50.626H46.4821C46.9501 49.366 47.3581 48.172 47.7061 47.044H42.9181V45.784Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7186_97120">
<rect width="68" height="68" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+16
View File
@@ -0,0 +1,16 @@
<svg
t="1615860353141"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="6624"
width="14"
height="14"
>
<path
d="M0 102.4h307.2v307.2H0zM0 614.4h307.2v307.2H0zM409.6 102.4h614.4v102.4H409.6zM409.6 307.2h614.4v102.4H409.6zM409.6 614.4h614.4v102.4H409.6zM409.6 819.2h614.4v102.4H409.6z"
p-id="6625"
fill="#656667"
></path>
</svg>

After

Width:  |  Height:  |  Size: 914 B

+4
View File
@@ -0,0 +1,4 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M832 192H544l-64-64H192c-35.2 0-64 28.8-64 64v576c0 35.2 28.8 64 64 64h640c35.2 0 64-28.8 64-64V256c0-35.2-28.8-64-64-64z m0 576H192V192h266.7l64 64H832v512z" fill="#999999"/>
<path d="M256 320h512v64H256z m0 128h384v64H256z m0 128h256v64H256z" fill="#cccccc"/>
</svg>

After

Width:  |  Height:  |  Size: 380 B

+13
View File
@@ -0,0 +1,13 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="1" width="30" height="30" rx="3" fill="white" stroke="#DCDEE0" stroke-width="2" stroke-dasharray="4 4"/>
<g clip-path="url(#clip0_125_1092)">
<path d="M24 8H8V24H24V8Z" fill="white" fill-opacity="0.01"/>
<path d="M16.0209 11.3333L16.0087 20.6666" stroke="#666666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.3333 16H20.6667" stroke="#666666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_125_1092">
<rect width="16" height="16" fill="white" transform="translate(8 8)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 695 B

+15
View File
@@ -0,0 +1,15 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="1" width="30" height="30" rx="3" fill="white" stroke="#DCDEE0" stroke-width="2"/>
<g clip-path="url(#clip0_125_1099)">
<path d="M24 8H8V24H24V8Z" fill="white" fill-opacity="0.01"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.6667 13H21.3333L20.3333 22.6667H11.6667L10.6667 13Z" stroke="#F15B43" stroke-width="1.125" stroke-linejoin="round"/>
<path d="M14.6667 16.3333V19.6667" stroke="#F15B43" stroke-width="1.125" stroke-linecap="round"/>
<path d="M17.3333 16.3333V19.6658" stroke="#F15B43" stroke-width="1.125" stroke-linecap="round"/>
<path d="M12 13L17.4414 9L20 13" stroke="#F15B43" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_125_1099">
<rect width="16" height="16" fill="white" transform="translate(8 8)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 919 B

+4
View File
@@ -0,0 +1,4 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M482.214544 543.934407l-0.099952-59.970717 59.970718-0.099952 0.099951 59.970718-59.970717 0.099951z m119.941435-0.199902l-0.099952-59.970718 59.970718-0.099951 0.099951 59.970717-59.970717 0.099952z m119.941434-0.199903l-0.099951-59.970717 59.970718-0.099951 0.099951 59.970717-59.970718 0.099951z m119.941435-0.299853l-0.099951-59.970718 59.970717-0.099951 0.099952 59.970717-59.970718 0.099952z m119.941435-0.199903l-0.099951-59.970717 59.970717-0.099951 0.099951 59.970717-59.970717 0.099951z" />
<path d="M482.914202 1024l-0.099951-59.970717 59.970717-0.099952 0.099951 59.970718-59.970717 0.099951z m-0.199902-119.941435l-0.099952-59.970717 59.970718-0.099951 0.099951 59.970717-59.970717 0.099951z m-0.199903-119.941435l-0.099951-59.970717 59.970717-0.099951 0.099952 59.970717-59.970718 0.099951z m-0.199902-119.941435l-0.099951-59.970717 59.970717-0.099951 0.099951 59.970717-59.970717 0.099951z m-0.099951-119.941434l-0.099952-59.970718 59.970718-0.099951 0.099951 59.970717-59.970717 0.099952z m-0.199903-119.941435l-0.099951-59.970718 59.970718-0.099951 0.099951 59.970718-59.970718 0.099951z m-0.199902-119.941435l-0.099951-59.970718 59.970717-0.099951 0.099951 59.970718-59.970717 0.099951z m-0.199902-119.941435l-0.099952-59.970717 59.970718-0.099952 0.099951 59.970718-59.970717 0.099951z m-0.199903-119.941435l-0.099951-59.970717 59.970717-0.099951 0.099952 59.970717-59.970718 0.099951z" />
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7225_67996)">
<path d="M18 0H0V18H18V0Z" fill="white" fill-opacity="0.01"/>
<path d="M14.625 2.25H3.375C2.75368 2.25 2.25 2.75368 2.25 3.375V14.625C2.25 15.2463 2.75368 15.75 3.375 15.75H14.625C15.2463 15.75 15.75 15.2463 15.75 14.625V3.375C15.75 2.75368 15.2463 2.25 14.625 2.25Z" stroke="#5B6871" stroke-width="1.125" stroke-linejoin="round"/>
<path d="M9 6V12" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 9H12" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_7225_67996">
<rect width="18" height="18" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 793 B

+5
View File
@@ -0,0 +1,5 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 0H0V18H18V0Z" fill="white" fill-opacity="0.01"/>
<path d="M2.625 15.75H16.125" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.125 10.02V12.75H6.86895L14.625 4.99054L11.8857 2.25L4.125 10.02Z" stroke="#5B6871" stroke-width="1.125" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 424 B

+14
View File
@@ -0,0 +1,14 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7225_67984)">
<path d="M18 0H0V18H18V0Z" fill="white" fill-opacity="0.01"/>
<path d="M7 3V15" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 7L7 3" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 15V3" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 15L15 11" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_7225_67984">
<rect width="18" height="18" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 740 B

+1
View File
@@ -0,0 +1 @@
<svg t="1784779423851" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6101" width="24" height="24"><path d="M1016.32 494.08l-143.872-143.36c-9.728-9.728-26.112-9.728-35.84 0-9.728 9.728-9.728 26.112 0 35.84L936.96 486.4h-399.36V87.04l99.84 100.352c9.728 9.728 26.112 9.728 35.84 0 9.728-9.728 9.728-26.112 0-35.84l-143.36-143.872c-9.728-9.728-26.112-9.728-35.84 0l-143.36 143.872c-9.728 9.728-9.728 26.112 0 35.84 9.728 9.728 26.112 9.728 35.84 0L486.4 87.04v399.36H87.04l100.352-99.84c9.728-9.728 9.728-26.112 0-35.84-9.728-9.728-26.112-9.728-35.84 0l-143.872 143.36c-9.728 9.728-9.728 26.112 0 35.84l143.872 143.36c9.728 9.728 26.112 9.728 35.84 0 9.728-9.728 9.728-26.112 0-35.84L87.04 537.6h399.36v399.36l-99.84-100.352c-9.728-9.728-26.112-9.728-35.84 0-9.728 9.728-9.728 26.112 0 35.84l143.36 143.872c9.728 9.728 26.112 9.728 35.84 0l143.36-143.872c9.728-9.728 9.728-26.112 0-35.84-9.728-9.728-26.112-9.728-35.84 0L537.6 936.96v-399.36h399.36l-100.352 99.84c-9.728 9.728-9.728 26.112 0 35.84 9.728 9.728 26.112 9.728 35.84 0l143.872-143.36c10.24-9.728 10.24-26.112 0-35.84z" p-id="6102"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7225_67990)">
<path d="M18 0H0V18H18V0Z" fill="white" fill-opacity="0.01"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 5.625H15L13.875 16.5H4.125L3 5.625Z" stroke="#5B6871" stroke-width="1.125" stroke-linejoin="round"/>
<path d="M7.50073 9.37598V13.1261" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round"/>
<path d="M10.5009 9.375V13.1241" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round"/>
<path d="M4.5 5.62496L10.6216 1.125L13.5 5.625" stroke="#5B6871" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_7225_67990">
<rect width="18" height="18" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 795 B

+1
View File
@@ -0,0 +1 @@
<svg t="1784812882139" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3484" width="24" height="24"><path d="M446.112323 177.545051c137.567677 0.219798 252.612525 104.59798 266.162424 241.493333 13.562828 136.895354-78.778182 261.818182-213.617777 289.008485-134.852525 27.203232-268.386263-52.156768-308.945455-183.608889s25.018182-272.252121 151.738182-325.779394A267.235556 267.235556 0 0 1 446.112323 177.545051m0-62.060607c-182.794343 0-330.989899 148.195556-330.989899 330.989899s148.195556 330.989899 330.989899 330.989899 330.989899-148.195556 330.989899-330.989899-148.195556-330.989899-330.989899-330.989899z m431.321212 793.341415a30.849293 30.849293 0 0 1-21.94101-9.102223l-157.220202-157.220202c-11.752727-12.179394-11.584646-31.534545 0.37495-43.50707 11.972525-11.972525 31.327677-12.140606 43.494141-0.37495l157.220202 157.220202a31.036768 31.036768 0 0 1 6.723232 33.810101 31.004444 31.004444 0 0 1-28.651313 19.174142z m0 0" p-id="3485"></path></svg>

After

Width:  |  Height:  |  Size: 1014 B

+8
View File
@@ -0,0 +1,8 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0_161_3866" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="24" height="24">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.3333 0H10.6667V10.6667H0V13.3333H10.6667V24H13.3333V13.3333H24V10.6667H13.3333V0Z" fill="white"/>
</mask>
<g mask="url(#mask0_161_3866)">
<rect x="-4" y="-4" width="32" height="32" fill="#646566"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 476 B

+8
View File
@@ -0,0 +1,8 @@
<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0_161_2681" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="3" y="3" width="12" height="12">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.7203 3.21967L14.7809 4.28033L10.061 9.00025L14.7809 13.7202L13.7203 14.7809L9.00034 10.0609L4.28039 14.7809L3.21973 13.7202L7.93968 9.00025L3.21975 4.28033L4.28041 3.21967L9.00034 7.93959L13.7203 3.21967Z" fill="white"/>
</mask>
<g mask="url(#mask0_161_2681)">
<rect width="18" height="18" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

+17
View File
@@ -0,0 +1,17 @@
*{
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
html,body,#app{
height: 100%;
}
body{
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
min-width: 1200px;
}
a{
text-decoration: none;
}
+2
View File
@@ -0,0 +1,2 @@
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain)*/
div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed,figure, figcaption, footer, header, hgroup,menu, nav, output, ruby, section, summary,time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; vertical-align: baseline;}/* HTML5 display-role reset for older browsers */article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section { display: block;}ol, ul { list-style: none;}blockquote, q { quotes: none;}blockquote:before, blockquote:after,q:before, q:after { content: ''; content: none;}table { border-collapse: collapse; border-spacing: 0;}
+84
View File
@@ -0,0 +1,84 @@
/*滚动条样式 */
/*第一种样式,所有的滚动条,都默认这个样子*/
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
/*正常情况下滑块的样式*/
*::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, .05);
border-radius: 10px;
-webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
}
/*鼠标悬浮在该类指向的控件上时滑块的样式*/
*:hover::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, .2);
border-radius: 10px;
-webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
}
/*鼠标悬浮在滑块上时滑块的样式*/
*::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, .3);
-webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
}
/*正常时候的主干部分*/
*::-webkit-scrollbar-track {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
background-color: white;
}
/*鼠标悬浮在滚动条上的主干部分*/
*::-webkit-scrollbar-track:hover {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .4);
background-color: rgba(0, 0, 0, .01);
}
/*第一种样式结束*/
/*第二种样式*/
.scroll2::-webkit-scrollbar {
width: 10px;
height: 10px;
}
/*正常时候的主干部分*/
.scroll2::-webkit-scrollbar-track {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
background-color: white;
}
/*正常情况下滑块的样式*/
.scroll2::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, .05);
border-radius: 10px;
-webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
}
/*鼠标悬浮在该类指向的控件上时滑块的样式*/
.scroll2:hover::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, .2);
border-radius: 10px;
-webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
}
/*鼠标悬浮在滚动条上的主干部分*/
.scroll2::-webkit-scrollbar-track:hover {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .4);
}
/*鼠标悬浮在滑块上时滑块的样式*/
.scroll2::-webkit-scrollbar-thumb:hover {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .4);
}
/*第二种样式结束*/
@@ -0,0 +1,35 @@
.my-table {
width: 100%;
border-bottom: 1px solid #c7c7c7;
border-right: 1px solid #c7c7c7;
border-collapse: separate;
.td-title {
background: #fafafa;
vertical-align: middle;
color: #111;
font-weight: 550;
}
th {
background: #fafafa;
height: 20px;
line-height: 20px;
padding: 12px;
}
td {
height: 20px;
line-height: 20px;
padding: 12px;
}
th,
td {
border-top: 1px solid #c7c7c7;
border-left: 1px solid #c7c7c7;
margin-left: -1px;
margin-top: -1px;
text-align: center;
}
}
@@ -0,0 +1,59 @@
.rule-tree {
padding: 0 !important;
width: 280px !important;
.head-ul {
background: #f6f8f9;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-evenly;
align-items: center;
height: 48px;
li {
width: 34px;
height: 34px;
box-sizing: content-box;
border-radius: 50%;
position: relative;
cursor: pointer;
.ivu-tooltip,
.ivu-tooltip-rel {
width: 100%;
height: 100%;
display: block;
}
svg {
position: absolute;
inset: 0;
margin: auto;
}
&:hover {
background-color: #eaeaea;
cursor: pointer;
}
&.disabled {
background-color: #fff;
cursor: not-allowed;
}
button {
display: inline-block;
width: 100%;
height: 100%;
border-radius: 50%;
color: #515a6e;
border: 0;
outline: none;
background-color: transparent;
cursor: inherit;
}
}
}
.body-box {
padding: 11px 0;
}
.ztree li span.button {
background-repeat: 10px;
}
}
@@ -0,0 +1,26 @@
table.small-table {
border: 1px solid #ebeef5;
border-radius: 5px;
th {
background-color: #fafafa;
border-bottom: 1px solid #ebeef5;
padding: 10px 20px;
}
td {
padding: 5px 20px;
}
tr:first-child td {
padding-top: 10px;
}
tr:last-child td {
padding-bottom: 10px;
}
.input-box {
width: 100px;
vertical-align: text-bottom;
display: inline-block;
}
.ivu-input-wrapper {
vertical-align: text-bottom;
}
}
+8
View File
@@ -0,0 +1,8 @@
$liColor: #969799, #e6a23c, #45b972, #eb0404;
@each $c in $liColor {
$i: index($liColor, $c);
.status-color-#{$i} {
color: $c;
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+117
View File
@@ -0,0 +1,117 @@
@import "base/base";
@import "base/bscroll.css";
@import "base/reset";
@import "utils/mixins";
@import "utils/utils";
@import "componets/status";
@import "componets/small_table";
@import "componets/my_table";
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
.base-subtitle {
position: relative;
padding-left: 12px;
line-height: 24px;
font-size: 15px;
font-weight: 400;
&::before {
content: "";
display: block;
width: 3px;
background: #5979ea;
height: 15px;
border-radius: 4px;
position: absolute;
top: 5px;
left: 0;
}
}
h4.second-title {
@extend .base-subtitle;
&::before {
background: #5979ea;
}
}
h4.subtitle {
@extend .second-title;
&::before {
background: #bda366;
}
}
.details-wrap {
display: flex;
padding-top: 10px;
.left-box {
width: 200px;
height: 100%;
.user-list-ul {
height: calc(100% - 50px);
overflow-y: auto;
li {
height: 42px;
border: 1px solid #ebeef5;
border-top: none;
position: relative;
cursor: pointer;
transition: border 200ms;
img {
object-fit: cover;
width: 30px;
height: 30px;
border-radius: 3px;
}
span.stu-name {
height: 20px;
line-height: 20px;
display: inline-block;
width: 60px;
}
span.stu-card {
width: 50px;
text-align: right;
}
}
li.active {
// background: #f3f3f3;
color: #7892ed;
border-right: 3px solid #5979ea;
}
}
}
.right-box {
width: 100%;
padding: 0 15px;
}
}
.table-spin-load {
width: 60px;
height: 90px;
padding-top: 60px;
background-image: url(../image/loading.gif);
background-size: 60px 60px;
background-position: top center;
background-repeat: no-repeat;
border: none;
color: #577afb;
margin: 0 auto;
}
.ivu-table-cell-tree {
margin-right: 4px;
margin-bottom: 2px;
}
+13
View File
@@ -0,0 +1,13 @@
@mixin tag_mixin($bgColor,$textColor) {
width:64px;
height:20px ;
padding: 0 5px;
background: $bgColor;
color: $textColor;
font-size: 12px;
border-radius: 2px 2px 2px 2px;
text-align: center;
line-height: 20px;
}
+170
View File
@@ -0,0 +1,170 @@
// utils 工具// 颜色
@import "./varible";
.bg-error {
background-color: $color-error !important;
}
.text-error {
color: $color-error !important;
}
.text-success {
color: $color-success !important;
}
.text-warning {
color: $color-warning !important;
}
.text-primary {
color: $color-primary !important;
}
.text-normal {
color: #404042 !important;
}
.text-black {
color: #000;
}
.text-dark {
color: #333;
}
.text-deep {
color: #555;
}
.text-weak {
color: #b3b3b3;
}
.text-white {
color: #fff;
}
.text-error.disabled {
color: #aaa !important;
}
// 文字对齐
.tl {
text-align: left;
}
.tc {
text-align: center;
}
.tr {
text-align: right;
}
// 浮动与清除浮动
.fl {
float: left;
}
.fr {
float: right;
}
.fix {
*zoom: 1;
}
.fix:after {
display: table;
content: "";
clear: both;
}
// 显示
.dn {
display: none;
}
.di {
display: inline;
}
.db {
display: block;
}
.dib {
display: inline-block;
}
.dt {
display: table;
}
div.dib {
*display: inline;
*zoom: 1;
}
.vm {
vertical-align: middle;
}
.vib {
display: inline-block;
vertical-align: middle;
}
.ovh {
overflow: hidden;
}
// 定位
.pr {
position: relative;
}
.pa {
position: absolute;
}
.pf {
position: fixed;
}
.align-middle {
position: relative;
top: 50%;
transform: translateY(-50%);
}
.align-middle-wrap {
display: flex;
align-items: center;
}
.text-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@for $i from 1 through 100 {
.width-#{$i} {
width: $i * 1%;
}
.height-#{$i} {
height: $i * 1px;
}
// @if $i<50 and $i%2==0 {
// @if $i<50 {
.ml-#{$i} {
margin-left: $i * 1px !important;
}
.mr-#{$i} {
margin-right: $i * 1px !important;
}
.mt-#{$i} {
margin-top: $i * 1px !important;
}
.mb-#{$i} {
margin-bottom: $i * 1px !important;
}
// }
}
// 字体
@for $i from 10 through 28 {
.f#{$i} {
font-size: $i * 1px;
}
}
// .chart-box {
// height: 50px;
// width: 100%;
// border-bottom: 50px solid;
// border-image: linear-gradient(90deg, #f55c65 0%, #fcced0 48%, #d4dffc 52%, #7194f5 100%) 50 50 50 50;
// }
// @for $i from 0 through 50 {
// .blue-#{$i} {
// background-color: rgba(#7194f5, 0.1 * $i * 0.2);
// }
// }
// @for $i from 0 through 50 {
// .red-#{$i} {
// background-color: rgba(#f55c65, 0.1 * $i * 0.2);
// }
// }
+22
View File
@@ -0,0 +1,22 @@
/*scss变量*/
// 主题色
$color-error: #e8684a;
$color-success: #45b972;
$color-warning: #e9b954;
$color-primary: #5979ea;
// 文字色
$color-black: #404042;
$color-dark: #333;
$color-deep: #555;
$color-pl: #999999;
$color-weak: #b3b3b3;
$color-white: #fff;
// 背景色
$bg-bar: #f9f9f9;
$bg-page: #f3f3f3;
$bg-page-light: #f9f9f9;
$border-color: #e9e9e9;
+88
View File
@@ -0,0 +1,88 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const Button: typeof import('view-ui-plus')['Button']
const EffectScope: typeof import('vue')['EffectScope']
const Form: typeof import('view-ui-plus')['Form']
const FormItem: typeof import('view-ui-plus')['FormItem']
const Input: typeof import('view-ui-plus')['Input']
const Message: typeof import('view-ui-plus')['Message']
const Modal: typeof import('view-ui-plus')['Modal']
const Select: typeof import('view-ui-plus')['Select']
const Table: typeof import('view-ui-plus')['Table']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useForm: typeof import('alova/client')['useForm']
const useId: typeof import('vue')['useId']
const useLink: typeof import('vue-router')['useLink']
const useModel: typeof import('vue')['useModel']
const usePagination: typeof import('alova/client')['usePagination']
const useRequest: typeof import('alova/client')['useRequest']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const useWatcher: typeof import('alova/client')['useWatcher']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
+95
View File
@@ -0,0 +1,95 @@
<template>
<div class="improt-wrap">
<div class="form-item">
<label>案例下载:</label>
<a @click="downTempFile" href="javascript:;">点击下载模板.xls</a>
</div>
<div class="upload-panel">
<Upload type="drag" :on-success="onSuccess" :on-error="onError" :data="uploadData" :headers="uploadHeader"
:with-credentials="true" :action="uploadUrl"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
<div class="upload-box">
<Icon type="ios-paper" size="52" style="color: #6281eb"></Icon>
<h4>点击或将文件拖拽到这里上传</h4>
<div class="info">文件大小不超过50M 支持扩展名: xls,xlsx</div>
</div>
</Upload>
</div>
<Alert v-if="!!errorMsg" type="error" show-icon><span v-html="errorMsg"></span></Alert>
<Alert v-else-if="!!successMsg" type="success" show-icon>{{ successMsg }}</Alert>
<Alert v-else style="margin-bottom: 0" type="warning" show-icon>
请按照案例模板内容进行编辑,否则将无法导入。
</Alert>
</div>
</template>
<script>
import Utils from "@/utils";
export default {
props: {
tempFileUrl: String,
uploadUrl: String,
uploadData: Object,
},
data() {
return {
errorMsg: null,
successMsg: null,
};
},
computed: {
uploadHeader() {
const roleInfo = Utils.getCurrentRoleInfo();
roleInfo.schoolId = roleInfo.schId;
roleInfo.yschapirequest = 1;
// roleInfo.userType = 2;
return roleInfo;
},
},
methods: {
downTempFile() {
window.top.location.href = this.tempFileUrl;
},
onSuccess(res, file) {
if (res.code == 0) {
this.errorMsg = null;
this.successMsg = "操作成功!";
this.$emit("on-success");
} else {
this.errorMsg = res.msg;
}
},
onError(err, file) {
this.errorMsg = JSON.stringify(err);
console.log(err, file);
},
},
};
</script>
<style lang="scss" scoped>
.improt-wrap {
padding: 16px;
.form-item {
margin-bottom: 10px;
}
}
.upload-panel {
.upload-box {
background: #f7f8fc;
padding: 20px 0;
h4 {
color: #505c7e;
margin: 3px 0;
}
}
.info {
font-size: 13px;
color: #666;
}
}
</style>
+37
View File
@@ -0,0 +1,37 @@
<template>
<Select v-model="innerId" @on-change="handleChange" v-bind="$attrs">
<Option v-for="item in stageSubjects" :key="item.k" :value="item.k">
{{ item.v }}
</Option>
</Select>
</template>
<script lang="ts" setup>
import { useDefaultStore } from '@/store'
const emit = defineEmits<{
'on-change': [stage: number, subject: string]
}>()
const store = useDefaultStore()
const stageSubjects = computed(() => store.getStageSubjects)
const innerId = ref<number | null>(null)
const cacheKey = 'bsch.learnmanage.cur_subject_id';
onMounted(async () => {
await nextTick()
if (!stageSubjects.value.length) return
const cached = sessionStorage.getItem(cacheKey)
const id = cached ? Number(cached) : stageSubjects.value[0]?.k;
if (id != null) innerId.value = id
handleChange(id)
})
function handleChange(val: number) {
const find = stageSubjects.value.find((i: any) => i.k === val)
if (!find) return
sessionStorage.setItem(cacheKey, String(val))
emit('on-change', find.stage, find.code)
}
</script>
+208
View File
@@ -0,0 +1,208 @@
<script setup lang="ts">
/**
* 动态表单渲染器(V2.0 Part B.3:schema → 控件,一期 7 类)。
* schemaJson = {"groups":[{title, fields:[{key,label,type,required,pattern,options,...}]}]}。
* v-model(formData) 为 {key:value} 对象;upload 字段值为 [{attachmentId,fileUrl,fileName}]。
*/
import { computed } from "vue";
import { Message } from "view-ui-plus";
import { fileApi } from "@/api/module/svc";
const props = defineProps<{ schemaJson?: string; formData: Record<string, any> }>();
const emit = defineEmits<{ (e: "update:formData", v: Record<string, any>): void }>();
interface Field {
key: string;
label: string;
type: string;
required?: boolean;
pattern?: string;
min?: number;
max?: number;
maxLength?: number;
tip?: string;
placeholder?: string;
options?: string[];
rows?: number;
defaultValue?: any;
accept?: string;
maxSize?: number;
maxFiles?: number;
}
const groups = computed<{ title: string; fields: Field[] }[]>(() => {
try {
const parsed = JSON.parse(props.schemaJson || "{}");
return (parsed.groups || []).map((g: any) => ({ title: g.title || "", fields: g.fields || [] }));
} catch {
return [];
}
});
function setValue(field: Field, value: any) {
emit("update:formData", { ...props.formData, [field.key]: value });
}
function ensureArray(field: Field): any[] {
const v = props.formData[field.key];
return Array.isArray(v) ? v : [];
}
/** upload 字段上传(maxSize MB/maxFiles 上限;返回 {attachmentId,fileUrl,fileName}) */
async function uploadFile(field: Field, ev: Event) {
const input = ev.target as HTMLInputElement;
const file = input.files?.[0];
input.value = "";
if (!file) return;
if (field.maxSize && file.size > field.maxSize * 1024 * 1024) {
Message.error(`单个文件不得超过 ${field.maxSize}MB`);
return;
}
const list = ensureArray(field);
if (field.maxFiles && list.length >= field.maxFiles) {
Message.error(`附件数超过上限 ${field.maxFiles}`);
return;
}
try {
const res: any = await fileApi.upload(file, "file").send();
setValue(field, [...list, res]);
} catch (e: any) {
Message.error(e?.message || "上传失败");
}
}
</script>
<template>
<div class="dyn-form">
<div v-for="(group, gi) in groups" :key="gi" class="dyn-group">
<div v-if="group.title" class="dyn-group-title">{{ group.title }}</div>
<div v-for="field in group.fields" :key="field.key" class="dyn-field">
<label class="dyn-label">
<span v-if="field.required" class="dyn-required">*</span>
{{ field.label }}
</label>
<template v-if="field.type === 'text' || field.type === 'phone'">
<Input
:model-value="formData[field.key] ?? field.defaultValue ?? ''"
:placeholder="field.placeholder || ''"
:maxlength="field.maxLength"
@update:model-value="(v: string) => setValue(field, v)"
/>
</template>
<template v-else-if="field.type === 'textarea'">
<Input
type="textarea"
:rows="field.rows || 3"
:model-value="formData[field.key] ?? field.defaultValue ?? ''"
:placeholder="field.placeholder || ''"
:maxlength="field.maxLength"
@update:model-value="(v: string) => setValue(field, v)"
/>
</template>
<template v-else-if="field.type === 'number'">
<InputNumber
:model-value="formData[field.key] ?? field.defaultValue ?? null"
:min="field.min"
:max="field.max"
:placeholder="field.placeholder || ''"
style="width: 220px"
@update:model-value="(v: number) => setValue(field, v)"
/>
</template>
<template v-else-if="field.type === 'date'">
<DatePicker
type="date"
:model-value="formData[field.key] ?? field.defaultValue ?? ''"
placeholder="选择日期"
style="width: 220px"
@update:model-value="(v: string) => setValue(field, v)"
/>
</template>
<template v-else-if="field.type === 'select'">
<Select
:model-value="formData[field.key] ?? field.defaultValue ?? ''"
:placeholder="field.placeholder || '请选择'"
style="width: 260px"
@update:model-value="(v: string) => setValue(field, v)"
>
<Option v-for="opt in field.options || []" :key="opt" :value="opt">{{ opt }}</Option>
</Select>
</template>
<template v-else-if="field.type === 'radio'">
<RadioGroup
:model-value="formData[field.key] ?? field.defaultValue ?? ''"
@update:model-value="(v: string) => setValue(field, v)"
>
<Radio v-for="opt in field.options || []" :key="opt" :label="opt">{{ opt }}</Radio>
</RadioGroup>
</template>
<template v-else-if="field.type === 'upload' || field.type === 'image'">
<div class="dyn-upload">
<div v-for="(f, fi) in ensureArray(field)" :key="fi" class="dyn-file">
<a :href="f.fileUrl" target="_blank" rel="noopener">{{ f.fileName }}</a>
<a class="dyn-file-remove" @click.prevent="
setValue(
field,
ensureArray(field).filter((_, i) => i !== fi)
)
">移除</a>
</div>
<label class="dyn-file-btn">
<input type="file" style="display: none" :accept="field.accept || ''" @change="uploadFile(field, $event)" />
<Button size="small" icon="ios-cloud-upload-outline">上传附件</Button>
</label>
</div>
</template>
<div v-if="field.tip" class="dyn-tip">{{ field.tip }}</div>
</div>
</div>
</div>
</template>
<style scoped>
.dyn-group {
margin-bottom: 8px;
}
.dyn-group-title {
font-weight: 600;
padding: 8px 0;
border-bottom: 1px solid #eee;
margin-bottom: 12px;
}
.dyn-field {
margin-bottom: 14px;
}
.dyn-label {
display: block;
margin-bottom: 6px;
color: #515a6e;
}
.dyn-required {
color: #ed4014;
margin-right: 2px;
}
.dyn-tip {
font-size: 12px;
color: #999;
margin-top: 4px;
}
.dyn-file {
display: flex;
gap: 8px;
align-items: center;
margin-bottom: 4px;
}
.dyn-file-remove {
color: #ed4014;
cursor: pointer;
font-size: 12px;
}
</style>
+138
View File
@@ -0,0 +1,138 @@
<script lang="ts" setup>
/**
* 附件预览弹窗(open-file-viewer,参考党建学习 PartyLearn 实现)。
* 支持 图片/docx/xlsx/pptx/pdf/txt 在线预览;mp4 用 <video> 播放(走 Preview 内联流);
* doc/ppt/xls/rtf/zip 等旧二进制格式不支持,弹窗内给「下载查看」兜底。
* 关键点:组件自拉 URL 带不上平台认证,必须先 fetch( credentials: include ) 取 Blob 再传 :file。
*/
import { ref, computed, watch } from "vue";
import { Message } from "view-ui-plus";
import { OpenFileViewer } from "@open-file-viewer/vue";
import { imagePlugin, pdfPlugin, officePlugin, textPlugin } from "@open-file-viewer/core";
import "@open-file-viewer/core/style.css";
// pdf worker:以 ?raw 内嵌源码(worker 自包含无 import),运行时生成 Blob URL,
// 不依赖部署环境对 .mjs 的 MIME 配置/文件完整性(模块 worker 对 MIME 校验严格,nginx 旧默认不含 mjs)
// @ts-ignore
import pdfWorkerRaw from "pdfjs-dist/build/pdf.worker.mjs?raw";
import config from "@/assets/config/host.config";
const props = withDefaults(
defineProps<{
modelValue: boolean;
fileId: number | null;
/** 预览文件名(用于类型判断与标题展示,需带扩展名) */
fileName?: string;
}>(),
{ fileName: "" }
);
const emit = defineEmits<{
(e: "update:modelValue", value: boolean): void;
}>();
const show = computed({
get: () => props.modelValue,
set: (value: boolean) => emit("update:modelValue", value),
});
const loading = ref(false);
const previewName = ref("");
const fileType = ref("");
const blob = ref<Blob | null>(null);
const fileServiceBase = config.isMock ? "" : config.serviceHost;
/** 内联流地址(<video> 等场景用;Down 是 attachment 头,视频流不可用) */
const previewUrl = computed(() => (props.fileId ? `${fileServiceBase}/api/file/Preview?id=${props.fileId}` : ""));
const isVideo = computed(() => ["mp4", "webm", "ogg"].includes(fileType.value));
const isUnsupported = computed(
() => !isVideo.value && ["doc", "ppt", "xls", "rtf", "zip", "rar", "7z", "wps"].includes(fileType.value)
);
const pdfWorkerSrc = URL.createObjectURL(new Blob([pdfWorkerRaw as unknown as BlobPart], { type: "text/javascript" }));
const plugins = [
imagePlugin(),
pdfPlugin({
workerSrc: pdfWorkerSrc,
// cmaps/标准字体自托管(public 下随构建发布),避免运行时依赖 cdn.jsdelivr.net(国内网络不稳定)
cMapUrl: `${import.meta.env.BASE_URL}cmaps/`,
standardFontDataUrl: `${import.meta.env.BASE_URL}standard_fonts/`,
}),
officePlugin(),
textPlugin(),
];
const load = async () => {
if (!props.fileId) return;
loading.value = true;
blob.value = null;
previewName.value = props.fileName || "文件预览";
fileType.value = (previewName.value.split(".").pop() || "").toLowerCase();
try {
// Down/Preview 走 Cookie 认证(location.href 能下载即证明),同源带 cookie 即可
const res = await fetch(`${fileServiceBase}/api/file/Preview?id=${props.fileId}`, {
credentials: "include",
});
if (!res.ok) throw new Error(`文件加载失败(${res.status})`);
blob.value = await res.blob();
} catch (error: any) {
Message.error(error?.message || "文件加载失败");
} finally {
loading.value = false;
}
};
const download = () => {
if (props.fileId) window.location.href = `${fileServiceBase}/api/file/Down?id=${props.fileId}`;
};
watch(
() => props.modelValue,
value => {
if (value) load();
}
);
</script>
<template>
<Modal v-model="show" :title="previewName || '文件预览'" :width="960" :mask-closable="false">
<div class="preview-body">
<Spin fix v-if="loading" size="large"></Spin>
<template v-if="blob && !loading">
<video v-if="isVideo" :src="previewUrl" controls autoplay class="video-player"></video>
<div v-else-if="isUnsupported" class="unsupported">
<Icon type="ios-alert-outline" size="64" />
<p>该格式({{ fileType }})暂不支持在线预览</p>
<Button type="primary" icon="ios-download-outline" @click="download">下载查看</Button>
</div>
<OpenFileViewer v-else :file="blob" :file-name="previewName" height="100%" toolbar :plugins="plugins" />
</template>
</div>
<template #footer>
<Button @click="show = false">关闭</Button>
<Button type="primary" @click="download">下载</Button>
</template>
</Modal>
</template>
<style lang="scss" scoped>
.preview-body {
position: relative;
height: 72vh;
overflow: hidden;
.video-player {
width: 100%;
height: 100%;
background: #000;
}
.unsupported {
text-align: center;
padding-top: 120px;
color: #999;
p {
margin: 12px 0 20px;
}
}
}
</style>
+89
View File
@@ -0,0 +1,89 @@
<template>
<Select
class="search-wrap_sel"
v-model="currentGradeId"
:placeholder="isGradeAllCheck ? '全部年级' : '请选择年级'"
:clearable="isGradeAllCheck"
@on-change="onGradeChange"
>
<Option v-for="item in gradeList" :value="item.k">{{ item.v }}</Option>
</Select>
<Select
ref="refClassSel"
class="search-wrap_sel ml-12"
v-model="currentClassId"
:placeholder="isClassAllCheck ? '全部班级' : '请选择班级'"
:clearable="isClassAllCheck"
@on-change="onClassChange"
>
<Option v-for="item in classList" :value="item.k">{{ item.v }}</Option>
</Select>
</template>
<script lang="ts" setup>
import { ref, onBeforeMount, computed } from "vue";
import { useDefaultStore } from "@/store/index.ts";
import { GradeClassInfo } from "@/types/index";
import { BaseDict } from "@/types/Basics";
import { storeToRefs } from "pinia";
interface GradeClassSel {
isGradeAllCheck?: boolean;
isClassAllCheck?: boolean;
}
const props = withDefaults(defineProps<GradeClassSel>(), {
isGradeAllCheck: false,
isClassAllCheck: true,
});
const emits = defineEmits<{
(e: "on-change", info: GradeClassInfo): void;
}>();
const store = useDefaultStore();
const refClassSel = ref();
const gradeClassList = ref<any[]>([]);
const { gradeId: currentGradeId, classId: currentClassId } = storeToRefs(store);
onBeforeMount(() => {
gradeClassList.value = store.$state.gradeClassList;
if (!props.isGradeAllCheck && currentGradeId.value == null)
currentGradeId.value = _.get(gradeList.value, "[0].k", null);
});
const gradeList = computed<BaseDict[]>(() => {
let arr = gradeClassList.value.map((element: GradeClassInfo) => {
return { k: element.gradeId, v: element.gradeName };
});
return _.uniqBy(arr, "k");
});
const classList = computed<BaseDict[]>(() => {
let arr = gradeClassList.value
.filter((x: GradeClassInfo) => x.gradeId == currentGradeId.value)
.map((element: GradeClassInfo) => {
return { k: element.classId, v: element.className };
});
return arr;
});
function onGradeChange() {
setTimeout(() => {
refClassSel.value.focusIndex = 0;
}, 200);
currentClassId.value = !props.isClassAllCheck ? _.get(classList.value, "[0].k", null) : null;
let info = getCurrentGradeInfo();
emits("on-change", info);
}
function onClassChange() {
let info = getCurrentGradeInfo();
emits("on-change", info);
}
function getCurrentGradeInfo() {
return store.findGradeClassInfo(currentGradeId.value, currentClassId.value);
}
</script>
<style></style>
+264
View File
@@ -0,0 +1,264 @@
<template>
<div class="group-tree-search-panel">
<div v-if="searchVisible" class="search-bar mt-8 mb-8">
<Input v-model="searchKeyword" :placeholder="searchPlaceholder" suffix="ios-search" search clearable
class="search-input" @on-search="onSearch" @on-clear="onClear" />
<Button v-if="showCloseButton" icon="md-close" @click="closeSearch" />
</div>
<div class="tree-body">
<MyTree v-if="!treeLoading" ref="refMyTree" :autoClick="autoClick" :treeData="treeData"
:setting="treeSetting" @on-tree-click="treeLink" />
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, nextTick, useTemplateRef } from "vue";
import { cloneDeep } from "lodash";
import { Message } from "view-ui-plus";
import MyTree from '@/components/MyTree.vue'
const GROUP_TYPE = {
NORMAL_GROUP: 1,
SCHOOL_GROUP: 2,
GRADE_GROUP: 3,
CLASS_GROUP: 4,
AREA_GROUP: 5,
STAGE_GROUP: 6,
TEACHER_GROUP: 7,
STUDENT_GROUP: 8,
} as const
const DEFAULT_CACHE_KEY = 'bsch.group-tree.selected-node'
const props = withDefaults(defineProps<{
treeApi: () => Promise<any[]>;
autoClick?: boolean;
defaultSearchVisible?: boolean;
showCloseButton?: boolean;
searchPlaceholder?: string;
cacheKey?: string;
}>(), {
autoClick: false,
defaultSearchVisible: true,
showCloseButton: false,
searchPlaceholder: '输入组名称搜索',
cacheKey: DEFAULT_CACHE_KEY,
})
const emit = defineEmits<{
'on-change': [treeNode: any]
'on-tree-data': [tree: any[]]
}>()
const curTreeNode = defineModel<any>('curTreeNode', { default: {} })
const refMyTree = useTemplateRef('refMyTree')
const treeLoading = ref(false)
const treeData = ref<any[]>([])
const searchKeyword = ref('')
const searchVisible = ref(props.defaultSearchVisible)
const treeSetting = ref({
view: { dblClickExpand: false, showIcon: false },
edit: { enable: false, showRemoveBtn: false, showRenameBtn: false, drag: false },
check: { enable: false },
callback: {},
})
function formatTree(list: any[], depth = 1): any[] {
return (list || []).map((node) => {
const children = node.children;
const hasChildren = Array.isArray(children) && children.length > 0;
const formatted: any = { ...node, isParent: hasChildren };
if (depth === 1) formatted.open = true;
if (hasChildren) {
formatted.children = formatTree(children, depth + 1);
} else {
delete formatted.children;
}
return formatted;
});
}
function findNodeById(list: any[], id?: number | null): any {
if (id == null) return null;
for (const node of list || []) {
if (Number(node.id) === Number(id)) return node;
const child = findNodeById(node.children || [], id);
if (child) return child;
}
return null;
}
function findFirstNodeByType(list: any[], type: number): any {
for (const node of list || []) {
if (Number(node.type) === type) return node;
const child = findFirstNodeByType(node.children || [], type);
if (child) return child;
}
return null;
}
function getCachedSelectedNodeId() {
try {
const raw = sessionStorage.getItem(props.cacheKey);
if (!raw) return null;
const cached = JSON.parse(raw);
const id = Number(cached?.id);
return Number.isFinite(id) ? id : null;
} catch {
return null;
}
}
function cacheSelectedNode(treeNode: any) {
if (!treeNode?.id) return;
sessionStorage.setItem(props.cacheKey, JSON.stringify({
id: Number(treeNode.id),
name: treeNode.name,
type: treeNode.type,
}));
}
function resolveInitialSelectId(list: any[], preferredId?: number | null) {
const preferred = findNodeById(list, preferredId);
if (preferred) return preferred.id;
const cached = findNodeById(list, getCachedSelectedNodeId());
if (cached) return cached.id;
const schoolNode = findFirstNodeByType(list, GROUP_TYPE.SCHOOL_GROUP);
if (schoolNode) return schoolNode.id;
if (props.autoClick && list.length) return list[0].id;
return list[0]?.id ?? null;
}
async function loadTree(preferredId?: number | null) {
treeLoading.value = true;
try {
const tree = await props.treeApi();
treeData.value = formatTree(tree || []);
emit('on-tree-data', cloneDeep(treeData.value));
} catch (e: any) {
Message.error(e?.message || '加载组织树失败');
} finally {
treeLoading.value = false;
}
if (!treeData.value.length) return;
await nextTick();
const selectId = resolveInitialSelectId(treeData.value, preferredId);
if (selectId != null) {
refMyTree.value?.reloadTree(selectId);
}
}
async function refreshTree(selectId?: number) {
await loadTree(selectId);
}
function treeLink(treeNode: any) {
const copyNode = cloneDeep(treeNode)
copyNode.children = [];
curTreeNode.value = copyNode;
cacheSelectedNode(copyNode);
emit('on-change', copyNode)
}
function onSearch() {
refMyTree.value?.search(searchKeyword.value);
}
function onClear() {
searchKeyword.value = '';
refMyTree.value?.search('');
}
function openSearch() {
searchVisible.value = true;
}
function closeSearch() {
searchVisible.value = false;
onClear();
}
function reloadTree(id?: number) {
refMyTree.value?.reloadTree(id);
}
function selectNode(id: number, isClick = true) {
refMyTree.value?.selectNode(id, isClick);
}
function removeNode(id: number) {
refMyTree.value?.removeNode(id);
}
function renameNode(id: number, name: string) {
refMyTree.value?.renameNode(id, name);
}
function getNodeById(id: number) {
return refMyTree.value?.getNodeById(id);
}
function addNote(pid: number, id: number, name: string, isParent?: boolean, children?: any[]) {
refMyTree.value?.addNote(pid, id, name, isParent, children);
}
function openTree(open: boolean) {
refMyTree.value?.openTree(open);
}
loadTree()
defineExpose({
openSearch,
closeSearch,
onSearch,
onClear,
loadTree,
refreshTree,
reloadTree,
selectNode,
removeNode,
renameNode,
getNodeById,
addNote,
openTree,
})
</script>
<style lang="scss" scoped>
.group-tree-search-panel {
display: flex;
flex-direction: column;
height: 100%;
}
.search-bar {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 10px;
}
.search-input {
width: 100%;
}
.tree-body {
flex: 1;
min-height: 0;
}
.tree-body :deep(.ztree) {
height: 100%;
overflow-y: auto;
}
</style>
+76
View File
@@ -0,0 +1,76 @@
<template>
<Modal v-model="isModal" @on-visible-change="showChange" :title="title">
<Alert type="warning" class="mb-1" show-icon>
<template #icon>
<Icon type="ios-bulb-outline" :class="{ 'mt-5': !info }" slot="icon" :size="28"></Icon>
</template>
<div v-if="msg" :class="['message-box', info ? '' : 'mt-10 mb-10 ml-10']">{{ msg }}</div>
<template #desc v-if="info" slot="desc">{{ info }}</template>
</Alert>
<template #footer>
<Button type="primary" :loading="okLoading" @click="onOkClick">{{ confirmText }}</Button>
<Button :loading="cancleLoading" @click="onCancleClick">{{ closeText }}</Button>
</template>
</Modal>
</template>
<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { Modal, Button, Alert, Icon } from "view-ui-plus";
const isModal = ref(false),
okLoading = ref(false),
cancleLoading = ref(false);
const props = withDefaults(
defineProps<{
title?: string;
msg: string;
info?: string;
isLoading?: boolean;
confirmText?: string;
closeText?: string;
confirmFn: any;
closeFn: any;
destroy: Function;
}>(),
{
title: "提示",
isLoading: true,
confirmText: "确认",
closeText: "取消",
}
);
onMounted(function () {
setTimeout(() => {
isModal.value = true;
}, 0);
});
const onOkClick = async () => {
if (!!props.isLoading) okLoading.value = true;
const { onOk, reslove } = props.confirmFn;
await Promise.resolve(onOk());
isModal.value = false;
okLoading.value = false;
reslove(true);
};
const onCancleClick = async () => {
if (!!props.isLoading) cancleLoading.value = true;
const { onCancel, reslove } = props.closeFn;
if (typeof onCancel !== "undefined") await Promise.resolve(onCancel());
cancleLoading.value = false;
isModal.value = false;
reslove(false);
};
const showChange = (state: boolean) => {
if (!state) {
props.destroy();
}
};
</script>
<style></style>
+42
View File
@@ -0,0 +1,42 @@
import { MyConfirm } from "@/types/Basics";
import confirm from "./Confirm.vue";
import { createApp } from "vue";
export default ({ title, msg, info, confirmText, closeText, isLoading, onOk, onCancel }: MyConfirm) => {
return new Promise<boolean>((reslove, reject) => {
const instance = createApp(confirm, {
title,
msg,
info,
confirmText,
closeText,
isLoading,
confirmFn: {
onOk,
reslove,
},
closeFn: {
onCancel,
reslove,
},
destroy: () => {
closeUnmount();
},
});
// 创建一个节点
const vnode = document.createElement("div");
// 添加到body元素上
document.body.appendChild(vnode);
// 实例挂载到节点上
instance.mount(vnode);
// 关闭状态
// 注册实例并移除节点
function closeUnmount() {
setTimeout(() => {
instance.unmount();
document.body.removeChild(vnode);
}, 100);
}
});
};
+206
View File
@@ -0,0 +1,206 @@
<template>
<div>
<div :id="domId" :ref="domId" class="ztree"></div>
</div>
</template>
<script>
export default {
props: {
treeData: {
type: Object,
},
setting: {
type: Object,
default: {},
},
autoClick: {
type: Boolean,
default: true,
},
isCheck: {
typeof: Boolean,
default: false,
},
},
data() {
return {
domId: "",
treeSetting: _.cloneDeep(this.setting),
treeObj: null,
highlightNodes: [],
};
},
created() {
this.$watch("treeData", val => {
if (val) {
this.$nextTick(() => {
this.initTree(this.treeData, this.domId);
});
}
});
},
mounted() {
this.domId = this.uuid();
if (this.treeData) {
this.$nextTick(() => {
this.initTree(this.treeData, this.domId);
});
}
},
methods: {
uuid() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
},
reloadTree(nodeId) {
this.initTree(this.treeData, this.domId);
if (nodeId != null) {
this.$nextTick(() => {
this.selectNode(nodeId, true); // 第二个参数 true 会 emit on-tree-click
});
}
},
initTree(_data, _domId) {
const _this = this;
_this.treeSetting.callback.onClick = (event, treeId, treeNode, clickFlag) => {
// console.log(event, treeId, treeNode, clickFlag);
if (_this.isCheck) {
var treeObj = $.fn.zTree.getZTreeObj(treeId);
treeObj.checkNode(treeNode, !treeNode.checked, true);
}
_this.$emit("on-tree-click", treeNode);
};
_this.treeSetting.callback.beforeDrop = (treeId, treeNodes, targetNode, moveType) => {
if (moveType == "inner") {
// 移除限制,允许叶子节点接受子节点
} else {
if (targetNode.pid === 0) return false;
}
return true;
};
_this.treeSetting.callback.beforeDrag = (treeId, treeNodes) => {
return treeNodes[0].drag !== false;
};
_this.treeSetting.callback.beforeClick = (treeId, treeNode, clickFlag) => {
return !(treeNode.click === false);
};
_this.treeSetting.callback.onDrop = (event, treeId, treeNodes, targetNode, moveType) => {
_this.$emit("on-tree-drag", { treeNodes, targetNode, moveType });
};
_this.treeSetting.callback.onCheck = (event, treeId, treeNode) => {
_this.$emit("on-tree-check", treeNode);
};
_this.treeObj = $.fn.zTree.init($("#" + _domId), _this.treeSetting, _data);
if (_this.autoClick) {
if (Array.isArray(this.treeData)) {
let id = this.treeData[0].id;
_this.selectNode(id);
} else {
let id = this.treeData.id;
_this.selectNode(id);
}
}
},
selectNode(id, isClick = true) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
if (node == null) return false;
treeObj.selectNode(node);
treeObj.expandNode(node, true, false, false);
treeObj.selectNode(node);
if (isClick) this.$emit("on-tree-click", node);
},
openTree(open) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
treeObj.expandAll(open);
},
removeNode(id) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
var pnode = node.getParentNode();
treeObj.removeNode(node);
pnode.isParent = true;
treeObj.updateNode(pnode);
this.selectNode(pnode.id);
},
getNodeById(id) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
return node;
},
renameNode(id, name) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
node.name = name;
treeObj.updateNode(node);
},
addNote(pid, id, name, isParent, children) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var pnode = treeObj.getNodesByFilter(node => node.id == pid, true);
var newNode = { pid, id, name, isParent };
if (children && children.length) newNode.children = children;
treeObj.addNodes(pnode, -1, newNode);
},
setHighlight(node, on = true) {
const a = $('#' + node.tId + '_a');
if (on) a.addClass('ztree-search-highlight');
else a.removeClass('ztree-search-highlight');
},
clearHighlight() {
(this.highlightNodes || []).forEach(n => this.setHighlight(n, false));
this.highlightNodes = [];
},
search(keyword) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
if (!treeObj) return;
this.clearHighlight();
const kw = (keyword || '').trim().toLowerCase();
if (!kw) return;
const matchNodes = treeObj.getNodesByFilter(
(node) => node.name && node.name.toLowerCase().includes(kw),
false
) || [];
if (!matchNodes.length) {
if (this.$Message && this.$Message.info) this.$Message.info('未搜索到匹配组');
return;
}
matchNodes.forEach(n => {
let p = n;
while (p) {
treeObj.expandNode(p, true, false, false);
p = p.getParentNode();
}
});
this.highlightNodes = matchNodes;
matchNodes.forEach(n => this.setHighlight(n, true));
this.selectNode(matchNodes[0].id, true);
},
},
};
</script>
<style>
.ztree-search-highlight {
background-color: #ff6600 !important;
}
.ztree li a.curSelectedNode {
background-color: #ffe4bb !important;
}
</style>
+234
View File
@@ -0,0 +1,234 @@
<template>
<div style="height: 100%;">
<div class="tree-search-bar">
<Input v-model="keyword" placeholder="输入学校,回车查找" suffix="ios-search" clearable @on-enter="onSearch"
@on-clear="onSearch" style="width:100%;margin-bottom: 10px;" />
</div>
<div :id="domId" :ref="domId" class="ztree"></div>
</div>
</template>
<script>
export default {
props: {
treeData: {
type: Object,
},
setting: {
type: Object,
default: {
view: {
dblClickExpand: false,
showIcon: false,
},
edit: {
enable: true,
showRemoveBtn: false,
showRenameBtn: false,
drag: false,
},
check: {
enable: false,
},
callback: {},
},
},
autoClick: {
type: Boolean,
default: true,
},
isCheck: {
typeof: Boolean,
default: false,
},
},
data() {
return {
domId: "",
treeSetting: _.cloneDeep(this.setting),
treeObj: null,
keyword: '',
highlightNodes: []
};
},
created() {
this.$watch("treeData", val => {
console.log(val);
if (val) {
console.log(val);
this.$nextTick(() => {
this.initTree(this.treeData, this.domId);
});
}
});
},
mounted() {
this.domId = this.uuid();
},
methods: {
uuid() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
},
reloadTree() {
this.treeData.open = true;
this.initTree(this.treeData, this.domId);
},
initTree(_data, _domId) {
const _this = this;
_this.treeSetting.callback.onClick = (event, treeId, treeNode, clickFlag) => {
// console.log(event, treeId, treeNode, clickFlag);
if (_this.isCheck) {
var treeObj = $.fn.zTree.getZTreeObj(treeId);
treeObj.checkNode(treeNode, !treeNode.checked, true);
}
_this.$emit("on-tree-click", treeNode);
};
_this.treeSetting.callback.beforeDrop = (treeId, treeNodes, targetNode, moveType) => {
if (moveType == "inner") {
if (!targetNode.isParent) return false;
} else {
if (targetNode.pid === 0) return false;
}
};
_this.treeSetting.callback.beforeClick = (treeId, treeNode, clickFlag) => {
return !(treeNode.click === false);
};
_this.treeSetting.callback.onDrop = (event, treeId, treeNodes, targetNode, moveType) => {
_this.$emit("on-tree-drag", { treeNodes, targetNode, moveType });
};
_this.treeSetting.callback.onCheck = (event, treeId, treeNode) => {
_this.$emit("on-tree-check", treeNode);
};
_this.treeObj = $.fn.zTree.init($("#" + _domId), _this.treeSetting, _data);
if (_this.autoClick) {
if (Array.isArray(this.treeData)) {
let id = this.treeData[0].id;
_this.selectNode(id);
} else {
let id = this.treeData.id;
_this.selectNode(id);
}
}
},
selectNode(id, isClick = true) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
if (node == null) return false;
treeObj.selectNode(node);
treeObj.expandNode(node, true, false, false);
treeObj.selectNode(node);
if (isClick) this.$emit("on-tree-click", node);
},
openTree(open) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
treeObj.expandAll(open);
},
removeNode(id) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
var pnode = node.getParentNode();
treeObj.removeNode(node);
pnode.isParent = true;
treeObj.updateNode(pnode);
this.selectNode(pnode.id);
},
getNodeById(id) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
return node;
},
renameNode(id, name) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
node.name = name;
treeObj.updateNode(node);
},
addNote(pid, id, name, isParent) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var pnode = treeObj.getNodesByFilter(node => node.id == pid, true);
var newNode = { pid, id, name, isParent };
treeObj.addNodes(pnode, -1, newNode);
},
onSearch() {
this.clearHighlight();
if (!this.keyword) return;
this.doSearch(this.keyword);
},
doSearch(key) {
const treeObj = this.treeObj;
// 1. 模糊匹配
const matchNodes = treeObj.getNodesByFilter(node =>
node.type == 2 &&
node.name && node.name.toLowerCase().includes(key.toLowerCase())
);
if (!matchNodes.length) {
this.$Message.info('未搜索到匹配学校')
return;
}
// 2. 展开所有命中节点的父节点
matchNodes.forEach(n => {
let p = n.getParentNode();
while (p) {
treeObj.expandNode(p, true, false, false);
p = p.getParentNode();
}
});
// 3. 高亮
this.highlightNodes = matchNodes;
matchNodes.forEach(n => this.setHighlight(n, true));
// const box = document.getElementById('treeBox');
// const nodeEl = document.getElementById(matchNodes[0].tId);
// box.scrollTop = nodeEl.offsetTop - box.clientHeight / 2; // 居中
if (matchNodes.length) {
const treeObj = this.treeObj;
console.log(matchNodes[0]);
this.selectNode(matchNodes[0].id);
// treeObj.selectNode(matchNodes[0]); // 先选中,会自动滚入可视区
//this.$nextTick(() => treeObj.cancelSelectedNode()); // 取消选中,保持纯高亮
}
},
setHighlight(node, on = true) {
const a = $('#' + node.tId + '_a');
if (on) a.addClass('ztree-search-highlight');
else a.removeClass('ztree-search-highlight');
},
clearHighlight() {
this.highlightNodes.forEach(n => this.setHighlight(n, false));
this.highlightNodes = [];
}
},
};
</script>
<style>
.ztree {
height: calc(100% - 60px);
overflow-y: auto;
}
.ztree-search-highlight {
background-color: #ff6600 !important;
}
.ztree li a.curSelectedNode {
background-color: #ffe4bb !important;
}
</style>
+116
View File
@@ -0,0 +1,116 @@
<template>
<div class="notice-upload">
<!-- 自定义上传附件(自旧前端 oldfront/src/components/uploadFile.vue 适配) -->
<div class="upload-row">
<Upload
:on-success="encloSuccess"
:on-remove="encloRemove"
:default-file-list="defaultList"
:action="uploadFileUrl"
:accept="fileType"
:multiple="isMultiple"
:before-upload="handleUpload"
:format="formatArr"
:max-size="maxSize"
:on-format-error="handleFormatError"
:on-exceeded-size="handleExceeded"
>
<Button><Icon type="ios-cloud-upload-outline"></Icon>选择文件</Button>
</Upload>
<span class="upload-tip">提示:附件大小不超过{{ maxFileSize }}</span>
</div>
</div>
</template>
<script lang="ts">
/*
* 通知附件上传(自旧前端 oldfront/src/components/uploadFile.vue 适配 Vue3)。
* v-model 为已上传附件 fileid 数组;编辑时经 defaultList 回显已有附件。
*/
import { Message, Notice } from "view-ui-plus";
import config from "@/assets/config/host.config";
export default {
name: "NoticeUpload",
props: {
defaultList: { type: Array as () => any[], default: () => [] },
fileids: { type: Array as () => number[], default: () => [] },
fileType: { type: String, default: "" },
multiple: { type: Boolean, default: false },
},
emits: ["update:fileids"],
data() {
return {
isMultiple: !this.multiple || false,
uploadFileUrl: (config.isMock ? "" : config.serviceHost) + "/api/base/FileUpload",
formatArr: ["jpg", "gif", "png", "bmp", "xls", "doc", "txt", "docx", "xlsx", "zip", "rar", "pdf", "ppt", "pptx", "wps"],
maxFileSize: "200MB",
maxSize: 204800,
};
},
methods: {
encloSuccess(resp: any, file: any) {
if (resp.code !== 0) {
Message.error(resp.msg || "上传失败");
return;
}
this.fileids.push(resp.data.fileid);
this.$emit("update:fileids", this.fileids);
},
encloRemove(file: any) {
//删除文件:默认列表项带 fileid,刚上传的取 response
const list = file.fileid ? file : file.response;
let fileid = list?.fileid || list?.data?.fileid;
const arry = this.fileids.filter((element: number) => element != fileid);
this.$emit("update:fileids", arry);
},
handleUpload() {
if (!this.isMultiple && this.fileids.length > 0) {
Message.info("仅允许上传一个附件!");
return false;
}
return true;
},
handleFormatError() {
Notice.info({
title: "不支持的上传类型!",
desc: "请上传指定的文件类型",
});
},
handleExceeded() {
Notice.warning({
title: "超出大小限制",
desc: "最大文件大小为" + this.maxFileSize + "!",
});
},
},
};
</script>
<style lang="scss" scoped>
.notice-upload {
display: block;
.upload-row {
display: flex;
align-items: center;
}
:deep(.ivu-upload) {
display: inline-flex;
align-items: center;
}
/* 文件列表整体另起一行,每项独占一行,不再与按钮挤在一起 */
:deep(.ivu-upload-list) {
display: block;
margin-top: 8px;
}
:deep(.ivu-upload-list-file) {
padding: 4px 0;
}
.upload-tip {
margin-left: 10px;
color: #f90;
font-size: 12px;
line-height: 1;
}
}
</style>
+80
View File
@@ -0,0 +1,80 @@
<script setup lang="ts">
/**
* 富文本编辑器(wangEditor 5 封装;图片走 /api/file/upload type=image)。
* v-model 为 HTML 字符串;图片上传返回完整 URL 直接内嵌(Notice 上传通道契约)。
*/
import { onBeforeUnmount, ref, watch } from "vue";
import { Message } from "view-ui-plus";
import "@wangeditor/editor/dist/css/style.css";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import { fileApi } from "@/api/module/svc";
import { useSite } from "@/utils/site";
const props = defineProps<{ modelValue?: string; placeholder?: string }>();
const emit = defineEmits<{ (e: "update:modelValue", v: string): void }>();
const { currentSiteCode } = useSite();
const editorRef = ref();
const mode = ref<"simple" | "default">("default");
const html = ref(props.modelValue || "");
watch(
() => props.modelValue,
v => {
if (v !== html.value) html.value = v || "";
}
);
watch(html, v => emit("update:modelValue", v));
const toolbarConfig = { excludeKeys: ["group-video"] };
const editorConfig = {
placeholder: props.placeholder || "",
MENU_CONF: {
uploadImage: {
async customUpload(file: File, insertFn: (url: string) => void) {
try {
const res: any = await fileApi.upload(file, "image", currentSiteCode.value).send();
if (res?.fileUrl) {
insertFn(res.fileUrl);
}
} catch (e: any) {
Message.error(e?.message || "图片上传失败");
}
},
},
},
};
onBeforeUnmount(() => {
editorRef.value?.destroy?.();
});
</script>
<template>
<div class="rich-editor">
<Toolbar class="rich-toolbar" :editor="editorRef" :defaultConfig="toolbarConfig" :mode="mode" />
<Editor
class="rich-content"
v-model="html"
:defaultConfig="editorConfig"
:mode="mode"
@onCreated="(ed: any) => (editorRef = ed)"
/>
</div>
</template>
<style scoped>
.rich-editor {
border: 1px solid #dcdee2;
border-radius: 4px;
z-index: 100;
background: #fff;
}
.rich-toolbar {
border-bottom: 1px solid #e8eaec;
}
.rich-content {
height: 260px;
overflow-y: hidden;
}
</style>
+43
View File
@@ -0,0 +1,43 @@
<script setup lang="ts">
import { ref, computed, withDefaults } from "vue";
interface Props {
prefix?: string;
name?: string;
color?: string;
hoverColor?: string;
size?: string | number;
}
const props = withDefaults(defineProps<Props>(), {
prefix: "icon",
name: "",
color: "#000",
});
const isHover = ref(false);
const symbolId = computed(() => `#${props.prefix}-${props.name}`);
const svgStyle = computed(() => {
if (!!props.size) return { width: props.size + "px", height: props.size + "px" };
else return null;
});
const compColor = computed(() => {
if (!props.hoverColor) return props.color;
else {
return !!isHover.value ? props.hoverColor : props.color;
}
});
</script>
<template>
<svg
@mouseover="isHover = true"
@mouseout="isHover = false"
aria-hidden="true"
:color="compColor"
:style="svgStyle"
>
<use :xlink:href="symbolId" :fill="compColor" :color="compColor" />
</svg>
</template>
+142
View File
@@ -0,0 +1,142 @@
<script lang="ts" setup>
import { OperatorEnum } from "@/types";
import { PageData, PageParams } from "@/types/Basics";
import Utils from "@/utils";
import { Message } from "view-ui-plus";
/* 表格插件参数类型 */
interface TablePageProps {
dataApi: (params: PageParams) => Promise<PageData>;
columns: object[];
tableHeight: number | undefined;
pageParams: PageParams | undefined;
dataFilter?: ((resp: object) => object[]) | undefined;
autoLoad?: boolean | undefined;
}
import { ref, onBeforeMount, onMounted } from "vue";
const props = withDefaults(defineProps<TablePageProps>(), {
autoLoad: true,
});
const list = ref<any[]>([]),
selectList = ref<number[]>([]),
total = ref(0),
tableH = ref(0),
tableLoading = ref(true);
const params = ref<PageParams>({ page: 1, count: 10 });
onBeforeMount(async () => {
if (props.tableHeight) tableH.value = props.tableHeight;
else tableH.value = Utils.useTableHeight();
if (!!props.pageParams) params.value = props.pageParams;
// 页长记忆(bsch 规范 §3:customPageCount localStorage)
params.value.count = parseInt(localStorage.getItem("customPageCount") || String(params.value.count));
if (props.autoLoad) await getData();
});
onMounted(() => {
// window.onresize = _.debounce(() => {
// tableH.value = Utils.useTableHeight();
// }, 1000);
});
const getData = async () => {
tableLoading.value = true;
try {
const tempParams: any = _.cloneDeep(params.value);
tempParams.size = tempParams.count;
delete tempParams.count;
tempParams.page -= 1;
var data = await props.dataApi(tempParams);
total.value = data.count;
if (typeof props.dataFilter != "undefined") list.value = props.dataFilter(data);
else list.value = data.list;
} catch (error) {
console.log(error);
Message.error(error);
} finally {
tableLoading.value = false;
}
};
function selectChange(selection: any) {
selectList.value = selection;
}
async function pageUpdate(page: number) {
params.value.page = page;
await getData();
}
async function pageSizeUpdate(size: number) {
params.value.page = 1;
params.value.count = size;
localStorage.setItem("customPageCount", String(size));
await getData();
}
/** 刷新数据-更新删除用 */
// "add" | "del" | "edit" | "sel"
async function refreshData() {
params.value.page = 1;
await getData();
}
/** 重置数据 */
// "add" | "del" | "edit" | "sel"
async function reloadData(type: OperatorEnum = OperatorEnum.sel) {
let { page, count } = params.value;
if (type == OperatorEnum.add) {
console.log(page, count, total.value);
if (page * count == total.value) page += 1;
} else if (type == OperatorEnum.del) {
if ((page - 1) * count + 1 == total.value) page -= 1;
if (page < 1) page = 1;
} else if (type == OperatorEnum.edit) {
//page=page
} else if (type == OperatorEnum.sel) page = 1;
params.value.page = page;
await getData();
}
defineExpose({
list,
refreshData,
reloadData,
});
</script>
<template>
<Table
:columns="columns"
:data="list"
@on-selection-change="selectChange"
class="link-table table-bottom-box"
:height="tableH"
:loading="tableLoading"
no-data-text="暂无数据"
>
<template #loading>
<div class="table-spin-load">加载中</div>
</template>
</Table>
<div class="page-panel">
<div class="fl ml-15 align-middle">
<slot :checkList="selectList"></slot>
</div>
<Page
class="page-box fr"
:total="total"
:model-value="params.page"
:page-size="params.count"
:page-size-opts="[10, 20, 30, 40]"
@on-page-size-change="pageSizeUpdate"
@on-change="pageUpdate"
placement="top"
show-total
show-sizer
></Page>
</div>
</template>
<style></style>
+119
View File
@@ -0,0 +1,119 @@
<template>
<!-- 表格 -->
<Table :columns="columns" :data="list" :height="tableH" :loading="loading" no-data-text="暂无数据"
class="link-table table-bottom-box" @on-selection-change="selectChange">
<template #loading>
<div class="table-spin-load">加载中</div>
</template>
</Table>
<!-- 分页 / 插槽 -->
<div class="page-panel">
<div class="fl ml-15 align-middle">
<slot :checkList="selectList" />
</div>
<Page class="page-box fr" :total="total" :model-value="page" :page-size="pageSize"
:page-size-opts="[10, 20, 30, 40]" show-total show-sizer placement="top" @on-change="onPageChange"
@on-page-size-change="onSizeChange" />
</div>
</template>
<script setup lang="ts">
import { computed, ref, onMounted } from 'vue'
import { Message } from 'view-ui-plus'
import Utils from '@/utils'
import { OperatorEnum } from '@/types'
interface Props {
/** 必填:alova-gen 生成的 selectTextbook 方法(或任意同形方法) */
dataApi: any
columns: any[]
dataParams: any
tableHeight?: number
autoLoad?: boolean
dataFilter?: (resp: any) => any[],
formatResponse?: (res: any) => { total: number; list: any[] }
}
const props = withDefaults(defineProps<Props>(), {
autoLoad: true,
formatResponse: (res: any) => ({ total: res.total, list: res.content })
})
const emit = defineEmits<{
(e: 'selection-change', list: number[]): void
}>()
onMounted(() => {
})
/* ---------------- 表格高度 ---------------- */
const tableH = ref(props.tableHeight ?? Utils.useTableHeight())
/* ---------------- 选中行 ---------------- */
const selectList = ref<number[]>([])
function selectChange(rows: any[]) {
selectList.value = rows.map((r: any) => r.id)
emit('selection-change', selectList.value)
}
/* ---------------- 分页 + 请求 ---------------- */
const {
loading,
data: resp,
send: sendLoad,
page,
pageSize,
total,
reload
} = usePagination(
(current: number, size: number) =>
props.dataApi({
...props.dataParams, // 合并外部条件
pageIndex: current,
pageSize: size,
}),
{
// total: res => res.total,
// data: res => res.list,
total: res => props.formatResponse(res).total,
data: res => props.formatResponse(res).list,
// 默认分页参数
initialPage: 1,
initialPageSize: 10,
immediate: props.autoLoad,
watchingStates: [() => props.dataParams]
}
)
/* 列表数据 */
const list = computed(() => {
if (!resp.value) return []
return props.dataFilter ? props.dataFilter(resp.value) : resp.value
})
/* ---------------- 翻页事件 ---------------- */
const onPageChange = (p: number) => (page.value = p)
const onSizeChange = (s: number) => (pageSize.value = s)
/* ---------------- 外部可调用 ---------------- */
function refreshData() {
page.value = 1
reload()
}
function reloadData(type: OperatorEnum = OperatorEnum.sel) {
let p = page.value
const s = pageSize.value
if (type === OperatorEnum.add && p * s === total.value) p += 1
if (type === OperatorEnum.del && (p - 1) * s + 1 === total.value) p -= 1
if (p < 1) p = 1
page.value = p
sendLoad()
}
defineExpose({ list, refreshData, reloadData })
</script>
<style scoped>
/* 沿用旧样式即可 */
</style>
+105
View File
@@ -0,0 +1,105 @@
<template>
<Table :columns="columns" :data="list" :height="tableH" :loading="loading" no-data-text="暂无数据"
class="link-table table-bottom-box" @on-selection-change="selectChange">
<template #loading>
<div class="table-spin-load">加载中</div>
</template>
<template v-for="slotName in tableSlotNames" :key="slotName" v-slot:[slotName]="slotProps">
<slot :name="slotName" v-bind="slotProps" />
</template>
</Table>
<div class="page-panel">
<div class="fl ml-15 align-middle">
<slot :checkList="selectList" />
</div>
<Page class="page-box fr" :total="total" :model-value="page" :page-size="pageSize"
:page-size-opts="[10, 20, 30, 40]" show-total show-sizer placement="top" @on-change="onPageChange"
@on-page-size-change="onSizeChange" />
</div>
</template>
<script setup lang="ts">
import { computed, ref, useSlots } from 'vue'
import Utils from '@/utils'
import { OperatorEnum } from '@/types'
interface Props {
dataApi: any
columns: any[]
tableHeight?: number
autoLoad?: boolean
dataFilter?: (resp: any) => any[]
formatResponse?: (res: any) => { total: number; list: any[] }
}
const props = withDefaults(defineProps<Props>(), {
autoLoad: true,
formatResponse: (res: any) => ({ total: res.total, list: res.content })
})
const emit = defineEmits<{
(e: 'selection-change', list: number[]): void
}>()
const slots = useSlots()
const tableH = ref(props.tableHeight ?? Utils.useTableHeight())
const tableSlotNames = computed(() => Object.keys(slots).filter(name => !['default', 'loading'].includes(name)))
const selectList = ref<number[]>([])
function selectChange(rows: any[]) {
selectList.value = rows.map((r: any) => r.id)
emit('selection-change', selectList.value)
}
const {
loading,
data: resp,
send: sendLoad,
page,
pageSize,
total,
reload
} = usePagination(
(current: number, size: number) =>
props.dataApi({ pageIndex: current, pageSize: size }),
{
total: res => props.formatResponse(res).total,
data: res => props.formatResponse(res).list,
initialPage: 1,
initialPageSize: 10,
immediate: props.autoLoad,
}
)
const list = computed(() => {
if (!resp.value) return []
return props.dataFilter ? props.dataFilter(resp.value) : resp.value
})
const onPageChange = (p: number) => (page.value = p)
const onSizeChange = (s: number) => (pageSize.value = s)
function refreshData() {
page.value = 1
reload()
}
function reloadData(type: OperatorEnum = OperatorEnum.sel) {
let p = page.value
const s = pageSize.value
if (type === OperatorEnum.add && p * s === total.value) p += 1
if (type === OperatorEnum.del && (p - 1) * s + 1 === total.value) p -= 1
if (type === OperatorEnum.sel) p = 1
if (p < 1) p = 1
page.value = p
sendLoad()
}
defineExpose({ list, refreshData, reloadData })
</script>
<style scoped></style>
+238
View File
@@ -0,0 +1,238 @@
<template>
<div>
<Select class="mt-8" v-model="curSubJectId" placeholder="请选择学科">
<Option v-for="item in subjectComp" :value="item.k">{{ item.v }}</Option>
</Select>
<MyTree v-if="!treeLoading" ref="refMyTree" :autoClick="false" :treeData="treeData" :setting="treeSetting"
@on-tree-click="treeLink" />
</div>
</template>
<script lang="ts" setup>
import MyTree from '@/components/MyTree.vue'
import { useDefaultStore } from "@/store";
import { cloneDeep, isEmpty } from "lodash";
import useCurrentInstance from "@/utils/hook/useCurrentInstance";
import { get, last } from "lodash";
import { requireImg } from "@/utils/hook/useImg";
const props = defineProps<{
}>()
const curTreeNode = defineModel<any>('curTreeNode', { default: {} })
//学科学段
const curSubjectInfo = defineModel<any>('curSubjectInfo', {
default: {
stage: null,
subject: null
}
})
const store = useDefaultStore();
const { $utils } = useCurrentInstance();
const refMyTree = useTemplateRef('refMyTree');
function showIconForTree(treeId: any, treeNode: any) {
return treeNode.level == 0;
};
const treeSetting = ref({
view: {
dblClickExpand: false,
// showIcon: true,
showIcon: showIconForTree
},
edit: {
enable: true,
showRemoveBtn: false,
showRenameBtn: false,
drag: false,
},
check: {
enable: false,
},
callback: {},
})
const curSubJectId = ref<number | null>(null);
const subjectComp = computed(() => {
return store.getStageSubjects;
})
const paramsComp = computed(() => {
const find = subjectComp.value.find((item: any) => item.k == curSubJectId.value)
if (!find) return null;
else
return {
stage: find.stage,
subject: find.code
}
})
const curNodePath = computed(() => {
if (!curTreeNode.value) return [];
let arr: any[] = curTreeNode.value.getPath().map((x: any) => x.name)
return arr;
})
const { loading: treeLoading, data: treeData, send: sendReloadTree, onSuccess: onNodeTreeSuccess } = useRequest(
() => Apis.NodeTree.getKnowledge({ params: paramsComp.value }),
{
initialData: [],
immediate: false,
})
watch(() => curSubJectId.value, async (val) => {
await nextTick();
curTreeNode.value = null;
curSubjectInfo.value.stage = paramsComp.value?.stage;
curSubjectInfo.value.subject = paramsComp.value?.subject;
if (!!val)
sessionStorage.setItem('bsch.learnmanage.cur_subject_id', val.toString())
sendReloadTree(-1);
})
onNodeTreeSuccess(() => reloadTree(-1))
onMounted(async () => {
await nextTick();
console.log(subjectComp.value);
if (subjectComp.value.length > 0) {
let cacheStr = sessionStorage.getItem('bsch.learnmanage.cur_subject_id');
if (!!cacheStr) {
curSubJectId.value = Number(cacheStr);
}
else
curSubJectId.value = subjectComp.value[0].k;
}
})
async function reloadTree(id?: number) {
await nextTick();
function recursion(tree: any[], level: number): any[] {
tree.forEach(element => {
if (level == 1) {
element.open = true;
element.parent = true;
element.isParent = true;
element.icon = requireImg(`tree-icon-item.png`, "image");
element.iconSkin = requireImg(`tree-icon-item.png`, "image");
}
else {
element.icon = '';
element.iconSkin = '';
}
// element.icon = requireImg(`tree-icon-${element.isParent ? "group" : "item"}.png`, "image");
element.level = level;
if (!!element.children && element.children.length > 0)
element.children = recursion(element.children, level + 1);
else if (!element.isParent) {
delete element.children;
}
});
return tree;
}
treeData.value = recursion(treeData.value, 1);
// treeData.value.forEach((n: any) => {
// n.open = true;
// n.icon = requireImg(`tree-icon-item.png`, "image");
// if (!n.children || n.children.length == 0) {
// n.parent = true;
// n.children = [];
// }
// });
if (!!curTreeNode.value && !!curTreeNode.value.id)
refMyTree.value?.reloadTree(curTreeNode.value.id)
else
refMyTree.value?.reloadTree(id)
}
async function refreshMoveTree() {
// const id = selectedNode.value.id;
// await Apis.NodeTree.refreshSortTree({ params: { nodeId: id } })
// Message.success('刷新成功!');
// refTreeNode.value?.reloadTree()
}
async function treeLink(treeNode: any) {
const copyNode = cloneDeep(treeNode)
copyNode.children = [];
curTreeNode.value = copyNode;
console.log('click', treeNode.compositeId);
console.log(copyNode.getPath().map((x: any) => x.name));
}
async function onChangeSubject() { }
</script>
<style lang="scss">
.opera-ul {
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 1px solid #ebeef5;
padding-bottom: 10px;
li {
padding: 10px;
height: 38px;
border-radius: 50%;
cursor: pointer;
&.active,
&:hover {
background-color: #f5f5f5;
}
svg {
width: 18px;
height: 18px;
}
}
li.disabled {
cursor: not-allowed;
opacity: 0.4;
&:hover {
background-color: #fff;
}
}
}
#modal-sortTreeNode-id {
position: relative;
z-index: 1000;
height: 380px;
.tree-div {
z-index: 1001;
border: 1px solid #cacaca;
border-radius: 5px;
height: 300px;
}
.ztree {
margin-bottom: 20px;
}
}
</style>
+487
View File
@@ -0,0 +1,487 @@
<template>
<div>
<ul class="opera-ul">
<Tooltip content="新增节点" placement="top" transfer>
<li @click="showAddNode" :class="{ disabled: !nodePermissions.canCreate }">
<SvgIcon name="tree-icon-1" />
</li>
</Tooltip>
<Tooltip content="编辑节点" placement="top" transfer>
<li @click="showEditNode" :class="{ disabled: !nodePermissions.canUpdate }">
<SvgIcon name="tree-icon-2" />
</li>
</Tooltip>
<Tooltip content="移动节点" placement="top" transfer>
<li @click="showMoveNode" :class="{ disabled: !nodePermissions.canMove }">
<SvgIcon name="tree-icon-3" />
</li>
</Tooltip>
<Tooltip content="删除节点" placement="top" transfer>
<li @click="showDeleteNode" :class="{ disabled: !nodePermissions.canDelete }">
<SvgIcon name="tree-icon-4" />
</li>
</Tooltip>
</ul>
<Select class="mt-8" v-model="curSubJectId" placeholder="请选择学科">
<Option v-for="item in subjectComp" :value="item.k">{{ item.v }}</Option>
</Select>
<MyTree v-if="!treeLoading" ref="refMyTree" :autoClick="false" :treeData="treeData" :setting="treeSetting"
@on-tree-click="treeLink" />
<div class="modal-wrap">
<Modal v-model="editNodeModal.modal" :title="editNodeModal.title" width="450px" :mask-closable="false">
<Form ref="refFormData" :label-width="100" :model="editNodeModal" class="myform mb-20 mr-20">
<Form-Item label="当前位置:">
{{ curNodePath.join(' > ') }}
</Form-Item>
<Form-Item label="节点名称:" prop="name"
:rules="{ required: true, message: '请输入节点名称', trigger: 'blur' }">
<Input ref="refNodeNameInput" maxlength="30" v-model="editNodeModal.name" />
</Form-Item>
</Form>
<template #footer>
<Button @click="editNodeModal.modal = false">取消</Button>
<Button type="primary" :loading="editNodeModal.loading" @click="saveEditNode">确认</Button>
</template>
</Modal>
<Modal id="modal-sortTreeNode-id" class-name="up-dowm-components" v-model="showMoveModalStatus" title="移动节点"
:closable="false" :mask-closable="false" width="600">
<div class="fix">
<Alert class="fl">拖拽到目标节点时,确保节点是展开状态,以保证节点数据一致</Alert>
<Button class="fr" @click="sendReloadTree()">刷新节点树</Button>
</div>
<MyTree class="tree-div" ref="refSortMyTree" :autoClick="false" :treeData="moveTreeData"
:setting="moveTreeSetting" @on-tree-drag="onTreeDragMove" />
<template #footer>
<Button @click="showMoveModalStatus = false" style="margin-left: 20px">关闭</Button>
</template>
</Modal>
</div>
</div>
</template>
<script lang="ts" setup>
import SvgIcon from "@/components/SvgIcon.vue";
import MyTree from '@/components/MyTree.vue'
import { useDefaultStore } from "@/store";
import { RootNode } from "@/types";
import { cloneDeep, isEmpty } from "lodash";
import useCurrentInstance from "@/utils/hook/useCurrentInstance";
import { get, last } from "lodash";
const props = defineProps<{
rootType: RootNode;
}>()
const emit = defineEmits<{
'on-change': [stage: number, subject: string, treeNode: any]
}>()
const curTreeNode = defineModel<any>('curTreeNode', { default: {} })
//学科学段
const curSubjectInfo = defineModel<any>('curSubjectInfo', {
default: {
stage: null,
subject: null
}
})
const store = useDefaultStore();
const { $utils } = useCurrentInstance();
const refMyTree = useTemplateRef('refMyTree');
const refFormData = useTemplateRef('refFormData')
const refNodeNameInput = useTemplateRef('refNodeNameInput')
const treeSetting = ref({
view: {
dblClickExpand: false,
showIcon: false,
},
edit: {
enable: true,
showRemoveBtn: false,
showRenameBtn: false,
drag: false,
},
check: {
enable: false,
},
callback: {},
})
const moveTreeSetting = ref({
view: { dblClickExpand: false, showIcon: true },
edit: {
enable: true,
showRemoveBtn: false,
showRenameBtn: false,
drag: {
isMove: true,
isCopy: false,
showArrow: true,
prev: true,
next: true,
inner: true,
autoExpandTrigger: true
}
},
check: {
enable: false
},
callback: {}
})
const showMoveModalStatus = ref(false)
const editNodeModal = reactive({
modal: false,
title: '',
loading: false,
name: null,
id: null,
})
const curSubJectId = ref<number | null>(null);
const subjectComp = computed(() => {
return store.getStageSubjects;
})
const paramsComp = computed(() => {
const find = subjectComp.value.find((item: any) => item.k == curSubJectId.value)
if (!find) return null;
else
return {
rootType: props.rootType,
stage: find.stage,
subject: find.code
}
})
const curNodePath = computed(() => {
if (!curTreeNode.value) return [];
let arr: any[] = curTreeNode.value.getPath().map((x: any) => x.name)
return arr;
})
const moveTreeData = computed(() => {
function formatTree(list: any[]): any[] {
return list
.map(node => {
const [, , canMove] = $utils.unpackPerms(node.permissions)
if (!canMove) return null
const copy = cloneDeep(node)
copy.drag = true
copy.children = copy.children?.length
? formatTree(copy.children)
: null
return copy
})
.filter(Boolean)
}
return formatTree(treeData.value)
})
const { loading: treeLoading, data: treeData, send: sendReloadTree, onSuccess: onNodeTreeSuccess } = useRequest(
() => Apis.NodeTree.getNodeTree({ params: paramsComp.value }),
{
initialData: [],
immediate: false,
})
watch(() => curSubJectId.value, async (val) => {
await nextTick();
curTreeNode.value = null;
curSubjectInfo.value.stage = paramsComp.value?.stage;
curSubjectInfo.value.subject = paramsComp.value?.subject;
if (!!val)
sessionStorage.setItem('bsch.learnmanage.cur_subject_id', val.toString())
sendReloadTree(-1);
})
onNodeTreeSuccess(() => reloadTree(-1))
onMounted(async () => {
await nextTick();
if (subjectComp.value.length > 0) {
let cacheStr = sessionStorage.getItem('bsch.learnmanage.cur_subject_id');
if (!!cacheStr) {
curSubJectId.value = Number(cacheStr);
}
else
curSubJectId.value = subjectComp.value[0].k;
}
})
async function reloadTree(id?: number) {
await nextTick();
console.log(id);
treeData.value.forEach((n: any) => (n.open = true));
if (!!curTreeNode.value && !!curTreeNode.value.id)
refMyTree.value?.reloadTree(curTreeNode.value.id)
else
refMyTree.value?.reloadTree(id)
}
function showAddNode() {
if (!nodePermissions.value.canCreate) return;
editNodeModal.title = '新增节点';
editNodeModal.modal = true;
editNodeModal.id = null;
editNodeModal.name = null;
nextTick().then(() => {
refNodeNameInput.value?.focus()
})
}
function showEditNode() {
if (!nodePermissions.value.canUpdate) return;
editNodeModal.title = '编辑节点';
editNodeModal.modal = true;
editNodeModal.id = curTreeNode.value.id;
editNodeModal.name = curTreeNode.value.name;
nextTick().then(() => {
refNodeNameInput.value.focus()
})
}
function showMoveNode() {
if (!nodePermissions.value.canMove) return;
showMoveModalStatus.value = true;
}
async function showDeleteNode() {
if (!nodePermissions.value.canDelete) return;
const temp = cloneDeep(curTreeNode.value);
const parentNode = temp.getParentNode();
Modal.confirm({
title: '删除知识树节点',
content: `确定删除名为【${curTreeNode.value.name}】的知识树节点记录?`,
onOk: async () => {
const id = curTreeNode.value.id;
await Apis.NodeTree.deleteNode({ params: { nodeId: id } })
Message.success('删除成功!');
curTreeNode.value = parentNode;
sendReloadTree()
}
});
}
async function saveEditNode() {
let isAdd = !!editNodeModal.id ? false : true;
const validate = await refFormData.value.validate();
if (!validate) {
Message.error('请填写红色星号内容!');
return;
}
const { id, name } = editNodeModal;
editNodeModal.loading = true;
if (isAdd) {
const parentId = get(curTreeNode.value, 'id', -1)
const brotherId = get(last(get(curTreeNode.value, 'children')), 'id', 0);
const params: any = {
rootType: props.rootType,
name, parentId, brotherId,
stage: paramsComp.value?.stage,
subject: paramsComp.value?.subject
};
await Apis.NodeTree.addNode({ params })
sendReloadTree()
}
else {
await Apis.NodeTree.updateNodeName({ params: { name, nodeId: id } })
sendReloadTree();
}
editNodeModal.loading = false;
editNodeModal.modal = false;
}
async function refreshMoveTree() {
// const id = selectedNode.value.id;
// await Apis.NodeTree.refreshSortTree({ params: { nodeId: id } })
// Message.success('刷新成功!');
// refTreeNode.value?.reloadTree()
}
//@ts-ignore
async function onTreeDragMove({ treeNodes, targetNode, moveType }) {
let mType = moveType == "inner" ? 3 : moveType == "prev" ? 1 : moveType == "next" ? 2 : 0;
let currentNode = treeNodes[0];
let nativeNode = currentNode;
const params = formatMoveTree(treeNodes[0], targetNode, mType);
await Apis.NodeTree.move({
params: params,
})
sendReloadTree();
}
function formatMoveTree(currentNode: any, targetNode: any, moveType: any) {
let nativeNode = currentNode;
let treeNode = targetNode;
let pathArr = treeNode.path.split(",");
let index2 = pathArr.findIndex((ele: any) => {
return ele == nativeNode.id;
});
if (index2 != -1) {
Message.warning("父节点无法移动到子节点下方");
return;
}
let newBrother = ""; //新兄长节点 【接口参数】
let newParent = ""; //新父节点 【接口参数】
console.log('treeNode', treeNode);
var parentNode = treeNode.getParentNode();
let chilList = !!parentNode ? parentNode.children : treeNode.children;
let index = chilList.findIndex((ele: any) => {
return ele.id == treeNode.id;
});
if (treeNode.id == nativeNode.id || (treeNode.id == nativeNode.parentId && moveType == 3)) {
//选中同一节点,无效移动
Message.warning("目标节点与选中节点冲突,请选择其他目标节点");
return;
} else if ((moveType == 1 || moveType == 2) && nativeNode.parentId == treeNode.parentId) {
if (moveType == 1) {
console.log('idnex:' + index);
index--;
//前面
newBrother = index == 0 ? 0 : chilList[index - 1].id;
} else {
//后面
newBrother = chilList[index].id;
}
newParent = "";
} else {
//跨父节点移动
if (moveType == 1) {
//选择的是前面
//前面
newBrother = index == 0 ? index : chilList[index - 1].id;
newParent = treeNode.parentId;
} else if (moveType == 2) {
//选择的是后面
//后面
newBrother = chilList[index].id;
newParent = treeNode.parentId;
} else {
//选择的是里面
//里面 选中的children里面的最后一个
newBrother = isEmpty(treeNode.children)
? 0
: treeNode.children[treeNode.children.length - 1].id;
newParent = treeNode.id;
}
}
return {
targetId: nativeNode.id,
newParent: newParent,
newBrother: newBrother,
}
}
async function treeLink(treeNode: any) {
const copyNode = cloneDeep(treeNode)
copyNode.children = [];
curTreeNode.value = copyNode;
// console.log('click', treeNode);
// console.log(copyNode.getPath().map((x: any) => x.name));
curSubjectInfo.value.stage = paramsComp.value?.stage;
curSubjectInfo.value.subject = paramsComp.value?.subject;
const { stage, subject } = curSubjectInfo.value;
emit('on-change', stage, subject, copyNode)
}
const nodePermissions = computed(() => {
if (!curTreeNode.value) return { canCreate: false, canUpdate: false, canMove: false, canDelete: false };
const [canCreate, canUpdate, canMove, canDelete] = $utils.unpackPerms(curTreeNode.value.permissions)
return {
canCreate,
canUpdate,
canMove,
canDelete,
}
})
async function onChangeSubject() { }
</script>
<style lang="scss">
.opera-ul {
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 1px solid #ebeef5;
padding-bottom: 10px;
li {
padding: 10px;
height: 38px;
border-radius: 50%;
cursor: pointer;
&.active,
&:hover {
background-color: #f5f5f5;
}
svg {
width: 18px;
height: 18px;
}
}
li.disabled {
cursor: not-allowed;
opacity: 0.4;
&:hover {
background-color: #fff;
}
}
}
#modal-sortTreeNode-id {
position: relative;
z-index: 1000;
height: 380px;
.tree-div {
z-index: 1001;
border: 1px solid #cacaca;
border-radius: 5px;
height: 300px;
}
.ztree {
margin-bottom: 20px;
}
}
</style>
+469
View File
@@ -0,0 +1,469 @@
<template>
<div>
<ul class="opera-ul">
<Tooltip content="新增节点" placement="top" transfer>
<li @click="showAddNode" :class="{ disabled: !nodePermissions.canCreate }">
<SvgIcon name="tree-icon-1" />
</li>
</Tooltip>
<Tooltip content="编辑节点" placement="top" transfer>
<li @click="showEditNode" :class="{ disabled: !nodePermissions.canUpdate }">
<SvgIcon name="tree-icon-2" />
</li>
</Tooltip>
<Tooltip content="移动节点" placement="top" transfer>
<li @click="showMoveNode" :class="{ disabled: !nodePermissions.canMove }">
<SvgIcon name="tree-icon-3" />
</li>
</Tooltip>
<Tooltip content="删除节点" placement="top" transfer>
<li @click="showDeleteNode" :class="{ disabled: !nodePermissions.canDelete }">
<SvgIcon name="tree-icon-4" />
</li>
</Tooltip>
</ul>
<BschSubjectSelect class="mt-8" @on-change="handleSubjectChange" />
<MyTree v-if="!treeLoading" ref="refMyTree" :autoClick="false" :treeData="treeData" :setting="treeSetting"
@on-tree-click="treeLink" />
<div class="modal-wrap">
<Modal v-model="editNodeModal.modal" :title="editNodeModal.title" width="450px" :mask-closable="false">
<Form ref="refFormData" :label-width="100" :model="editNodeModal" class="myform mb-20 mr-20">
<Form-Item label="当前位置:">
{{ curNodePath.join(' > ') }}
</Form-Item>
<Form-Item label="节点名称:" prop="name"
:rules="{ required: true, message: '请输入节点名称', trigger: 'blur' }">
<Input ref="refNodeNameInput" maxlength="30" v-model="editNodeModal.name" />
</Form-Item>
</Form>
<template #footer>
<Button @click="editNodeModal.modal = false">取消</Button>
<Button type="primary" :loading="editNodeModal.loading" @click="saveEditNode">确认</Button>
</template>
</Modal>
<Modal id="modal-sortTreeNode-id" class-name="up-dowm-components" v-model="showMoveModalStatus" title="移动节点"
:closable="false" :mask-closable="false" width="600">
<div class="fix">
<Alert class="fl">拖拽到目标节点时,确保节点是展开状态,以保证节点数据一致</Alert>
<Button class="fr" @click="sendReloadTree()">刷新节点树</Button>
</div>
<MyTree class="tree-div" ref="refSortMyTree" :autoClick="false" :treeData="moveTreeData"
:setting="moveTreeSetting" @on-tree-drag="onTreeDragMove" />
<template #footer>
<Button @click="showMoveModalStatus = false" style="margin-left: 20px">关闭</Button>
</template>
</Modal>
</div>
</div>
</template>
<script lang="ts" setup>
import SvgIcon from "@/components/SvgIcon.vue";
import MyTree from '@/components/MyTree.vue'
import { useDefaultStore } from "@/store";
import { RootNode } from "@/types";
import { cloneDeep, isEmpty } from "lodash";
import useCurrentInstance from "@/utils/hook/useCurrentInstance";
import BschSubjectSelect from '@/components/BschSubjectSelect.vue'
import { get, last } from "lodash";
const props = defineProps<{
rootType: RootNode;
}>()
const emit = defineEmits<{
'on-change': [stage: number, subject: string, treeNode: any]
}>()
const curTreeNode = defineModel<any>('curTreeNode', { default: {} })
//学科学段
const curSubjectInfo = defineModel<any>('curSubjectInfo', {
default: {
stage: null,
subject: null
}
})
const store = useDefaultStore();
const { $utils } = useCurrentInstance();
const refMyTree = useTemplateRef('refMyTree');
const refFormData = useTemplateRef('refFormData')
const refNodeNameInput = useTemplateRef('refNodeNameInput')
const treeSetting = ref({
view: {
dblClickExpand: false,
showIcon: false,
},
edit: {
enable: true,
showRemoveBtn: false,
showRenameBtn: false,
drag: false,
},
check: {
enable: false,
},
callback: {},
})
const moveTreeSetting = ref({
view: { dblClickExpand: false, showIcon: true },
edit: {
enable: true,
showRemoveBtn: false,
showRenameBtn: false,
drag: {
isMove: true,
isCopy: false,
showArrow: true,
prev: true,
next: true,
inner: true,
autoExpandTrigger: true
}
},
check: {
enable: false
},
callback: {}
})
const showMoveModalStatus = ref(false)
const editNodeModal = reactive({
modal: false,
title: '',
loading: false,
name: null,
id: null,
})
const curSubject = reactive({
subject: '',
stage: 0,
})
const paramsComp = computed(() => {
return {
rootType: props.rootType,
stage: curSubject.stage,
subject: curSubject.subject
}
})
const curNodePath = computed(() => {
if (!curTreeNode.value) return [];
let arr: any[] = curTreeNode.value.getPath().map((x: any) => x.name)
return arr;
})
const moveTreeData = computed(() => {
function formatTree(list: any[]): any[] {
return list
.map(node => {
const [, , canMove] = $utils.unpackPerms(node.permissions)
if (!canMove) return null
const copy = cloneDeep(node)
copy.drag = true
copy.children = copy.children?.length
? formatTree(copy.children)
: null
return copy
})
.filter(Boolean)
}
return formatTree(treeData.value)
})
const { loading: treeLoading, data: treeData, send: sendReloadTree, onSuccess: onNodeTreeSuccess } = useRequest(
() => Apis.NodeTree.getNodeTree({ params: paramsComp.value }),
{
initialData: [],
immediate: false,
})
onNodeTreeSuccess(() => reloadTree(-props.rootType))
onMounted(async () => {
})
async function reloadTree(id?: number) {
await nextTick();
console.log(id);
refMyTree.value?.reloadTree(id)
// treeData.value.forEach((n: any) => (n.open = true));
// if (!!curTreeNode.value && !!curTreeNode.value.id)
// refMyTree.value?.reloadTree(curTreeNode.value.id)
// else
// refMyTree.value?.reloadTree(id)
}
function showAddNode() {
if (!nodePermissions.value.canCreate) return;
editNodeModal.title = '新增节点';
editNodeModal.modal = true;
editNodeModal.id = null;
editNodeModal.name = null;
nextTick().then(() => {
refNodeNameInput.value?.focus()
})
}
function showEditNode() {
if (!nodePermissions.value.canUpdate) return;
editNodeModal.title = '编辑节点';
editNodeModal.modal = true;
editNodeModal.id = curTreeNode.value.id;
editNodeModal.name = curTreeNode.value.name;
nextTick().then(() => {
refNodeNameInput.value.focus()
})
}
function showMoveNode() {
if (!nodePermissions.value.canMove) return;
showMoveModalStatus.value = true;
}
async function showDeleteNode() {
if (!nodePermissions.value.canDelete) return;
const temp = cloneDeep(curTreeNode.value);
const parentNode = temp.getParentNode();
Modal.confirm({
title: '删除知识树节点',
content: `确定删除名为【${curTreeNode.value.name}】的知识树节点记录?`,
onOk: async () => {
const id = curTreeNode.value.id;
await Apis.NodeTree.deleteNode({ params: { nodeId: id } })
Message.success('删除成功!');
curTreeNode.value = parentNode;
sendReloadTree()
}
});
}
async function saveEditNode() {
let isAdd = !!editNodeModal.id ? false : true;
const validate = await refFormData.value.validate();
if (!validate) {
Message.error('请填写红色星号内容!');
return;
}
const { id, name } = editNodeModal;
editNodeModal.loading = true;
if (isAdd) {
const parentId = get(curTreeNode.value, 'id', -1)
const brotherId = get(last(get(curTreeNode.value, 'children')), 'id', 0);
const params: any = {
rootType: props.rootType,
name, parentId, brotherId,
stage: paramsComp.value?.stage,
subject: paramsComp.value?.subject
};
await Apis.NodeTree.addNode({ params })
sendReloadTree()
}
else {
await Apis.NodeTree.updateNodeName({ params: { name, nodeId: id } })
sendReloadTree();
}
editNodeModal.loading = false;
editNodeModal.modal = false;
}
async function refreshMoveTree() {
// const id = selectedNode.value.id;
// await Apis.NodeTree.refreshSortTree({ params: { nodeId: id } })
// Message.success('刷新成功!');
// refTreeNode.value?.reloadTree()
}
//@ts-ignore
async function onTreeDragMove({ treeNodes, targetNode, moveType }) {
let mType = moveType == "inner" ? 3 : moveType == "prev" ? 1 : moveType == "next" ? 2 : 0;
let currentNode = treeNodes[0];
let nativeNode = currentNode;
const params = formatMoveTree(treeNodes[0], targetNode, mType);
await Apis.NodeTree.move({
params: params,
})
sendReloadTree();
}
function formatMoveTree(currentNode: any, targetNode: any, moveType: any) {
let nativeNode = currentNode;
let treeNode = targetNode;
let pathArr = treeNode.path.split(",");
let index2 = pathArr.findIndex((ele: any) => {
return ele == nativeNode.id;
});
if (index2 != -1) {
Message.warning("父节点无法移动到子节点下方");
return;
}
let newBrother = ""; //新兄长节点 【接口参数】
let newParent = ""; //新父节点 【接口参数】
console.log('treeNode', treeNode);
var parentNode = treeNode.getParentNode();
let chilList = !!parentNode ? parentNode.children : treeNode.children;
let index = chilList.findIndex((ele: any) => {
return ele.id == treeNode.id;
});
if (treeNode.id == nativeNode.id || (treeNode.id == nativeNode.parentId && moveType == 3)) {
//选中同一节点,无效移动
Message.warning("目标节点与选中节点冲突,请选择其他目标节点");
return;
} else if ((moveType == 1 || moveType == 2) && nativeNode.parentId == treeNode.parentId) {
if (moveType == 1) {
console.log('idnex:' + index);
index--;
//前面
newBrother = index == 0 ? 0 : chilList[index - 1].id;
} else {
//后面
newBrother = chilList[index].id;
}
newParent = "";
} else {
//跨父节点移动
if (moveType == 1) {
//选择的是前面
//前面
newBrother = index == 0 ? index : chilList[index - 1].id;
newParent = treeNode.parentId;
} else if (moveType == 2) {
//选择的是后面
//后面
newBrother = chilList[index].id;
newParent = treeNode.parentId;
} else {
//选择的是里面
//里面 选中的children里面的最后一个
newBrother = isEmpty(treeNode.children)
? 0
: treeNode.children[treeNode.children.length - 1].id;
newParent = treeNode.id;
}
}
return {
targetId: nativeNode.id,
newParent: newParent,
newBrother: newBrother,
}
}
async function treeLink(treeNode: any) {
const copyNode = cloneDeep(treeNode)
copyNode.children = [];
curTreeNode.value = copyNode;
// console.log('click', treeNode);
// console.log(copyNode.getPath().map((x: any) => x.name));
curSubjectInfo.value.stage = paramsComp.value?.stage;
curSubjectInfo.value.subject = paramsComp.value?.subject;
const { stage, subject } = curSubjectInfo.value;
emit('on-change', stage, subject, copyNode)
}
const nodePermissions = computed(() => {
if (!curTreeNode.value) return { canCreate: false, canUpdate: false, canMove: false, canDelete: false };
const [canCreate, canUpdate, canMove, canDelete] = $utils.unpackPerms(curTreeNode.value.permissions)
return {
canCreate,
canUpdate,
canMove,
canDelete,
}
})
async function handleSubjectChange(stage: number, subject: string) {
curSubject.stage = stage;
curSubject.subject = subject;
await nextTick();
sendReloadTree();
}
</script>
<style lang="scss">
.opera-ul {
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 1px solid #ebeef5;
padding-bottom: 10px;
li {
padding: 10px;
height: 38px;
border-radius: 50%;
cursor: pointer;
&.active,
&:hover {
background-color: #f5f5f5;
}
svg {
width: 18px;
height: 18px;
}
}
li.disabled {
cursor: not-allowed;
opacity: 0.4;
&:hover {
background-color: #fff;
}
}
}
#modal-sortTreeNode-id {
position: relative;
z-index: 1000;
height: 380px;
.tree-div {
z-index: 1001;
border: 1px solid #cacaca;
border-radius: 5px;
height: 300px;
}
.ztree {
margin-bottom: 20px;
}
}
</style>
+169
View File
@@ -0,0 +1,169 @@
<template>
<div class="type_set-box">
<div class="type_name">
<i class="iconfont icon-stop fl mr-10" v-if="!isEdit && !active" style="color: #ff5959"></i>
<Input v-if="isEdit" v-model="type.name" ref="type_input" @on-blur="update" @on-enter="update" />
<span v-else class="fl">{{ type.name }}</span>
</div>
<div class="type_action flex">
<div class="action_item" @click="open">
<span v-if="active">停用</span>
<span v-else>启用</span>
</div>
<div class="action_edit" @click="edit">
<span>编辑</span>
</div>
<div class="action_delete" @click="remove">
<span>删除</span>
</div>
</div>
<div class="divider"></div>
<div class="divider2"></div>
</div>
</template>
<script>
export default {
name: "TypeSetBox",
props: {
type: {
name: { type: String, default: "" },
id: { type: String, default: "" },
},
active: { type: Boolean, default: true },
},
data() {
return {
isEdit: false,
eventType: "",
};
},
watch: {
type: {
deep: true,
handler(newVal) {
if (this.isEdit) {
this.isEdit = false;
}
},
},
"type.name"(newVal) {
if (this.isEdit) {
this.isEdit = false;
}
},
},
methods: {
open() {
this.$emit("active", this.type.id);
},
edit() {
this.isEdit = !this.isEdit;
if (this.isEdit) this.$nextTick(() => this.$refs["type_input"].focus());
},
update(e) {
if (!this.type.name) {
this.$Message.error("值不得为空!");
return;
}
if (this.eventType == "") {
this.eventType = e.type;
this.isEdit = false;
this.$emit("edit", this.type.id, this.type.name);
setTimeout(() => {
this.eventType = "";
}, 500);
}
},
remove() {
this.$emit("remove", this.type.id);
},
},
};
</script>
<style lang="scss" scoped>
.flex {
display: flex;
}
.type_set-box {
width: 222px;
background: #ffffff;
margin-right: 15px;
margin-bottom: 15px;
.type_name {
height: 66px;
border: 1px solid #e9e9e9;
border-bottom: none;
padding-left: 15px;
padding-right: 15px;
line-height: 66px;
display: flex;
justify-content: center;
align-items: center;
span {
height: 24px;
font-size: 15px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 500;
color: #272829;
line-height: 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 222px;
display: inline-block;
}
.iconfont {
font-size: 26px;
}
}
.type_action {
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 222px;
height: 30px;
line-height: 30px;
background: #f7f7f7;
border-radius: 0px 0px 2px 2px;
border-top: none;
border: 1px solid #e9e9e9;
span {
font-size: 12px;
}
div {
cursor: pointer;
flex: 1;
text-align: center;
}
div:hover {
color: #6c91f0;
}
}
.divider {
// position: relative;
height: 14px;
width: 1px;
background: #e8e8e8;
// left: 73px;
// top: -23px;
float: left;
margin-left: 71px;
margin-top: -22px;
}
.divider2 {
// position: relative;
// left: 146px;
// top: -37px;
height: 14px;
width: 1px;
background: #e8e8e8;
float: left;
margin-left: 147px;
margin-top: -22px;
}
}
</style>
+106
View File
@@ -0,0 +1,106 @@
<template>
<div class="improt-wrap">
<slot></slot>
<div class="upload-panel">
<Upload type="drag" :on-success="onSuccess" :on-remove="onRemove" :on-error="onError"
:before-upload="handleUploadBefore" :headers="headers" :data="uploadData" :action="uploadUrl"
:with-credentials="true" :max-size="maxSize" :multiple="multiple">
<div class="upload-box">
<Icon type="ios-paper" size="52" style="color: #6281eb"></Icon>
<h4>点击或将文件拖拽到这里上传</h4>
<div class="info">文件大小不超过{{ $utils.getFileSize(maxSize) }}</div>
</div>
<Alert v-if="!!errorMsg" type="error" show-icon><span v-html="errorMsg"></span></Alert>
</Upload>
</div>
<!-- <slot name="footer"></slot> -->
</div>
</template>
<script>
export default {
model: {
event: "update:fileList",
prop: "fileList",
},
props: {
fileList: {
type: Array,
default: [],
},
uploadUrl: String,
uploadData: Object,
headers: Object,
multiple: {
type: Boolean,
default: false,
},
},
data() {
return {
maxSize: 200 * 1024 * 1024,
errorMsg: null,
};
},
methods: {
handleUploadBefore(file) {
var _this = this;
if (file.size > _this.maxSize) {
_this.$Message.error({
content: "请上传小于" + _this.$utils.getFileSize(_this.maxSize) + "的文件!",
duration: 3,
});
}
},
onSuccess(res, file) {
if (res.code == 0) {
this.errorMsg = null;
const { uid } = file;
this.fileList.push({ ...res.data, uid });
this.$emit("update:fileList", this.fileList);
} else {
let msg = res.data.error;
this.errorMsg = msg;
}
},
onRemove(file, fileList) {
const { uid } = file;
const findIndex = this.fileList.findIndex(item => item.uid === uid);
this.fileList.splice(findIndex, 1);
this.$emit("update:fileList", this.fileList);
console.log(file, fileList);
},
onError(err, file) {
this.errorMsg = JSON.stringify(err);
console.log(err, file);
},
},
};
</script>
<style lang="scss" scoped>
.improt-wrap {
padding: 0 12px;
.form-item {
margin-bottom: 10px;
}
}
.upload-panel {
.upload-box {
background: #f7f8fc;
padding: 30px 0;
h4 {
color: #505c7e;
margin: 3px 0;
}
}
.info {
font-size: 13px;
color: #666;
}
}
</style>
+132
View File
@@ -0,0 +1,132 @@
<template>
<div>
<ul class="public-upload-img fix">
<li v-for="(item, index) in uploadList">
<template v-if="item.status === 'finished'">
<img :src="item.url" alt="" />
<div class="upload-list-cover">
<Icon
type="ios-eye-outline"
size="24"
title="预览图片"
@click.native="handleView(item.url)"
></Icon>
<Icon
size="24"
class="ml-10"
title="删除图片"
type="ios-trash-outline"
@click.native="handleRemove(index)"
></Icon>
</div>
</template>
<template v-else>
<Progress v-if="item.showProgress" :percent="item.percentage" class="mt-24" hide-info></Progress>
</template>
</li>
<li class="add-li" v-show="uploadList.length < uploadCount">
<Upload
ref="upload"
:show-upload-list="false"
:on-success="handleSuccess"
:format="['jpg', 'jpeg', 'png', 'gif']"
accept="image/gif,image/jpeg,image/jpg,image/png"
:max-size="20480"
:on-format-error="handleFormatError"
:on-exceeded-size="handleMaxSize"
:default-file-list="defaultList"
:headers="uploadHeader"
type="drag"
:action="uploadUrl"
:data="data"
>
<div class="add-box">
<Icon type="ios-add" size="50"></Icon>
</div>
</Upload>
</li>
</ul>
<Modal title="图片预览" v-model="visible" footer-hide>
<img :src="imgName" v-if="visible" style="width: 100%" />
</Modal>
</div>
</template>
<script>
export default {
props: {
imgList: { type: Array, default: [] },
uploadUrl: { type: String, default: "" },
uploadCount: { type: Number, default: 1 },
data: { type: Object, default: null },
},
data() {
return {
imgName: "",
visible: false,
uploadList: [],
defaultList: [],
};
},
created() {
this.setDefaultList();
this.$watch("imgList", val => {
this.setDefaultList();
});
},
mounted() {
console.log(this.$refs.upload.fileList);
this.uploadList = this.$refs.upload.fileList;
},
computed: {
uploadHeader() {
const bschUtil = BschLoadUtil.getInstance();
if (!bschUtil.getIsSelf()) {
return {
ticket: sessionStorage.getItem("bschTicket"),
platform: "grzx",
};
} else return null;
},
},
methods: {
handleView(name) {
this.imgName = name;
this.visible = true;
},
handleRemove(index) {
this.$refs.upload.fileList.splice(index, 1);
this.imgList.splice(index, 1);
},
handleSuccess(res, file) {
console.log(res, file);
file.url = res.data.fileurl;
this.imgList.push(res.data.fileurl);
},
handleFormatError(file) {
this.$Notice.info({
title: "不支持的文件类型!",
desc: "请上传指定的文件类型",
});
},
handleMaxSize(file) {
this.$Notice.warning({
title: "图片过大",
desc: "图片最大上传大小为20M.",
});
},
setDefaultList() {
let arr = [];
this.imgList.forEach(element => {
arr.push({
name: "",
url: element,
});
});
this.defaultList = arr;
},
},
};
</script>
<style></style>
+165
View File
@@ -0,0 +1,165 @@
<template>
<!-- 通知对象选择:全部用户 / 指定用户(自旧前端 user_check_input.vue 适配) -->
<div class="check-user-wrap">
<div class="check-user-box">
<RadioGroup v-model="isCheckUserAll" class="radio" @on-change="userAllCheck">
<Radio :disabled="editDisabled" :label="0">{{ isEdit ? "现有" : "全部" }}用户</Radio>
<Radio :label="1">指定用户</Radio>
</RadioGroup>
<Input
type="text"
v-model="userNameStr"
readonly
:disabled="!isCheckUserAll"
placeholder="选择指定的用户"
class="input"
></Input>
<Button icon="md-add" @click="checkUserShow" :disabled="!isCheckUserAll"></Button>
<Button icon="md-trash" @click="resetUser" :disabled="!isCheckUserAll"></Button>
</div>
<UserCheckModal
ref="userCheckModal"
:sources="sources"
:userids="tempUserIds"
@on-submit="submitUser"
/>
</div>
</template>
<script lang="ts">
/*
* 通知对象选择输入(自旧前端 oldfront/src/components/user_check_input.vue 适配 Vue3)。
* v-model 值为 "all" 或用户 id 逗号串;切换到「指定用户」直接弹出选择用户弹窗。
*/
import UserCheckModal from "@/components/UserCheckModal.vue";
import { baseApi, settingApi } from "@/api/module/notice";
export default {
name: "UserCheckInput",
components: { UserCheckModal },
props: {
modelValue: {
type: String,
default: "all",
},
/** 编辑态:全部用户选项禁用为「现有用户」 */
isEdit: {
type: Boolean,
default: false,
},
},
emits: ["update:modelValue"],
data() {
return {
isCheckUserAll: 0 as number,
tempUserIds: [] as any[],
userNameStr: "",
editDisabled: false,
sources: [
{
name: "基础平台",
loader: () => baseApi.getSchoolAll().send() as Promise<any[]>,
},
{
name: "自定义组",
loader: () => settingApi.getGroupTree().send() as Promise<any[]>,
},
],
};
},
created() {
if (this.modelValue === "all") {
this.isCheckUserAll = 0;
this.userNameStr = this.isEdit ? "现有用户" : "全部用户";
} else {
this.isCheckUserAll = 1;
this.tempUserIds = this.modelValue.split(",").map((x) => parseInt(x)).filter((x) => !isNaN(x));
}
},
methods: {
checkUserShow() {
(this.$refs.userCheckModal as any).show();
},
resetUser() {
//清除用户
this.tempUserIds = [];
this.userNameStr = "";
this.$emit("update:modelValue", "");
},
userAllCheck(type: number) {
let tempIds: any = String(this.modelValue || "")
.split(",")
.map((x) => parseInt(x))
.filter((x) => !isNaN(x));
if (type == 0) {
if (this.isEdit) {
this.tempUserIds = tempIds;
this.userNameStr = "现有用户";
this.$emit("update:modelValue", String(tempIds));
} else {
this.tempUserIds = [];
this.userNameStr = "全部用户";
this.$emit("update:modelValue", "all");
}
} else {
if (this.isEdit) {
this.editDisabled = true;
}
this.tempUserIds = tempIds;
this.userNameStr = "";
this.checkUserShow();
}
},
submitUser(arr: any[]) {
//确认用户
this.userNameStr = arr.map((x) => x.name).join("、");
const ids = arr.map((x) => x.id).join(",");
this.$emit("update:modelValue", ids || "all");
if (!arr.length) {
// 清空后回到全部用户
this.isCheckUserAll = 0;
this.userNameStr = "全部用户";
this.$emit("update:modelValue", "all");
}
},
},
watch: {
modelValue(val: string) {
if (val === "all") {
this.isCheckUserAll = 0;
this.userNameStr = this.isEdit ? "现有用户" : "全部用户";
} else if (val === "") {
this.userNameStr = "";
} else {
// 编辑回显:指定用户 id 串
this.isCheckUserAll = 1;
this.tempUserIds = val
.split(",")
.map((x) => parseInt(x))
.filter((x) => !isNaN(x));
}
},
},
};
</script>
<style lang="scss" scoped>
.check-user-wrap {
width: 100%;
.check-user-box {
display: flex;
align-items: center;
gap: 8px;
.radio {
width: 180px;
flex: none;
font-size: 12px;
vertical-align: middle;
line-height: 32px;
}
.input {
flex: 1;
}
}
}
</style>
+446
View File
@@ -0,0 +1,446 @@
<template>
<Modal
v-model="modal"
title="选择用户"
width="720px"
:mask-closable="false"
:closable="false"
>
<Tabs
v-if="sources.length > 1"
:key="tabKey"
type="card"
:value="String(tabIndex)"
@on-click="tabChange"
>
<TabPane v-for="(item, index) in sources" :key="index" :label="item.name" :name="index + ''"></TabPane>
</Tabs>
<AutoComplete
@on-search="handleSearch"
@on-select="handleSelect"
placeholder="输入名字搜索"
v-model="searchTreeName"
:clearable="true"
class="auto-box"
>
<Option v-for="item in searchResult" :key="item.id" :value="item.name">
<span>{{ item.name }}</span>
<span class="fr info">{{ item.group }}</span>
</Option>
</AutoComplete>
<div class="tree-wrap fix">
<div class="tree-panel fl">
<div class="tree-box">
<div :id="ztreeDomId" class="ztree"></div>
</div>
</div>
<div class="arrow-box fl">
<svg
t="1626916477711"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
width="36"
height="36"
>
<path
d="M138.935 256.078v511.844h63.42V256.078h-63.42z m126.842 0v511.844h127.215V256.078H265.777zM885.064 512L583.254 64.323v191.755H456.414v511.844h126.842v191.755L885.064 512z"
fill="#2d8cf0"
></path>
</svg>
</div>
<div class="user-panel fl">
<div class="title-box fix">
<Checkbox @on-change="checkAllUser" v-model="isCheckUserAll">全选</Checkbox>
<div class="fr">{{ tempUserList.length }}</div>
<a
href="javascript:;"
@click="delCheckUser"
v-if="tempUserList.findIndex((x: any) => x.isCheck) > -1"
>删除选中</a
>
</div>
<ul class="user-box">
<li
v-for="item in tempUserList"
:key="item.id"
:class="{ active: item.isCheck }"
@click="checkUserOne(item)"
>
{{ item.name }}
<span class="info">{{ item.group }}</span>
</li>
</ul>
</div>
</div>
<template #footer>
<Button type="primary" @click="submit">提交</Button>
<Button @click="modal = false" style="margin-left: 8px">取消</Button>
</template>
</Modal>
</template>
<script lang="ts">
/*
* 选择用户弹窗(自旧前端 oldfront/src/components/userCheck.vue 适配 Vue3)。
* 左侧为带复选框的组织树(部门→人员,叶子=人员),勾选/取消按父子级联;
* 右侧为已选人员列表,支持全选/删除选中;提交返回去重后的用户 id 数组与用户对象数组。
*/
import { Message } from "view-ui-plus";
import { requireImg } from "@/utils/hook/useImg";
interface SelectSource {
name: string;
loader: () => Promise<any[]>;
}
export default {
name: "UserCheckModal",
props: {
/** 数据源 tab:{ name, loader },loader 返回 ztree 树数据(children 嵌套,叶子=人员) */
sources: {
type: Array as () => SelectSource[],
default: () => [],
},
/** 已选用户 id(打开时自动勾选) */
userids: {
type: Array as () => number[],
default: () => [],
},
isDisabled: {
type: Boolean,
default: false,
},
},
emits: ["update:userids", "on-submit"],
data() {
return {
ztreeDomId: "user_check_tree_" + Math.floor(Math.random() * 1e8),
modal: false,
tabIndex: 0,
/** 每次打开弹窗自增,强制重建 Tabs,避免上次 tab 高亮残留与数据错位 */
tabKey: 0,
/** 树加载序号:tab 快速切换时只渲染最后一次请求的结果 */
treeSeq: 0,
isCheckUserAll: false,
cacheMap: new Map(),
currentTree: [] as any[],
searchTreeName: "",
searchResult: [] as any[],
tempUserList: [] as any[],
};
},
computed: {
/** 当前树扁平化(含父级名称,供搜索展示) */
currentTreeFlatten(): any[] {
const flatten = (data: any[], pid: number, pname: string): any[] =>
data.reduce(
(arr: any[], { id, name, children = [], type }: any) =>
arr.concat([{ id, name, pid, type, group: pname }], flatten(children, id, name)),
[]
);
return flatten(this.currentTree, 0, "");
},
},
methods: {
show() {
this.modal = true;
// 重置到第一个 tab:显式赋值 + key 重建 Tabs,保证高亮与数据一致
this.tabIndex = 0;
this.tabKey++;
this.changeEmpty();
this.initTree();
},
tabChange(index: string) {
const idx = Number(index);
// 严格比较:v-model 场景下 iview 会把值写成字符串 name,
// 宽松相等("1" == 1)会误判“未切换”导致 tab 永远不生效
if (idx !== 0 && this.tabIndex === idx) return;
this.tabIndex = idx;
this.changeEmpty();
this.initTree();
},
handleSearch(query: string) {
let arr: any[] = [];
const searchArr = this.currentTreeFlatten.filter(
(x: any) => x.type == 2 && x.name.indexOf(query) != -1
);
for (const item of searchArr) {
!arr
.map((x) => this.getSplitId(x.id))
.includes(this.getSplitId(item.id)) && arr.push(item);
}
this.searchResult = arr;
},
handleSelect(query: string) {
if (query.indexOf(",") != -1) query = query.split(",")[0];
var treeObj = ($.fn as any).zTree.getZTreeObj(this.ztreeDomId);
var node = treeObj.getNodeByParam("name", query, null);
if (!!node) treeObj.checkNode(node, true, true, true);
},
/**
* ztree 数据预处理:拼接 pid 保证同人多组时 id 可区分;叶子标记 type=2。
* 组/用户判定优先用接口 isParent(组=文件夹),缺失时按有无子节点兜底;
* 并设置组/用户区分图标。
*/
formatTree(tree: any[], level = 0, pid: number = 0) {
tree.forEach((element: any) => {
element.open = level == 0;
element.pid = pid;
element.id = element.id + "," + pid;
element.checked = false;
if (typeof element.isParent !== "undefined") {
element.type = element.isParent ? 1 : 2;
} else {
element.type = element.children && element.children.length > 0 ? 1 : 2;
}
element.icon = requireImg(
element.type == 1 ? "tree-icon-group.png" : "tree-icon-item.png",
"image"
);
if (typeof element.children !== "undefined" && element.children.length > 0) {
element.children = this.formatTree(element.children, level + 1, this.getSplitId(element.id));
}
});
return tree;
},
initTree() {
const _this = this;
// 竞态守卫:慢请求返回时若已切换 tab,丢弃结果
const seq = ++this.treeSeq;
const cacheKey = this.tabIndex;
const source = this.sources[this.tabIndex];
if (!source) return;
const cached = this.cacheMap.get(cacheKey);
if (cached) {
this.createTree(cached);
return;
}
source
.loader()
.then((data: any[]) => {
if (seq !== _this.treeSeq) return;
_this.cacheMap.set(cacheKey, data || []);
_this.createTree(data || []);
})
.catch((e: any) => {
if (seq === _this.treeSeq) Message.error(e?.message || "加载组织数据失败");
});
},
createTree(rawData: any[]) {
const _this = this;
var jtree = JSON.parse(JSON.stringify(rawData));
var ftree = _this.formatTree(jtree);
_this.currentTree = ftree;
let treeSetting: any = {
view: {
dblClickExpand: false,
showIcon: true,
},
check: {
enable: true,
chkboxType: { Y: "ps", N: "ps" },
},
callback: {},
};
/** 勾选变化后同步右侧已选列表:收集勾选节点子树内的所有叶子 */
function formatUser(treeNode: any, checked: boolean) {
const recursionCheckIds = (tree: any): any[] => {
let arrIds: any[] = [];
for (const key in tree) {
const element = tree[key];
if (element.type == 2 && !element.chkDisabled) {
arrIds.push({ id: element.id, tid: element.tId });
}
if (typeof element.children !== "undefined" && element.children) {
arrIds = [...arrIds, ...recursionCheckIds(element.children)];
}
}
return arrIds;
};
const checkIds = recursionCheckIds([treeNode]);
const checkUserList = _this.currentTreeFlatten.filter((x: any) =>
checkIds.map((x) => x.id).includes(x.id)
);
const checkUserArr: any[] = [];
for (const element of checkUserList) {
var findObj = checkIds.find((x) => x.id == element.id);
if (
!!findObj &&
checkUserArr.findIndex((x) => x.id == element.id) === -1 &&
_this.tempUserList.findIndex((x) => x.id == element.id) === -1
) {
checkUserArr.push({ ...element, isCheck: false, tid: findObj.tid });
}
}
if (checked) {
_this.tempUserList = _this.tempUserList.concat(checkUserArr);
} else {
var ids = checkUserList.map((x) => x.id);
_this.tempUserList = _this.tempUserList.filter((x) => !ids.includes(x.id));
}
}
treeSetting.callback.onClick = (event: any, treeId: string, treeNode: any) => {
let check = treeNode.checked;
let treeObj = ($.fn as any).zTree.getZTreeObj(treeId);
treeObj.checkNode(treeNode, !check, true);
formatUser(treeNode, treeNode.checked);
};
treeSetting.callback.onCheck = (event: any, treeId: string, treeNode: any) => {
formatUser(treeNode, treeNode.checked);
};
var treeObj = ($.fn as any).zTree.init($("#" + _this.ztreeDomId), treeSetting, ftree);
// 回显:已选用户打勾(callbackFlag=true 会触发 onCheck,同步右侧列表)
var nodes = treeObj.getNodesByFilter((x: any) =>
_this.userids.includes(_this.getSplitId(x.id))
);
var arr: any[] = [];
nodes.forEach((element: any) => {
var splitId = _this.getSplitId(element.id); //重复id只选择第一个
if (!arr.includes(splitId)) treeObj.checkNode(element, true, true, true);
if (_this.isDisabled) treeObj.setChkDisabled(element, true);
arr.push(splitId);
});
},
checkAllUser(check: boolean) {
this.tempUserList.forEach((element: any) => {
element.isCheck = check;
});
},
checkUserOne(item: any) {
item.isCheck = !item.isCheck;
const tlist = this.tempUserList;
this.isCheckUserAll =
tlist.length > 0 && tlist.filter((x) => x.isCheck).length == tlist.length;
},
delCheckUser() {
const _this = this;
const tlist = _this.tempUserList;
const delArr = tlist.filter((item: any) => item.isCheck);
var treeObj = ($.fn as any).zTree.getZTreeObj(_this.ztreeDomId);
delArr.forEach((element: any) => {
var node = treeObj.getNodeByTId(element.tid);
treeObj.checkNode(node, false, true, true);
});
_this.isCheckUserAll = false;
},
changeEmpty() {
this.tempUserList = [];
this.searchTreeName = "";
this.searchResult = [];
},
submit() {
const _this = this;
let idsArr = this.tempUserList.map((x: any) => _this.getSplitId(x.id));
idsArr = Array.from(new Set(idsArr));
this.$emit("update:userids", idsArr);
function delKey(obj: any, ...args: string[]) {
args.forEach((v) => delete obj[v]);
return obj;
}
const objArr: any[] = [];
idsArr.forEach((element) => {
let findObj = _this.tempUserList.find((x: any) => _this.getSplitId(x.id) == element);
findObj = delKey({ ...findObj }, "id", "isCheck", "tid", "pid", "type");
objArr.push({ ...findObj, id: element });
});
this.$emit("on-submit", objArr);
this.modal = false;
},
/** 树节点 id 形如 "1,301"(原id,父id),取真实 id */
getSplitId(strId: any) {
if (typeof strId === "string" && strId.indexOf(",") != -1) return parseInt(strId.split(",")[0]);
return strId;
},
},
};
</script>
<style lang="scss" scoped>
.tree-wrap {
height: 430px;
position: relative;
}
.tree-panel {
border: 1px solid #eee;
width: 280px;
height: 430px;
overflow: hidden;
}
.tree-box {
padding: 4px 0;
height: 428px;
width: auto;
overflow-y: auto;
border: none;
}
.user-panel {
border: 1px solid #eee;
width: 280px;
.title-box {
background: #f7f7f7;
height: 34px;
line-height: 34px;
padding: 0 12px;
a {
text-decoration: none;
float: right;
margin-right: 20px;
outline: none;
}
}
.user-box {
height: 396px;
overflow-y: auto;
li {
line-height: 32px;
padding-left: 12px;
cursor: pointer;
.info {
float: right;
margin-right: 12px;
font-size: 12px;
color: gray;
}
}
li:hover {
background: #f3f3f3;
}
li.active {
background: #e4edf6;
}
}
}
.arrow-box {
width: 128px;
text-align: center;
position: relative;
top: 50%;
margin-top: -17px;
}
.auto-box {
width: 200px;
margin-bottom: 10px;
:deep(.ivu-select-item .info) {
font-size: 12px;
color: gray;
position: relative;
top: 2px;
}
}
:deep(.ztree li) {
overflow: hidden;
}
:deep(.ztree li a) {
width: 100%;
}
:deep(.ztree li a:hover) {
text-decoration: none;
}
:deep(.ivu-auto-complete .ivu-select-dropdown-list) {
max-height: 310px;
overflow-y: auto;
}
</style>
+284
View File
@@ -0,0 +1,284 @@
<script setup lang="ts">
import { ref, onBeforeMount, watch, computed } from "vue";
import { useRoute, useRouter } from "vue-router";
import { Message } from "view-ui-plus";
import { resolveMenuPage } from "@/utils/menuRoute";
const props = defineProps<{ layoutData: Record<string, any> }>();
const route = useRoute();
const router = useRouter();
const isPanel = ref(false);
const currPath = ref<string>("");
const navPath = ref<any[]>([]);
const baseHost = computed(() => props.layoutData?.baseHost || "");
const ssoHost = computed(() => props.layoutData?.ssoHost || "");
const appName = computed(() => props.layoutData?.appName || "通知公告");
const appList = computed(() => props.layoutData?.appList || []);
const userInfo = computed(() => props.layoutData?.userInfo || { name: "管理员", avatar: "" });
const isAlone = computed(() => props.layoutData?.isAlone ?? false);
const modList = computed(() => props.layoutData?.modList || []);
const pathNavStyle = computed(() => (isAlone.value ? { left: "0", width: "100%" } : null));
onBeforeMount(() => {
routeChange(route);
});
watch(
() => route.fullPath,
() => routeChange(route)
);
const flaten = (tree: any[], pid = 0): any[] => {
const arr: any[] = [];
tree.forEach((element: any) => {
const { id, name, modId } = element;
// 平台配置的 path 格式不可控,统一解析为内部路由 path(名称/modId 兜底)
const resolved = resolveMenuPage(element.page, element.modId ?? element.id, element.name);
arr.push({ id, name, modId, page: resolved.path, external: resolved.external, pid });
if (element.children && element.children.length) {
arr.push(...flaten(element.children, id));
}
});
return arr;
};
const menuArr = computed(() => flaten(modList.value));
const routeChange = (to: any) => {
const meta: any = to.meta || {};
const { modId, title, parentId } = meta;
const navArr: any[] = [];
// 优先按 path 匹配菜单(平台模块 id 与路由 meta.modId 不保证一致),
// 匹配不到再退回 modId 对照
const find: any =
menuArr.value.find((x: any) => x.page && x.page === to.path) ||
menuArr.value.find((x: any) => x.modId === modId);
if (find) {
currPath.value = find.page || "";
if (find.pid) {
const pfind = menuArr.value.find((x: any) => x.id === find.pid);
if (pfind) navArr.push({ name: pfind.name });
}
navArr.push({ name: find.name || title, page: find.page });
navPath.value = navArr;
return;
}
if (parentId) {
const parent = menuArr.value.find((x: any) => x.modId === parentId);
if (parent) {
currPath.value = parent.page || "";
if (parent.pid) {
const gp = menuArr.value.find((x: any) => x.id === parent.pid);
if (gp) navArr.push({ name: gp.name });
}
navArr.push({ name: parent.name, page: parent.page });
navArr.push({ name: title });
navPath.value = navArr;
return;
}
}
const r = router.getRoutes().find((rt: any) => (rt.meta as any)?.modId === modId);
if (r) {
currPath.value = r.path;
navPath.value = [{ name: (r.meta as any).title, page: r.path }];
return;
}
currPath.value = "";
navPath.value = [];
};
const linkMenu = (item: any) => {
const page: string = item?.page || "";
if (!page) {
// 解析不出有效页面:显式提示,而不是静默不动或被重定向吞到默认页
Message.warning(`菜单「${item?.name || "未命名"}」未配置有效页面路径,请检查基础平台模块设置`);
return;
}
// 平台配置的外部链接模块:整页跳转
if (item?.external) {
window.location.href = page;
return;
}
if (page === route.path) {
router.go(0);
} else {
router.push(page);
}
};
const linkUserInfo = () => {
window.location.href = baseHost.value + "/v/userinfo";
};
const logout = () => {
let url = window.location.href;
url = "/logout?service=" + url;
window.location.href = ssoHost.value + url;
};
const childChange = (index: number) => {
const arr = modList.value || [];
if (arr[index]) {
arr[index].childState = !arr[index].childState;
}
};
/** 根据菜单项映射图标:优先按解析后的 page 判断(平台模块 id 不可依赖),
* 兜底保留旧版 modId 对照。图标为本地 bsch-icons(iconfont 掩码类,见 styles/icons.css) */
const getMenuIcon = (item?: any): string => {
const page: string = item?.page || "";
if (page === "/list/new") return "icon-xiugaijl";
if (page === "/list") return "icon-fasong";
if (page === "/" || page === "/accept") return "icon-sjx";
if (page === "/noticelist") return "icon-liebiao";
if (page === "/stats") return "icon-tongji";
if (page === "/setting") return "icon-shezhi";
switch (item?.modId ?? item?.id) {
case 1: return "icon-xiugaijl";
case 2: return "icon-fasong";
case 3: return "icon-sjx";
case 4: return "icon-liebiao";
case 5: return "icon-wenzhang";
case 21: return "icon-shezhi";
case 22: return "icon-xiugaijl";
default: return "";
}
};
function linkHomePage() {
if (baseHost.value) {
// 旧 BschHome 已下线(线上 404),首页统一指向用户中心 userhome
window.location.href = baseHost.value + "/userhome/front/index.html";
} else {
window.location.href = "/";
}
}
</script>
<template>
<div class="layout-wrap">
<header class="header-container fix">
<div class="fl align-middle icon-box">
<div title="首页" class="icon-btn" @click="linkHomePage">
<i class="iconfont icon-shouye"></i>
</div>
</div>
<div class="delimiter fl align-middle"></div>
<h4 class="fl align-middle">{{ appName }}</h4>
<div class="school-bg"></div>
<div class="header-aside fr">
<img :src="userInfo.avatar" class="fl align-middle" @click="linkUserInfo" />
<a class="name fl align-middle text-ellipsis" href="javascript:void(0);" @click="linkUserInfo">
{{ userInfo.name }}
</a>
<div class="delimiter fl align-middle"></div>
<a href="javascript:;" @click="logout" class="logout fl align-middle" title="退出登陆">
<i class="iconfont icon-logout"></i>
</a>
</div>
</header>
<div class="left-menu" v-if="!isAlone">
<div class="menu-top-box"></div>
<ul>
<template v-for="(item, index) in modList" :key="'menu_li_' + index">
<template v-if="item.children && item.children.length > 0">
<li>
<a href="javascript:;" @click="childChange(index)">
<i :class="item.childState ? 'arrow-down' : 'arrow-up'"></i>
<i v-if="getMenuIcon(item)" :class="['iconfont', getMenuIcon(item)]"></i>
{{ item.name }}
</a>
</li>
<transition name="fade_child_ul">
<div class="child-item-wrap" v-show="item.childState">
<li
:class="citem.page == currPath ? 'active child-item' : 'child-item'"
v-for="citem in item.children"
:key="citem.id"
>
<a href="javascript:;" @click="linkMenu(citem)">
{{ citem.name }}
</a>
</li>
</div>
</transition>
</template>
<li v-else :class="item.page == currPath ? 'active' : ''">
<a href="javascript:;" @click="linkMenu(item)">
<i v-if="getMenuIcon(item)" :class="['iconfont', getMenuIcon(item)]"></i>
{{ item.name }}
</a>
</li>
</template>
</ul>
<div class="clear-box"></div>
</div>
<div class="path-nav" :style="pathNavStyle">
<Breadcrumb separator=">">
<a href="javascript:;" @click="linkHomePage">
<BreadcrumbItem>
<span class="crumb-home">
<i class="iconfont icon-category"></i>
首页
</span>
</BreadcrumbItem>
</a>
<BreadcrumbItem v-if="!isAlone" to="/">{{ appName }}</BreadcrumbItem>
<template v-for="(item, index) in navPath" :key="index">
<BreadcrumbItem v-if="index != navPath.length - 1" :to="item.page">
{{ item.name }}
</BreadcrumbItem>
<BreadcrumbItem v-else>{{ item.name }}</BreadcrumbItem>
</template>
</Breadcrumb>
</div>
<transition name="fade_apps">
<div class="app-panel" v-if="isPanel">
<div class="tips-box"></div>
<ul class="fix">
<li class="fl" v-for="(item, index) in appList" :key="index">
<a :href="item.url" target="_blank" rel="noopener noreferrer">
<div class="icon-box">
<img :src="item.icon" alt="" />
</div>
<p class="text-ellipsis">{{ item.name }}</p>
</a>
</li>
</ul>
<div class="link-panel">
<a :href="baseHost + '/userhome/front/index.html#/apps'" target="_blank" rel="noopener noreferrer">
全部应用
<i>→</i>
</a>
</div>
</div>
</transition>
</div>
</template>
<style scoped>
/* 仅覆盖/补充必要的动态样式,其余样式由全局 layout.css 提供 */
/* 菜单图标(本地 bsch-icons 掩码类)与文字间距 */
.left-menu a .iconfont {
margin-right: 8px;
}
/* 面包屑「首页」垂直居中:layout.css 遗留的 .path-nav .icon-category{position:relative;top:1px}
是给老 iconfont 字体字形做的基线补偿,换成 ysch mask 的 1em 方块后反而把图标顶偏;
这里用 inline-flex 真居中并关掉该补偿(不动压缩产物 layout.css,覆盖收在本组件内) */
.crumb-home {
display: inline-flex;
align-items: center;
gap: 4px;
}
.crumb-home .iconfont {
position: static;
top: 0;
}
</style>
+149
View File
@@ -0,0 +1,149 @@
<template>
<div :id="domId" :ref="domId" class="ztree"></div>
</template>
<script>
export default {
props: {
treeData: {
type: Object
},
setting: {
type: Object,
default() {
return {
view: {
dblClickExpand: false,
showIcon: false
},
check: {
enable: false
},
callback: {}
};
}
},
autoClick: {
type: Boolean,
default: true,
},
},
data() {
return {
domId: ""
};
},
created() {
this.$watch("treeData", val => {
if (val) {
this.$nextTick(() => {
this.initTree(this.treeData, this.domId);
});
}
});
},
mounted() {
this.domId = this.uuid();
},
methods: {
uuid() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
},
reloadTree(nodeId) {
this.initTree(this.treeData, this.domId);
if (nodeId != null) {
this.$nextTick(() => {
this.selectNode(nodeId, true); // 第二个参数 true 会 emit on-tree-click
});
}
},
initTree(_data, _domId) {
const _this = this;
_this.setting.callback.onClick = (event, treeId, treeNode, clickFlag) => {
// console.log(event, treeId, treeNode, clickFlag);
_this.$emit("on-tree-click", treeNode);
};
_this.setting.callback.onExpand = (event, treeId, treeNode) => {
if (treeNode.isParent && !treeNode.children) {
_this.$emit("on-tree-expand", treeNode);//触发展开事件
}
};
_this.setting.callback.beforeClick = (treeId, treeNode, clickFlag) => {
return treeNode.click != false;
};
var zNodes = _this.openFistNode(_data);
$.fn.zTree.init($("#" + _domId), _this.setting, zNodes);
if (_this.autoClick) {
if (Array.isArray(this.treeData)) {
let id = this.treeData[0].id;
_this.selectNode(id);
} else {
let id = this.treeData.id;
_this.selectNode(id);
}
}
var treeObj = $.fn.zTree.getZTreeObj(_domId);
setTimeout(() => {
this.selectNode(0);
}, 0);
},
selectNode(id, isClick = true) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
if (node == null) return false;
treeObj.selectNode(node);
treeObj.expandNode(node, true, false, false);
treeObj.selectNode(node);
if (isClick) this.$emit("on-tree-click", node);
},
openFistNode(_zNodes) {
//展开一级节点
if (_zNodes && _zNodes.length > 0) {
for (var key in _zNodes) {
if (_zNodes.hasOwnProperty(key)) {
var element = _zNodes[key];
element.open = true;
}
}
} else {
_zNodes.open = true;
}
return _zNodes;
},
selectNode(id, isClick = true) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var node = treeObj.getNodesByFilter(node => node.id == id, true);
if (node == null) return false;
treeObj.selectNode(node);
treeObj.expandNode(node, true, false, false);
treeObj.selectNode(node);
if (isClick) this.$emit("on-tree-click", node);
},
addNode(pid, id, name, isParent) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
var pnode = treeObj.getNodesByFilter(node => node.id == pid, true);
var newNode = { pid, id, name, isParent };
treeObj.addNodes(pnode, -1, newNode);
},
addNodes(treeNode, children) {
const _domId = this.domId;
var treeObj = $.fn.zTree.getZTreeObj(_domId);
const parentZNode = treeObj.getNodeByParam("id", treeNode.id, null);
treeObj.addNodes(parentZNode, children, false);
}
}
};
</script>
<style></style>
+41
View File
@@ -0,0 +1,41 @@
import { createApp } from "vue";
import App from "./App.vue";
import router from "@/router";
import utils from "@/utils";
import { createPinia } from "pinia";
// @ts-ignore
import ViewUIPlus from "view-ui-plus";
import mittBus from "@/utils/mitt";
import "view-ui-plus/dist/styles/viewuiplus.css";
import "@/assets/styles/main.scss";
// 本地化的布局/主题样式(原远程 base.layout.beta / _iview_override / default-theme 合并)
import "@/assets/styles/layout.css";
// 规范 iconfont 图标本地实现(icon-browse / icon-edit / icon-ashbin 等,平台主题不含字体)
import "@/assets/styles/icons.css";
//导入自定义指令
import directive from "@/utils/directive/index";
import "virtual:uno.css";
const app = createApp(App);
app.use(createPinia());
app.use(router);
app.use(ViewUIPlus);
import config from "@/assets/config/host.config";
app.config.globalProperties.$conf = config;
app.config.globalProperties.$utils = utils;
app.config.globalProperties.$bus = mittBus;
// direct(app);
directive(app);
import "virtual:svg-icons-register";
app.mount("#app");
+9
View File
@@ -0,0 +1,9 @@
import { createRouter, createWebHashHistory } from "vue-router";
import routes from "./routes";
const router = createRouter({
history: createWebHashHistory(),
routes,
});
export default router;
+74
View File
@@ -0,0 +1,74 @@
import type { RouteRecordRaw } from "vue-router";
/**
* 办事大厅路由(V2.0 Part B.6)。
*
* modId 是菜单 ↔ 路由的稳定契约(UserBase app_module 按本应用 appKey 配置),
* 新 modId 提案(旧 CMS 21/22 随迁移退役):
* 23=办事事项 24=服务字典 25=表单管理 26=办件记录 27=我的办件
* 发起页 /apply 与详情 /apply-detail 为参数页,不挂菜单(parentId 仅作面包屑归属)。
*/
const routes: RouteRecordRaw[] = [
// 管理面:办事事项
{
path: "/svc/item",
name: "svc_item_list",
component: () => import("@/views/svc/ServiceItemList.vue"),
meta: { title: "办事事项", modId: 23 },
},
{
path: "/svc/item/edit",
name: "svc_item_edit",
component: () => import("@/views/svc/ServiceItemEdit.vue"),
meta: { title: "编辑事项", modId: 28, parentId: 23 },
},
// 管理面:服务字典
{
path: "/svc/dict",
name: "svc_dict",
component: () => import("@/views/svc/ServiceDictManage.vue"),
meta: { title: "服务字典", modId: 24 },
},
// 管理面:表单管理
{
path: "/svc/form",
name: "svc_form",
component: () => import("@/views/svc/ServiceFormManage.vue"),
meta: { title: "表单管理", modId: 25 },
},
// 管理面:办件记录
{
path: "/svc/apply",
name: "svc_apply_admin",
component: () => import("@/views/svc/ApplyManage.vue"),
meta: { title: "办件记录", modId: 26 },
},
// 用户面:我的办件
{
path: "/my",
name: "svc_apply_my",
component: () => import("@/views/svc/ApplyMy.vue"),
meta: { title: "我的办件", modId: 27 },
},
// 用户面:发起(CMS 指南页"我要办理"跳入:/#/apply?siteCode=&itemCode=)
{
path: "/apply",
name: "svc_apply",
component: () => import("@/views/svc/Apply.vue"),
meta: { title: "在线办理", parentId: 27 },
},
// 用户面:办件详情
{
path: "/apply-detail",
name: "svc_apply_detail",
component: () => import("@/views/svc/ApplyDetail.vue"),
meta: { title: "办件详情", parentId: 27 },
},
// 应用入口默认页(pcUrl 直达时落到我的办件)
{ path: "/", redirect: "/my" },
// 兜底:外部深链(bizUrl 等)若拼成路径参数形态(/#/apply-detail/12)会 no-match,
// catch-all 避免静默空白页(回落我的办件,用户可自行进详情)
{ path: "/:pathMatch(.*)*", redirect: "/my" },
];
export default routes;
+12
View File
@@ -0,0 +1,12 @@
import { defineStore } from "pinia";
export const useDefaultStore = defineStore("defaultStore", {
state: () => ({
userRole: "school" as string,
}),
actions: {
setUserRole(role: string) {
this.userRole = role;
},
},
});
+79
View File
@@ -0,0 +1,79 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
+214
View File
@@ -0,0 +1,214 @@
/**
* 办事大厅前端类型(对齐后端 SvcModels/OapiModels)。
*/
/** 学校组织树节点(BaseApi GetUserInfo/GetUserMod 通用形态) */
export interface SchoolTreeNode {
id?: number;
name?: string;
[key: string]: any;
}
// ===== 站点 =====
export interface SiteOption {
siteCode: string;
name: string;
schId: number;
}
// ===== 字典 =====
export interface SvcDictVo {
id: number;
siteCode: string;
dictType: "object" | "category";
dictKey: string;
dictName: string;
sortNo: number;
status: number;
referenced: number;
}
export interface SvcDictSaveRequest {
id?: number;
siteCode: string;
dictType: string;
dictKey: string;
dictName: string;
sortNo?: number;
status?: number;
}
export interface SvcDeptVo {
id: number;
name: string;
children: SvcDeptVo[];
}
// ===== 事项 =====
export interface SvcItemPageItem {
id: number;
siteCode: string;
itemCode: string;
title: string;
summary?: string;
objectKey?: string;
objectName?: string;
categoryKey?: string;
categoryName?: string;
deptGroupId?: number;
deptName?: string;
handleMode: number;
onlineFlag: number;
formCode?: string;
flowGuid?: string;
status: number;
sortNo: number;
publishTime?: string;
viewCount: number;
createTime?: string;
createBy?: string;
}
export interface SvcItemEditVo {
id?: number;
siteCode: string;
itemCode: string;
title?: string;
summary?: string;
objectKey?: string;
categoryKey?: string;
deptGroupId?: number;
deptName?: string;
handleMode?: number;
onlineFlag?: number;
handlePlace?: string;
handleTimeLimit?: string;
promiseTimeLimit?: string;
contactPhone?: string;
supervisePhone?: string;
processHtml?: string;
materialHtml?: string;
noticeHtml?: string;
faqCategoryId?: number;
noticeCategoryId?: number;
ruleCategoryId?: number;
coverImage?: string;
formCode?: string;
flowGuid?: string;
applyUrl?: string;
sortNo?: number;
status?: number;
viewCount?: number;
}
export interface SvcItemSaveRequest {
id?: number;
siteCode: string;
itemCode: string;
title: string;
summary?: string;
objectKey?: string;
categoryKey?: string;
deptGroupId?: number;
handleMode?: number;
onlineFlag?: number;
handlePlace?: string;
handleTimeLimit?: string;
promiseTimeLimit?: string;
contactPhone?: string;
supervisePhone?: string;
processHtml?: string;
materialHtml?: string;
noticeHtml?: string;
faqCategoryId?: number;
noticeCategoryId?: number;
ruleCategoryId?: number;
coverImage?: string;
formCode?: string;
flowGuid?: string;
applyUrl?: string;
sortNo?: number;
attachmentIds?: number[];
}
export interface SvcItemAttachmentVo {
id: number;
fileName: string;
fileUrl: string;
fileSize?: number;
}
// ===== 表单 =====
export interface SvcFormVo {
id: number;
code: string;
name: string;
version: number;
status: number;
schemaJson: string;
publishTime?: string;
referenced?: boolean;
}
export interface SvcFormSaveRequest {
id?: number;
code: string;
name: string;
schemaJson: string;
}
// ===== 办件 =====
export interface ApplyVo {
id: number;
siteCode: string;
itemId: number;
itemCode: string;
itemTitle: string;
itemSnapshotJson?: string;
formVersion?: number;
formDataJson?: string;
attachmentsJson?: string;
submitterId: number;
submitterName: string;
flowGuid?: string;
flowInstanceId?: number;
flowStatus: number;
flowResultJson?: string;
submitTime?: string;
finishTime?: string;
createTime?: string;
}
export interface ApplyAttachmentItem {
fieldKey?: string;
attachmentId: number;
}
export interface ApplySubmitRequest {
siteCode: string;
itemCode: string;
formData?: string;
attachments?: ApplyAttachmentItem[];
}
// ===== 流程(选择器) =====
export interface FlowSummary {
flowGuid: string;
name: string;
version: number;
nodeSummary?: string;
}
// ===== 通用 =====
export interface PageResult<T> {
total: number;
list?: T[];
items?: T[];
}
+156
View File
@@ -0,0 +1,156 @@
import { createAlova, Method, StatesHook } from "alova";
import fetchAdapter from "alova/fetch";
import VueHook from "alova/vue";
import Utils from "..";
/* ============= 类型定义 ============= */
export interface RequestHooks {
/** 前置票据/通用头注入 */
injectHeaders?: (method: Method) => void;
/** 加载开始 */
onLoadingStart?: () => void;
/** 加载结束 */
onLoadingEnd?: () => void;
/** 业务错误提示(code !== 0)*/
onBizError?: (msg: string) => void;
/** http 错误提示(status !== 200)*/
onHttpError?: (msg: string) => void;
}
/** 和后端约定的通用响应格式 */
export interface BschResponse<T = any> {
code: number;
msg?: string;
data: T;
urlToRedirectTo?: string;
}
/* ============= 默认空实现 ============= */
const defHooks: Required<RequestHooks> = {
injectHeaders: () => {},
onLoadingStart: () => {},
onLoadingEnd: () => {},
onBizError: () => {},
onHttpError: () => {},
};
/* ============= 错误处理(原 axios 逻辑平移) ============= */
function errorHandle<T>(res: BschResponse<T>, status: number): T {
// http 层错误
if (status !== 200) {
let msg = "网络错误";
switch (status) {
case 401:
case 403:
break;
case 404:
msg = "请求的资源不存在!";
break;
default:
msg = res?.msg || "内部服务错误!";
}
throw new Error(msg);
}
// 业务层错误
switch (res.code) {
case 0:
return res.data ?? (null as T);
case 302:
console.log(res);
// 后端 CasSsoApiRedirectFilter 已在 service 中拼好 ;redirectToReferer=<hex>,
// 直接跳转即可;登录后由 CasSsoRefererRedirectFilter 解码 302 回前端页。
// 跳转后返回永不 resolve 的挂起 Promise:调用方 await 悬停,
// 全局 onBizError 与各页面的 catch 均不再触发(不弹 redirect 报错)
window.location.href = res.urlToRedirectTo!;
return new Promise(() => {}) as T;
case 4:
throw new Error(res.msg || "参数错误!");
default:
throw new Error(res.msg || "业务错误");
}
}
/* ============= 工厂函数 ============= */
export function createBschAlova(
baseURL: string,
hooks: RequestHooks = {},
statesHook: StatesHook<any> = VueHook,
) {
const { injectHeaders, onLoadingStart, onLoadingEnd, onBizError, onHttpError } = {
...defHooks,
...hooks,
};
let reqCount = 0;
let timer: ReturnType<typeof setTimeout>;
/* ---- 请求拦截 ---- */
function beforeRequest(method: Method) {
reqCount++;
if (reqCount === 1) timer = setTimeout(() => onLoadingStart(), 800);
Promise.resolve().then(() => {
if (reqCount === 0) {
clearTimeout(timer);
onLoadingEnd();
}
});
// 1. 用户注入票据/角色等头
injectHeaders(method);
method.config.credentials = "include";
// 2. 通用头
method.config.headers = Object.assign(method.config.headers || {}, {
yschapirequest: "1",
timeout: 20000,
yschreferer: Utils.strToHexCharCode(window.location.href),
});
}
/* ---- 响应拦截 ---- */
async function onSuccess(response: Response) {
reqCount--;
if (reqCount === 0) {
clearTimeout(timer);
onLoadingEnd();
}
const res: BschResponse = await response.json();
try {
return errorHandle(res, response.status);
} catch (e: any) {
console.log(e);
onBizError(e.message);
return Promise.reject(e);
}
}
async function onError(err: any) {
reqCount = 0;
clearTimeout(timer);
onLoadingEnd();
const msg = err?.message || "网络请求出错";
onHttpError(msg);
return Promise.reject(err);
}
async function onComplete(method: Method) {
if (method.fromCache) {
reqCount--;
if (reqCount === 0) {
clearTimeout(timer);
onLoadingEnd();
}
}
}
return createAlova({
statesHook,
requestAdapter: fetchAdapter(),
baseURL,
cacheFor: null,
beforeRequest,
responded: { onSuccess, onError, onComplete },
});
}
+40
View File
@@ -0,0 +1,40 @@
// @/utils/alova-iview.ts
import { createBschAlova } from "./alova-core";
import { Message } from "view-ui-plus";
import conf from "@/assets/config/host.config";
/* 全局 loading 遮罩实例 */
let spinInstance: any = null;
/* 主动关闭 loading */
function closeLoading() {
if (spinInstance) {
Message.destroy();
spinInstance = null;
}
}
const baseUrl = conf.serviceHost;
/* 创建带 View Design UI 的 Alova 实例 */
export const alovaInstance = createBschAlova(baseUrl, {
injectHeaders(method) {
// currentRole: encodeURI(JSON.stringify({ userId, roleId, schId: schoolId })),
if (localStorage.getItem("currentRole") != null) {
method.config.headers["currentRole"] = localStorage.getItem("currentRole") as string;
}
},
/* 2. 加载动画 – View Design Spin */
onLoadingStart() {
spinInstance = Message.loading("加载中...");
},
onLoadingEnd: closeLoading,
onBizError(msg: string) {
if (!!msg) Message.error(msg);
},
onHttpError(msg: string) {
Message.error({ title: "网络错误", content: msg });
},
});
+54
View File
@@ -0,0 +1,54 @@
// @/utils/alova-vant.ts
import { createBschAlova } from "./alova-core";
import { Toast, Dialog, showFailToast, showDialog, showLoadingToast, closeToast } from "vant";
import conf from "@/assets/config/host.config";
import { useBschTicketStore } from "@/store/TicketStore";
import { WappUserHeader } from "@/types/Basics";
let toastLoading: ReturnType<typeof Toast.loading> | null = null;
/* 主动关闭 loading */
function closeLoading() {
if (toastLoading) {
toastLoading.close();
toastLoading = null;
} else {
closeToast();
}
}
// const baseUrl = conf.serviceHost + "/api";
const baseUrl = conf.serviceHost + "/mobiapi";
/* 创建带 Vant UI 的 Alova 实例 */
export const alovaInstance = createBschAlova(baseUrl, {
injectHeaders(method) {
const store = useBschTicketStore();
const authoHeaders = store.getAuthoHeaders;
const userHeaders = store.getTicket;
const bschTicket: WappUserHeader = store.getTicket;
for (const key in authoHeaders) method.config.headers[key] = authoHeaders[key];
for (const key in bschTicket) method.config.headers[key] = (bschTicket as any)[key];
// method.config.headers.currentRole = encodeURIComponent(
// JSON.stringify({ roleId: userHeaders.roleId, childId: userHeaders.userId, schId: userHeaders.schoolId }),
// );
},
/* 2. 加载动画 – Vant Toast */
onLoadingStart() {
toastLoading = showLoadingToast({
message: "加载中...",
forbidClick: true,
duration: 0,
});
},
onLoadingEnd: closeLoading,
onBizError(msg) {
showFailToast(msg);
},
onHttpError(msg) {
showDialog({ title: "网络错误", message: msg });
},
});
+90
View File
@@ -0,0 +1,90 @@
import { BschResponse, AxiosResponse } from "axios";
import axios from "axios";
import { initAxiosInstance } from "./interceptor";
import { baseConfig } from "@/assets/config/api.config";
export interface BschResult {
url: string;
params?: object;
data?: object;
isMsg?: boolean; //是否自动显示错误提示
}
class Abstract {
private apiAxios<T>({ method, url, params, data, isMsg = true }: any): Promise<T> {
const instance = initAxiosInstance(baseConfig);
return new Promise((resolve, reject) => {
instance({
method,
url,
params,
data,
})
.then((res: AxiosResponse<BschResponse, number>) => {
// console.log(res);
let { data } = res;
resolve(data as T);
})
.catch(err => {
console.error(err);
reject(err);
// throw err;
});
});
}
/**
*GET类型的网络请求
*
* @protected
* @template T
* @param {BschResult} { url, params }
* @returns {Promise<T>}
* @memberof Abstract
*/
protected getRequest<T>({ url, params, isMsg = true }: BschResult): Promise<T> {
return this.apiAxios<T>({ method: "GET", url, params, isMsg });
}
/**
*POST类型的网络请求
*
* @protected
* @template T
* @param {BschResult} { url, data }
* @returns {Promise<T>}
* @memberof Abstract
*/
protected postRequest<T>({ url, params, data, isMsg = true }: BschResult): Promise<T> {
return this.apiAxios<T>({ method: "POST", url, params, data, isMsg });
}
/**
*PUT类型的网络请求
*
* @protected
* @template T
* @param {BschResult} { url, data }
* @returns {Promise<T>}
* @memberof Abstract
*/
protected putRequest<T>({ url, params, data, isMsg = true }: BschResult): Promise<T> {
return this.apiAxios<T>({ method: "PUT", url, params, data, isMsg });
}
/**
*DELETE类型的网络请求
*
* @protected
* @template T
* @param {BschResult} { url, params }
* @returns {Promise<T>}
* @memberof Abstract
*/
protected deleteRequest<T>({ url, params, data, isMsg = true }: BschResult): Promise<T> {
return this.apiAxios<T>({ method: "DELETE", url, params, data, isMsg });
}
}
export default Abstract;
+61
View File
@@ -0,0 +1,61 @@
import { AxiosResponse, BschResponse } from "axios";
function formrHandle(response: AxiosResponse) {
let errorMsg: string = "";
let { data, status } = response;
if (status == 200) {
switch (data.code) {
case 0:
return data;
case 4:
errorMsg = data.msg;
break;
case 302:
errorMsg = "redirect";
window.location.href = data.urlToRedirectTo;
break;
// errorMsg = "redirect";
default:
errorMsg = data.msg;
}
} else {
switch (status) {
case 401:
break;
case 403:
break;
case 404:
errorMsg = "请求的资源不存在!";
default:
break;
}
if (!errorMsg) errorMsg = typeof data.code == "undefined" ? "内部服务错误!" : data.msg;
}
throw errorMsg;
}
function formrHandle2(response: AxiosResponse<BschResponse, number>) {
let errorMsg: string = "";
let { data, status } = response;
if (status == 200) {
if (!!data.State) return response;
else errorMsg = data.Message || JSON.stringify(data.Data);
} else {
switch (status) {
case 401:
errorMsg = "您的登录已过期!";
break;
case 403:
break;
case 404:
errorMsg = "请求的资源不存在!";
break;
default:
break;
}
if (!errorMsg) errorMsg = typeof data.State == "undefined" ? "内部服务错误!" : data.Message;
}
throw errorMsg;
}
export default formrHandle;
+39
View File
@@ -0,0 +1,39 @@
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosRequestHeaders } from "axios";
import formrHandle from "./format-handle";
import { debugUser } from "@/assets/config/api.config";
import conf from "@/assets/config/host.config";
export const initAxiosInstance: (config: AxiosRequestConfig) => AxiosInstance = config => {
let axiosInstance: AxiosInstance = axios.create(config);
axiosInstance.interceptors.request.use((config: AxiosRequestConfig) => {
// if (config.params && typeof config.params != "string") config.params = utils.filterNull(config.params);
if (localStorage.getItem("currentRole") != null) {
(config.headers as AxiosRequestHeaders)["currentRole"] = localStorage.getItem("currentRole") as string;
}
//@ts-ignore
const bschUtil = BschLoadUtil.getInstance();
if (!bschUtil.getIsSelf()) {
(config.headers as AxiosRequestHeaders)["ticket"] = sessionStorage.getItem("bschTicket") as string;
(config.headers as AxiosRequestHeaders)["platform"] = "grzx";
}
if (!!conf.isDebug) {
//如果是开发环境
for (const key in debugUser) (config.headers as AxiosRequestHeaders)[key] = (debugUser as any)[key];
// (config.headers as AxiosRequestHeaders)["yschapirequest"] = "1";
}
return config;
});
axiosInstance.interceptors.response.use(
response => {
return formrHandle(response);
},
error => {
return formrHandle(error.response);
}
);
return axiosInstance;
};
+26
View File
@@ -0,0 +1,26 @@
import * as axios from "axios";
declare module "axios" {
// 定制业务相关的网络请求响应格式, T 是具体的接口返回类型数据
// export interface BschResponse<T> {
// code: number;
// msg?: string;
// data?: T;
// [keys: string]: any; //任意属性
// }
export interface BschResponse {
State: boolean;
Data: any;
Message: string;
OtherData: any;
Page: any;
[keys: string]: any; //任意属性
}
export interface BschResult {
url: string;
params?: object;
data?: object;
}
}
+30
View File
@@ -0,0 +1,30 @@
import Utils from "./index";
export function replaceOriginUrl(urlToRedirectTo: string, baseRedirectHost: string) {
var newUrl = Utils.strToHexCharCode(window.location.href);
// newUrl = hexHrefToString("https://base.bestsch.com/BschHome/base/index.html#/lightapp?id=1&name=2");
// newUrl = Utils.strToHexCharCode("https://base.bestsch.com/BschHome/base/index.html#/lightapp?id=1&name=2");
var ssoUrlObj = new URL(urlToRedirectTo);
var paramsStr = ssoUrlObj.searchParams.get("service") || "";
let ssoServiceUrl = decodeURI(paramsStr).split(";")[0];
ssoServiceUrl += ";redirectToReferer=" + baseRedirectHost + "/api/base/RedirectTo/" + newUrl;
ssoUrlObj.searchParams.set("service", encodeURI(ssoServiceUrl));
return ssoUrlObj.href;
}
export function hexStringToHref(urlHexStr: string, paramsKey: string = "hex") {
let urlObj = new URL(urlHexStr);
let hexStr = urlObj.searchParams.get(paramsKey) || "";
urlObj.hash = Utils.hexToString(hexStr);
urlObj.searchParams.delete(paramsKey);
return urlObj.href;
}
export function hexHrefToString(hrefStr: string, paramsKey: string = "hex") {
var urlObj = new URL(hrefStr);
var hasHexStr = Utils.strToHexCharCode(urlObj.hash);
const newUrlObj = new URL(urlObj.origin);
newUrlObj.pathname = urlObj.pathname;
// newUrlObj.searchParams.set(paramsKey, hasHexStr);
return newUrlObj.href + hasHexStr;
}
+19
View File
@@ -0,0 +1,19 @@
import { App } from "vue";
import realImg from "./real-img";
// 自动导入当前文件夹下的所有自定义指令(默认导出项)
export default (app: App<Element>) => {
realImg(app);
};
// const modules = import.meta.glob("../directive/**/**.ts");
// for (const path in modules) {
// // 排除当前文件
// if (path !== "../directive/index.ts") {
// modules[path]().then(mod => {
// mod.default(app);
// });
// }
// }
+41
View File
@@ -0,0 +1,41 @@
import type { App } from "vue";
export default (app: App<Element>): void => {
app.directive("real-img", {
async mounted(el, binding, vnode: any) {
console.log(el);
if (el.getAttribute("data-load") == null) el.classList.add("img-hide");
let imgURL = binding.value; //获取图片地址
if (imgURL) {
let exist = await imageIsExist(imgURL);
if (exist) {
el.setAttribute("src", imgURL);
el.setAttribute("data-load", "1");
}
}
el.classList.remove("img-hide");
},
});
};
/**
* 检测图片是否存在
* @param url
*/
let imageIsExist = function (url: string) {
return new Promise(resolve => {
var img: HTMLImageElement | null = new Image();
img.onload = function () {
if ((this as any).complete == true) {
resolve(true);
img = null;
}
};
img.onerror = function () {
resolve(false);
img = null;
};
img.src = url;
});
};
+4
View File
@@ -0,0 +1,4 @@
import { ref } from "vue";
export function useCompRef<T extends abstract new (...args: any) => any>(_comp: T) {
return ref<InstanceType<T>>();
}
+7
View File
@@ -0,0 +1,7 @@
import { VueGlobal } from "@/types/Basics";
import { ComponentInternalInstance, getCurrentInstance } from "vue";
export default function useCurrentInstance(): VueGlobal {
const { appContext } = getCurrentInstance() as ComponentInternalInstance;
const proxy = appContext.config.globalProperties;
return proxy as unknown as VueGlobal;
}
+5
View File
@@ -0,0 +1,5 @@
type PathType = "image" | "icons";
export const requireImg = (imgPath: string, basePath?: PathType) => {
basePath = basePath || "image";
return new URL(`../../assets/${basePath}/${imgPath}`, import.meta.url).href;
};
+37
View File
@@ -0,0 +1,37 @@
import { ref, watch, type Ref } from "vue";
/**
* 将任意响应式数据与 sessionStorage 双向绑定
* @param key sessionStorage 的 key
* @param def 默认值(当 sessionStorage 没有时)
* @param reviver 可选:解析时用 JSON.parse 的第二个参数
* @returns Ref<T>
*/
export function useSessionStorage<T>(
key: string,
def: T,
reviver?: (this: any, key: string, value: any) => any,
): Ref<T> {
/* ---------- 初始化 ---------- */
const raw = sessionStorage.getItem(key);
let init: T = def;
if (raw) {
try {
init = JSON.parse(raw, reviver);
} catch {
/* 解析失败回退默认值 */
}
}
const state = ref<T>(init) as Ref<T>;
/* ---------- 变化时落盘 ---------- */
watch(
state,
newVal => {
sessionStorage.setItem(key, JSON.stringify(newVal));
},
{ deep: true, flush: "post" },
);
return state;
}
+347
View File
@@ -0,0 +1,347 @@
import { IObj, UseTableSetting } from "@/types/Basics";
import { resolveComponent } from "vue";
export default class Utils {
/**
* 格式化日期
*
* @param {(Date | string)} 日期
* @param {string} fmt 格式化字符串
* @returns {string} 日期字符串
* @memberof Utils
*/
public static dateFormat(date: Date | string, fmt: string): string {
if (typeof date === "string") date = date.replace(/\-/g, "/");
let dt = new Date(date);
let o: IObj = {
"M+": dt.getMonth() + 1, //月份
"d+": dt.getDate(), //日
"H+": dt.getHours(), //小时
"m+": dt.getMinutes(), //分
"s+": dt.getSeconds(), //秒
"q+": Math.floor((dt.getMonth() + 3) / 3), //季度
S: dt.getMilliseconds(), //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (dt.getFullYear() + "").substr(4 - RegExp.$1.length));
for (let k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
return fmt;
}
/**
* 获取地址栏指定参数
*/
public static getUrlParam(name: string): string | null {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
let r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
else return null;
}
/**
* 生成uuid
*/
public static uuid(): string {
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
let r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
/**
* 返回文件大小
*/
public static getFileSize(size: number): string {
if (!size) return "";
if (size / 1024 < 1024) {
size = Math.ceil(size / 1024);
return size + "KB";
} else if (size / (1024 * 1024) < 1024) {
size = Math.ceil((size / (1024 * 1024)) * 100) / 100;
return size + "MB";
} else if (size / (1024 * 1024 * 1024) < 1024) {
size = Math.ceil((size / (1024 * 1024 * 1024)) * 100) / 100;
return size + "GB";
} else return "";
}
/**
* 删除指定键
*/
public static delKey(obj: IObj, ...args: string[]) {
args.forEach(v => delete obj[v]);
return obj;
}
/**
* iview Tooltip封装
*/
public static operatingHandle(
h: any,
info: string,
iconClass: string,
callback: Function,
disabled: boolean = false,
) {
if (disabled) iconClass += " disabled";
return h(
resolveComponent("Tooltip"),
{
content: info,
placement: "bottom",
transfer: true,
},
{
default: () => [
h(
"div",
{
class: `operating-btn iconfont ${iconClass}`,
onClick: callback,
},
null,
),
],
},
);
}
public static operatingTextHandle(
h: any,
info: string,
className: string,
callback: Function,
disabled: boolean = false,
) {
if (disabled) className += " disabled";
return h(
"div",
{
class: `operating-link ${className}`,
onClick: disabled ? null : callback,
},
info,
);
}
/**
* 计算表格高度
*/
public static useTableHeight({
isSearch = false,
isPage = false,
isTabs = false,
isOperat = false,
otherH = 0,
} = {}) {
let bodyH = document.body.clientHeight,
headerH = 112,
searchH = 52,
operatH = 48,
tabsH = 56,
pageH = 72,
paddingH = 8;
try {
//@ts-ignore 平台注入的全局对象,独立运行时不存在
const bschUtil = BschLoadUtil.getInstance();
if (!bschUtil.getIsSelf()) headerH = 56;
} catch (e) {
/* 独立运行:保留自身 header(56) + 面包屑(56) = 112 */
}
let tableH = bodyH - headerH - paddingH;
isOperat && (tableH -= operatH);
isTabs && (tableH -= tabsH);
isSearch && (tableH -= searchH);
isPage && (tableH -= pageH);
otherH > 0 && (tableH -= otherH);
return tableH;
}
/**
* 数字转大写汉字
* @param num
* @returns
*/
public static convertToChinaNum(num: number) {
var arr1 = new Array("零", "一", "二", "三", "四", "五", "六", "七", "八", "九");
var arr2 = new Array(
"",
"十",
"百",
"千",
"万",
"十",
"百",
"千",
"亿",
"十",
"百",
"千",
"万",
"十",
"百",
"千",
"亿",
); //可继续追加更高位转换值
if (!num || isNaN(num)) {
return "零";
}
var english = num.toString().split("");
var result = "";
for (var i = 0; i < english.length; i++) {
var des_i = english.length - 1 - i; //倒序排列设值
result = arr2[i] + result;
var arr1_index: any = english[des_i];
result = arr1[arr1_index] + result;
}
//将【零千、零百】换成【零】 【十零】换成【十】
result = result.replace(/零(千|百|十)/g, "零").replace(/十零/g, "十");
//合并中间多个零为一个零
result = result.replace(/零+/g, "零");
//将【零亿】换成【亿】【零万】换成【万】
result = result.replace(/零亿/g, "亿").replace(/零万/g, "万");
//将【亿万】换成【亿】
result = result.replace(/亿万/g, "亿");
//移除末尾的零
result = result.replace(/零+$/, "");
//将【零一十】换成【零十】
//result = result.replace(/零一十/g, '零十');//貌似正规读法是零一十
//将【一十】换成【十】
result = result.replace(/^一十/g, "十");
return result;
}
/**
* 对象转url参数
* @param num
* @returns
*/
public static createUrl(url: string, query: any) {
var temp: any[] = [];
for (var k in query) {
if (query[k] != null) temp.push(k + "=" + query[k]);
}
return url + "?" + temp.join("&");
}
/**
* 获取当前角色信息
* @returns
*/
public static getCurrentRoleInfo<T>() {
let currentRole = localStorage.getItem("currentRole");
if (!currentRole) return null;
let { schId, roleId, childId, userId } = JSON.parse(decodeURI(currentRole ?? ""));
return { schId, roleId, childId, userId } as T;
}
/**
* tree对象转化为数组
* @param tree
* @returns
*/
public static treeToArray(tree: any[]): any[] {
return tree.reduce((res, item) => {
const { children, ...i } = item;
return res.concat(i, children && children.length ? this.treeToArray(children) : []);
}, []);
}
/**
* 数组转化为tree对象
* @param tree
* @returns
*/
public static arrayToTree(arr: any[], pid: number): any[] {
return arr
.filter(item => item.pid === pid)
.map(item => ({ ...item, children: this.arrayToTree(arr, item.id) }));
}
//字符串的16进制表达
public static strToHexCharCode(_str: string) {
if (_str === "") return "";
var hexCharCode: string[] = [];
for (var i = 0; i < _str.length; i++) {
var str = _str.charCodeAt(i).toString(16);
if (_str.length == 1) str += "0" + _str;
hexCharCode.push(str);
}
return hexCharCode.join("");
}
public static hexToString(hex: string) {
if (hex === "") return "";
// 处理奇数长度,补前导零
if (hex.length % 2 !== 0) {
hex = "0" + hex;
[[3]];
}
let str = "";
for (let i = 0; i < hex.length; i += 2) {
// 每两位解析为一个字符的Unicode值
const hexPair = hex.substr(i, 2);
const charCode = parseInt(hexPair, 16);
str += String.fromCharCode(charCode);
[[14, 16]];
}
return str;
}
/**
* 将颜色值HEX格式转换为rgb的格式
* @param {hex} hex 需要转换的rgb字符串
* @param {number} opacity 透明度
* @return {string} ;
*/
public static hexToRgb(hex: string, opacity: number = 1) {
let str = hex.replace("#", "");
if (str.length % 3) {
return "hex格式不正确!";
}
//获取截取的字符长度
let count = str.length / 3;
//根据字符串的长度判断是否需要 进行幂次方
let power = 6 / str.length;
let r = parseInt("0x" + str.substring(0 * count, 1 * count)) ** power;
let g = parseInt("0x" + str.substring(1 * count, 2 * count)) ** power;
let b = parseInt("0x" + str.substring(2 * count)) ** power;
return `rgb(${r}, ${g}, ${b},${opacity})`;
}
public static removeHtmlTag(str: string) {
str = str.replace(/<\/?[^>]*>/g, ""); //去除HTML tag
str = str.replace(/[ | ]*\n/g, "\n"); //去除行尾空白
str = str.replace(/\n[\s| | ]*\r/g, "\n"); //去除多余空行
str = str.replace(/ /gi, ""); //去掉
return str;
}
public static unpackPerms = (bits: number) => [
!!(bits & 1), // create
!!(bits & 2), // update
!!(bits & 4), // move
!!(bits & 8), // delete
];
public static copyToClipboard(text: string) {
const input = document.createElement("input");
input.setAttribute("value", text);
document.body.appendChild(input);
input.select();
try {
const successful = document.execCommand("copy");
if (successful) {
return Promise.resolve();
} else {
return Promise.reject();
}
} catch (err) {
return Promise.reject(err);
} finally {
document.body.removeChild(input);
}
}
}
+163
View File
@@ -0,0 +1,163 @@
import routes from "@/router/routes";
/**
* 平台模块配置 → 前端内部路由的统一解析器。
*
* 基础平台里配置的模块 path 格式不可控(可能带 /notice 旧前缀、带
* index.html#/hash、是应用入口地址甚至完整 URL、或干脆配错),直接
* router.push(item.page) 匹配不到就会白屏或被重定向兜到默认页。所有消费
* 模块 page 的地方(侧边栏跳转/高亮、登录后默认跳转)必须先经过这里。
*
* 解析顺序:路径精确匹配 → 模块名匹配 → 外链判定 → modId 契约匹配。
* 全部落空时返回空结果并 console.warn,绝不返回未注册的原始路径——
* 把它 push 给路由器会被 / 重定向吞掉,表象就是"点了菜单跳到默认页"。
*/
/** 路由 path 集合:重定向路由穿透到目标 path,保证解析结果可直接用于高亮对照 */
const ROUTE_PATHS = routes
.map((r) => (typeof r.redirect === "string" ? r.redirect : r.path))
.filter((p): p is string => !!p && !p.includes(":"));
/** modId → 路由 path(取该 modId 的第一个非重定向路由) */
const ROUTE_BY_MODID = new Map<number, string>();
for (const r of routes) {
const modId = (r.meta as any)?.modId as number | undefined;
if (!modId || !r.path || r.path.includes(":") || r.redirect) continue;
if (!ROUTE_BY_MODID.has(modId)) ROUTE_BY_MODID.set(modId, r.path);
}
/** 标题 → 路由 path(重复标题取先注册的,如 发通知 → /list/new) */
const ROUTE_BY_TITLE = new Map<string, string>();
for (const r of routes) {
if (r.redirect || !r.path || r.path.includes(":")) continue;
const title = (r.meta as any)?.title as string | undefined;
if (title && !ROUTE_BY_TITLE.has(title)) ROUTE_BY_TITLE.set(title, r.path);
}
/** 平台历史模块名 → 路由(旧菜单叫法与现页面标题不一致的对照) */
const NAME_ALIASES: Record<string, string> = {
通知发送: "/list/new",
发通知: "/list/new",
已发通知: "/list",
已收通知: "/accept",
通知列表: "/noticelist",
统计分析: "/stats",
};
const EXTERNAL_RE = /^(https?:)?\/\//i;
/** 从平台原始配置里提取内部路由候选串(去掉 hash、query、尾斜杠) */
function extractCandidate(raw: string): string {
let p = raw.trim();
try {
p = decodeURIComponent(p);
} catch {
/* 含非法编码时保持原样 */
}
// 带 hash 的地址(.../index.html#/setting):取 # 后的 SPA 路由
const hashIdx = p.indexOf("#");
if (hashIdx >= 0) {
p = p.slice(hashIdx + 1);
} else if (EXTERNAL_RE.test(p)) {
// 无 hash 的完整 URL:取 pathname(如 https://host/setting)
try {
p = new URL(p, "http://placeholder.local").pathname;
} catch {
/* 保持原样 */
}
}
const qIdx = p.indexOf("?");
if (qIdx >= 0) p = p.slice(0, qIdx);
// 入口文件名去掉后即可命中根重定向路由
p = p.replace(/index\.html?$/i, "");
p = p.replace(/\/+$/, "");
if (p && !p.startsWith("/")) p = "/" + p;
return p;
}
/** 候选串 → 已注册路由 path;未命中返回 null */
function matchRoute(candidate: string): string | null {
if (!candidate) return null;
const lower = candidate.toLowerCase();
// 1. 精确匹配(含重定向穿透后的目标路径)
const exact = ROUTE_PATHS.find((p) => p.toLowerCase() === lower);
if (exact) return exact;
// 2. 兼容旧 /notice 前缀(/notice/setting → /setting)。
// 不做通用后缀匹配,避免 /stats/OA/Notice 这类外部路径被误匹配
if (lower.startsWith("/notice/")) {
const stripped = lower.slice("/notice".length);
return ROUTE_PATHS.find((p) => p.toLowerCase() === stripped) ?? null;
}
return null;
}
/** 按模块名解析路由:精确标题 → 历史别名 → 双向包含(命中多个则放弃) */
function matchByName(name?: string | null): string | null {
const n = String(name ?? "").trim();
if (!n) return null;
const byTitle = ROUTE_BY_TITLE.get(n);
if (byTitle) return byTitle;
const alias = NAME_ALIASES[n];
if (alias) return alias;
const hits = [...ROUTE_BY_TITLE.entries()].filter(
([title]) => title.length >= 2 && (n.includes(title) || title.includes(n))
);
return hits.length === 1 ? hits[0][1] : null;
}
/** 是否为本应用入口类地址(/、/notice、…/index.html):只表示"打开应用",
* 不携带页面信息,不能当作有效跳转目标 */
function isAppEntryCandidate(candidate: string): boolean {
return !candidate || candidate === "/" || candidate === "/notice";
}
export interface ResolvedMenuPage {
/** 内部路由 path;解析不出时为空串 */
path: string;
/** 外部链接(完整 URL 且不属于本应用路由),需整页跳转而非 router.push */
external: boolean;
}
/** 空配置的统一返回值 */
export const EMPTY_MENU_PAGE: ResolvedMenuPage = { path: "", external: false };
export function resolveMenuPage(
page?: string | null,
modId?: number | null,
name?: string | null
): ResolvedMenuPage {
const raw = String(page ?? "").trim();
const byName = (): string | null => matchByName(name);
const byModId = (): string | null => (modId != null ? ROUTE_BY_MODID.get(modId) ?? null : null);
if (raw) {
const candidate = extractCandidate(raw);
const byPath = matchRoute(candidate);
if (byPath) return { path: byPath, external: false };
// 完整 URL:指向本应用入口的不算有效配置(继续用名字/modId 识别),
// 其余按外部链接整页打开
if (EXTERNAL_RE.test(raw) && !raw.includes("#")) {
if (!isAppEntryCandidate(candidate)) {
return { path: raw, external: true };
}
}
const fallback = byName() ?? byModId();
if (fallback) return { path: fallback, external: false };
console.warn(
"[menuRoute] 模块路径/名称/modId 均无法匹配前端路由,请检查基础平台模块配置:",
raw,
"modId =", modId,
"name =", name
);
return EMPTY_MENU_PAGE;
}
// 未配置 path:按模块名 → modId 契约解析
const fallback = byName() ?? byModId();
if (fallback) return { path: fallback, external: false };
console.warn("[menuRoute] 模块未配置路径且名称/modId 无法识别:", name, "modId =", modId);
return EMPTY_MENU_PAGE;
}
+15
View File
@@ -0,0 +1,15 @@
// import { BschIframeType, LightAppModal, IframePageParmas, RoleInfo, StateEnum } from "@/types";
import mitt, { Emitter } from "mitt";
type MittType<T = any> = {
reload: void; //刷新页面
setMenuPath: number; //选择左侧菜单
resetMenuPath: any[]; //重置设置左侧菜单
setNavPath: any[]; //设置面包屑
resetLayout: { identity: number; modId: number }; //重置页面菜单
};
// 类型
const emitter: Emitter<MittType> = mitt<MittType>();
// 导出
export default emitter;
+50
View File
@@ -0,0 +1,50 @@
/**
* NodeId 解码工具
*/
const ROOT_BITS = 4,
TYPE_BITS = 4,
SUBJ_BITS = 20,
STAGE_BITS = 4,
GRADE_BITS = 4,
NODE_BITS = 28;
const ROOT_MASK = mask(ROOT_BITS),
TYPE_MASK = mask(TYPE_BITS),
SUBJ_MASK = mask(SUBJ_BITS),
STAGE_MASK = mask(STAGE_BITS),
GRADE_MASK = mask(GRADE_BITS),
NODE_MASK = mask(NODE_BITS);
function mask(bits: number) {
return (1n << BigInt(bits)) - 1n;
}
function intToSubject(n: number) {
if (n === 0) return null;
return n <= 6 ? `SUB0${n}` : `SUB${n}`;
}
/**
* 解码入口:long → 普通对象
* @param {string|number} compositeId 后端传来的 long 字符串或数字
* @returns {Object}
*/
export function decodeNodeId(compositeId: number | string) {
const id = BigInt(compositeId);
const root = Number((id >> BigInt(TYPE_BITS + SUBJ_BITS + STAGE_BITS + GRADE_BITS + NODE_BITS)) & ROOT_MASK);
const type = Number((id >> BigInt(SUBJ_BITS + STAGE_BITS + GRADE_BITS + NODE_BITS)) & TYPE_MASK);
const subNum = Number((id >> BigInt(STAGE_BITS + GRADE_BITS + NODE_BITS)) & SUBJ_MASK);
const stage = Number((id >> BigInt(GRADE_BITS + NODE_BITS)) & STAGE_MASK);
const grade = Number((id >> BigInt(NODE_BITS)) & GRADE_MASK);
const nodeId = Number(id & NODE_MASK);
return {
rootType: root === 0 ? null : root,
nodeType: type === 0 ? null : type,
subject: intToSubject(subNum),
stage: stage === 0 ? null : stage,
grade: grade === 0 ? null : grade,
nodeId: nodeId === 0 ? null : nodeId,
};
}

Some files were not shown because too many files have changed in this diff Show More