SystemApplyCount.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="card-search">
  3. <a-form
  4. ref="formRef"
  5. name="advanced_search"
  6. class="ant-advanced-search-form"
  7. :model="searchParams"
  8. >
  9. <a-row :gutter="24">
  10. <a-col :span="6">
  11. <a-form-item label="统计日期" :label-col="{span:6}" name="reportDate">
  12. <a-range-picker format="YYYY-MM-DD" :placeholder="['开始日期', '结束日期']"
  13. @change="onRangeChange"/>
  14. </a-form-item>
  15. </a-col>
  16. <a-col :span="6" style="text-align: left">
  17. <a-button type="primary" html-type="submit" @click="loadData">查询</a-button>
  18. <a-button style="margin: 0 8px" @click="onReset">重置</a-button>
  19. </a-col>
  20. </a-row>
  21. </a-form>
  22. <a-row class="edit-operation">
  23. <a-col :span="24" class="flex-space-between">
  24. <div>
  25. </div>
  26. <div>
  27. <BExportExcel :filename="'系统使用情况统计'"
  28. :params="{...exportSearchParams}"
  29. :title="'导出'"
  30. :url="'statistics/export/systemApplyCount'"></BExportExcel>
  31. </div>
  32. </a-col>
  33. </a-row>
  34. <div class="search-result-list">
  35. <a-table :columns="originalColumns" :data-source="systemApplyCount" :scroll="{ x:'100%' }"
  36. :loading="tableLoading"
  37. :pagination="false"
  38. bordered>
  39. <template #bodyCell="{ column, text, record }">
  40. <template v-if="column.key == 'regionName'">
  41. <div>
  42. {{ record.regionName }}
  43. </div>
  44. </template>
  45. <template v-if="column.key == 'siteName'">
  46. <div>
  47. {{ record.siteName }}
  48. </div>
  49. </template>
  50. <template v-if="column.key == 'siteUserCount'">
  51. <div>
  52. {{ record.siteUserCount }}
  53. </div>
  54. </template>
  55. <template v-if="column.key == 'companyCount'">
  56. <div>
  57. {{ record.companyCount }}
  58. </div>
  59. </template>
  60. <template v-if="column.key == 'postCount'">
  61. <div>
  62. {{ record.postCount }}
  63. </div>
  64. </template>
  65. <template v-if="column.key == 'jobUserCount'">
  66. <div>
  67. {{ record.jobUserCount }}
  68. </div>
  69. </template>
  70. </template>
  71. </a-table>
  72. </div>
  73. </div>
  74. </template>
  75. <script setup lang="ts">
  76. import {computed, onMounted, reactive, ref} from "vue";
  77. import {getSystemApplyCount} from "@/api/statistics";
  78. import type {FormInstance, TableColumnType} from "ant-design-vue";
  79. import dayjs from "dayjs";
  80. import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
  81. const formRef = ref<FormInstance>();
  82. const originalColumns: TableColumnType[] = [
  83. {
  84. title: '行政区划', dataIndex: 'regionName', key: 'regionName', align: "center", width: 250,
  85. customCell: (record, index: any) => {
  86. const obj = {
  87. colSpan: 1,
  88. rowSpan: 1,
  89. };
  90. if (record.regionName == '合计') {
  91. obj.colSpan = 2;
  92. }
  93. if (index === 0 || record.regionName !== systemApplyCount.value[index - 1].regionName) {
  94. for (let i = index + 1; i < systemApplyCount.value.length; i++) {
  95. if (systemApplyCount.value[i].regionName == record.regionName) {
  96. obj.rowSpan++;
  97. } else {
  98. break;
  99. }
  100. }
  101. } else {
  102. obj.rowSpan = 0;
  103. }
  104. return obj;
  105. },
  106. },
  107. {
  108. title: '驿站名', dataIndex: 'siteName', key: 'siteName', align: "center", width: 250,
  109. customCell: (record) => {
  110. const obj = {
  111. colSpan: 1,
  112. };
  113. if (record.siteName == '合计') {
  114. obj.colSpan = 0;
  115. }
  116. return obj;
  117. },
  118. },
  119. {title: '驿站人员数量', dataIndex: 'siteUserCount', key: 'siteUserCount', align: "center"},
  120. {title: '录入企业数量', dataIndex: 'companyCount', key: 'companyCount', align: "center"},
  121. {title: '收集岗位数量', dataIndex: 'postCount', key: 'postCount', align: "center"},
  122. {title: '登记求职人数', dataIndex: 'jobUserCount', key: 'jobUserCount', align: "center"},
  123. ]
  124. // 统计数据
  125. const systemApplyCount = ref<Array<any>>([]);
  126. // 查询条件
  127. const searchParams = reactive({
  128. startDate: "",
  129. endDate: ""
  130. })
  131. // 表格加载
  132. const tableLoading = ref(false);
  133. // const reportDate = ref();
  134. // 导出Excel查询参数
  135. const exportSearchParams = computed(() => {
  136. return JSON.parse(JSON.stringify(searchParams));
  137. })
  138. // 数据加载
  139. function loadData() {
  140. tableLoading.value = true;
  141. getSystemApplyCount(searchParams).then((result: any) => {
  142. systemApplyCount.value = result;
  143. }).finally(() => {
  144. tableLoading.value = false;
  145. })
  146. }
  147. // 时间段变更事件
  148. const onRangeChange = (dateString: [string, string]) => {
  149. searchParams.startDate = dateString != null ? dayjs(dateString[0]).format("YYYY-MM-DD") : "";
  150. searchParams.endDate = dateString != null ? dayjs(dateString[1]).format("YYYY-MM-DD") : "";
  151. };
  152. // 查询表单
  153. function onReset() {
  154. formRef.value?.resetFields();
  155. loadData()
  156. }
  157. // 页面初始化
  158. onMounted(() => {
  159. loadData()
  160. })
  161. </script>
  162. <script lang="ts">
  163. // 设置页面名称进行组件缓存
  164. export default {
  165. name: "SystemApplyDataCount",
  166. }
  167. </script>
  168. <style lang="less">
  169. .totalCol {
  170. background-color: #40a9ff !important;
  171. }
  172. </style>