eventClass.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="judicial-statistics-event-calss-container layout-pd">
  3. <el-card shadow="never">
  4. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  5. <el-form-item prop="AreaCode" label="区域">
  6. <el-select v-model="state.AreaCode" placeholder="请选择区域" @change="handleQuery" clearable>
  7. <el-option :label="item.areaName" :value="item.id" v-for="item in areaOptions" :key="item.id" />
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item prop="crTime" label="生成时间">
  11. <el-date-picker
  12. v-model="state.queryParams.crTime"
  13. type="datetimerange"
  14. unlink-panels
  15. range-separator="至"
  16. start-placeholder="开始时间"
  17. end-placeholder="结束时间"
  18. :shortcuts="shortcuts"
  19. @change="handleQuery"
  20. value-format="YYYY-MM-DD[T]HH:mm:ss"
  21. :default-time="defaultTimeStartEnd"
  22. :clearable="false"
  23. />
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  27. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  28. <SvgIcon name="ele-Refresh" class="mr5" />重置
  29. </el-button>
  30. </el-form-item>
  31. </el-form>
  32. </el-card>
  33. <el-row :gutter="20">
  34. <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4">
  35. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  36. <el-statistic :value="state.orderCount.theClueIsTrue">
  37. <template #title>
  38. <span class="color-info font14">线索属实</span>
  39. </template>
  40. </el-statistic>
  41. </el-card>
  42. </el-col>
  43. <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4">
  44. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  45. <el-statistic :value="state.orderCount.theClueIsNotTrue">
  46. <template #title>
  47. <span class="color-info font14">线索不属实</span>
  48. </template>
  49. </el-statistic>
  50. </el-card>
  51. </el-col>
  52. <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4">
  53. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  54. <el-statistic :value="state.orderCount.enforcementOrder">
  55. <template #title>
  56. <span class="color-info font14">行政执法工单</span>
  57. </template>
  58. </el-statistic>
  59. </el-card>
  60. </el-col>
  61. <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4">
  62. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  63. <el-statistic :value="state.orderCount.passTheBuckOrder">
  64. <template #title>
  65. <span class="color-info font14">推诿工单</span>
  66. </template>
  67. </el-statistic>
  68. </el-card>
  69. </el-col>
  70. <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4">
  71. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  72. <el-statistic :value="state.orderCount.toBeVerified">
  73. <template #title>
  74. <span class="color-info font14">待核实</span>
  75. </template>
  76. </el-statistic>
  77. </el-card>
  78. </el-col>
  79. </el-row>
  80. <el-card shadow="never">
  81. <vxe-toolbar
  82. ref="toolbarRef"
  83. :loading="state.loading"
  84. custom
  85. :refresh="{
  86. queryMethod: handleQuery,
  87. }"
  88. >
  89. </vxe-toolbar>
  90. <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
  91. <vxe-table
  92. border
  93. :loading="state.loading"
  94. :data="state.tableData"
  95. :column-config="{ resizable: true }"
  96. :row-config="{ isCurrent: true, isHover: true, height: 30, keyField: 'id' }"
  97. ref="tableRef"
  98. show-overflow
  99. id="judicialStatisticsEventClass"
  100. :custom-config="{ storage: true }"
  101. :tree-config="treeConfig"
  102. show-footer
  103. :footer-method="footerMethod"
  104. >
  105. <vxe-column field="name" title="问题类型" min-width="200" tree-node></vxe-column>
  106. <vxe-column field="num" title="工单总量" width="100">
  107. <template #default="{ row }">
  108. <el-button type="primary" link @click="linkDetail(row)">
  109. {{ row.num }}
  110. </el-button>
  111. </template>
  112. </vxe-column>
  113. </vxe-table>
  114. </div>
  115. </el-card>
  116. </div>
  117. </template>
  118. <script setup lang="tsx" name="judicialStatisticsEventClass">
  119. import { onMounted, reactive, ref } from 'vue';
  120. import { FormInstance } from 'element-plus';
  121. import { defaultDateTime, defaultTimeStartEnd, shortcuts } from '@/utils/constants';
  122. import { eventStatistics, getAreaChildren } from '@/api/judicial';
  123. import { useRouter } from 'vue-router';
  124. import XEUtils from 'xe-utils';
  125. // 定义变量内容
  126. const ruleFormRef = ref<RefType>(); // 表单ref
  127. const state = reactive<any>({
  128. queryParams: {
  129. // 查询条件
  130. AreaCode: null,
  131. crTime: defaultDateTime, // 时间默认今天开始到今天结束
  132. },
  133. tableData: [], //表单
  134. loading: false, // 加载
  135. totalCount: {},
  136. orderCount: {
  137. theClueIsTrue: 0,
  138. theClueIsNotTrue: 0,
  139. enforcementOrder: 0,
  140. passTheBuckOrder: 0,
  141. toBeVerified: 0,
  142. },
  143. AreaCode: null,
  144. });
  145. /** 搜索按钮操作 */
  146. const handleQuery = () => {
  147. // state.queryParams.PageIndex = 1;
  148. state.tableData = [];
  149. queryList();
  150. };
  151. // 计算合计
  152. const footerMethod = ({ columns, data }) => {
  153. return [
  154. columns.map((column: any, columnIndex: number) => {
  155. if (columnIndex === 0) {
  156. return '合计';
  157. }
  158. if (['num'].includes(column.property)) {
  159. return XEUtils.sum(data, column.property);
  160. }
  161. return null;
  162. }),
  163. ];
  164. };
  165. /** 获取列表 */
  166. const queryList = () => {
  167. state.loading = true;
  168. const StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  169. const EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  170. const request = {
  171. StartTime,
  172. EndTime,
  173. AreaCode: state.AreaCode,
  174. };
  175. eventStatistics(request)
  176. .then((res: any) => {
  177. state.tableData = res.result.list;
  178. state.orderCount = res.result.orderCount;
  179. state.totalCount = res.result.total;
  180. state.loading = false;
  181. })
  182. .catch(() => {
  183. state.loading = false;
  184. });
  185. };
  186. /** 重置按钮操作 */
  187. const resetQuery = (formEl: FormInstance | undefined) => {
  188. if (!formEl) return;
  189. formEl.resetFields();
  190. state.AreaCode = null;
  191. queryList();
  192. };
  193. const areaOptions = ref<any>([]);
  194. const getBaseData = async () => {
  195. try {
  196. const res = await getAreaChildren();
  197. areaOptions.value = res.result ?? [];
  198. } catch (e) {
  199. console.log(e);
  200. }
  201. };
  202. const treeConfig = reactive({
  203. transform: true,
  204. rowField: 'id',
  205. parentField: 'parentId',
  206. lazy: true,
  207. hasChild: 'sublevel',
  208. loadMethod({ row }) {
  209. // 异步加载子节点
  210. return fetchChildListApi(row);
  211. },
  212. });
  213. const fetchChildListApi = (row: any) => {
  214. return new Promise((resolve) => {
  215. const StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  216. const EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  217. const request = {
  218. StartTime,
  219. EndTime,
  220. AreaCode: state.AreaCode,
  221. Id: row.id,
  222. };
  223. eventStatistics(request)
  224. .then((res: any) => {
  225. state.totalCount = res.result.total;
  226. state.orderCount = res.result.orderCount;
  227. resolve(res.result?.list ?? []);
  228. })
  229. .catch(() => {});
  230. });
  231. };
  232. // 查看详情
  233. const router = useRouter();
  234. const linkDetail = (row: any) => {
  235. const StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  236. const EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  237. router.push({
  238. name: 'judicialDetailEventClass',
  239. query: {
  240. StartTime,
  241. EndTime,
  242. AreaCode: state.AreaCode,
  243. EventTypeId: row.id,
  244. },
  245. });
  246. };
  247. const toolbarRef = ref<RefType>();
  248. const tableRef = ref<RefType>();
  249. onMounted(() => {
  250. queryList();
  251. if (tableRef.value && toolbarRef.value) {
  252. tableRef.value.connect(toolbarRef.value);
  253. }
  254. getBaseData();
  255. });
  256. </script>
  257. <style lang="scss" scoped>
  258. .statistics-item {
  259. margin-bottom: 10px;
  260. }
  261. :deep(.el-statistic__content) {
  262. font-size: 32px;
  263. font-weight: bold;
  264. margin-top: 15px;
  265. }
  266. </style>