index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <div class="performance">
  3. <div class="main-container">
  4. <div
  5. class="card"
  6. v-for="(item, index) in titleList"
  7. :class="index === active ? 'actived' : 'isActived'"
  8. :key="index"
  9. @click="getDetails(index)"
  10. >
  11. <div class="card-t">{{ item.sysOrgName }}</div>
  12. <div class="card-b">
  13. <div class="box" v-for="(items, ind) in item.tab" :key="ind" @click="getToggle(ind)">
  14. <div class="img" :class="ind === toggleItem ? 'isPic' : 'pic'"> <img :src="items.src" alt="" /> </div>
  15. <div class="text">{{ items.text }}</div>
  16. <div class="num" :class="ind === toggleItem ? 'isNum' : 'nums'">{{ items.num }}</div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script lang="ts" setup>
  24. import { reactive, ref, onMounted } from 'vue';
  25. import { useRouter } from 'vue-router';
  26. import leftImg from '../../../../assets/images/files/homes/file.svg';
  27. import rightImg from '../../../../assets/images/files/homes/sp.svg';
  28. import { list } from './fileIndex.api';
  29. let router = useRouter(); //路由
  30. let active = ref(); //当前选中项
  31. let toggleItem = ref(); //当前选中子项
  32. let titleList = reactive<any[]>([]);
  33. //获取首页数据
  34. let getPageList = async () => {
  35. let data = await list();
  36. console.log(data, '首页数据');
  37. if (data.length !== 0) {
  38. let datas = data.map((el) => {
  39. return {
  40. sysOrgName: el.sysOrgName,
  41. tab: [
  42. { src: leftImg, text: '文档总数', num: el.tolalNum },
  43. { src: rightImg, text: '待审批数', num: el.approveNum },
  44. ],
  45. };
  46. });
  47. titleList.push(...datas);
  48. console.log(titleList, '123456');
  49. }
  50. };
  51. //切换选项
  52. let getDetails = (index) => {
  53. console.log('详情跳转');
  54. active.value = index;
  55. router.push('/fileManager/fileDetail');
  56. };
  57. //切换左右选项
  58. let getToggle = (ind) => {
  59. console.log(ind);
  60. toggleItem.value = ind;
  61. };
  62. onMounted(() => {
  63. getPageList();
  64. });
  65. </script>
  66. <style lang="less" scoped>
  67. @font-face {
  68. font-family: 'douyuFont';
  69. src: url(../../../../assets/images/files/douyuFont.otf);
  70. }
  71. .performance {
  72. width: 100%;
  73. height: 100%;
  74. padding: 15px;
  75. position: relative;
  76. box-sizing: border-box;
  77. background: url(../../../../assets/images/files/homes/bd.png) no-repeat center;
  78. .main-container {
  79. width: 100%;
  80. height: calc(100% - 30px);
  81. display: flex;
  82. flex-direction: row;
  83. justify-content: flex-start;
  84. align-items: flex-start;
  85. flex-wrap: wrap;
  86. .card {
  87. width: 331px;
  88. height: 235px;
  89. background: url(../../../../assets/images/files/homes/default.png) no-repeat center;
  90. background-size: 100% 100%;
  91. margin: 0px 23px 15px 23px;
  92. cursor: pointer;
  93. .card-t {
  94. height: 50px;
  95. display: flex;
  96. justify-content: center;
  97. align-items: center;
  98. font-family: '思源黑体', 'Microsoft Yahei';
  99. font-size: 20px;
  100. color: #fff;
  101. }
  102. .card-b {
  103. height: calc(100% - 65px);
  104. margin-top: 15px;
  105. display: flex;
  106. flex-direction: row;
  107. .box {
  108. display: flex;
  109. flex: 1;
  110. flex-direction: column;
  111. justify-content: flex-start;
  112. align-items: center;
  113. .img {
  114. position: relative;
  115. width: 72px;
  116. height: 78px;
  117. background: url(../../../../assets/images/files/homes/file1.png) no-repeat center;
  118. img {
  119. position: absolute;
  120. left: 50%;
  121. top: 50%;
  122. transform: translate(-50%, -75%);
  123. }
  124. }
  125. .pic {
  126. width: 72px;
  127. height: 78px;
  128. background: url(../../../../assets/images/files/homes/file1.png) no-repeat center;
  129. background-size: 100% 100%;
  130. }
  131. .isPic {
  132. width: 72px;
  133. height: 78px;
  134. background: url(../../../../assets/images/files/homes/sp.png) no-repeat center;
  135. background-size: 100% 100%;
  136. }
  137. .text {
  138. margin: 5px 0px;
  139. font-family: '思源黑体', 'Microsoft Yahei';
  140. color: #fff;
  141. font-size: 14px;
  142. }
  143. .num {
  144. width: 120px;
  145. height: 30px;
  146. font-family: 'douyuFont';
  147. color: #fff;
  148. font-size: 20px;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. background: url(../../../../assets/images/files/homes/file2.png) no-repeat center;
  153. }
  154. .nums {
  155. width: 120px;
  156. height: 30px;
  157. background: url(../../../../assets/images/files/homes/file2.png) no-repeat center;
  158. }
  159. .isNum {
  160. width: 120px;
  161. height: 30px;
  162. background: url(../../../../assets/images/files/homes/sp2.png) no-repeat center;
  163. }
  164. }
  165. }
  166. }
  167. .actived {
  168. background: url(../../../../assets/images/files/homes/mouse.png) no-repeat center;
  169. background-size: 100% 100%;
  170. }
  171. .isActived {
  172. background: url(../../../../assets/images/files/homes/default.png) no-repeat center;
  173. background-size: 100% 100%;
  174. }
  175. }
  176. }
  177. </style>