stats.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <el-scrollbar class="hc-using-stats-page">
  3. <div class="hc-project-box">
  4. <HcIcon name="stack" class="project-icon" />
  5. <span class="project-alias">{{ projectInfo?.projectAlias }}</span>
  6. </div>
  7. <div class="hc-chart-flex">
  8. <el-row :gutter="20" class="h-full">
  9. <el-col :span="8" class="h-full">
  10. <div class="hc-chart-card-box">
  11. <div class="header">原生、数字化文件数量(份)</div>
  12. <div v-loading="isNativeLoading" class="body">
  13. <BarChart ref="nativeChartRef" :config="nativeChartConfig" :datas="nativeChartData" />
  14. </div>
  15. </div>
  16. </el-col>
  17. <el-col :span="8" class="h-full">
  18. <div class="hc-chart-card-box gird">
  19. <HcBorderNeon align="right" neon />
  20. <div class="header">档案总存储</div>
  21. <div class="body num-text">
  22. <span class="font-FZGongYHJW">{{ tableData[0]?.auto || 0 }}卷</span>
  23. <div v-loading="isSizeLoading" class="size-data">电子文件存储量:{{ allArchiveFileSizedata }}</div>
  24. </div>
  25. </div>
  26. <div class="hc-chart-card-box gird">
  27. <HcBorderNeon align="right" />
  28. <div class="header">已组案卷</div>
  29. <div v-loading="isHasBeenLoading" class="body">
  30. <ArrRoundChart ref="hasBeenChartRef" :config="hasBeenChartConfig" :datas="hasBeenChartData" />
  31. </div>
  32. </div>
  33. </el-col>
  34. <el-col :span="8" class="h-full">
  35. <div class="hc-chart-card-box gird">
  36. <HcBorderNeon align="left" />
  37. <div class="header">档案年限占比</div>
  38. <div v-loading="isFixedLoading" class="body">
  39. <!-- <RoundPieChart ref="fixedChartRef" :datas="fixedChartData" /> -->
  40. <ArrRoundChart ref="fixedChartRef" :config="fixedChartConfig" :datas="fixedChartData" />
  41. </div>
  42. </div>
  43. <div class="hc-chart-card-box gird">
  44. <HcBorderNeon align="left" neon />
  45. <div class="header">已销毁案卷</div>
  46. <div v-loading="isDestroyLoading" class="body">
  47. <ArrRoundChart ref="destroyChartRef" :config="destroyChartConfig" :datas="destroyChartData" />
  48. </div>
  49. </div>
  50. </el-col>
  51. </el-row>
  52. </div>
  53. <el-table
  54. v-loading="isLoading" :data="tableData" lazy :load="loadData" border row-key="id"
  55. :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  56. >
  57. <el-table-column prop="name" label="归档目录文件夹" />
  58. <el-table-column prop="auto" label="已组卷" align="center" width="100" />
  59. <el-table-column prop="deleted" label="已销毁" align="center" width="100" />
  60. </el-table>
  61. </el-scrollbar>
  62. </template>
  63. <script setup>
  64. import { onMounted, ref, watch } from 'vue'
  65. import { useAppStore } from '~src/store'
  66. import BarChart from './components/echarts/BarChart.vue'
  67. import ArrRoundChart from './components/echarts/ArrRoundChart.vue'
  68. import RoundPieChart from './components/echarts/RoundPieChart.vue'
  69. import archivesStatsApi from '~api/using/stats.js'
  70. import { getArrValue, getObjValue } from 'js-fast-way'
  71. //变量
  72. const useAppState = useAppStore()
  73. const projectId = ref(useAppState.getProjectId)
  74. const contractId = ref(useAppState.getContractId)
  75. const projectInfo = ref(useAppState.getProjectInfo)
  76. //渲染完成
  77. onMounted(() => {
  78. gethasBeenChartData()
  79. getfixedChartData()
  80. getdestroyChartData()
  81. getnativeChartData()
  82. getallArchiveFileSize()
  83. gettableData()
  84. })
  85. //监听
  86. watch(() => [
  87. useAppState.getProjectId,
  88. ], ([ProjectId]) => {
  89. projectId.value = ProjectId
  90. gethasBeenChartData()
  91. getfixedChartData()
  92. getdestroyChartData()
  93. getnativeChartData()
  94. getallArchiveFileSize()
  95. gettableData()
  96. })
  97. //深度监听
  98. watch(() => [
  99. useAppState.getProjectInfo,
  100. ], ([ProjectInfo]) => {
  101. projectInfo.value = ProjectInfo
  102. }, {
  103. deep: true,
  104. })
  105. //原生、数字化文件数量 图表配置
  106. const nativeChartRef = ref(null)
  107. const nativeChartConfig = {
  108. name: ['原生', '数字化'],
  109. key: ['key1', 'key2'],
  110. color: ['#FFBF6B', '#74F9FD'],
  111. label: '',
  112. }
  113. //原生、数字化文件数量 图表数据
  114. const isNativeLoading = ref(false)
  115. const nativeChartData = ref([
  116. { title: '施工', key1: 100, key2: 50 },
  117. { title: '监理', key1: 60, key2: 80 },
  118. { title: '业主', key1: 4, key2: 30 },
  119. ])
  120. //获取原生文件数量
  121. const getnativeChartData = async () => {
  122. const { error, code, data } = await archivesStatsApi.getallnativeChartData({
  123. projectId: projectId.value,
  124. })
  125. if (!error && code === 200) {
  126. nativeChartData.value = getArrValue(data)
  127. } else {
  128. nativeChartData.value = []
  129. }
  130. }
  131. //已组案卷 图表配置
  132. const hasBeenChartRef = ref(null)
  133. const hasBeenChartConfig = {
  134. name: ['施工', '监理', '业主'],
  135. key: ['key1', 'key2', 'key3'],
  136. color: ['#81B336', '#1040F3', '#EA9B43'],
  137. label: '已组案卷',
  138. }
  139. //已组案卷 图表数据
  140. const isHasBeenLoading = ref(false)
  141. const hasBeenChartData = ref({
  142. key1: 3210, key2: 850, key3: 1203,
  143. })
  144. //档案年限占比fixedChartConfig
  145. const fixedChartConfig = {
  146. name: ['永久', '30年', '10年'],
  147. key: ['key1', 'key2', 'key3'],
  148. color: ['#DF868F', '#7727F5', '#74F9FD'],
  149. label: '档案年限占比',
  150. }
  151. //获取已组案卷
  152. const gethasBeenChartData = async () => {
  153. const { error, code, data } = await archivesStatsApi.getallArchiveByContractType({
  154. projectId: projectId.value,
  155. })
  156. if (!error && code === 200) {
  157. hasBeenChartData.value = getObjValue(data)
  158. } else {
  159. hasBeenChartData.value = {}
  160. }
  161. }
  162. //档案年限占比 图表数据
  163. const fixedChartRef = ref(null)
  164. const isFixedLoading = ref(false)
  165. const fixedChartData = ref([
  166. { value: 1048, name: '永久' },
  167. { value: 735, name: '30年' },
  168. { value: 580, name: '20年' },
  169. { value: 484, name: '10年' },
  170. { value: 300, name: '5年' },
  171. ])
  172. //获取档案年限
  173. const getfixedChartData = async () => {
  174. const { error, code, data } = await archivesStatsApi.getallArchiveAge({
  175. projectId: projectId.value,
  176. })
  177. if (!error && code === 200) {
  178. let objarr = getArrValue(data)
  179. let obj = { key1: 0, key2: 0, key3: 0 }
  180. objarr.forEach((ele) => {
  181. if (ele.name === '永久') {
  182. obj['key1'] = ele.value
  183. } else if (ele.name === '30年') {
  184. obj['key2'] = ele.value
  185. } else if (ele.name === '31年') {
  186. obj['key3'] = ele.value
  187. }
  188. })
  189. fixedChartData.value = obj
  190. } else {
  191. fixedChartData.value = {}
  192. }
  193. }
  194. //已销毁案卷 图表配置
  195. const destroyChartRef = ref(null)
  196. const destroyChartConfig = {
  197. name: ['施工', '监理', '业主'],
  198. key: ['key1', 'key2', 'key3'],
  199. color: ['#81B336', '#1040F3', '#EA9B43'],
  200. label: '已销毁案卷',
  201. }
  202. //已销毁案卷 图表数据
  203. const isDestroyLoading = ref(false)
  204. const destroyChartData = ref({
  205. key1: 202, key2: 150, key3: 100,
  206. })
  207. //获取已销毁案卷
  208. const getdestroyChartData = async () => {
  209. const { error, code, data } = await archivesStatsApi.getallArchiveDestory({
  210. projectId: projectId.value,
  211. })
  212. if (!error && code === 200) {
  213. destroyChartData.value = getObjValue(data)
  214. console.log(data, '已销毁')
  215. } else {
  216. destroyChartData.value = []
  217. }
  218. }
  219. //获取总存储数据
  220. const allArchiveFileSizedata = ref('')
  221. const isSizeLoading = ref(false)
  222. const getallArchiveFileSize = async () => {
  223. isSizeLoading.value = true
  224. const { error, code, data } = await archivesStatsApi.getallArchiveSize({
  225. projectId: projectId.value,
  226. })
  227. if (!error && code === 200) {
  228. allArchiveFileSizedata.value = data
  229. isSizeLoading.value = false
  230. } else {
  231. allArchiveFileSizedata.value = ''
  232. isSizeLoading.value = false
  233. }
  234. }
  235. //初始数据获取
  236. const isLoading = ref(false)
  237. const tableData = ref([])
  238. const nodeId = ref(0)
  239. //获取归档目录文件夹getArchiveTreeAndArchiveCount
  240. const gettableData = async () => {
  241. isLoading.value = true
  242. const { error, code, data } = await archivesStatsApi.getArchiveTreeAndArchiveCount({
  243. projectId: projectId.value,
  244. nodeId:nodeId.value,
  245. })
  246. if (!error && code === 200) {
  247. let resdata = getArrValue(data)
  248. tableData.value = resdata
  249. isLoading.value = false
  250. } else {
  251. tableData.value = resdata
  252. }
  253. isLoading.value = false
  254. }
  255. const loadData = (tree, treeNode, resolve)=>{
  256. archivesStatsApi.getArchiveTreeAndArchiveCount({ projectId: projectId.value, nodeId:tree.id }).then((response) => {
  257. console.log(response, 'response')
  258. let resdata = getArrValue(response.data)
  259. resolve(resdata)
  260. })
  261. }
  262. </script>
  263. <style lang="scss">
  264. @import '~style/using/scoped/stats.scss';
  265. </style>
  266. <style lang="scss">
  267. @import '~src/styles/theme/using/stats.scss';
  268. </style>