阅行客电子档案
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.

389 lines
12 KiB

2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="dashboard-container">
  3. <div class="dashboard-editor-container">
  4. <panel-group :top-object-num="topObjectNum" />
  5. <el-row :gutter="20" style="margin-bottom:20px;height: calc(50vh - 174px);">
  6. <el-col :xs="24" :sm="24" :lg="12">
  7. <div class="container-wrap">
  8. <span class="right-top-line" />
  9. <span class="left-bottom-line" />
  10. <h3 class="home-item-title">
  11. 流程中心
  12. </h3>
  13. <div class="home-flowable" style="height: calc(100% - 54px); overflow-x: hidden;">
  14. <div class="home-tab">
  15. <span :class="{'home-tab-active': flowableTabIndex == 0}">待处理({{ flowableData.length !==0? flowableData.length: 0 }})</span>
  16. <span :class="{'home-tab-active': flowableTabIndex == 1}" @click="toMoreProcess">更多流程</span>
  17. </div>
  18. <div class="home-flowable-list" style="height: calc(100% - 45px); overflow-y: auto; overflow-x: hidden;">
  19. <el-table v-if="flowableData.length !== 0" height="calc(100%)" :data="flowableData" stripe style="width: 100%">
  20. <el-table-column prop="title" label="标题" />
  21. <el-table-column prop="applicant" label="申请人" width="100" />
  22. <el-table-column prop="createTime" label="申请时间" width="180">
  23. <template slot-scope="scope">
  24. <div>{{ scope.row.createTime | parseTime }}</div>
  25. </template>
  26. </el-table-column>
  27. </el-table>
  28. <div v-else class="empty-main" style="height: 100%;">
  29. <svg-icon icon-class="empty" class-name="empty-img" />
  30. <p>暂无数据</p>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </el-col>
  36. <el-col :xs="24" :sm="24" :lg="12">
  37. <div class="container-wrap">
  38. <span class="right-top-line" />
  39. <span class="left-bottom-line" />
  40. <h3 class="home-item-title">
  41. 服务器监控
  42. </h3>
  43. <!-- <div class="chart-wrapper"> -->
  44. <serverProgress :system-data="systemData" />
  45. <!-- </div> -->
  46. </div>
  47. </el-col>
  48. </el-row>
  49. <el-row :gutter="20" style="height:calc(50vh - 174px);">
  50. <el-col :xs="24" :sm="24" :lg="8">
  51. <!-- 档案借阅 -->
  52. <div class="container-wrap">
  53. <span class="right-top-line" />
  54. <span class="left-bottom-line" />
  55. <h3 class="home-item-title">
  56. 档案统计
  57. </h3>
  58. <div v-if="lendData.otherData.length !== 0" class="chart-wrapper">
  59. <lend-across :lend-data="lendData" />
  60. </div>
  61. <div v-else class="empty-main">
  62. <svg-icon icon-class="empty" class-name="empty-img" />
  63. <p>暂无数据</p>
  64. </div>
  65. </div>
  66. </el-col>
  67. <el-col :xs="24" :sm="24" :lg="8">
  68. <!-- 档案类型 -->
  69. <div class="container-wrap">
  70. <span class="right-top-line" />
  71. <span class="left-bottom-line" />
  72. <h3 class="home-item-title">
  73. 档案类型
  74. </h3>
  75. <div class="chart-wrapper">
  76. <cate-pie :add-arcives-data="addArcivesData" />
  77. </div>
  78. </div>
  79. </el-col>
  80. <el-col :xs="24" :sm="24" :lg="8">
  81. <!-- 档案门类 -->
  82. <div class="container-wrap">
  83. <span class="right-top-line" />
  84. <span class="left-bottom-line" />
  85. <h3 class="home-item-title">
  86. 档案门类
  87. </h3>
  88. <div v-if="typeData.length !== 0" class="chart-wrapper">
  89. <type-pie :type-data="typeData" />
  90. </div>
  91. <div v-else class="empty-main">
  92. <svg-icon icon-class="empty" class-name="empty-img" />
  93. <p>暂无数据</p>
  94. </div>
  95. </div>
  96. </el-col>
  97. </el-row>
  98. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import PanelGroup from './dashboard/PanelGroup'
  103. import lendAcross from '@/views/components/echarts/lendAcross.vue'
  104. import catePie from '@/views/components/echarts/catePie.vue'
  105. import typePie from '@/views/components/echarts/typePie.vue'
  106. import serverProgress from '@/views/components/echarts/serverProgress.vue'
  107. import { FetchMainData } from '@/api/archivesManage/library'
  108. import { FetchSystemInfo } from '@/api/home/cpu/index'
  109. import { mapGetters } from 'vuex'
  110. export default {
  111. name: 'Dashboard',
  112. components: {
  113. PanelGroup,
  114. lendAcross,
  115. catePie,
  116. typePie,
  117. serverProgress
  118. },
  119. data() {
  120. return {
  121. topObjectNum: {
  122. archivesNum: 0,
  123. caseNum: 0,
  124. documentNum: 0,
  125. fileNum: 0
  126. },
  127. archivesTotalNum: 0,
  128. flowableData: [],
  129. flowableTabIndex: 0,
  130. lendData: {
  131. archivesTotalNum: null,
  132. otherData: []
  133. },
  134. cateData: [],
  135. typeData: [],
  136. addArcivesData: {
  137. addArcivesMaxCount: null,
  138. addArcivesMonth: [],
  139. addArcivesNum: [],
  140. addArcivesNumFile: []
  141. },
  142. echartsTimer: null,
  143. refreshtime: 10000,
  144. systemTimer: null,
  145. systemData: {
  146. cpuPercentage: 0,
  147. memPercentage: 0,
  148. sysFilesPercentage: 0
  149. }
  150. }
  151. },
  152. computed: {
  153. ...mapGetters([
  154. 'user'
  155. ])
  156. },
  157. created() {
  158. this.handleMainData()
  159. this.getSystemInfo()
  160. // this.get()
  161. },
  162. mounted() {
  163. // const _this = this
  164. // // 每隔一分钟刷新档案借阅和档案类型的数据
  165. // this.echartsTimer = setInterval(() => {
  166. // _this.lendData = {
  167. // archivesTotalNum: null,
  168. // otherData: []
  169. // }
  170. // _this.cateData = []
  171. // _this.typeData = []
  172. // _this.addArcivesData = {
  173. // addArcivesMaxCount: null,
  174. // addArcivesMonth: [],
  175. // addArcivesNum: [],
  176. // addArcivesNumFile: []
  177. // }
  178. // _this.handleMainData()
  179. // }, this.refreshtime)
  180. // 服务器监控定时更新
  181. // this.systemTimer = setInterval(() => {
  182. // _this.systemData = {
  183. // cpuPercentage: 0,
  184. // memPercentage: 0,
  185. // sysFilesPercentage: 0
  186. // }
  187. // this.getSystemInfo()
  188. // }, 3000)
  189. },
  190. methods: {
  191. getSystemInfo() {
  192. FetchSystemInfo().then(res => {
  193. // cpu 占有率 (总的cpuTotal-空闲的cpuFree)/总的cpuTotal
  194. this.systemData.cpuPercentage = Math.round((res.cpuTotal - res.cpuFree) / res.cpuTotal * 100)
  195. // 内存占比 使用的memUsed/总的memTotal
  196. this.systemData.memPercentage = Math.round(res.memUsed / res.memTotal * 100)
  197. // 磁盘占比 多个磁盘 使用总和sysFiles[i].used的和/总的总和sysFiles[i].total的和
  198. let sysFilesTotalUsed = 0
  199. let sysFilesTotal = 0
  200. res.sysFiles.forEach(item => {
  201. sysFilesTotalUsed += parseFloat(item.used)
  202. sysFilesTotal += parseFloat(item.total)
  203. })
  204. this.systemData.sysFilesPercentage = Math.round((sysFilesTotalUsed / sysFilesTotal) * 100)
  205. })
  206. },
  207. toMoreProcess() {
  208. this.$router.push({ path: '/user/center?activeIndex=2' })
  209. },
  210. handleMainData() {
  211. const fondsAffiliation = []
  212. fondsAffiliation.push(this.user.fonds.id.toString())
  213. const params = {
  214. fondsAffiliations: fondsAffiliation
  215. }
  216. FetchMainData(params).then(data => {
  217. this.topObjectNum = {
  218. archivesNum: data.archivesNum,
  219. caseNum: data.caseNum,
  220. documentNum: data.documentNum,
  221. fileNum: data.fileNum
  222. }
  223. this.flowableData = data.flows
  224. // '标签', '装盒', '入库', '借阅', '开放', '实体', '审批'
  225. // "archivesTotalNum 总数 archivesTagNum 标签 installNum 已装盒 storageNum 入库 borrowNum 借阅 openNum 开放 entityNum 实体 approveNum 审批
  226. // 档案统计
  227. this.lendData.archivesTotalNum = data.archivesTotalNum
  228. this.lendData.otherData = [
  229. data.archivesTagNum, data.installNum, data.storageNum, data.borrowNum, data.openNum, data.entityNum, data.approveNum
  230. ]
  231. // 档案类别
  232. let maxCount = 0
  233. data.statisNumJSON.archives.forEach(archive => {
  234. if (archive.count > maxCount) {
  235. maxCount = archive.count
  236. }
  237. })
  238. data.statisNumJSON.singles.forEach(single => {
  239. if (single.count > maxCount) {
  240. maxCount = single.count
  241. }
  242. })
  243. this.addArcivesData.addArcivesMaxCount = maxCount
  244. const currentDate = new Date() // 获取当前日期
  245. const currentYear = currentDate.getFullYear() // 获取当前年份
  246. const currentMonth = currentDate.getMonth() // 获取当前月份(从 0 到 11,所以要加 1)
  247. let startYear = currentYear - 1 // 去年的年份
  248. let startMonth = currentMonth + 1 // 当前月份加上 1
  249. const result = [] // 存储每个年份和月份的组合
  250. const xResult = []
  251. while (startYear < currentYear || startMonth <= currentMonth) {
  252. xResult.push(startYear + '/' + startMonth)
  253. result.push({ year: startYear, month: startMonth, archivesCount: 0, singlesCount: 0 })
  254. // 计算下一个月份
  255. startMonth += 1
  256. if (startMonth > 12) {
  257. startYear += 1
  258. startMonth = 1
  259. }
  260. }
  261. result.forEach(yearMonthObj => {
  262. data.statisNumJSON.archives.forEach(archive => {
  263. if (parseInt(archive.month) === yearMonthObj.month) {
  264. yearMonthObj.archivesCount = archive.count
  265. return
  266. }
  267. })
  268. data.statisNumJSON.singles.forEach(single => {
  269. if (parseInt(single.month) === yearMonthObj.month) {
  270. yearMonthObj.singlesCount = single.count
  271. return
  272. }
  273. })
  274. })
  275. this.addArcivesData.addArcivesMonth = xResult
  276. this.addArcivesData.addArcivesNum = result.map(function(obj) {
  277. return obj.archivesCount
  278. })
  279. this.addArcivesData.addArcivesNumFile = result.map(function(obj) {
  280. return obj.singlesCount
  281. })
  282. // 档案类型
  283. for (const type in data.typeGroupBy) {
  284. if (data.typeGroupBy.hasOwnProperty(type)) {
  285. this.typeData.push({ name: type, value: data.typeGroupBy[type] })
  286. }
  287. }
  288. })
  289. }
  290. }
  291. }
  292. </script>
  293. <style rel="stylesheet/scss" lang="scss" scoped>
  294. .dashboard-editor-container {
  295. padding: 20px;
  296. position: relative;
  297. .chart-wrapper {
  298. height: calc(100% - 55px);
  299. }
  300. }
  301. @media (max-width: 1024px) {
  302. .chart-wrapper {
  303. padding: 8px;
  304. }
  305. }
  306. .el-col {
  307. height: 100%;
  308. }
  309. .container-left,
  310. .container-right,
  311. .container-wrap,
  312. .el-card,
  313. .header-container-wrap {
  314. min-height: 100%;
  315. }
  316. .container-wrap {
  317. min-height: auto;
  318. height: 100%;
  319. }
  320. .home-item-title{
  321. position: relative;
  322. padding: 18px 0 18px 15px;
  323. font-size: 16px;
  324. color: #0C0E1E;
  325. &::before{
  326. position: absolute;
  327. left: 0;
  328. top: 50%;
  329. content: "";
  330. width: 3px;
  331. height: 16px;
  332. background-color: #0348F3;
  333. transform: translateY(-50%);
  334. }
  335. }
  336. .home-flowable{
  337. padding: 0 20px;
  338. }
  339. .home-tab{
  340. display: flex;
  341. justify-content: flex-start;
  342. span{
  343. display: block;
  344. margin-right: 30px;
  345. padding-bottom: 3px;
  346. border-bottom: 3px solid #fff;
  347. cursor: pointer;
  348. &.home-tab-active{
  349. color: #0348F3;
  350. border-bottom: 3px solid #0348F3;
  351. }
  352. }
  353. }
  354. ::v-deep .home-flowable-list .el-table__body-wrapper::-webkit-scrollbar {
  355. width: 5px !important;
  356. height: 5px !important;
  357. background-color: #DDE8FB !important;
  358. }
  359. ::v-deep .home-flowable-list .el-table__body-wrapper::-webkit-scrollbar-thumb {
  360. border-radius: 3px;
  361. background-color: #4578F6 !important;
  362. }
  363. ::v-deep .home-flowable-list .el-table__body-wrapper::-webkit-scrollbar-thumb:hover {
  364. background-color: #4578F6 !important;
  365. }
  366. ::v-deep .home-flowable-list .el-table__body-wrapper::-webkit-scrollbar-corner {
  367. background-color: #DDE8FB !important;
  368. }
  369. </style>