index.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <ContentWrap>
  3. <!-- 搜索工作栏 -->
  4. <el-form
  5. class="-mb-15px"
  6. :model="queryParams"
  7. ref="queryFormRef"
  8. :inline="true"
  9. label-width="68px"
  10. >
  11. <el-form-item label="类型" prop="type">
  12. <el-select v-model="queryParams.type" placeholder="请选择类型" clearable class="!w-240px">
  13. <el-option
  14. v-for="dict in getIntDictOptions(DICT_TYPE.BI_ANALYZE_TYPE)"
  15. :key="dict.value"
  16. :label="dict.label"
  17. :value="dict.value"
  18. />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="归属部门" prop="deptId">
  22. <el-tree-select
  23. v-model="queryParams.deptId"
  24. :data="deptList"
  25. :props="defaultProps"
  26. check-strictly
  27. node-key="id"
  28. placeholder="请选择归属部门"
  29. />
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  33. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. </ContentWrap>
  37. <el-col>
  38. <el-tabs v-model="activeTab">
  39. <el-tab-pane label="合同金额排行" name="contractAmountRanking">
  40. <!-- 合同金额排行 -->
  41. <RankingContractStatistics :queryParams="queryParams" ref="rankingContractStatisticsRef" />
  42. </el-tab-pane>
  43. <el-tab-pane label="回款金额排行" name="receivablesRanKing" lazy>
  44. <!-- 回款金额排行 -->
  45. <RankingReceivablesStatistics
  46. :queryParams="queryParams"
  47. ref="rankingReceivablesStatisticsRef"
  48. />
  49. </el-tab-pane>
  50. </el-tabs>
  51. </el-col>
  52. </template>
  53. <script lang="ts" setup>
  54. import RankingContractStatistics from './components/RankingContractStatistics.vue'
  55. import { defaultProps, handleTree } from '@/utils/tree'
  56. import * as DeptApi from '@/api/system/dept'
  57. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  58. /** 排行榜 */
  59. defineOptions({ name: 'RankingStatistics' })
  60. const queryParams = reactive({
  61. type: 9, // 将 type 的初始值设置为 9 本年
  62. deptId: null
  63. })
  64. const queryFormRef = ref() // 搜索的表单
  65. const deptList = ref<Tree[]>([]) // 树形结构
  66. const activeTab = ref('contractAmountRanking')
  67. const rankingContractStatisticsRef = ref() // RankingContractStatistics组件的引用
  68. const rankingReceivablesStatisticsRef = ref() // RankingReceivablesStatistics组件的引用
  69. /** 搜索按钮操作 */
  70. const handleQuery = () => {
  71. if (activeTab.value === 'contractAmountRanking') {
  72. rankingContractStatisticsRef.value.reloadData()
  73. } else if (activeTab.value === 'receivablesRanKing') {
  74. rankingReceivablesStatisticsRef.value.reloadData()
  75. }
  76. }
  77. /** 重置按钮操作 */
  78. const resetQuery = () => {
  79. queryFormRef.value.resetFields()
  80. handleQuery()
  81. }
  82. // 加载部门树
  83. onMounted(async () => {
  84. deptList.value = handleTree(await DeptApi.getSimpleDeptList())
  85. })
  86. </script>
  87. <style lang="scss" scoped></style>