stats.vue 9.7 KB

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