index.vue 26 KB

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