report.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <div class="statistics-center-report-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="dateType" label="时间单位">
  7. <el-select v-model="state.queryParams.dateType" placeholder="部门名称" @change="changeDateType">
  8. <el-option label="日" value="date" />
  9. <el-option label="周" value="week" />
  10. <el-option label="月" value="month" />
  11. <el-option label="自定义" value="daterange" />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item prop="crTime" v-if="state.queryParams.dateType === 'daterange'" label="时间">
  15. <el-date-picker
  16. v-model="state.queryParams.crTime"
  17. type="daterange"
  18. unlink-panels
  19. range-separator="至"
  20. start-placeholder="开始时间"
  21. end-placeholder="结束时间"
  22. :shortcuts="shortcuts"
  23. @change="
  24. () => {
  25. queryList();
  26. changeDateType('daterange');
  27. }
  28. "
  29. value-format="YYYY-MM-DD"
  30. :clearable="false"
  31. />
  32. </el-form-item>
  33. <el-form-item prop="time" v-else label="时间">
  34. <el-date-picker
  35. v-model="state.queryParams.time"
  36. :type="state.queryParams.dateType"
  37. placeholder="选择时间"
  38. @change="
  39. () => {
  40. queryList();
  41. changeDateType(state.queryParams.dateType);
  42. }
  43. "
  44. :value-format="valueFormat"
  45. :format="formats"
  46. :clearable="false"
  47. />
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="primary" @click="queryList" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  51. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  52. <SvgIcon name="ele-Refresh" class="mr5" />重置
  53. </el-button>
  54. <el-button class="default-button" :loading="state.loading" @click="exportWord"
  55. ><SvgIcon name="iconfont icon-daochu" class="mr5" /> 导出</el-button
  56. >
  57. </el-form-item>
  58. </el-form>
  59. </el-card>
  60. <el-card shadow="never">
  61. <table style="min-width: 80%; height: 100%; margin: 0 auto; text-align: center" v-loading="state.loading" ref="exportTable">
  62. <tbody>
  63. <tr style="height: 70px">
  64. <td style="vertical-align: top; text-align: center">
  65. <div style="font-size: 28px; font-weight: bold">{{ tableTitle }}</div>
  66. <div style="margin-top: 10px; font-size: 22px">{{ dates }}</div>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td>
  71. <table style="width: 100%; border: 1px solid #000000; border-collapse: collapse; padding: 0">
  72. <tbody>
  73. <tr style="height: 43px">
  74. <td colspan="4" style="font-size: 22px; font-weight: bold; border-bottom: 1px solid #000000">一、总体情况</td>
  75. </tr>
  76. <tr style="height: 43px">
  77. <td colspan="2" style="font-size: 22px; text-align: left; border-bottom: 1px solid #000000">
  78. 电话总量:{{ centerReportCallData.allCallCount }}
  79. </td>
  80. <td colspan="2" style="font-size: 22px; text-align: left; border-bottom: 1px solid #000000">
  81. 居家养老电话总量:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;居家养老呼入接通量:
  82. </td>
  83. </tr>
  84. <tr style="height: 43px">
  85. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">有效</td>
  86. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">
  87. {{ centerReportCallData.effectiveCount }}(接通)
  88. </td>
  89. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">无效</td>
  90. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000">{{ centerReportCallData.invalidCount }}(未接通)</td>
  91. </tr>
  92. <tr style="height: 43px">
  93. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">在IVR中挂断</td>
  94. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">
  95. {{ centerReportCallData.ivrByeCount }}
  96. </td>
  97. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">在队列中挂断</td>
  98. <td style="width: 25%; font-size: 22px; border-bottom: 1px solid #000000">{{ centerReportCallData.queueByeCount }}</td>
  99. </tr>
  100. <tr style="height: 43px">
  101. <td colspan="4" style="font-size: 22px; text-align: left; border-bottom: 1px solid #000000">信件回访量</td>
  102. </tr>
  103. <tr style="height: 43px">
  104. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">已回访量</td>
  105. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">
  106. {{ centerReportVisitdData.visitd }}
  107. </td>
  108. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">待回访量</td>
  109. <td style="font-size: 22px; border-bottom: 1px solid #000000">{{ centerReportVisitdData.waitVisitd }}</td>
  110. </tr>
  111. <tr style="height: 43px">
  112. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">坐席满意度</td>
  113. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">
  114. {{ centerReportVisitdData.seatsRate }}%
  115. </td>
  116. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">部门满意度</td>
  117. <td style="font-size: 22px; border-bottom: 1px solid #000000">{{ centerReportVisitdData.orgRate }}%</td>
  118. </tr>
  119. <tr style="height: 43px">
  120. <td colspan="4" style="font-size: 22px; text-align: left; border-bottom: 1px solid #000000">
  121. 来件总计:{{ centerReportOrderData.allCallCount }}
  122. </td>
  123. </tr>
  124. <tr style="height: 43px">
  125. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">有效</td>
  126. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">
  127. {{ centerReportOrderData.effectiveCount }}
  128. </td>
  129. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">无效</td>
  130. <td style="font-size: 22px; border-bottom: 1px solid #000000">{{ centerReportOrderData.invalidCount }}</td>
  131. </tr>
  132. <tr style="height: 43px">
  133. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">已办结信件</td>
  134. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">
  135. {{ centerReportOrderData.completedCount }}
  136. </td>
  137. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">在办信件</td>
  138. <td style="font-size: 22px; border-bottom: 1px solid #000000">{{ centerReportOrderData.inProgressCount }}</td>
  139. </tr>
  140. <tr style="height: 43px">
  141. <td colspan="4" style="font-size: 22px; border-bottom: 1px solid #000000">信件来源</td>
  142. </tr>
  143. <tr style="height: 43px">
  144. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">来源方式</td>
  145. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">数量</td>
  146. <td colspan="2" style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">备注</td>
  147. </tr>
  148. <tr style="height: 43px" v-for="(item, index) in centerReportOrderSourceChannelsData" :key="index">
  149. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.name }}:</td>
  150. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.countNum }}</td>
  151. <td colspan="2" style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.remark }}</td>
  152. </tr>
  153. <tr style="height: 43px">
  154. <td colspan="4" style="font-size: 22px; border-bottom: 1px solid #000000">信件分类</td>
  155. </tr>
  156. <tr style="height: 43px" v-for="(item, index) in centerReportOrderAcceptTypesData" :key="index">
  157. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.name }}</td>
  158. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.countNum }}</td>
  159. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">所占百分比</td>
  160. <td style="font-size: 22px; border-bottom: 1px solid #000000">{{ item.proportionRate }}%</td>
  161. </tr>
  162. </tbody>
  163. </table>
  164. </td>
  165. </tr>
  166. <tr>
  167. <td style="height: 30px">&nbsp;</td>
  168. </tr>
  169. <tr>
  170. <td style="vertical-align: top">
  171. <table style="width: 100%; border: 1px solid #000000; border-collapse: collapse; padding: 0px">
  172. <tbody>
  173. <tr style="height: 43px">
  174. <td colspan="2" style="font-size: 22px; font-weight: bold; border-bottom: 1px solid #000000">二、信件分布情况</td>
  175. </tr>
  176. <tr style="height: 43px">
  177. <td colspan="2" style="font-size: 22px; text-align: left; border-bottom: 1px solid #000000">
  178. 市本级总计:{{ orgStatisticsCityAllData.orgStatisticsCountAll }}件
  179. </td>
  180. </tr>
  181. <tr style="height: 43px">
  182. <td style="font-size: 22px; width: 40%; border-bottom: 1px solid #000000; border-right: 1px solid #000000">部门(单位)</td>
  183. <td style="font-size: 22px; width: 40%; border-bottom: 1px solid #000000; border-right: 1px solid #000000">数 量</td>
  184. </tr>
  185. <tr style="height: 43px" v-for="(item, index) in orgStatisticsCityAllData.orgStatistics" :key="index">
  186. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.orgName }}</td>
  187. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.countNum }}</td>
  188. </tr>
  189. <tr style="height: 43px">
  190. <td colspan="2" style="font-size: 22px; text-align: left; border-bottom: 1px solid #000000">
  191. 县(区)总计:{{ orgStatisticsAreaAllData.orgStatisticsCountAll }}件
  192. </td>
  193. </tr>
  194. <tr style="height: 43px">
  195. <td style="font-size: 22px; width: 40%; border-bottom: 1px solid #000000; border-right: 1px solid #000000">县(区)</td>
  196. <td style="font-size: 22px; width: 40%; border-bottom: 1px solid #000000; border-right: 1px solid #000000">数 量</td>
  197. </tr>
  198. <tr style="height: 43px" v-for="(item, index) in orgStatisticsAreaAllData.orgStatistics" :key="index">
  199. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.orgName }}</td>
  200. <td style="font-size: 22px; border-bottom: 1px solid #000000; border-right: 1px solid #000000">{{ item.countNum }}</td>
  201. </tr>
  202. </tbody>
  203. </table>
  204. </td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. </el-card>
  209. </div>
  210. </template>
  211. <script setup lang="ts" name="statisticsCenterReport">
  212. import { onMounted, reactive, ref } from 'vue';
  213. import { ElMessageBox, FormInstance } from 'element-plus';
  214. import { throttle } from '@/utils/tools';
  215. import { centerReport } from '@/api/statistics/center';
  216. import { defaultDate, shortcuts } from '@/utils/constants';
  217. import dayjs from 'dayjs';
  218. import { exportAsDocx } from '@/utils/exportAsWord';
  219. // 定义变量内容
  220. const ruleFormRef = ref<RefType>(); // 表单ref
  221. const state = reactive(<any>{
  222. queryParams: {
  223. dateType: 'date', //
  224. time: dayjs(new Date()).format('YYYY-MM-DD'), // 时间默认今天
  225. crTime: defaultDate, // 时间默认今天开始到今天结束
  226. },
  227. loading: false, // 加载
  228. });
  229. const valueFormat = ref('YYYY-MM-DD');
  230. const formats = ref('YYYY-MM-DD');
  231. const tableTitle = ref('12345市民服务热线办理工作日统计');
  232. const dates = ref<string>(dayjs(state.queryParams.time).format('YYYY-MM-DD'));
  233. const changeDateType = (val: string) => {
  234. switch (val) {
  235. case 'date':
  236. valueFormat.value = 'YYYY-MM-DD';
  237. formats.value = 'YYYY-MM-DD';
  238. dates.value = dayjs(state.queryParams.time).format('YYYY-MM-DD');
  239. tableTitle.value = '12345市民服务热线办理工作日统计';
  240. state.queryParams.crTime = [dayjs().startOf('day').format('YYYY-MM-DD'), dayjs().endOf('day').format('YYYY-MM-DD')];
  241. queryList();
  242. break;
  243. case 'month':
  244. valueFormat.value = 'YYYY-MM';
  245. formats.value = 'YYYY-MM';
  246. dates.value = `${dayjs(state.queryParams.time).startOf('month').format('YYYY-MM-DD')} 至 ${dayjs(state.queryParams.time)
  247. .endOf('month')
  248. .format('YYYY-MM-DD')}`;
  249. tableTitle.value = '12345市民服务热线办理工作月统计';
  250. state.queryParams.crTime = [dayjs().startOf('month').format('YYYY-MM-DD'), dayjs().endOf('month').format('YYYY-MM-DD')];
  251. queryList();
  252. break;
  253. case 'week':
  254. valueFormat.value = 'YYYY-MM-DD';
  255. formats.value = 'YYYY 第ww周';
  256. dates.value = `${dayjs(state.queryParams.time).startOf('week').format('YYYY-MM-DD')} 至 ${dayjs(state.queryParams.time)
  257. .endOf('week')
  258. .format('YYYY-MM-DD')}`;
  259. tableTitle.value = '12345市民服务热线办理工作周统计';
  260. state.queryParams.crTime = [dayjs().startOf('week').format('YYYY-MM-DD'), dayjs().endOf('week').format('YYYY-MM-DD')];
  261. queryList();
  262. break;
  263. case 'daterange':
  264. dates.value = `${dayjs(state.queryParams.crTime[0]).format('YYYY-MM-DD')} 至 ${dayjs(state.queryParams.crTime[1]).format('YYYY-MM-DD')}`;
  265. tableTitle.value = '12345市民服务热线办理工作时间段统计';
  266. queryList();
  267. break;
  268. default:
  269. valueFormat.value = 'YYYY-MM-DD';
  270. formats.value = 'YYYY-MM-DD';
  271. dates.value = dayjs(state.queryParams.time).format('YYYY-MM-DD');
  272. tableTitle.value = '12345市民服务热线办理工作日统计';
  273. state.queryParams.crTime = [dayjs().startOf('day').format('YYYY-MM-DD'), dayjs().endOf('day').format('YYYY-MM-DD')];
  274. queryList();
  275. break;
  276. }
  277. };
  278. const centerReportCallData = ref<EmptyObjectType>({}); // 电话统计
  279. const centerReportOrderData = ref<EmptyObjectType>({}); // 信件统计
  280. const centerReportOrderAcceptTypesData = ref<EmptyObjectType>([]); // 信件类型统计
  281. const centerReportOrderSourceChannelsData = ref<EmptyObjectType>([]); // 信件来源统计
  282. const centerReportVisitdData = ref<EmptyObjectType>({}); // 信件回访统计
  283. const orgStatisticsAreaAllData = ref<EmptyObjectType>({}); // 区域统计
  284. const orgStatisticsCityAllData = ref<EmptyObjectType>({}); // 城市统计
  285. /** 获取列表 */
  286. const queryList = throttle(() => {
  287. state.loading = true;
  288. let StartDate = null;
  289. let EndDate = null;
  290. if (state.queryParams?.crTime) {
  291. StartDate = state.queryParams?.crTime[0];
  292. EndDate = state.queryParams?.crTime[1];
  293. }
  294. const request = {
  295. StartDate,
  296. EndDate,
  297. };
  298. centerReport(request)
  299. .then((res: any) => {
  300. const {
  301. centerReportCall,
  302. centerReportOrder,
  303. centerReportOrderAcceptTypes,
  304. centerReportOrderSourceChannels,
  305. centerReportVisitd,
  306. orgStatisticsAreaAll,
  307. orgStatisticsCityAll,
  308. } = res.result;
  309. centerReportCallData.value = centerReportCall;
  310. centerReportOrderData.value = centerReportOrder;
  311. centerReportOrderAcceptTypesData.value = centerReportOrderAcceptTypes;
  312. centerReportOrderSourceChannelsData.value = centerReportOrderSourceChannels;
  313. centerReportVisitdData.value = centerReportVisitd;
  314. orgStatisticsAreaAllData.value = orgStatisticsAreaAll;
  315. orgStatisticsCityAllData.value = orgStatisticsCityAll;
  316. state.loading = false;
  317. })
  318. .catch(() => {
  319. state.loading = false;
  320. });
  321. }, 300);
  322. /** 重置按钮操作 */
  323. const resetQuery = throttle((formEl: FormInstance | undefined) => {
  324. if (!formEl) return;
  325. formEl.resetFields();
  326. queryList();
  327. valueFormat.value = 'YYYY-MM-DD';
  328. formats.value = 'YYYY-MM-DD';
  329. dates.value = dayjs(state.queryParams.time).format('YYYY-MM-DD');
  330. tableTitle.value = '12345市民服务热线办理工作日统计';
  331. state.queryParams.crTime = [dayjs().startOf('day').format('YYYY-MM-DD'), dayjs().endOf('day').format('YYYY-MM-DD')];
  332. }, 300);
  333. const exportTable = ref<RefType>();
  334. const exportWord = () => {
  335. ElMessageBox.confirm(`确定要导出(${tableTitle.value}【${dates.value}】),是否继续?`, '提示', {
  336. confirmButtonText: '确认导出',
  337. cancelButtonText: '取消',
  338. type: 'warning',
  339. draggable: true,
  340. cancelButtonClass: 'default-button',
  341. autofocus: false,
  342. })
  343. .then(() => {
  344. exportAsDocx(exportTable.value, `${tableTitle.value}【${dates.value}】`);
  345. })
  346. .catch(() => {});
  347. };
  348. onMounted(() => {
  349. queryList();
  350. });
  351. </script>