index.vue 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097
  1. <template>
  2. <div class="ehr-page">
  3. <Header />
  4. <section class="hero">
  5. <div class="hero-inner">
  6. <!-- 判断上下午 -->
  7. <h1 class="hero-title">
  8. {{ getGreeting() }},{{ userStore.getUser.nickname }}
  9. </h1>
  10. <p class="hero-desc">
  11. 今天是 {{ new Date().toLocaleDateString() }}。您有
  12. {{ stats[0].number }}条流程待处理。
  13. </p>
  14. </div>
  15. </section>
  16. <!-- 任务统计 -->
  17. <section class="total">
  18. <div class="total-card" v-for="(item, index) in stats" :key="index">
  19. <el-popover
  20. placement="top"
  21. :width="100"
  22. trigger="hover"
  23. popper-class="glass-popover"
  24. :disabled="getDetailList(index).length === 0"
  25. transition="el-zoom-in-left"
  26. >
  27. <template #reference>
  28. <div class="card-wrapper">
  29. <!-- ... 图标和内容 ... -->
  30. <div class="card-icon" :style="{ backgroundColor: item.bgcolor }">
  31. <Icon :icon="item.icon" :color="item.color" />
  32. </div>
  33. <div class="card-content">
  34. <p class="card-title">{{ item.title }}</p>
  35. <el-skeleton :rows="1" :animated="true" :loading="statsLoading">
  36. <template #template>
  37. <el-skeleton-item
  38. variant="text"
  39. style="width: 60%; height: 32px; border-radius: 50px"
  40. />
  41. </template>
  42. <p class="card-number">{{ item.number }}</p>
  43. </el-skeleton>
  44. </div>
  45. </div>
  46. </template>
  47. <div class="detail-list">
  48. <div
  49. v-for="(task, idx) in getDetailList(index)"
  50. :key="idx"
  51. class="detail-item"
  52. @click="handleDetailClick(task, item.title)"
  53. >
  54. <span class="detail-name">{{ task.name }}</span>
  55. <span class="detail-val">{{ task.value }}</span>
  56. </div>
  57. <div v-if="getDetailList(index).length === 0" class="empty-tip">
  58. 暂无详细数据
  59. </div>
  60. </div>
  61. </el-popover>
  62. </div>
  63. </section>
  64. <div class="content">
  65. <div class="tabs-container" role="tablist" aria-label="EHR模块">
  66. <button
  67. class="el-tab-item"
  68. type="button"
  69. role="tab"
  70. :class="{ 'is-active': activeKey === 'all' }"
  71. :aria-selected="activeKey === 'all'"
  72. @click="setAll"
  73. >
  74. <span class="tab-label">全部</span>
  75. </button>
  76. <button
  77. v-for="tab in tabs"
  78. :key="tab.groupName"
  79. class="el-tab-item"
  80. :class="{ 'is-active': tab.groupName === activeKey }"
  81. type="button"
  82. role="tab"
  83. :aria-selected="tab.groupName === activeKey"
  84. @click="getById(tab)"
  85. >
  86. <span class="tab-label">{{ tab.groupName }}</span>
  87. </button>
  88. </div>
  89. <div role="tabpanel">
  90. <div class="items-grid">
  91. <div
  92. v-for="item in activeTab.flowRespVOS"
  93. :key="item.id"
  94. class="item-card"
  95. @click="go(item)"
  96. >
  97. <div class="item-top">
  98. <div class="item-icon">
  99. <Icon :icon="item.icon || 'mdi:file-document-outline'" />
  100. </div>
  101. <div>
  102. <span
  103. class="text-[10px] font-bold text-slate-300 uppercase tracking-widest group-hover:text-blue-200"
  104. >{{ item.type }}</span
  105. >
  106. </div>
  107. </div>
  108. <div class="item-body">
  109. <h3 class="item-name font-bold text-slate-900">
  110. {{ item.flowName }}
  111. </h3>
  112. <p class="item-desc">{{ item.remark || "暂无描述" }}</p>
  113. </div>
  114. <div class="flex justify-between">
  115. <div class="item-time flex items-center gap-2">
  116. <svg
  117. xmlns="http://www.w3.org/2000/svg"
  118. width="1em"
  119. height="1em"
  120. viewBox="0 0 24 24"
  121. >
  122. <g
  123. fill="none"
  124. stroke="#f97316"
  125. stroke-linecap="round"
  126. stroke-linejoin="round"
  127. stroke-width="1.5"
  128. >
  129. <path
  130. d="M15.362 5.214A8.252 8.252 0 0 1 12 21A8.25 8.25 0 0 1 6.038 7.047A8.3 8.3 0 0 0 9 9.601a8.98 8.98 0 0 1 3.361-6.867a8.2 8.2 0 0 0 3 2.48"
  131. ></path>
  132. <path
  133. d="M12 18a3.75 3.75 0 0 0 .495-7.468a6 6 0 0 0-1.925 3.547a6 6 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18"
  134. ></path>
  135. </g>
  136. </svg>
  137. <span class="text-[12px] text-[#babdd1]">85人使用</span>
  138. </div>
  139. <Icon icon="mdi-light:chevron-right" class="item-arrow w-6 h-6" />
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <Footer />
  146. </div>
  147. </template>
  148. <script setup>
  149. import Header from "@components/home/header.vue";
  150. import Footer from "@components/home/Footer.vue";
  151. import { computed, ref, onMounted, onBeforeUnmount, nextTick } from "vue";
  152. import { Icon } from "@iconify/vue";
  153. import { getFlows, ssoLogin, getOATasks, getCRMTasks } from "@/api/user";
  154. import { useUserStore } from "@/stores/useUserStore";
  155. import { getAccessToken } from "@/utils/auth";
  156. import * as echarts from "echarts";
  157. import { useRouter } from "vue-router";
  158. const router = useRouter();
  159. const userStore = useUserStore();
  160. const lineChartInstance = ref(null);
  161. let lineChartRef = ref(null);
  162. let pieChartRef = ref(null);
  163. const pieChartInstance = ref(null);
  164. let chartResizeObserver = null;
  165. let chartInitTimer = null;
  166. const initChartsSafe = (attempt = 0) => {
  167. const lineDom = lineChartRef.value;
  168. const pieDom = pieChartRef.value;
  169. if (!lineDom || !pieDom) return;
  170. const lineRect = lineDom.getBoundingClientRect();
  171. const pieRect = pieDom.getBoundingClientRect();
  172. const isLineReady = lineRect.width > 0 && lineRect.height > 0;
  173. const isPieReady = pieRect.width > 0 && pieRect.height > 0;
  174. if (isLineReady && isPieReady) {
  175. initLineChart();
  176. initPieChart();
  177. handleResize();
  178. return;
  179. }
  180. if (attempt < 8) {
  181. chartInitTimer = window.setTimeout(() => {
  182. initChartsSafe(attempt + 1);
  183. }, 120);
  184. }
  185. };
  186. const getGreeting = () => {
  187. const hour = new Date().getHours();
  188. if (hour < 12) return "早上好";
  189. if (hour < 18) return "下午好";
  190. return "晚上好";
  191. };
  192. // 模拟数据 - 请根据实际 API 返回的数据调整
  193. const lineChartData = {
  194. title: "流程处理趋势 (30天)",
  195. xAxis: ["03-27", "03-28", "03-29", "03-30", "03-31", "04-01", "04-02"],
  196. yAxis: [12, 18, 15, 20, 27, 24, 31],
  197. };
  198. const pieChartData = {
  199. title: "流程类型占比",
  200. seriesData: [
  201. { name: "财务报销", value: 35, itemStyle: { color: "#409eff" } },
  202. { name: "行政办公", value: 25, itemStyle: { color: "#f56c6c" } },
  203. { name: "IT技术", value: 20, itemStyle: { color: "#9a66ff" } },
  204. { name: "人力资源", value: 15, itemStyle: { color: "#e6a23c" } },
  205. { name: "业务申请", value: 5, itemStyle: { color: "#50c878" } },
  206. ],
  207. };
  208. const getDetailList = (index) => {
  209. switch (index) {
  210. case 0: // 我的待办
  211. return todoCount.value;
  212. case 1: // 已办事项
  213. return doneCount.value;
  214. case 2: // 发起流程
  215. return startCount.value;
  216. case 3: // 草稿箱
  217. return drafts.value;
  218. default:
  219. return [];
  220. }
  221. };
  222. // 初始化图表
  223. const initLineChart = () => {
  224. const chartDom = lineChartRef.value;
  225. if (!chartDom) return;
  226. const chart = echarts.init(chartDom);
  227. lineChartInstance.value = chart; // 保存实例
  228. chart.setOption({
  229. title: {
  230. text: lineChartData.title,
  231. left: "10",
  232. top: 20,
  233. textStyle: {
  234. fontSize: 16,
  235. fontWeight: "bold",
  236. color: "#333",
  237. },
  238. },
  239. // ... 原有的 option 配置保持不变 ...
  240. tooltip: {
  241. trigger: "axis",
  242. axisPointer: { type: "shadow" },
  243. },
  244. grid: {
  245. left: "3%",
  246. right: "4%",
  247. bottom: "10%",
  248. containLabel: true,
  249. },
  250. xAxis: {
  251. type: "category",
  252. data: lineChartData.xAxis,
  253. axisLabel: { formatter: (value) => value },
  254. },
  255. yAxis: {
  256. type: "value",
  257. splitLine: { show: true, lineStyle: { color: "#eee" } },
  258. },
  259. series: [
  260. {
  261. name: "处理数量",
  262. type: "line",
  263. smooth: true,
  264. areaStyle: {
  265. opacity: 0.3,
  266. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  267. { offset: 0, color: "#409eff" },
  268. { offset: 1, color: "#b3d8ff" },
  269. ]),
  270. },
  271. lineStyle: { width: 3, color: "#2563eb" },
  272. symbol: "circle",
  273. symbolSize: 8,
  274. data: lineChartData.yAxis,
  275. },
  276. ],
  277. });
  278. };
  279. const initPieChart = () => {
  280. const chartDom = pieChartRef.value;
  281. if (!chartDom) return;
  282. const chart = echarts.init(chartDom);
  283. pieChartInstance.value = chart; // 保存实例
  284. chart.setOption({
  285. title: {
  286. text: pieChartData.title,
  287. left: "10",
  288. top: 20,
  289. textStyle: {
  290. fontSize: 16,
  291. fontWeight: "bold",
  292. color: "#333",
  293. },
  294. },
  295. // ... 原有的 option 配置保持不变 ...
  296. tooltip: {
  297. trigger: "item",
  298. formatter: "{a} <br/>{b}: {c} ({d}%)",
  299. },
  300. legend: { show: false },
  301. series: [
  302. {
  303. name: "流程类型",
  304. type: "pie",
  305. radius: ["50%", "70%"],
  306. avoidLabelOverlap: false,
  307. label: { show: false, position: "center" },
  308. emphasis: {
  309. label: { show: true, fontSize: "14", fontWeight: "bold" },
  310. },
  311. labelLine: { show: false },
  312. data: pieChartData.seriesData,
  313. },
  314. ],
  315. });
  316. };
  317. const handleResize = () => {
  318. lineChartInstance.value?.resize();
  319. pieChartInstance.value?.resize();
  320. };
  321. const tabs = ref([]);
  322. const activeKey = ref("all");
  323. const allTab = computed(() => {
  324. const flowRespVOS = tabs.value.flatMap((tab) => tab.flowRespVOS || []);
  325. return {
  326. groupName: "全部",
  327. remark: "全部流程",
  328. flowRespVOS,
  329. };
  330. });
  331. const activeTab = computed(() => {
  332. if (activeKey.value === "all") {
  333. return allTab.value;
  334. }
  335. return (
  336. tabs.value.find((tab) => tab.groupName === activeKey.value) || allTab.value
  337. );
  338. });
  339. const getAll = async () => {
  340. const res = await getFlows({
  341. pageNo: 1,
  342. pageSize: 99,
  343. });
  344. tabs.value = res;
  345. };
  346. const setAll = () => {
  347. activeKey.value = "all";
  348. };
  349. const getById = (tab) => {
  350. activeKey.value = tab.groupName;
  351. };
  352. const go = async (item) => {
  353. if (userStore.getUser.username && getAccessToken()) {
  354. if (item.type === "OA") {
  355. const res = await ssoLogin({
  356. username: userStore.getUser.username,
  357. });
  358. if (res) {
  359. const ua = window.navigator.userAgent.toLowerCase();
  360. if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
  361. const targetUrl1 = item.indexUrl + "?ssoToken=" + res + "#/main";
  362. const targetUrl2 = item.flowUrl;
  363. dd.biz.util.openLink({
  364. url: targetUrl1, // 先跳你的 SSO 链接
  365. onSuccess: () => {
  366. // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
  367. setTimeout(() => {
  368. dd.biz.util.openLink({ url: targetUrl2 });
  369. }, 100);
  370. },
  371. });
  372. } else {
  373. const newTab = window.open("", "_blank");
  374. newTab.location.href = item.indexUrl + "?ssoToken=" + res + "#/main";
  375. setTimeout(function () {
  376. newTab.location.href = item.flowUrl;
  377. }, 100);
  378. }
  379. }
  380. }
  381. if (item.type === "CRM") {
  382. const ua = window.navigator.userAgent.toLowerCase();
  383. if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
  384. dd.biz.util.openLink({
  385. url:
  386. item.indexUrl +
  387. "/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=" +
  388. getAccessToken(), // 先跳你的 SSO 链接
  389. onSuccess: () => {
  390. // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
  391. setTimeout(() => {
  392. dd.biz.util.openLink({ url: item.flowUrl });
  393. }, 100);
  394. },
  395. });
  396. } else {
  397. const newTab = window.open("", "_blank");
  398. newTab.location.href =
  399. item.indexUrl +
  400. "/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=" +
  401. getAccessToken();
  402. setTimeout(function () {
  403. newTab.location.href = item.flowUrl;
  404. }, 100);
  405. }
  406. }
  407. } else {
  408. router.push({ path: "/login" });
  409. }
  410. };
  411. const handleDetailClick = (task, categoryTitle) => {
  412. console.log(`点击了 ${categoryTitle} 中的 ${task.name}: ${task.value}`);
  413. // 示例:根据类型跳转
  414. if (task.name === "OA" && categoryTitle === "我的待办") {
  415. router.push({
  416. path: "/todo-list",
  417. query: { type: task.name.toLowerCase() },
  418. });
  419. }
  420. if (task.name === "OA" && categoryTitle === "已办事项") {
  421. router.push({
  422. path: "/oa-done-list",
  423. query: { type: task.name.toLowerCase() },
  424. });
  425. }
  426. if (task.name === "CRM" && categoryTitle === "我的待办") {
  427. router.push({
  428. path: "/crm-todo-list",
  429. query: { type: task.name.toLowerCase() },
  430. });
  431. }
  432. if (task.name === "CRM" && categoryTitle === "已办事项") {
  433. router.push({
  434. path: "/crm-done-list",
  435. query: { type: task.name.toLowerCase() },
  436. });
  437. }
  438. };
  439. let oaTasks = ref([]);
  440. let crmTasks = ref([]);
  441. const statsLoading = ref(true);
  442. const stats = ref([
  443. {
  444. icon: "mdi:clock-outline",
  445. title: "我的待办",
  446. number: 0,
  447. extra: "+2 今日",
  448. bgcolor: "#fff7ed",
  449. color: "#f59e0b",
  450. },
  451. {
  452. icon: "mdi:check-circle-outline",
  453. title: "已办事项",
  454. number: 0,
  455. bgcolor: "#eff6ff",
  456. color: "#2563eb",
  457. },
  458. ]);
  459. const todoCount = ref([
  460. { name: "OA", value: 0 },
  461. { name: "CRM", value: 0 },
  462. ]);
  463. // 已办事项
  464. const doneCount = ref([
  465. { name: "OA", value: 0 },
  466. { name: "CRM", value: 0 },
  467. ]);
  468. onMounted(async () => {
  469. getAll();
  470. // 等待 DOM 与样式生效,避免移动端首屏尺寸为 0
  471. await nextTick();
  472. requestAnimationFrame(() => {
  473. initChartsSafe();
  474. // 添加监听
  475. window.addEventListener("resize", handleResize);
  476. // 使用 ResizeObserver 监听容器尺寸变化(移动端更稳定)
  477. if (typeof ResizeObserver !== "undefined") {
  478. chartResizeObserver = new ResizeObserver(() => {
  479. handleResize();
  480. });
  481. if (lineChartRef.value) chartResizeObserver.observe(lineChartRef.value);
  482. if (pieChartRef.value) chartResizeObserver.observe(pieChartRef.value);
  483. }
  484. });
  485. if (userStore.getUser.username) {
  486. try {
  487. const res = await getOATasks({
  488. id: userStore.getUser.username,
  489. pageNum: 1,
  490. pageSize: 99,
  491. });
  492. oaTasks.value = res;
  493. const crmRes = await getCRMTasks({
  494. id: userStore.getUser.username,
  495. type: "pending",
  496. pageNum: 1,
  497. pageSize: 10,
  498. });
  499. crmTasks.value = crmRes;
  500. stats.value[0].number =
  501. Number(oaTasks.value.todoCount) + Number(crmTasks.value.todoCount);
  502. todoCount.value = [
  503. { name: "OA", value: oaTasks.value.todoCount ?? 0 },
  504. { name: "CRM", value: crmTasks.value.todoCount ?? 0 },
  505. ];
  506. // *****************已办事项统计*************************
  507. const crmDoneRes = await getCRMTasks({
  508. id: userStore.getUser.username,
  509. type: "approved",
  510. pageNum: 1,
  511. pageSize: 10,
  512. });
  513. stats.value[1].number =
  514. Number(oaTasks.value.doneCount) + Number(crmDoneRes.todoCount);
  515. doneCount.value = [
  516. { name: "OA", value: oaTasks.value.doneCount ?? 0 },
  517. { name: "CRM", value: crmDoneRes.todoCount ?? 0 },
  518. ];
  519. } finally {
  520. statsLoading.value = false;
  521. }
  522. setInterval(
  523. async () => {
  524. const res = await getOATasks({
  525. id: userStore.getUser.username,
  526. pageNum: 1,
  527. pageSize: 10,
  528. });
  529. oaTasks.value = res;
  530. const crmRes = await getCRMTasks({
  531. id: userStore.getUser.username,
  532. type: "pending",
  533. pageNum: 1,
  534. pageSize: 10,
  535. });
  536. crmTasks.value = crmRes;
  537. stats.value[0].number =
  538. Number(oaTasks.value.todoCount) + Number(crmTasks.value.todoCount);
  539. todoCount.value = [
  540. { name: "OA", value: oaTasks.value.todoCount ?? 0 },
  541. { name: "CRM", value: crmTasks.value.todoCount ?? 0 },
  542. ];
  543. const crmDoneRes = await getCRMTasks({
  544. id: userStore.getUser.username,
  545. type: "approved",
  546. pageNum: 1,
  547. pageSize: 10,
  548. });
  549. stats.value[1].number =
  550. Number(oaTasks.value.doneCount) + Number(crmDoneRes.todoCount);
  551. doneCount.value = [
  552. { name: "OA", value: oaTasks.value.doneCount ?? 0 },
  553. { name: "CRM", value: crmDoneRes.todoCount ?? 0 },
  554. ];
  555. },
  556. 5 * 60 * 1000,
  557. ); // 每5分钟刷新一次
  558. } else {
  559. statsLoading.value = false;
  560. }
  561. });
  562. // 组件卸载时移除监听,防止内存泄漏
  563. onBeforeUnmount(() => {
  564. window.removeEventListener("resize", handleResize);
  565. chartResizeObserver?.disconnect();
  566. if (chartInitTimer) window.clearTimeout(chartInitTimer);
  567. // 可选:销毁 echarts 实例
  568. lineChartInstance.value?.dispose();
  569. pieChartInstance.value?.dispose();
  570. });
  571. </script>
  572. <style scoped>
  573. /* .ehr-page {
  574. color: #1f2a37;
  575. background: linear-gradient(180deg, #f4f4f2 0%, #f7f6f3 50%, #f2f1ef 100%);
  576. min-height: 100vh;
  577. } */
  578. :global(body) {
  579. background-color: #f8fafc;
  580. }
  581. .hero {
  582. position: relative;
  583. padding: 72px 6vw 48px;
  584. overflow: hidden;
  585. margin-top: 20px;
  586. display: flex;
  587. justify-content: space-between;
  588. align-items: center;
  589. }
  590. .hero-inner {
  591. max-width: 920px;
  592. }
  593. .hero-title {
  594. font-size: clamp(18px, 2vw, 22px);
  595. line-height: 1.2;
  596. margin: 16px 0 12px;
  597. color: #111827;
  598. font-weight: bold;
  599. }
  600. .hero-desc {
  601. font-size: 16px;
  602. color: #4b5563;
  603. max-width: 720px;
  604. line-height: 1.8;
  605. }
  606. .hero-accent {
  607. position: absolute;
  608. top: -120px;
  609. right: -140px;
  610. width: 360px;
  611. height: 360px;
  612. border-radius: 50%;
  613. opacity: 0.9;
  614. pointer-events: none;
  615. }
  616. .content {
  617. padding: 0 6vw 80px;
  618. /* height: 80vh; */
  619. }
  620. .tabs-container {
  621. display: flex;
  622. align-items: center;
  623. border-bottom: 1px solid #e4e7ed; /* Element Plus 标准的分割线颜色 */
  624. margin-bottom: 20px;
  625. padding-left: 0;
  626. overflow-x: auto; /* 防止Tab过多时溢出 */
  627. }
  628. .el-tab-item {
  629. position: relative;
  630. display: inline-flex;
  631. align-items: center;
  632. justify-content: center;
  633. padding: 0 20px;
  634. height: 40px; /* 标准高度 */
  635. font-size: 14px;
  636. color: #64748b; /* Element Plus 主要文字颜色 */
  637. background-color: transparent;
  638. border: none;
  639. border-bottom: 2px solid transparent; /* 用于激活态的下划线 */
  640. cursor: pointer;
  641. transition: all 0.3s;
  642. margin-right: 0;
  643. outline: none;
  644. flex-shrink: 0; /* 防止压缩 */
  645. }
  646. .el-tab-item:hover {
  647. color: #02409b; /* Element Plus 主题蓝 */
  648. }
  649. .el-tab-item.is-active {
  650. color: #02409b; /* 激活态文字颜色 */
  651. font-weight: 500;
  652. border-bottom-color: #02409b; /* 激活态下划线 */
  653. }
  654. .tab-label {
  655. line-height: 1;
  656. font-weight: bold;
  657. }
  658. .tab-sub {
  659. margin-left: 8px;
  660. font-size: 12px;
  661. color: #909399; /* 次要文字颜色 */
  662. transform: scale(0.9);
  663. }
  664. .panel {
  665. background: #ffffff;
  666. border-radius: 24px;
  667. padding: 28px 28px 32px;
  668. box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
  669. }
  670. .panel-head {
  671. display: flex;
  672. align-items: flex-start;
  673. justify-content: space-between;
  674. gap: 24px;
  675. padding-bottom: 20px;
  676. margin-bottom: 24px;
  677. }
  678. .panel-title {
  679. font-size: 22px;
  680. color: #111827;
  681. margin-bottom: 6px;
  682. }
  683. .panel-subtitle {
  684. color: #6b7280;
  685. font-size: 14px;
  686. }
  687. .panel-meta {
  688. text-align: right;
  689. color: #6b7280;
  690. font-size: 12px;
  691. }
  692. .panel-count {
  693. display: block;
  694. font-size: 20px;
  695. font-weight: 600;
  696. color: #111827;
  697. }
  698. .items-grid {
  699. display: grid;
  700. grid-template-columns: repeat(auto-fill, 240px);
  701. justify-content: flex-start;
  702. gap: 16px;
  703. }
  704. .item-card {
  705. display: flex;
  706. flex-direction: column;
  707. gap: 18px;
  708. padding: 22px 22px 18px;
  709. border-radius: 22px;
  710. background: #ffffff;
  711. border: 1px solid rgb(241, 245, 249);
  712. box-shadow:
  713. rgba(0, 0, 0, 0) 0px 0px 0px 0px,
  714. rgba(0, 0, 0, 0) 0px 0px 0px 0px,
  715. rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
  716. transition:
  717. transform 0.2s ease,
  718. border-color 0.2s ease,
  719. box-shadow 0.2s ease;
  720. cursor: pointer;
  721. border-bottom: 1px solid rgb(241, 245, 249);
  722. }
  723. .item-card:hover {
  724. transform: translateY(-3px);
  725. box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  726. color: #02409b !important;
  727. }
  728. .item-top {
  729. display: flex;
  730. align-items: flex-start;
  731. justify-content: space-between;
  732. }
  733. .item-body {
  734. display: flex;
  735. flex-direction: column;
  736. gap: 8px;
  737. }
  738. .item-icon {
  739. width: 52px;
  740. height: 52px;
  741. border-radius: 16px;
  742. background: #f5f7fb;
  743. display: grid;
  744. place-items: center;
  745. font-size: 20px;
  746. }
  747. .item-icon :deep(svg) {
  748. width: 24px;
  749. height: 24px;
  750. }
  751. .item-role {
  752. font-size: 12px;
  753. letter-spacing: 0.2em;
  754. color: #c7ced9;
  755. font-weight: 600;
  756. }
  757. .item-name {
  758. font-size: 16px;
  759. line-height: 1.45;
  760. /* font-weight: 600; */
  761. }
  762. .item-desc {
  763. font-size: 13px;
  764. color: #6b7280;
  765. line-height: 1.6;
  766. }
  767. .item-footer {
  768. display: flex;
  769. align-items: center;
  770. justify-content: space-between;
  771. color: #94a3b8;
  772. font-size: 12px;
  773. }
  774. .item-usage {
  775. display: inline-flex;
  776. align-items: center;
  777. gap: 8px;
  778. }
  779. .item-flame {
  780. width: 18px;
  781. height: 18px;
  782. border-radius: 50%;
  783. display: grid;
  784. place-items: center;
  785. background: rgba(255, 108, 0, 0.12);
  786. color: #ff6c00;
  787. font-size: 12px;
  788. }
  789. .item-arrow {
  790. font-size: 22px;
  791. color: #cbd5e1;
  792. }
  793. @media (max-width: 720px) {
  794. .hero {
  795. padding: 56px 7vw 36px;
  796. }
  797. .panel-head {
  798. flex-direction: column;
  799. align-items: flex-start;
  800. }
  801. .panel-meta {
  802. text-align: left;
  803. }
  804. .items-grid {
  805. grid-template-columns: 1fr;
  806. }
  807. }
  808. .total {
  809. display: flex;
  810. gap: 16px;
  811. padding: 0 6vw 50px;
  812. /* margin-bottom: 24px; */
  813. }
  814. .total-card {
  815. /* flex: 1; */
  816. width: 300px;
  817. background: #ffffff;
  818. border-radius: 16px;
  819. padding: 20px;
  820. box-shadow:
  821. rgba(0, 0, 0, 0.05) 0px 1px 3px 0px,
  822. rgba(0, 0, 0, 0) 0px 0px 0px 0px,
  823. rgba(0, 0, 0, 0.05) 0px 1px 2px 0px,
  824. rgba(0, 0, 0, 0.05) 0px 2px 4px -1px,
  825. rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
  826. transition:
  827. transform 0.2s ease,
  828. box-shadow 0.2s ease;
  829. cursor: pointer;
  830. /* border: 1px solid #e5e7eb; */
  831. /* border-top: solid 5px #02409b; */
  832. overflow: visible;
  833. }
  834. .total-card:hover {
  835. transform: translateY(-4px);
  836. box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  837. color: #02409b !important;
  838. }
  839. .card-icon {
  840. width: 40px;
  841. height: 40px;
  842. border-radius: 12px;
  843. background: #f9f9f9;
  844. display: flex;
  845. align-items: center;
  846. justify-content: center;
  847. margin-bottom: 12px;
  848. }
  849. .card-icon svg {
  850. width: 20px;
  851. height: 20px;
  852. color: var(--primary-color);
  853. }
  854. .card-content {
  855. flex: 1;
  856. text-align: left;
  857. }
  858. .card-title {
  859. font-size: 14px;
  860. color: #6b7280;
  861. margin-bottom: 4px;
  862. }
  863. .card-number {
  864. font-size: 28px;
  865. font-weight: 600;
  866. /* color: #111827; */
  867. }
  868. .card-extra {
  869. font-size: 12px;
  870. color: #10b981;
  871. margin-top: 8px;
  872. text-align: right;
  873. }
  874. .charts-container {
  875. display: flex;
  876. flex-wrap: wrap;
  877. gap: 24px;
  878. padding: 0 6vw;
  879. margin-bottom: 80px;
  880. width: 100%;
  881. box-sizing: border-box;
  882. }
  883. .chart-item {
  884. flex: 1;
  885. /* 桌面端最小宽度,防止过度挤压 */
  886. min-width: 300px;
  887. /* 必须设置固定高度,ECharts 需要明确的高度才能渲染 */
  888. height: 350px;
  889. border-radius: 16px;
  890. background-color: #ffffff;
  891. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  892. overflow: hidden;
  893. position: relative;
  894. }
  895. :global(.glass-popover) {
  896. background: rgba(0, 0, 0, 0.6) !important;
  897. backdrop-filter: blur(10px);
  898. -webkit-backdrop-filter: blur(10px);
  899. height: 200px !important;
  900. width: 100px !important;
  901. overflow-y: auto !important;
  902. box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
  903. border-radius: 8px !important;
  904. padding: 10px !important;
  905. color: #fff !important;
  906. z-index: 2000 !important; /* 确保在最上层 */
  907. top: 15% !important; /* 根据需要调整位置 */
  908. }
  909. :global(.glass-popover .el-popper__arrow::before) {
  910. background: transparent !important;
  911. /* border: 1px solid rgba(255, 255, 255, 0.1); */
  912. border: none !important;
  913. }
  914. .detail-list {
  915. padding: 5px 0;
  916. }
  917. .detail-item {
  918. display: flex;
  919. justify-content: space-between;
  920. align-items: center;
  921. margin-bottom: 8px;
  922. font-size: 14px;
  923. color: #e0e0e0; /* 浅色文字 */
  924. line-height: 1.5;
  925. padding: 6px 8px;
  926. border-radius: 4px;
  927. cursor: pointer; /* 鼠标变成手型 */
  928. transition: background-color 0.2s ease;
  929. }
  930. .detail-item:last-child {
  931. margin-bottom: 0;
  932. }
  933. /* 鼠标悬浮背景变灰 */
  934. .detail-item:hover {
  935. background-color: rgba(
  936. 255,
  937. 255,
  938. 255,
  939. 0.15
  940. ); /* 半透明白色,视觉上为灰色高亮 */
  941. }
  942. .detail-name {
  943. color: #ccc;
  944. }
  945. .detail-val {
  946. font-weight: bold;
  947. color: #fff;
  948. }
  949. .empty-tip {
  950. text-align: center;
  951. color: #aaa;
  952. font-size: 12px;
  953. padding: 10px 0;
  954. }
  955. .item-arrow {
  956. transition: all 0.3s ease;
  957. color: #cbd5e1; /* 默认颜色 */
  958. }
  959. /* 2. 当卡片悬浮时,改变箭头的样式 */
  960. .item-card:hover .item-arrow {
  961. color: #02409b; /* 变蓝 (使用你主题中的蓝色) */
  962. transform: translateX(4px); /* 向右平移 4px */
  963. }
  964. </style>