【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

344 lines
9.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <el-row :gutter="20" class="panel-group" type="flex" justify="space-between">
  3. <el-col class="card-panel-col">
  4. <div class="card-panel danganzongliang" @click="handleSetLineChartData('archives')">
  5. <div class="card-panel-icon-wrapper icon-people">
  6. <svg-icon icon-class="danganzongliang" class-name="card-panel-icon" />
  7. </div>
  8. <div class="card-panel-description">
  9. <div class="card-panel-text">
  10. <count-to :start-val="0" :end-val="archivesNum" :duration="3200" class="card-panel-num" />
  11. </div>
  12. 档案总量
  13. </div>
  14. </div>
  15. </el-col>
  16. <el-col class="card-panel-col">
  17. <div class="card-panel danganhezongliang" @click="handleSetLineChartData('case')">
  18. <div class="card-panel-icon-wrapper icon-message">
  19. <svg-icon icon-class="danganhezongliang" class-name="card-panel-icon" />
  20. </div>
  21. <div class="card-panel-description">
  22. <div class="card-panel-text">
  23. <count-to :start-val="0" :end-val="caseNum" :duration="3200" class="card-panel-num" />
  24. </div>
  25. 档案盒总量
  26. </div>
  27. </div>
  28. </el-col>
  29. <el-col class="card-panel-col">
  30. <div class="card-panel quanbushebei" @click="handleSetLineChartData('device')">
  31. <div class="card-panel-icon-wrapper icon-money">
  32. <svg-icon icon-class="quanbushebei" class-name="card-panel-icon" />
  33. </div>
  34. <div class="card-panel-description">
  35. <div class="card-panel-text">
  36. <count-to v-if="getDeviceFlag" :start-val="0" :end-val="totalDeviceNum" :duration="3200" class="card-panel-num" />
  37. <div v-if="!getDeviceFlag" class="card-panel-text"><span class="card-panel-num">获取中...</span></div>
  38. </div>
  39. 全部设备
  40. </div>
  41. </div>
  42. </el-col>
  43. <el-col class="card-panel-col">
  44. <div class="card-panel zaixianshebei" @click="handleSetLineChartData('device')">
  45. <div class="card-panel-icon-wrapper icon-shopping">
  46. <svg-icon icon-class="zaixianshebei" class-name="card-panel-icon" />
  47. </div>
  48. <div class="card-panel-description">
  49. <div class="card-panel-text">
  50. <count-to v-if="getDeviceFlag" :start-val="0" :end-val="onlineDeviceNum" :duration="3200" class="card-panel-num" />
  51. <div v-if="!getDeviceFlag" class="card-panel-text"><span class="card-panel-num">获取中...</span></div>
  52. </div>
  53. 在线设备
  54. </div>
  55. </div>
  56. </el-col>
  57. <el-col class="card-panel-col">
  58. <div class="card-panel lixianshebei" @click="handleSetLineChartData('device')">
  59. <div class="card-panel-icon-wrapper icon-shopping">
  60. <svg-icon icon-class="lixianshebei" class-name="card-panel-icon" />
  61. </div>
  62. <div class="card-panel-description">
  63. <div class="card-panel-text">
  64. <count-to v-if="getDeviceFlag" :start-val="0" :end-val="offlineDeviceNum" :duration="3200" class="card-panel-num" />
  65. <div v-if="!getDeviceFlag" class="card-panel-text"><span class="card-panel-num">获取中...</span></div>
  66. </div>
  67. 离线设备
  68. </div>
  69. </div>
  70. </el-col>
  71. </el-row>
  72. </template>
  73. <script>
  74. import CountTo from 'vue-count-to'
  75. import { FetchGetArchivesNum, FetchGetCaseNum } from '@/api/archivesManage/statistics'
  76. import { getDeviceList } from '@/api/storeManage/deviceManage/device'
  77. import { getOnlineDevice } from '@/api/home/device'
  78. import { mapGetters } from 'vuex'
  79. export default {
  80. components: {
  81. CountTo
  82. },
  83. data() {
  84. return {
  85. archivesNum: 0,
  86. caseNum: 0,
  87. getDeviceFlag: false,
  88. totalDeviceNum: 0,
  89. onlineDeviceNum: 0,
  90. offlineDeviceNum: 0
  91. }
  92. },
  93. computed: {
  94. ...mapGetters([
  95. 'roles'
  96. ])
  97. },
  98. mounted() {
  99. this.handleArchivesNum()
  100. this.handleCaseNum()
  101. this.handleTotalDeviceNum()
  102. },
  103. methods: {
  104. handleSetLineChartData(type) {
  105. // this.$emit('handleSetLineChartData', type)
  106. if (type === 'archives') {
  107. if (this.roles.includes('archivesList:list') || this.roles.includes('admin')) {
  108. this.$router.push({
  109. name: 'ArchivesList'
  110. })
  111. } else {
  112. this.$message({
  113. message: '当前账号没有权限',
  114. type: 'warning'
  115. })
  116. }
  117. } else if (type === 'case') {
  118. if (this.roles.includes('caseManage:list') || this.roles.includes('admin')) {
  119. this.$router.push({
  120. name: 'caseManage'
  121. })
  122. } else {
  123. this.$message({
  124. message: '当前账号没有权限',
  125. type: 'warning'
  126. })
  127. }
  128. } else if (type === 'device') {
  129. if (this.roles.includes('deviceManage:list') || this.roles.includes('admin')) {
  130. this.$router.push({
  131. name: 'DeviceManage'
  132. })
  133. } else {
  134. this.$message({
  135. message: '当前账号没有权限',
  136. type: 'warning'
  137. })
  138. }
  139. }
  140. },
  141. // 档案总数
  142. handleArchivesNum() {
  143. FetchGetArchivesNum().then(data => {
  144. this.archivesNum = data
  145. })
  146. },
  147. // 档案盒总数
  148. handleCaseNum() {
  149. FetchGetCaseNum().then(data => {
  150. this.caseNum = data
  151. })
  152. },
  153. // 设备总数,在线设备数,离线设备数
  154. handleTotalDeviceNum() {
  155. Promise.all([getDeviceList({ page: 0, size: 10 }), getOnlineDevice()]).then((result) => {
  156. this.getDeviceFlag = true
  157. this.totalDeviceNum = result[0].totalElements
  158. this.onlineDeviceNum = result[1]
  159. this.offlineDeviceNum = this.totalDeviceNum - this.onlineDeviceNum
  160. })
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .panel-group {
  167. .card-panel-col {
  168. margin-bottom: 20px;
  169. }
  170. .card-panel {
  171. cursor: pointer;
  172. height: 100px;
  173. // height: 108px;
  174. // cursor: pointer;
  175. font-size: 15px;
  176. position: relative;
  177. overflow: hidden;
  178. opacity: 0.86;
  179. // box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
  180. // border-color: rgba(0, 0, 0, .05);
  181. &.danganzongliang {
  182. color: #21aae1;
  183. background: linear-gradient(
  184. 180deg,
  185. rgba(51, 159, 210, 0.5) 0%,
  186. rgba(56, 158, 225, 0) 100%
  187. );
  188. border-top: 2px #21aae1 solid;
  189. & span.card-panel-num {
  190. background: linear-gradient(180deg, #ffffff 0%, #21aae1 100%);
  191. }
  192. }
  193. &.danganhezongliang {
  194. color: #793cba;
  195. background: linear-gradient(
  196. 180deg,
  197. rgba(121, 60, 186, 0.5) 0%,
  198. rgba(121, 60, 186, 0) 100%
  199. );
  200. border-top: 2px #793cba solid;
  201. & span.card-panel-num {
  202. background: linear-gradient(180deg, #ffffff 0%, #793cba 100%);
  203. }
  204. }
  205. &.quanbushebei {
  206. color: #008e81;
  207. background: linear-gradient(
  208. 180deg,
  209. rgba(0, 142, 129, 0.5) 0%,
  210. rgba(0, 142, 129, 0) 100%
  211. );
  212. border-top: 2px #008e81 solid;
  213. & span.card-panel-num {
  214. background: linear-gradient(180deg, #ffffff 0%, #008e81 100%);
  215. }
  216. }
  217. &.zaixianshebei {
  218. color: #c4c859;
  219. background: linear-gradient(
  220. 180deg,
  221. rgba(196, 200, 89, 0.5) 0%,
  222. rgba(196, 200, 89, 0) 100%
  223. );
  224. border-top: 2px #c4c859 solid;
  225. & span.card-panel-num {
  226. background: linear-gradient(180deg, #ffffff 0%, #bfc458 100%);
  227. }
  228. }
  229. &.lixianshebei {
  230. color: #f65164;
  231. background: linear-gradient(
  232. 180deg,
  233. rgba(246, 81, 100, 0.5) 0%,
  234. rgba(247, 80, 100, 0) 100%
  235. );
  236. border-top: 2px #f65164 solid;
  237. & span.card-panel-num {
  238. background: linear-gradient(180deg, #ffffff 0%, #f55164 100%);
  239. }
  240. }
  241. // &:hover {
  242. // .card-panel-icon-wrapper {
  243. // color: #fff;
  244. // }
  245. // .icon-people {
  246. // background: #40c9c6;
  247. // }
  248. // .icon-message {
  249. // background: #36a3f7;
  250. // }
  251. // .icon-money {
  252. // background: #f4516c;
  253. // }
  254. // .icon-shopping {
  255. // background: #34bfa3
  256. // }
  257. // }
  258. // .icon-danganzongliang {
  259. // color: #21AAE1;
  260. // }
  261. // .icon-danganhezongliang {
  262. // color: #793CBA;
  263. // }
  264. // .icon-quanbushebei {
  265. // color: #008E81;
  266. // }
  267. // .icon-zaixianshebei {
  268. // color: #C4C859
  269. // }
  270. // .icon-lixianshebei {
  271. // color: #F65164
  272. // }
  273. .card-panel-icon-wrapper {
  274. float: left;
  275. margin: 0 10px 0 12px;
  276. padding: 20px;
  277. transition: all 0.38s ease-out;
  278. border-radius: 6px;
  279. }
  280. .card-panel-icon {
  281. float: left;
  282. font-size: 60px;
  283. }
  284. .card-panel-description {
  285. // float: right;
  286. // font-weight: bold;
  287. margin: 19px;
  288. margin-left: 0px;
  289. .card-panel-text {
  290. line-height: 30px;
  291. color: rgba(0, 0, 0, 0.45);
  292. font-size: 28px;
  293. margin-bottom: 11px;
  294. & span {
  295. // background: linear-gradient(180deg, #FFFFFF 0%, #21AAE1 100%);
  296. -webkit-background-clip: text;
  297. color: transparent;
  298. font-weight: bold;
  299. }
  300. }
  301. // .card-panel-num {
  302. // font-size: 20px;
  303. // }
  304. }
  305. }
  306. }
  307. @media (max-width: 550px) {
  308. .card-panel-description {
  309. display: none;
  310. }
  311. .card-panel-icon-wrapper {
  312. float: none !important;
  313. width: 100%;
  314. height: 100%;
  315. margin: 0 !important;
  316. .svg-icon {
  317. display: block;
  318. margin: 14px auto !important;
  319. float: none !important;
  320. }
  321. }
  322. }
  323. </style>