index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <div class="ehr-page">
  3. <Header />
  4. <section class="hero">
  5. <div class="hero-inner">
  6. <h1 class="hero-title">下午好,晓华</h1>
  7. <p class="hero-desc">
  8. 今天是 {{ new Date().toLocaleDateString() }}。您有 5 条流程待处理。
  9. </p>
  10. </div>
  11. <div class="hero-accent" aria-hidden="true"></div>
  12. </section>
  13. <!-- 任务统计 -->
  14. <section class="total">
  15. <div class="total-card" v-for="(item, index) in stats" :key="index">
  16. <div class="card-icon" :style="{ backgroundColor: item.bgcolor }">
  17. <Icon :icon="item.icon" />
  18. </div>
  19. <div class="card-content">
  20. <p class="card-title">{{ item.title }}</p>
  21. <p class="card-number">{{ item.number }}</p>
  22. </div>
  23. <div v-if="item.extra" class="card-extra">
  24. {{ item.extra }}
  25. </div>
  26. </div>
  27. </section>
  28. <div class="content">
  29. <div class="tabs" role="tablist" aria-label="EHR模块">
  30. <button
  31. class="tab"
  32. type="button"
  33. role="tab"
  34. :class="{ active: activeKey === 'all' }"
  35. :aria-selected="activeKey === 'all'"
  36. @click="setAll"
  37. >
  38. 全部
  39. </button>
  40. <button
  41. v-for="tab in tabs"
  42. :key="tab.groupName"
  43. class="tab"
  44. :class="{ active: tab.groupName === activeKey }"
  45. type="button"
  46. role="tab"
  47. :aria-selected="tab.groupName === activeKey"
  48. @click="getById(tab)"
  49. >
  50. <span class="tab-title">{{ tab.groupName }}</span>
  51. <span class="tab-sub">{{ tab.remark }}</span>
  52. </button>
  53. </div>
  54. <div class="panel" role="tabpanel">
  55. <div class="panel-head">
  56. <div>
  57. <p class="panel-title">{{ activeTab.groupName }}</p>
  58. <p class="panel-subtitle">{{ activeTab.remark }}</p>
  59. </div>
  60. <div class="panel-meta">
  61. <span class="panel-count"
  62. >{{ activeTab.flowRespVOS.length }} 项</span
  63. >
  64. <span class="panel-note">流程与表单</span>
  65. </div>
  66. </div>
  67. <div class="items-grid">
  68. <div
  69. v-for="item in activeTab.flowRespVOS"
  70. :key="item.id"
  71. class="item-card"
  72. @click="go(item)"
  73. >
  74. <div class="item-top">
  75. <div class="item-icon">
  76. <Icon :icon="item.icon || 'mdi:file-document-outline'" />
  77. </div>
  78. </div>
  79. <div class="item-body">
  80. <p class="item-name">{{ item.flowName }}</p>
  81. <p class="item-desc">{{ item.remark || "暂无描述" }}</p>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <!-- 修复宽度:自适应包裹按钮 -->
  88. <Footer />
  89. </div>
  90. </template>
  91. <script setup>
  92. import Header from "@components/home/header.vue";
  93. import Footer from "@components/home/Footer.vue";
  94. import { computed, ref, onMounted } from "vue";
  95. import { Icon } from "@iconify/vue";
  96. import { getFlows } from "@/api/user";
  97. const tabs = ref([]);
  98. const activeKey = ref("all");
  99. const allTab = computed(() => {
  100. const flowRespVOS = tabs.value.flatMap((tab) => tab.flowRespVOS || []);
  101. return {
  102. groupName: "全部",
  103. remark: "全部流程",
  104. flowRespVOS,
  105. };
  106. });
  107. const activeTab = computed(() => {
  108. if (activeKey.value === "all") {
  109. return allTab.value;
  110. }
  111. return (
  112. tabs.value.find((tab) => tab.groupName === activeKey.value) || allTab.value
  113. );
  114. });
  115. const stats = [
  116. {
  117. icon: "mdi:clock-outline",
  118. title: "我的待办",
  119. number: "05",
  120. extra: "+2 今日",
  121. bgcolor: "#fff7ed",
  122. },
  123. {
  124. icon: "mdi:check-circle-outline",
  125. title: "已办事项",
  126. number: "128",
  127. bgcolor: "#eff6ff",
  128. },
  129. {
  130. icon: "mdi:arrow-right-bold-box-outline",
  131. title: "发起流程",
  132. number: "42",
  133. extra: "85% 准时",
  134. bgcolor: "#eff6ff",
  135. },
  136. {
  137. icon: "mdi:file-document-outline",
  138. title: "草箱箱",
  139. number: "03",
  140. bgcolor: "#fef3c7",
  141. },
  142. ];
  143. const getAll = async () => {
  144. const res = await getFlows({
  145. pageNo: 1,
  146. pageSize: 99,
  147. });
  148. tabs.value = res;
  149. };
  150. const setAll = () => {
  151. activeKey.value = "all";
  152. };
  153. const getById = (tab) => {
  154. activeKey.value = tab.groupName;
  155. };
  156. const go = (item) => {
  157. console.log("跳转", item);
  158. };
  159. onMounted(async () => {
  160. getAll();
  161. });
  162. </script>
  163. <style scoped>
  164. :global(body) {
  165. background-color: #f4f4f2;
  166. }
  167. /* .ehr-page {
  168. color: #1f2a37;
  169. background: linear-gradient(180deg, #f4f4f2 0%, #f7f6f3 50%, #f2f1ef 100%);
  170. min-height: 100vh;
  171. } */
  172. .hero {
  173. position: relative;
  174. padding: 72px 6vw 48px;
  175. overflow: hidden;
  176. margin-top: 20px;
  177. }
  178. .hero-inner {
  179. max-width: 920px;
  180. }
  181. .hero-title {
  182. font-size: clamp(18px, 2vw, 22px);
  183. line-height: 1.2;
  184. margin: 16px 0 12px;
  185. color: #111827;
  186. font-weight: bold;
  187. }
  188. .hero-desc {
  189. font-size: 16px;
  190. color: #4b5563;
  191. max-width: 720px;
  192. line-height: 1.8;
  193. }
  194. .hero-accent {
  195. position: absolute;
  196. top: -120px;
  197. right: -140px;
  198. width: 360px;
  199. height: 360px;
  200. background: radial-gradient(
  201. circle at 30% 30%,
  202. rgba(2, 64, 155, 0.25),
  203. transparent 65%
  204. );
  205. border-radius: 50%;
  206. opacity: 0.9;
  207. pointer-events: none;
  208. }
  209. .content {
  210. padding: 0 6vw 80px;
  211. /* height: 80vh; */
  212. }
  213. .tabs {
  214. display: grid;
  215. grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  216. gap: 16px;
  217. margin-bottom: 28px;
  218. }
  219. .tab {
  220. padding: 18px 20px;
  221. border-radius: 14px;
  222. /* border: 1px solid #e5e7eb; */
  223. background: #ffffff;
  224. text-align: left;
  225. transition: all 0.25s ease;
  226. cursor: pointer;
  227. box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
  228. }
  229. .tab:hover {
  230. transform: translateY(-2px);
  231. border-color: #02409b;
  232. }
  233. .tab.active {
  234. background: linear-gradient(135deg, #02409b 0%, #0b2f6d 60%, #0b1f45 100%);
  235. border-color: transparent;
  236. color: #f9fafb;
  237. box-shadow: 0 18px 36px rgba(2, 64, 155, 0.25);
  238. }
  239. .tab-title {
  240. display: block;
  241. font-weight: 600;
  242. font-size: 16px;
  243. margin-bottom: 6px;
  244. }
  245. .tab-sub {
  246. display: block;
  247. font-size: 12px;
  248. color: inherit;
  249. opacity: 0.75;
  250. }
  251. .panel {
  252. background: #ffffff;
  253. border-radius: 24px;
  254. padding: 28px 28px 32px;
  255. box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
  256. }
  257. .panel-head {
  258. display: flex;
  259. align-items: flex-start;
  260. justify-content: space-between;
  261. gap: 24px;
  262. padding-bottom: 20px;
  263. margin-bottom: 24px;
  264. }
  265. .panel-title {
  266. font-size: 22px;
  267. color: #111827;
  268. margin-bottom: 6px;
  269. }
  270. .panel-subtitle {
  271. color: #6b7280;
  272. font-size: 14px;
  273. }
  274. .panel-meta {
  275. text-align: right;
  276. color: #6b7280;
  277. font-size: 12px;
  278. }
  279. .panel-count {
  280. display: block;
  281. font-size: 20px;
  282. font-weight: 600;
  283. color: #111827;
  284. }
  285. .items-grid {
  286. display: grid;
  287. grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  288. gap: 16px;
  289. }
  290. .item-card {
  291. display: flex;
  292. flex-direction: column;
  293. gap: 18px;
  294. padding: 22px 22px 18px;
  295. border-radius: 22px;
  296. background: #ffffff;
  297. border: 1px solid #edf0f5;
  298. box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  299. transition:
  300. transform 0.2s ease,
  301. border-color 0.2s ease,
  302. box-shadow 0.2s ease;
  303. cursor: pointer;
  304. }
  305. .item-card:hover {
  306. transform: translateY(-3px);
  307. border-color: rgba(2, 64, 155, 0.25);
  308. box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  309. color: #02409b !important;
  310. }
  311. .item-top {
  312. display: flex;
  313. align-items: flex-start;
  314. justify-content: space-between;
  315. }
  316. .item-body {
  317. display: flex;
  318. flex-direction: column;
  319. gap: 8px;
  320. }
  321. .item-icon {
  322. width: 52px;
  323. height: 52px;
  324. border-radius: 16px;
  325. background: #f5f7fb;
  326. display: grid;
  327. place-items: center;
  328. font-size: 20px;
  329. }
  330. .item-icon :deep(svg) {
  331. width: 24px;
  332. height: 24px;
  333. }
  334. .item-role {
  335. font-size: 12px;
  336. letter-spacing: 0.2em;
  337. color: #c7ced9;
  338. font-weight: 600;
  339. }
  340. .item-name {
  341. font-size: 16px;
  342. line-height: 1.45;
  343. /* font-weight: 600; */
  344. }
  345. .item-desc {
  346. font-size: 13px;
  347. color: #6b7280;
  348. line-height: 1.6;
  349. }
  350. .item-footer {
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. color: #94a3b8;
  355. font-size: 12px;
  356. }
  357. .item-usage {
  358. display: inline-flex;
  359. align-items: center;
  360. gap: 8px;
  361. }
  362. .item-flame {
  363. width: 18px;
  364. height: 18px;
  365. border-radius: 50%;
  366. display: grid;
  367. place-items: center;
  368. background: rgba(255, 108, 0, 0.12);
  369. color: #ff6c00;
  370. font-size: 12px;
  371. }
  372. .item-arrow {
  373. font-size: 22px;
  374. color: #cbd5e1;
  375. }
  376. @media (max-width: 720px) {
  377. .hero {
  378. padding: 56px 7vw 36px;
  379. }
  380. .panel-head {
  381. flex-direction: column;
  382. align-items: flex-start;
  383. }
  384. .panel-meta {
  385. text-align: left;
  386. }
  387. }
  388. .total {
  389. display: flex;
  390. gap: 16px;
  391. padding: 0 6vw 80px;
  392. /* margin-bottom: 24px; */
  393. }
  394. .total-card {
  395. flex: 1;
  396. min-width: 0;
  397. background: #ffffff;
  398. border-radius: 16px;
  399. padding: 20px;
  400. box-shadow:
  401. rgba(0, 0, 0, 0.05) 0px 1px 3px 0px,
  402. rgba(0, 0, 0, 0) 0px 0px 0px 0px,
  403. rgba(0, 0, 0, 0.05) 0px 1px 2px 0px,
  404. rgba(0, 0, 0, 0.05) 0px 2px 4px -1px,
  405. rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
  406. transition:
  407. transform 0.2s ease,
  408. box-shadow 0.2s ease;
  409. cursor: pointer;
  410. /* border: 1px solid #e5e7eb; */
  411. /* border-top: solid 5px #02409b; */
  412. }
  413. .total-card:hover {
  414. transform: translateY(-4px);
  415. box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  416. }
  417. .card-icon {
  418. width: 40px;
  419. height: 40px;
  420. border-radius: 12px;
  421. background: #f9f9f9;
  422. display: flex;
  423. align-items: center;
  424. justify-content: center;
  425. margin-bottom: 12px;
  426. }
  427. .card-icon svg {
  428. width: 20px;
  429. height: 20px;
  430. color: var(--primary-color);
  431. }
  432. .card-content {
  433. flex: 1;
  434. text-align: left;
  435. }
  436. .card-title {
  437. font-size: 14px;
  438. color: #6b7280;
  439. margin-bottom: 4px;
  440. }
  441. .card-number {
  442. font-size: 28px;
  443. font-weight: 600;
  444. color: #111827;
  445. }
  446. .card-extra {
  447. font-size: 12px;
  448. color: #10b981;
  449. margin-top: 8px;
  450. text-align: right;
  451. }
  452. </style>