statisticsTabs.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="statistics-tabs">
  3. <el-row :gutter="16" type="flex">
  4. <el-col v-for="(tab, index) in tabList" :key="index" :span="4">
  5. <el-dropdown
  6. v-if="tab.children && tab.children.length"
  7. placement="bottom"
  8. @command="commandHandler"
  9. >
  10. <div :class="['tab-bar', { 'tab-active': activeIndex === index }]">
  11. <img
  12. class="tab-icon"
  13. :src="activeIndex === index ? activeIcon : defaultIcon"
  14. :alt="tab.title"
  15. />
  16. <el-tooltip :content="tab.title" placement="top">
  17. <span class="tab-title">{{ tab.title }}</span>
  18. </el-tooltip>
  19. <i class="icon-arrow el-icon-caret-bottom" />
  20. </div>
  21. <el-dropdown-menu slot="dropdown">
  22. <el-dropdown-item
  23. v-for="(childTab, childIndex) in tab.children"
  24. :key="childIndex"
  25. :command="[tab.path, childTab.path]"
  26. >{{ childTab.title }}</el-dropdown-item
  27. >
  28. </el-dropdown-menu>
  29. </el-dropdown>
  30. <div
  31. v-else
  32. :class="[
  33. 'tab-bar tab-bar-single',
  34. { 'tab-active': activeIndex === index },
  35. ]"
  36. @click="clickHandler(tab.path)"
  37. >
  38. <img
  39. class="tab-icon"
  40. :src="activeIndex === index ? activeIcon : defaultIcon"
  41. :alt="tab.title"
  42. />
  43. <el-tooltip :content="tab.title" placement="top">
  44. <span class="tab-title">{{ tab.title }}</span>
  45. </el-tooltip>
  46. </div>
  47. </el-col>
  48. </el-row>
  49. </div>
  50. </template>
  51. <script>
  52. export default {
  53. name: "StatisticsTabs",
  54. data() {
  55. return {
  56. defaultIcon: require("@/assets/nav/ic_statistical_top_default.png"),
  57. activeIcon: require("@/assets/nav/ic_statistical_top_check.png"),
  58. tabList: [
  59. {
  60. title: "航司行李相关统计",
  61. path: "/statisticsCharts/airlineCompany",
  62. children: [
  63. {
  64. path: "flight",
  65. title: "航班量统计",
  66. },
  67. {
  68. path: "baggage",
  69. title: "行李量统计",
  70. },
  71. {
  72. path: "baggagePassenger",
  73. title: "行李旅客量统计",
  74. },
  75. {
  76. path: "specialBaggage",
  77. title: "特殊行李量统计",
  78. },
  79. {
  80. path: "baggageAverage",
  81. title: "平均行李量统计",
  82. },
  83. {
  84. path: "abnormalBaggage",
  85. title: "异常行李量统计",
  86. },
  87. {
  88. path: "complaintBaggage",
  89. title: "投诉行李量统计",
  90. },
  91. {
  92. path: "compensationBaggage",
  93. title: "赔偿行李量统计",
  94. },
  95. {
  96. path: "compensation",
  97. title: "赔偿金额统计",
  98. },
  99. ],
  100. },
  101. {
  102. path: "/statisticsCharts/passengerClassification",
  103. title: "旅客分类统计",
  104. children: [
  105. {
  106. path: "baggage",
  107. title: "行李量统计",
  108. },
  109. {
  110. path: "baggagePassenger",
  111. title: "行李旅客量统计",
  112. },
  113. {
  114. path: "specialBaggage",
  115. title: "特殊行李量统计",
  116. },
  117. {
  118. path: "abnormalBaggage",
  119. title: "异常行李量统计",
  120. },
  121. {
  122. path: "complaintBaggage",
  123. title: "投诉行李量统计",
  124. },
  125. {
  126. path: "compensationBaggage",
  127. title: "赔偿行李量统计",
  128. },
  129. {
  130. path: "compensation",
  131. title: "赔偿金额统计",
  132. },
  133. ],
  134. },
  135. {
  136. path: "/statisticsCharts/flightClassification",
  137. title: "航班分类相关统计",
  138. children: [
  139. {
  140. path: "flight",
  141. title: "航班量统计",
  142. },
  143. {
  144. path: "baggage",
  145. title: "行李量统计",
  146. },
  147. {
  148. path: "passenger",
  149. title: "行李旅客量统计",
  150. },
  151. ],
  152. },
  153. {
  154. path: "/statisticsCharts/node",
  155. title: "扫描节点与位置分析",
  156. },
  157. {
  158. title: "报表统计",
  159. path: "/statisticsCharts/report",
  160. children: [
  161. {
  162. path: "reportStatistics",
  163. title: "运送效率报表统计",
  164. },
  165. {
  166. path: "transitTable",
  167. title: "中转专项报表统计",
  168. },
  169. {
  170. path: "ScanningStatistics",
  171. title: "航站BRS扫描统计",
  172. },
  173. ],
  174. },
  175. {
  176. title: "特殊赔偿异常分类统计",
  177. path: "/statisticsCharts/specialClassification",
  178. children: [
  179. {
  180. path: "special",
  181. title: "特殊行李分类统计",
  182. },
  183. {
  184. path: "abnormal",
  185. title: "异常行李分类统计",
  186. },
  187. {
  188. path: "compensationBaggage",
  189. title: "赔偿行李分类统计",
  190. },
  191. {
  192. path: "compensation",
  193. title: "赔偿金额分类统计",
  194. },
  195. ],
  196. },
  197. {
  198. path: "/statisticsCharts/statisticalAnalysis",
  199. title: "统计分析",
  200. },
  201. ],
  202. activeIndex: null,
  203. };
  204. },
  205. watch: {
  206. "$route.path": {
  207. handler(path) {
  208. let activeIndex = null;
  209. this.tabList.some((tab, index) => {
  210. if (path.includes(tab.path)) {
  211. activeIndex = index;
  212. return true;
  213. }
  214. });
  215. this.activeIndex = activeIndex;
  216. },
  217. immediate: true,
  218. },
  219. },
  220. methods: {
  221. commandHandler(pathArray) {
  222. if (pathArray.some((path) => !path)) {
  223. this.$message.info("开发中");
  224. return;
  225. }
  226. this.$router.push({
  227. path: pathArray.join("/"),
  228. });
  229. },
  230. clickHandler(path) {
  231. if (!path) {
  232. this.$message.info("开发中");
  233. return;
  234. }
  235. this.$router.push({
  236. path,
  237. });
  238. },
  239. },
  240. };
  241. </script>
  242. <style lang="scss" scoped>
  243. .statistics-tabs {
  244. > .el-row > .el-col {
  245. max-width: 232px;
  246. min-width: 175px;
  247. .el-dropdown {
  248. width: 100%;
  249. }
  250. .tab-bar {
  251. width: 100%;
  252. height: 56px;
  253. background-color: #ffffff;
  254. padding-left: 16px;
  255. padding-right: 16px;
  256. display: flex;
  257. align-items: center;
  258. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  259. border-radius: 4px;
  260. &-single {
  261. cursor: pointer;
  262. }
  263. &:not(:last-child) {
  264. margin-right: 16px;
  265. }
  266. .tab-icon {
  267. width: 14px;
  268. height: 14px;
  269. }
  270. .tab-title {
  271. padding-left: 12px;
  272. padding-right: 8px;
  273. font-size: 14px;
  274. font-family: Helvetica, "Microsoft YaHei";
  275. font-weight: bold;
  276. color: #101116;
  277. letter-spacing: 0;
  278. overflow: hidden;
  279. white-space: nowrap;
  280. text-overflow: ellipsis;
  281. }
  282. &.tab-active {
  283. background-color: #2d67e3;
  284. .tab-title {
  285. color: #ffffff;
  286. }
  287. }
  288. .icon-arrow {
  289. position: absolute;
  290. right: 16px;
  291. color: #101116;
  292. font-size: 14px;
  293. transition: transform 0.3s;
  294. }
  295. &.tab-active .icon-arrow {
  296. color: #ffffff;
  297. }
  298. &:hover .icon-arrow {
  299. transform: rotate(180deg);
  300. }
  301. }
  302. }
  303. }
  304. </style>