import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_setup_true_lang.DN-P1Gi6.js"; import { C as ElAvatar, r as ElText, T as ElCard, V as ElCol, u as ElEmpty, U as ElRow, a3 as ElDescriptions, a4 as ElDescriptionsItem, t as ElLink, l as ElTooltip, _ as ElTimeline, $ as ElTimelineItem, q as ElTag, h as ElButton, i as ElIcon, a8 as circle_close_default, a9 as question_filled_default, aa as delete_default, E as ElMessage, D as ElMessageBox } from "./element-plus.CkEW9frc.js"; import { J as defineComponent, e9 as useI18n, dY as useRouter, r as ref, t as onMounted, ah as onUnmounted, S as openBlock, _ as createElementBlock, a1 as createBaseVNode, $ as createVNode, a0 as withCtx, aa as toDisplayString, o as unref, a9 as createTextVNode, T as createBlock, H as Fragment, ay as renderList, a8 as createCommentVNode, a7 as resolveDynamicComponent, a2 as normalizeStyle, a3 as normalizeClass, aw as withModifiers, ak as reactive } from "./.pnpm.BW3P1y8f.js"; import { f as useUserStore, N as NoticeAPI } from "./index.CMd5bD1r.js"; import { g as greetings } from "./common.ySZAMJjg.js"; import { q as quickStartManager } from "./quickStartManager.Dn9BdP3l.js"; import { _ as _export_sfc } from "./_plugin-vue_export-helper.1tPrXgE0.js"; import "./echarts.Cg_Ec8L-.js"; import "./codemirror.CvJAcn2d.js"; const _hoisted_1 = { class: "app-container" }; const _hoisted_2 = { class: "flex flex-wrap justify-between items-center" }; const _hoisted_3 = { class: "flex items-center md:mb-0" }; const _hoisted_4 = { class: "text-20px font-bold" }; const _hoisted_5 = { class: "statItem text-14px text-gray-600 text-right" }; const _hoisted_6 = { class: "mt-5px text-20px" }; const _hoisted_7 = { class: "mt-4" }; const _hoisted_8 = { class: "flex items-center" }; const _hoisted_9 = { class: "flex justify-between items-center" }; const _hoisted_10 = { class: "flex justify-between items-center" }; const _hoisted_11 = { class: "bg-[var(--el-fill-color-light)] rounded-lg p-4 border border-[var(--el-border-color)] hover:shadow-md transition-shadow" }; const _hoisted_12 = { class: "flex justify-between items-start mb-2" }; const _hoisted_13 = { class: "flex items-center gap-2" }; const _hoisted_14 = { class: "font-medium text-[var(--el-text-color-primary)]" }; const _hoisted_15 = { class: "text-xs text-[var(--el-text-color-regular)]" }; const _hoisted_16 = { class: "text-sm text-[var(--el-text-color-regular)] mb-3 line-clamp-2" }; const _hoisted_17 = { class: "flex justify-between items-center text-xs" }; const _hoisted_18 = { class: "text-[var(--el-text-color-regular)]" }; const _hoisted_19 = { class: "text-sm truncate text-[var(--el-text-color-regular)]" }; const _hoisted_20 = { class: "flex justify-between items-center" }; const _hoisted_21 = { class: "flex items-center gap-2" }; const welcome = "祝你开心每一天!"; const _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: "Workplace", inheritAttrs: false }, __name: "workplace", setup(__props) { const userStore = useUserStore(); const timefix = greetings(); const { t } = useI18n(); const router = useRouter(); const noticeList = ref([]); const quickLinks = ref(quickStartManager.getQuickLinks()); const formatTime = (time) => { if (!time) return ""; const date = new Date(time); const now = /* @__PURE__ */ new Date(); const diff = now.getTime() - date.getTime(); const minutes = Math.floor(diff / (1e3 * 60)); const hours = Math.floor(diff / (1e3 * 60 * 60)); const days = Math.floor(diff / (1e3 * 60 * 60 * 24)); if (minutes < 1) return "刚刚"; if (minutes < 60) return `${minutes}分钟前`; if (hours < 24) return `${hours}小时前`; if (days < 7) return `${days}天前`; return date.toLocaleDateString(); }; const goToNotice = () => { router.push({ name: "Notice" }).catch(() => { ElMessage.warning(`公告通知跳转失败,请检查路由配置`); }); }; const getNoticeTypeText = (type) => { switch (type) { case "1": return "通知"; case "2": return "公告"; default: return "通知"; } }; const getNoticeTypeColor = (type) => { switch (type) { case "1": return "primary"; case "2": return "success"; default: return "primary"; } }; const listNotice = async () => { try { const response = await NoticeAPI.listNotice({ page_no: 1, page_size: 10, status: "0" // 只获取启用的公告 }); if (response.data.code === 0) { noticeList.value = response.data.data.items; } } catch (error) { console.error("获取通知公告失败:", error); } }; const handleQuickLinkClick = (item) => { if (item.href) { router.push(item.href).catch(() => { ElMessage.warning(`路由 ${item.href} 不存在,请检查配置`); }); ElMessage.success(`进入:${item.title}`); } else { ElMessage.info(`${item.title} 功能待开发`); } }; const getRandomColor = () => { const colors = [ "#FF5733", "#33FF57", "#3357FF", "#FF33E6", "#FFFF33", "#33FFFF", "#FF3333", "#5733FF", "#33FFE6", "#E633FF" ]; const randomIndex = Math.floor(Math.random() * colors.length); return colors[randomIndex]; }; const handleDeleteLink = (item) => { ElMessageBox.confirm(`确定要取消收藏"${item.title}"吗?`, "取消收藏确认", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(() => { if (item.id) { quickStartManager.removeQuickLink(item.id); ElMessage.success(`已取消收藏:${item.title}`); } }).catch(() => { }); }; const clearBookmarks = () => { ElMessageBox.confirm("确定要清空收藏吗?", "清空收藏确认", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(() => { quickStartManager.clearQuickLinks(); ElMessage.success("已清空收藏"); }).catch(() => { }); }; const updateQuickLinks = (links) => { quickLinks.value = links; }; onMounted(() => { listNotice(); quickStartManager.addListener(updateQuickLinks); }); onUnmounted(() => { quickStartManager.removeListener(updateQuickLinks); }); const currentUser = { avatar: userStore.basicInfo.avatar || "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", name: userStore.basicInfo.name || "吴彦祖", username: userStore.basicInfo.username || "账号信息", description: userStore.basicInfo.description || "用户说明", dept_name: userStore.basicInfo.dept_name || "软件专业部", last_login: userStore.basicInfo.last_login || "2023-01-01 00:00:00" }; const projectNotice = [ { id: "xxx1", title: "Mysql", avatar: "https://labs.mysql.com/common/themes/sakila/favicon.ico", description: "最流行的关系型数据库", updatedAt: "几秒前", member: "科学搬砖组", href: "https://www.mysql.com/", memberLink: "" }, { id: "xxx2", title: "Fastapi", avatar: "https://fastapi.tiangolo.com/img/favicon.png", description: "一个现代、快速(高性能)的 web 框架", updatedAt: "6 年前", member: "全组都是吴彦祖", href: "https://fastapi.tiangolo.com/zh/", memberLink: "" }, { id: "xxx3", title: "Element-plus", avatar: "https://element-plus.org/images/element-plus-logo-small.svg", description: "面向设计师和开发者的组件库", updatedAt: "几秒前", member: "中二少女团", href: "https://element-plus.org/zh-CN/", memberLink: "" }, { id: "xxx4", title: "Vue", avatar: "https://cn.vuejs.org/logo.svg", description: "渐进式 JavaScript 框架", updatedAt: "6 年前", member: "程序员日常", href: "https://cn.vuejs.org/", memberLink: "" }, { id: "xxx5", title: "Vite", avatar: "https://vitejs.cn/vite3-cn/logo.svg", description: "Vite 下一代的前端工具链", updatedAt: "6 年前", member: "高逼格设计天团", href: "https://cn.vitejs.dev/", memberLink: "" }, { id: "xxx6", title: "Python", avatar: "https://python.p2hp.com/static/favicon.ico", description: "一种解释型、面向对象类型编程语言", updatedAt: "6 年前", member: "骗你来学计算机", href: "", memberLink: "" } ]; const chartOptions = reactive({ tooltip: { trigger: "item" }, legend: { data: ["个人", "团队", "部门"] }, radar: { shape: "circle", indicator: [ { name: "引用", max: 10 }, { name: "热度", max: 10 }, { name: "贡献", max: 10 }, { name: "产量", max: 10 }, { name: "口碑", max: 10 } ] }, series: [ { name: "Budget vs spending", type: "radar", areaStyle: {}, symbol: "none", emphasis: { focus: "self" }, data: [ { value: [10, 7, 5, 4, 8], name: "个人" }, { value: [3, 1, 3, 6, 9], name: "团队" }, { value: [4, 7, 5, 6, 1], name: "部门" } ] } ] }); return (_ctx, _cache) => { const _component_ElAvatar = ElAvatar; const _component_el_text = ElText; const _component_ElCard = ElCard; const _component_ElLink = ElLink; const _component_el_empty = ElEmpty; const _component_ElDescriptionsItem = ElDescriptionsItem; const _component_el_tooltip = ElTooltip; const _component_ElDescriptions = ElDescriptions; const _component_ElCol = ElCol; const _component_ElRow = ElRow; const _component_ElButton = ElButton; const _component_el_tag = ElTag; const _component_ElTimelineItem = ElTimelineItem; const _component_ElTimeline = ElTimeline; const _component_el_icon = ElIcon; const _component_ECharts = _sfc_main$1; return openBlock(), createElementBlock("div", _hoisted_1, [ createBaseVNode("div", null, [ createVNode(_component_ElCard, { shadow: "hover" }, { default: withCtx(() => [ createBaseVNode("div", _hoisted_2, [ createBaseVNode("div", _hoisted_3, [ createVNode(_component_ElAvatar, { size: "large", src: currentUser.avatar, class: "mr-20px" }, null, 8, ["src"]), createBaseVNode("div", null, [ createBaseVNode("div", _hoisted_4, toDisplayString(unref(timefix)) + toDisplayString(currentUser.name) + "," + toDisplayString(welcome), 1), createVNode(_component_el_text, null, { default: withCtx(() => [ createTextVNode(toDisplayString(currentUser.username) + " | " + toDisplayString(currentUser.dept_name) + " | " + toDisplayString(currentUser.description), 1) ]), _: 1 }) ]) ]), createBaseVNode("div", _hoisted_5, [ createVNode(_component_el_text, null, { default: withCtx(() => [..._cache[3] || (_cache[3] = [ createTextVNode("最近登录时间", -1) ])]), _: 1 }), createBaseVNode("div", _hoisted_6, toDisplayString(currentUser.last_login), 1) ]) ]) ]), _: 1 }) ]), createBaseVNode("div", _hoisted_7, [ createVNode(_component_ElRow, { gutter: 16, justify: "space-between" }, { default: withCtx(() => [ createVNode(_component_ElCol, { xl: 16, lg: 16, md: 24, sm: 24, xs: 24 }, { default: withCtx(() => [ createVNode(_component_ElCard, { shadow: "hover", title: "进行中的项目" }, { header: withCtx(() => [ _cache[5] || (_cache[5] = createBaseVNode("span", { class: "font-bold" }, "进行中的项目", -1)), createVNode(_component_ElLink, { href: "", type: "primary", underline: "never", style: { "float": "right" } }, { default: withCtx(() => [..._cache[4] || (_cache[4] = [ createTextVNode(" 全部项目 ", -1) ])]), _: 1 }) ]), default: withCtx(() => [ projectNotice.length === 0 ? (openBlock(), createBlock(_component_el_empty, { key: 0, "image-size": 80, description: "暂无数据" })) : (openBlock(), createBlock(_component_ElRow, { key: 1 }, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(projectNotice, (item) => { return createVNode(_component_ElCol, { key: `card-${item.id}`, xl: 8, lg: 8, md: 12, sm: 24, xs: 24 }, { default: withCtx(() => [ (openBlock(), createBlock(_component_ElCard, { key: item.id, shadow: "hover" }, { default: withCtx(() => [ createVNode(_component_ElDescriptions, { column: 1 }, { default: withCtx(() => [ createVNode(_component_ElDescriptionsItem, null, { default: withCtx(() => [ createBaseVNode("div", _hoisted_8, [ createVNode(_component_ElAvatar, { src: item.avatar, size: "small", class: "mr-20px" }, null, 8, ["src"]), createVNode(_component_ElLink, { href: item.href, underline: "never" }, { default: withCtx(() => [ createTextVNode(toDisplayString(item.title), 1) ]), _: 2 }, 1032, ["href"]) ]) ]), _: 2 }, 1024), createVNode(_component_ElDescriptionsItem, null, { default: withCtx(() => [ createVNode(_component_el_tooltip, { placement: "top", content: item.description }, { default: withCtx(() => [ createVNode(_component_el_text, { "line-clamp": "1", class: "truncate-text" }, { default: withCtx(() => [ createTextVNode(toDisplayString(item.description), 1) ]), _: 2 }, 1024) ]), _: 2 }, 1032, ["content"]) ]), _: 2 }, 1024), createVNode(_component_ElDescriptionsItem, null, { default: withCtx(() => [ createBaseVNode("div", _hoisted_9, [ createVNode(_component_ElLink, { href: item.memberLink, underline: "never" }, { default: withCtx(() => [ createTextVNode(toDisplayString(item.member || ""), 1) ]), _: 2 }, 1032, ["href"]), createBaseVNode("span", null, toDisplayString(item.updatedAt), 1) ]) ]), _: 2 }, 1024) ]), _: 2 }, 1024) ]), _: 2 }, 1024)) ]), _: 2 }, 1024); }), 64)) ]), _: 1 })) ]), _: 1 }), createVNode(_component_ElCard, { shadow: "hover", class: "mt-4" }, { header: withCtx(() => [ createBaseVNode("div", _hoisted_10, [ _cache[7] || (_cache[7] = createBaseVNode("span", { class: "font-bold" }, "通知公告", -1)), createVNode(_component_ElButton, { type: "primary", link: "", onClick: _cache[0] || (_cache[0] = ($event) => goToNotice()) }, { default: withCtx(() => [..._cache[6] || (_cache[6] = [ createTextVNode("更多", -1) ])]), _: 1 }) ]) ]), default: withCtx(() => [ noticeList.value.length === 0 ? (openBlock(), createBlock(_component_el_empty, { key: 0, "image-size": 80, description: "暂无数据" })) : createCommentVNode("", true), createVNode(_component_ElTimeline, null, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(noticeList.value, (item, index) => { return openBlock(), createBlock(_component_ElTimelineItem, { key: item.id, type: index === 0 ? "primary" : "info" }, { default: withCtx(() => { var _a; return [ createBaseVNode("div", _hoisted_11, [ createBaseVNode("div", _hoisted_12, [ createBaseVNode("div", _hoisted_13, [ createBaseVNode("span", _hoisted_14, toDisplayString(item.notice_title), 1), createVNode(_component_el_tag, { size: "small", type: getNoticeTypeColor(item.notice_type) }, { default: withCtx(() => [ createTextVNode(toDisplayString(getNoticeTypeText(item.notice_type)), 1) ]), _: 2 }, 1032, ["type"]) ]), createBaseVNode("span", _hoisted_15, toDisplayString(formatTime(item.created_time)), 1) ]), createBaseVNode("div", _hoisted_16, toDisplayString(item.notice_content), 1), createBaseVNode("div", _hoisted_17, [ createBaseVNode("span", _hoisted_18, toDisplayString((_a = item.created_by) == null ? void 0 : _a.name) + " 发布 ", 1), createVNode(_component_el_tooltip, { placement: "top", content: item.description || item.notice_content }, { default: withCtx(() => [ createVNode(_component_ElButton, { target: "_blank", type: "primary", link: "", onClick: _cache[1] || (_cache[1] = ($event) => goToNotice()) }, { default: withCtx(() => [..._cache[8] || (_cache[8] = [ createTextVNode(" 详情↗ ", -1) ])]), _: 1 }) ]), _: 1 }, 8, ["content"]) ]) ]) ]; }), _: 2 }, 1032, ["type"]); }), 128)) ]), _: 1 }) ]), _: 1 }), createVNode(_component_ElCard, { shadow: "hover", class: "mt-4" }, { header: withCtx(() => [..._cache[9] || (_cache[9] = [ createBaseVNode("span", { class: "font-bold" }, "团队", -1) ])]), default: withCtx(() => [ projectNotice.length === 0 ? (openBlock(), createBlock(_component_el_empty, { key: 0, "image-size": 80, description: "暂无数据" })) : (openBlock(), createBlock(_component_ElRow, { key: 1, gutter: 16 }, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(projectNotice, (item) => { return createVNode(_component_ElCol, { key: `members-item-${item.id}`, span: 8, class: "mb-3" }, { default: withCtx(() => [ createVNode(_component_ElLink, { underline: "never", href: item.href, class: "flex items-center hover:bg-[var(--el-fill-color-light)] p-2 rounded transition-colors" }, { default: withCtx(() => [ createVNode(_component_ElAvatar, { src: item.avatar, size: "small", class: "mr-2" }, null, 8, ["src"]), createBaseVNode("span", _hoisted_19, toDisplayString(item.member), 1) ]), _: 2 }, 1032, ["href"]) ]), _: 2 }, 1024); }), 64)) ]), _: 1 })) ]), _: 1 }) ]), _: 1 }), createVNode(_component_ElCol, { xl: 8, lg: 8, md: 12, sm: 12, xs: 24 }, { default: withCtx(() => [ createVNode(_component_ElCard, { shadow: "hover", class: "mb-4" }, { header: withCtx(() => [ createBaseVNode("div", _hoisted_20, [ createBaseVNode("div", _hoisted_21, [ createVNode(_component_el_tooltip, { content: "快速访问常用功能,标签右键收藏可添加快捷栏菜单。", placement: "top" }, { default: withCtx(() => [ createVNode(_component_el_icon, { class: "cursor-help", size: "16" }, { default: withCtx(() => [ createVNode(unref(question_filled_default)) ]), _: 1 }) ]), _: 1 }), _cache[10] || (_cache[10] = createBaseVNode("span", { class: "font-bold" }, "快速开始 / 便捷导航", -1)) ]), createVNode(_component_ElButton, { size: "small", type: "danger", plain: "", onClick: _cache[2] || (_cache[2] = ($event) => clearBookmarks()) }, { default: withCtx(() => [ createVNode(_component_el_icon, null, { default: withCtx(() => [ createVNode(unref(delete_default)) ]), _: 1 }), createTextVNode(" " + toDisplayString(unref(t)("common.clear")), 1) ]), _: 1 }) ]) ]), default: withCtx(() => [ quickLinks.value.length > 0 ? (openBlock(), createBlock(_component_ElRow, { key: 0, gutter: 8 }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(quickLinks.value, (item, index) => { return openBlock(), createBlock(_component_ElCol, { key: index, span: 6, class: "group mb-4" }, { default: withCtx(() => [ createVNode(_component_ElButton, { plain: "", type: "default", class: "w-full relative", onClick: ($event) => handleQuickLinkClick(item) }, { default: withCtx(() => [ item.icon && item.icon.startsWith("el-icon") ? (openBlock(), createBlock(_component_el_icon, { key: 0, color: getRandomColor() }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(item.icon.replace("el-icon-", "")))) ]), _: 2 }, 1032, ["color"])) : item.icon ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(`i-svg:${item.icon} mr-2`), style: normalizeStyle({ color: getRandomColor() }) }, null, 6)) : (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(`i-svg:menu mr-2`), style: normalizeStyle({ color: getRandomColor() }) }, null, 4)), createBaseVNode("span", null, toDisplayString(item.title), 1), createVNode(_component_el_icon, { color: "var(--el-color-danger)", class: "absolute top-0 right-0 opacity-0 group-hover:opacity-100", onClick: withModifiers(($event) => handleDeleteLink(item), ["stop"]) }, { default: withCtx(() => [ createVNode(unref(circle_close_default)) ]), _: 1 }, 8, ["onClick"]) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024); }), 128)) ]), _: 1 })) : (openBlock(), createBlock(_component_el_empty, { key: 1, "image-size": 80, description: "暂无数据" })) ]), _: 1 }), createVNode(_component_ElCard, { class: "mb-4 font-bold", header: "XX 指数" }, { default: withCtx(() => [ createVNode(_component_ECharts, { class: "chart", options: chartOptions, height: "450px", autoresize: "", "init-options": { renderer: "canvas" } }, null, 8, ["options"]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ]) ]); }; } }); const workplace = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e11cce7f"]]); export { workplace as default };