CardItem.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <el-card class="w-full min-w-0 relative" style="border: 0">
  3. <div
  4. class="relative overflow-hidden rounded-md mb-3 h-36 bg-cover bg-center"
  5. :style="{ backgroundImage: `url(${bg})` }"
  6. >
  7. <div class="absolute inset-0 bg-white/0"></div>
  8. <div
  9. class="relative h-full flex items-center gap-3 px-4 cursor-pointer"
  10. @click="goDetail"
  11. >
  12. <div class="min-w-0 flex-1">
  13. <div class="text-[20px] font-bold text-[#0050b3]">{{ title }}</div>
  14. <div class="text-[#606266] text-sm mt-1 leading-snug">{{ desc }}</div>
  15. </div>
  16. </div>
  17. </div>
  18. <!-- 九宫格布局 -->
  19. <div class="p-4">
  20. <div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
  21. <div
  22. v-for="(item, index) in items"
  23. :key="index"
  24. class="relative bg-gray-50 rounded-lg p-3 text-center cursor-pointer group transform transition-transform duration-200 hover:bg-blue-50 hover:scale-105 hover:shadow-lg"
  25. @mouseenter="showTooltip(index)"
  26. @mouseleave="hideTooltip"
  27. @click="handleView(item)"
  28. >
  29. <div class="flex flex-col items-center">
  30. <!-- 功能图标占位符 -->
  31. <div
  32. class="w-13 h-13 bg-blue-100 rounded-lg flex items-center justify-center mb-2 mx-auto transition-colors"
  33. >
  34. <img
  35. :src="getIconByLabel(item.label)"
  36. :alt="`${item.label} Logo`"
  37. class="w-full h-full object-contain"
  38. />
  39. </div>
  40. <!-- 功能名称 -->
  41. <span
  42. :class="[
  43. 'text-sm w-full px-1',
  44. isSpecialSystem(item.label)
  45. ? 'font-bold text-gray-800'
  46. : 'text-gray-700',
  47. ]"
  48. >
  49. {{ item.label }}
  50. </span>
  51. <!-- 标签 -->
  52. <span
  53. v-if="item.tag"
  54. class="mt-1 text-xs px-2 py-0.5 rounded-full bg-red-100 text-red-700"
  55. >
  56. {{ item.tag }}
  57. </span>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="h-[50px] mt-20"></div>
  63. <div
  64. class="absolute bottom-0 left-0 w-full h-36 bg-contain bg-center no-repeat"
  65. :style="{ backgroundImage: `url(${bg2[0]})` }"
  66. ></div>
  67. </el-card>
  68. </template>
  69. <script setup lang="ts">
  70. import { ref } from "vue";
  71. import { useRouter } from "vue-router";
  72. import { ssoLogin } from "@/api/user";
  73. import { useUserStore } from "@/stores/useUserStore";
  74. import { getAccessToken } from "@/utils/auth";
  75. // 导入所有图标
  76. import oaimage from "@/assets/images/oa.png";
  77. import crmimage from "@/assets/images/crm.png";
  78. import ehrimage from "@/assets/images/ehr.png";
  79. import scmimage from "@/assets/images/scm.png";
  80. import erpimage from "@/assets/images/erp.jpg"; // 财务管理系统
  81. import driveimage from "@/assets/images/drive.png"; // 经营驾驶舱
  82. import zhanlueimage from "@/assets/images/zhanlue.jpeg"; // 战略解码
  83. import jishuimage from "@/assets/images/jishu.jpeg"; // 技术研发管理
  84. import zuzhiimage from "@/assets/images/zuzhi.png"; // 组织资产管理
  85. import safeimage from "@/assets/images/safe.png"; // 安全合规管理
  86. import pmsimage from "@/assets/images/pms.jpeg"; // 设备管理
  87. import zhonghangimage from "@/assets/images/中航.png"; // 中航北斗
  88. import lianyouimage from "@/assets/images/lianyou.jpeg"; // 智能连油
  89. import qhseimage from "@/assets/images/qhse.jpeg"; // qhse
  90. import zuanjingimage from "@/assets/images/zuanjing.jpeg"; //智能钻井
  91. import yalieimage from "@/assets/images/yalie.png"; //智能压裂
  92. import zhuqiimage from "@/assets/images/zhuqi.png"; //智能注气
  93. import pmimage from "@/assets/images/pm.png"; // 项目管理
  94. import dataimage from "@/assets/images/data.png"; // 全局数据治理
  95. import thinkimage from "@/assets/images/think.png"; // 智能决策
  96. import aiimage from "@/assets/images/ai.png"; // AI大模型
  97. import agentimage from "@/assets/images/agent.jpeg"; // ai智能体
  98. const userStore = useUserStore();
  99. const router = useRouter();
  100. // 控制弹出框显示
  101. const currentTooltipIndex = ref<number | null>(null);
  102. const showTooltip = (index: number) => {
  103. currentTooltipIndex.value = index;
  104. };
  105. const hideTooltip = () => {
  106. currentTooltipIndex.value = null;
  107. };
  108. type Item = { label: string; tag?: "新" | "热" };
  109. const props = defineProps<{
  110. title: string;
  111. desc: string;
  112. items: Item[];
  113. bg: string;
  114. bg2: string[];
  115. id: string;
  116. }>();
  117. // 创建图标映射表
  118. const iconMap: Record<string, string> = {
  119. "OA办公系统": oaimage,
  120. "经营驾驶舱": driveimage,
  121. "战略解码与执行": zhanlueimage,
  122. "财务管理(收入、成本、应收账款)": erpimage,
  123. "技术研发管理": jishuimage,
  124. "客户管理(CRM)": crmimage,
  125. "人力资源(EHR)": ehrimage,
  126. "供应链管理(SCM)": scmimage,
  127. "组织资产管理": zuzhiimage,
  128. "风控、合规管理": safeimage,
  129. "中航北斗智慧管理系统": zhonghangimage,
  130. "智能钻井系统": zuanjingimage,
  131. "智能压裂系统": yalieimage,
  132. "智能注气系统": zhuqiimage,
  133. "智能连油系统": lianyouimage,
  134. "QHSE (安全监控、应急指挥)": qhseimage,
  135. "设备管理系统 (PMS)": pmsimage,
  136. "项目管理 (PM)": pmimage,
  137. "全局数据治理 (数据中台)": dataimage,
  138. "智能决策": thinkimage,
  139. "行业AI大模型": aiimage,
  140. "AI智能体 (智能交互)": agentimage,
  141. };
  142. const isSpecialSystem = (label: string) => {
  143. const specialSystems = [
  144. "OA办公系统",
  145. "客户管理(CRM)",
  146. "设备管理系统 (PMS)",
  147. "中航北斗智慧管理系统",
  148. "智能连油系统",
  149. ];
  150. return specialSystems.includes(label);
  151. };
  152. // 根据标签获取对应图标
  153. const getIconByLabel = (label: string) => {
  154. return iconMap[label] || oaimage; // 默认返回oa图标,以防某些标签没有对应图标
  155. };
  156. const goDetail = () => {
  157. if (props.id === "management") {
  158. router.push({ path: "/management" });
  159. } else if (props.id === "command") {
  160. router.push({ path: "/command" });
  161. } else if (props.id === "chatbi") {
  162. router.push({ path: "/chatbi" });
  163. }
  164. };
  165. // 处理查看按钮点击事件
  166. const handleView = async (item: Item) => {
  167. console.log("查看", item);
  168. console.log("*************************", userStore.getUser.username);
  169. if (item.label === "OA办公系统") {
  170. if (userStore.getUser.username && getAccessToken()) {
  171. const res = await ssoLogin({
  172. username: userStore.getUser.username,
  173. });
  174. if (res) {
  175. window.open(
  176. "https://yfoa.keruioil.com/wui/index.html?ssoToken=" + res + "#/main",
  177. "_blank"
  178. );
  179. }
  180. } else {
  181. console.log("未登录》》》》》》》》》》》");
  182. window.open("https://yfoa.keruioil.com", "_blank");
  183. }
  184. }
  185. if (item.label === "设备管理系统 (PMS)") {
  186. if (userStore.getUser.username && getAccessToken()) {
  187. // window.open(
  188. // "https://iot.deepoil.cc/portalLogin?username=" +
  189. // userStore.getUser.username,
  190. // "_blank"
  191. // );
  192. window.open(
  193. import.meta.env.VITE_PMS_URL +
  194. "/portalLogin?username=" +
  195. userStore.getUser.username,
  196. "_blank"
  197. );
  198. } else {
  199. console.log("未登录");
  200. window.open(import.meta.env.VITE_PMS_URL, "_blank");
  201. }
  202. }
  203. if (item.label === "中航北斗智慧管理系统") {
  204. window.open("https://zhbdgps.cn", "_blank");
  205. }
  206. if (item.label === "客户管理(CRM)") {
  207. window.open("https://www.xiaoshouyi.com/sfa", "_blank");
  208. }
  209. if (item.label === "智能连油系统") {
  210. const extraParam = "source=zhly";
  211. if (userStore.getUser.username && getAccessToken()) {
  212. window.open(
  213. import.meta.env.VITE_PMS_URL +
  214. "/portalLogin?username=" +
  215. userStore.getUser.username +
  216. "&" +
  217. extraParam,
  218. "_blank"
  219. );
  220. } else {
  221. router.push({ path: "/login" });
  222. // window.open(import.meta.env.VITE_PMS_URL + "?" + extraParam, "_blank");
  223. }
  224. }
  225. };
  226. </script>
  227. <style scoped>
  228. :deep(.el-card) {
  229. width: 100%;
  230. min-width: 0;
  231. overflow: hidden;
  232. }
  233. :deep(.el-card__body) {
  234. width: 100%;
  235. min-width: 0;
  236. padding: 0;
  237. }
  238. /* 弹出框向上淡入动画 */
  239. .tooltip-fade-enter-active {
  240. transition: all 0.3s ease;
  241. }
  242. .tooltip-fade-leave-active {
  243. transition: all 0.2s ease;
  244. }
  245. .tooltip-fade-enter-from {
  246. opacity: 0;
  247. transform: translate(-50%, 10px);
  248. }
  249. .tooltip-fade-leave-to {
  250. opacity: 0;
  251. transform: translate(-50%, 10px);
  252. }
  253. </style>