statisticsTabs.vue 9.3 KB

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