eventClass.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div class="judicial-statistics-event-calss-container layout-pd">
  3. <!-- 搜索 -->
  4. <el-card shadow="never">
  5. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  6. <el-form-item prop="crTime" label="受理时间段">
  7. <el-date-picker
  8. v-model="state.queryParams.crTime"
  9. type="daterange"
  10. unlink-panels
  11. range-separator="至"
  12. start-placeholder="开始时间"
  13. end-placeholder="结束时间"
  14. :shortcuts="shortcuts"
  15. @change="handleQuery"
  16. value-format="YYYY-MM-DD"
  17. :clearable="false"
  18. />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  22. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  23. <SvgIcon name="ele-Refresh" class="mr5" />重置
  24. </el-button>
  25. </el-form-item>
  26. </el-form>
  27. </el-card>
  28. <el-row :gutter="20">
  29. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  30. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  31. <el-statistic :value="state.orderCount.theClueIsTrue">
  32. <template #title>
  33. <span class="color-info font14">线索属实</span>
  34. </template>
  35. </el-statistic>
  36. </el-card>
  37. </el-col>
  38. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  39. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  40. <el-statistic :value="state.orderCount.theClueIsNotTrue">
  41. <template #title>
  42. <span class="color-info font14">线索不属实</span>
  43. </template>
  44. </el-statistic>
  45. </el-card>
  46. </el-col>
  47. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  48. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  49. <el-statistic :value="state.orderCount.enforcementOrder">
  50. <template #title>
  51. <span class="color-info font14">行政执法工单</span>
  52. </template>
  53. </el-statistic>
  54. </el-card>
  55. </el-col>
  56. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  57. <el-card shadow="never" v-loading="state.loading" class="statistics-item">
  58. <el-statistic :value="state.orderCount.passTheBuckOrder">
  59. <template #title>
  60. <span class="color-info font14">推诿工单</span>
  61. </template>
  62. </el-statistic>
  63. </el-card>
  64. </el-col>
  65. </el-row>
  66. <el-card shadow="never">
  67. <ProTable
  68. ref="proTableRef"
  69. :columns="columns"
  70. :data="state.tableData"
  71. @updateTable="queryList"
  72. :loading="state.loading"
  73. border
  74. :pagination="false"
  75. lazy
  76. :load="load"
  77. :tree-props="{ children: 'children', hasChildren: 'sublevel' }"
  78. show-summary
  79. row-key="id"
  80. >
  81. <template #tableHeader>
  82. <el-select v-model="state.AreaCode" placeholder="请选择区域" @change="handleQuery" clearable style="max-width: 220px;">
  83. <el-option :label="item.areaName" :value="item.id" v-for="item in areaOptions" :key="item.id" />
  84. </el-select>
  85. </template>
  86. </ProTable>
  87. </el-card>
  88. </div>
  89. </template>
  90. <script setup lang="tsx" name="judicialStatisticsEventClass">
  91. import { onMounted, reactive, ref } from 'vue';
  92. import { FormInstance } from 'element-plus';
  93. import { shortcuts } from '@/utils/constants';
  94. import dayjs from 'dayjs';
  95. import { eventStatistics, getArea } from '@/api/judicial';
  96. import { useRouter } from 'vue-router';
  97. const columns = ref<any>([
  98. { prop: 'name', label: '事项类型' },
  99. {
  100. prop: 'num',
  101. label: '工单总量',
  102. width: 120,
  103. render: (scope) => {
  104. return (
  105. <el-button type="primary" link onClick={() => linkDetail(scope.row)}>
  106. {scope.row.num}
  107. </el-button>
  108. );
  109. },
  110. },
  111. ]); // 表头
  112. // 定义变量内容
  113. const ruleFormRef = ref<RefType>(); // 表单ref
  114. const state = reactive({
  115. queryParams: {
  116. // 查询条件
  117. AreaCode: null,
  118. crTime: [dayjs(new Date()).startOf('date').format('YYYY-MM-DD'), dayjs(new Date()).endOf('date').format('YYYY-MM-DD')], // 时间默认今天开始到今天结束
  119. },
  120. tableData: [], //表单
  121. loading: false, // 加载
  122. totalCount: {},
  123. orderCount: {
  124. theClueIsTrue: 0,
  125. theClueIsNotTrue: 0,
  126. enforcementOrder: 0,
  127. passTheBuckOrder: 0,
  128. },
  129. AreaCode: null,
  130. });
  131. /** 搜索按钮操作 */
  132. const handleQuery = () => {
  133. // state.queryParams.PageIndex = 1;
  134. queryList();
  135. };
  136. /** 获取列表 */
  137. const queryList = () => {
  138. state.loading = true;
  139. let StartDate = null;
  140. let EndDate = null;
  141. if (state.queryParams?.crTime) {
  142. StartDate = state.queryParams?.crTime[0];
  143. EndDate = state.queryParams?.crTime[1];
  144. }
  145. const request = {
  146. StartDate,
  147. EndDate,
  148. AreaCode: state.AreaCode,
  149. };
  150. eventStatistics(request)
  151. .then((res: any) => {
  152. state.tableData = res.result.list;
  153. state.orderCount = res.result.orderCount;
  154. state.totalCount = res.result.total;
  155. state.loading = false;
  156. })
  157. .catch(() => {
  158. state.loading = false;
  159. });
  160. };
  161. /** 重置按钮操作 */
  162. const resetQuery = (formEl: FormInstance | undefined) => {
  163. if (!formEl) return;
  164. formEl.resetFields();
  165. state.AreaCode = null;
  166. queryList();
  167. };
  168. // 懒加载
  169. const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => {
  170. let StartDate = null;
  171. let EndDate = null;
  172. if (state.queryParams?.crTime) {
  173. StartDate = state.queryParams?.crTime[0];
  174. EndDate = state.queryParams?.crTime[1];
  175. }
  176. const request = {
  177. StartDate,
  178. EndDate,
  179. AreaCode: state.AreaCode,
  180. Id: row.id,
  181. };
  182. eventStatistics(request)
  183. .then((res: any) => {
  184. state.totalCount = res.result.total;
  185. state.orderCount = res.result.orderCount;
  186. resolve(res.result?.list ?? []);
  187. })
  188. .catch(() => {});
  189. };
  190. const areaOptions = ref<any>([]);
  191. const getBaseData = async () => {
  192. try {
  193. const res = await getArea();
  194. areaOptions.value = res.result ?? [];
  195. } catch (e) {
  196. console.log(e);
  197. }
  198. };
  199. // 查看详情
  200. const router = useRouter();
  201. const linkDetail = (row: any) => {
  202. let StartDate = null;
  203. let EndDate = null;
  204. if (state.queryParams?.crTime) {
  205. StartDate = state.queryParams?.crTime[0];
  206. EndDate = state.queryParams?.crTime[1];
  207. }
  208. const AreaCode = state.AreaCode;
  209. router.push({
  210. name: 'judicialDetailEventClass',
  211. params: {
  212. id: row.id,
  213. },
  214. state: {
  215. StartDate,
  216. EndDate,
  217. AreaCode,
  218. },
  219. });
  220. };
  221. onMounted(() => {
  222. getBaseData();
  223. queryList();
  224. });
  225. </script>
  226. <style lang="scss" scoped>
  227. .statistics-item {
  228. margin-bottom: 10px;
  229. }
  230. :deep(.el-statistic__content) {
  231. font-size: 32px;
  232. font-weight: bold;
  233. margin-top: 15px;
  234. }
  235. </style>