message-dashboard.component.html 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  1. <nz-card nzTitle="消息推送统计概览" [nzBordered]="false">
  2. <div class="filter-controls">
  3. <nz-range-picker
  4. [(ngModel)]="dateRange"
  5. (ngModelChange)="refreshData()"
  6. style="width: 300px; margin-right: 16px"
  7. ></nz-range-picker>
  8. <!-- 新增策略筛选下拉框 -->
  9. <nz-select
  10. [(ngModel)]="selectedStrategy"
  11. (ngModelChange)="refreshData()"
  12. style="width: 300px; margin-right: 16px"
  13. nzPlaceHolder="选择策略"
  14. >
  15. <nz-option nzValue="" nzLabel="全部策略"></nz-option>
  16. <nz-option
  17. *ngFor="let strategy of strategies"
  18. [nzValue]="strategy"
  19. [nzLabel]="strategy"
  20. ></nz-option>
  21. </nz-select>
  22. <button
  23. nz-button
  24. nzType="primary"
  25. (click)="refreshData()"
  26. [nzLoading]="isLoading"
  27. >
  28. <span nz-icon nzType="sync"></span>刷新数据
  29. </button>
  30. </div>
  31. <nz-spin [nzSpinning]="isLoading">
  32. <!-- 整体统计卡片 -->
  33. <nz-card nzTitle="整体统计" style="margin-top: 16px">
  34. <div nz-row [nzGutter]="16" *ngIf="overallStats">
  35. <div nz-col [nzSpan]="4">
  36. <nz-statistic
  37. nzTitle="总发送量"
  38. [nzValue]="overallStats.totalRecords || 0"
  39. ></nz-statistic>
  40. </div>
  41. <div nz-col [nzSpan]="4">
  42. <nz-statistic
  43. nzTitle="发送成功率"
  44. [nzValue]="formatPercentage(overallStats.sentSuccessRate || 0)"
  45. ></nz-statistic>
  46. <div class="statistic-subtext">
  47. 成功数: {{ overallStats.sent || 0 }}
  48. </div>
  49. </div>
  50. <div nz-col [nzSpan]="4">
  51. <nz-statistic
  52. nzTitle="送达率"
  53. [nzValue]="formatPercentage(overallStats.deliveredRate || 0)"
  54. ></nz-statistic>
  55. <div class="statistic-subtext">
  56. 送达数: {{ overallStats.delivered || 0 }}
  57. </div>
  58. </div>
  59. <div nz-col [nzSpan]="4">
  60. <nz-statistic
  61. nzTitle="展示率"
  62. [nzValue]="formatPercentage(overallStats.displayRate || 0)"
  63. ></nz-statistic>
  64. <div class="statistic-subtext">
  65. 展示数: {{ overallStats.displayCount || 0 }}
  66. </div>
  67. </div>
  68. <div nz-col [nzSpan]="4">
  69. <nz-statistic
  70. nzTitle="点击率"
  71. [nzValue]="formatPercentage(overallStats.clickThroughRate || 0)"
  72. ></nz-statistic>
  73. </div>
  74. <div nz-col [nzSpan]="4">
  75. <nz-statistic
  76. nzTitle="失败率"
  77. [nzValue]="
  78. formatPercentage(overallStats.tokenInvalidationRate || 0)
  79. "
  80. ></nz-statistic>
  81. <div class="statistic-subtext">
  82. 失败数: {{ overallStats.failed || 0 }}
  83. </div>
  84. </div>
  85. </div>
  86. </nz-card>
  87. <!-- 图表区域 -->
  88. <div nz-row [nzGutter]="16" style="margin-top: 16px">
  89. <div nz-col [nzSpan]="24">
  90. <nz-card nzTitle="每日消息量与转化率">
  91. <div class="chart-container">
  92. <canvas
  93. baseChart
  94. [type]="'bar'"
  95. [data]="combinedChartData"
  96. [options]="combinedChartOptions"
  97. ></canvas>
  98. </div>
  99. <div class="chart-legend">
  100. <div>
  101. <span
  102. class="legend-color"
  103. style="background-color: #1890ff"
  104. ></span>
  105. 总发送量
  106. </div>
  107. <div>
  108. <span
  109. class="legend-color"
  110. style="background-color: #52c41a"
  111. ></span>
  112. 成功发送
  113. </div>
  114. <div>
  115. <span
  116. class="legend-color"
  117. style="background-color: #13c2c2"
  118. ></span>
  119. 已送达
  120. </div>
  121. <div>
  122. <span
  123. class="legend-color"
  124. style="background-color: #722ed1"
  125. ></span>
  126. 已打开
  127. </div>
  128. <div>
  129. <span
  130. class="legend-color"
  131. style="background-color: #faad14"
  132. ></span>
  133. 展示数
  134. </div>
  135. <div>
  136. <span
  137. class="legend-color"
  138. style="background-color: #f5222d"
  139. ></span>
  140. 失败数
  141. </div>
  142. <div>
  143. <span class="legend-line" style="border-color: #13c2c2"></span>
  144. 送达率
  145. </div>
  146. <div>
  147. <span class="legend-line" style="border-color: #faad14"></span>
  148. 展示率
  149. </div>
  150. <div>
  151. <span class="legend-line" style="border-color: #722ed1"></span>
  152. 点击率
  153. </div>
  154. </div>
  155. </nz-card>
  156. </div>
  157. </div>
  158. <!-- 统计表格标签页 -->
  159. <nz-tabset [(nzSelectedIndex)]="activeTab" style="margin-top: 16px">
  160. <!-- 按策略统计表格 -->
  161. <nz-tab nzTitle="按策略统计">
  162. <nz-table
  163. #strategyTable
  164. [nzData]="strategyStats"
  165. [nzFrontPagination]="false"
  166. [nzShowPagination]="false"
  167. [nzBordered]="true"
  168. [nzSize]="'small'"
  169. nzTableLayout="fixed"
  170. >
  171. <thead>
  172. <tr>
  173. <th nzWidth="50px"></th>
  174. <th (click)="sortStrategyTable('strategyName')">
  175. 策略名称
  176. <span *ngIf="strategySortField === 'strategyName'">
  177. <i
  178. nz-icon
  179. [nzType]="
  180. strategySortDirection === 'ascend'
  181. ? 'caret-up'
  182. : 'caret-down'
  183. "
  184. ></i>
  185. </span>
  186. </th>
  187. <th (click)="sortStrategyTable('totalRecords')">
  188. 总发送量
  189. <span *ngIf="strategySortField === 'totalRecords'">
  190. <i
  191. nz-icon
  192. [nzType]="
  193. strategySortDirection === 'ascend'
  194. ? 'caret-up'
  195. : 'caret-down'
  196. "
  197. ></i>
  198. </span>
  199. </th>
  200. <th (click)="sortStrategyTable('sent')">
  201. 成功数
  202. <span *ngIf="strategySortField === 'sent'">
  203. <i
  204. nz-icon
  205. [nzType]="
  206. strategySortDirection === 'ascend'
  207. ? 'caret-up'
  208. : 'caret-down'
  209. "
  210. ></i>
  211. </span>
  212. </th>
  213. <th (click)="sortStrategyTable('delivered')">
  214. 送达数
  215. <span *ngIf="strategySortField === 'delivered'">
  216. <i
  217. nz-icon
  218. [nzType]="
  219. strategySortDirection === 'ascend'
  220. ? 'caret-up'
  221. : 'caret-down'
  222. "
  223. ></i>
  224. </span>
  225. </th>
  226. <th (click)="sortStrategyTable('displayCount')">
  227. 展示数
  228. <span *ngIf="strategySortField === 'displayCount'">
  229. <i
  230. nz-icon
  231. [nzType]="
  232. strategySortDirection === 'ascend'
  233. ? 'caret-up'
  234. : 'caret-down'
  235. "
  236. ></i>
  237. </span>
  238. </th>
  239. <th (click)="sortStrategyTable('opened')">
  240. 打开数
  241. <span *ngIf="strategySortField === 'opened'">
  242. <i
  243. nz-icon
  244. [nzType]="
  245. strategySortDirection === 'ascend'
  246. ? 'caret-up'
  247. : 'caret-down'
  248. "
  249. ></i>
  250. </span>
  251. </th>
  252. <th (click)="sortStrategyTable('failed')">
  253. 失败数
  254. <span *ngIf="strategySortField === 'failed'">
  255. <i
  256. nz-icon
  257. [nzType]="
  258. strategySortDirection === 'ascend'
  259. ? 'caret-up'
  260. : 'caret-down'
  261. "
  262. ></i>
  263. </span>
  264. </th>
  265. <th (click)="sortStrategyTable('deliveredRate')">
  266. 送达率
  267. <span *ngIf="strategySortField === 'deliveredRate'">
  268. <i
  269. nz-icon
  270. [nzType]="
  271. strategySortDirection === 'ascend'
  272. ? 'caret-up'
  273. : 'caret-down'
  274. "
  275. ></i>
  276. </span>
  277. </th>
  278. <th (click)="sortStrategyTable('displayRate')">
  279. 展示率
  280. <span *ngIf="strategySortField === 'displayRate'">
  281. <i
  282. nz-icon
  283. [nzType]="
  284. strategySortDirection === 'ascend'
  285. ? 'caret-up'
  286. : 'caret-down'
  287. "
  288. ></i>
  289. </span>
  290. </th>
  291. <th (click)="sortStrategyTable('clickThroughRate')">
  292. 点击率
  293. <span *ngIf="strategySortField === 'clickThroughRate'">
  294. <i
  295. nz-icon
  296. [nzType]="
  297. strategySortDirection === 'ascend'
  298. ? 'caret-up'
  299. : 'caret-down'
  300. "
  301. ></i>
  302. </span>
  303. </th>
  304. <th (click)="sortStrategyTable('tokenInvalidationRate')">
  305. 失败率
  306. <span *ngIf="strategySortField === 'tokenInvalidationRate'">
  307. <i
  308. nz-icon
  309. [nzType]="
  310. strategySortDirection === 'ascend'
  311. ? 'caret-up'
  312. : 'caret-down'
  313. "
  314. ></i>
  315. </span>
  316. </th>
  317. </tr>
  318. </thead>
  319. <tbody>
  320. <ng-template ngFor let-item [ngForOf]="strategyTable.data">
  321. <tr>
  322. <td
  323. (click)="toggleExpand(item, 'strategy')"
  324. class="expand-icon-cell"
  325. >
  326. <i
  327. nz-icon
  328. [nzType]="item.expanded ? 'down' : 'right'"
  329. class="expand-icon"
  330. ></i>
  331. </td>
  332. <td class="strategy-name-col">
  333. <a
  334. (click)="navigateToStrategy(item.strategyName)"
  335. *ngIf="item.strategyName"
  336. >
  337. {{ item.strategyName || "-" }}
  338. </a>
  339. <span *ngIf="!item.strategyName">-</span>
  340. </td>
  341. <td>{{ item.totalRecords || 0 }}</td>
  342. <td>{{ item.sent || 0 }}</td>
  343. <td>{{ item.delivered || 0 }}</td>
  344. <td>{{ item.displayCount || 0 }}</td>
  345. <td>{{ item.opened || 0 }}</td>
  346. <td>{{ item.failed || 0 }}</td>
  347. <td>{{ formatPercentage(item.deliveredRate || 0) }}</td>
  348. <td>{{ formatPercentage(item.displayRate || 0) }}</td>
  349. <td>{{ formatPercentage(item.clickThroughRate || 0) }}</td>
  350. <td>{{ formatPercentage(item.tokenInvalidationRate || 0) }}</td>
  351. </tr>
  352. <tr [nzExpand]="item.expanded">
  353. <td colspan="12" *ngIf="item.expanded" class="expanded-row">
  354. <div *ngIf="item.loading" class="loading-container">
  355. <nz-spin></nz-spin>
  356. </div>
  357. <div
  358. *ngIf="item.dailyData && !item.loading"
  359. class="expanded-content"
  360. >
  361. <nz-table
  362. class="expanded-table"
  363. [nzData]="item.dailyData"
  364. [nzShowPagination]="false"
  365. [nzSize]="'small'"
  366. nzBordered
  367. >
  368. <thead>
  369. <tr>
  370. <th>日期</th>
  371. <th>总发送量</th>
  372. <th>成功数</th>
  373. <th>送达数</th>
  374. <th>展示数</th>
  375. <th>打开数</th>
  376. <th>失败数</th>
  377. <th>送达率</th>
  378. <th>展示率</th>
  379. <th>点击率</th>
  380. <th>失败率</th>
  381. </tr>
  382. </thead>
  383. <tbody>
  384. <tr *ngFor="let daily of item.dailyData">
  385. <td>{{ formatDate(daily.date) }}</td>
  386. <td>{{ daily.totalRecords || 0 }}</td>
  387. <td>{{ daily.sent || 0 }}</td>
  388. <td>{{ daily.delivered || 0 }}</td>
  389. <td>{{ daily.displayCount || 0 }}</td>
  390. <td>{{ daily.opened || 0 }}</td>
  391. <td>{{ daily.failed || 0 }}</td>
  392. <td>
  393. {{ formatPercentage(daily.deliveredRate || 0) }}
  394. </td>
  395. <td>
  396. {{ formatPercentage(daily.displayRate || 0) }}
  397. </td>
  398. <td>
  399. {{ formatPercentage(daily.clickThroughRate || 0) }}
  400. </td>
  401. <td>
  402. {{
  403. formatPercentage(daily.tokenInvalidationRate || 0)
  404. }}
  405. </td>
  406. </tr>
  407. </tbody>
  408. </nz-table>
  409. </div>
  410. </td>
  411. </tr>
  412. </ng-template>
  413. </tbody>
  414. </nz-table>
  415. <nz-empty *ngIf="strategyStats.length === 0 && !isLoading"></nz-empty>
  416. </nz-tab>
  417. <!-- 按模板统计表格 -->
  418. <nz-tab nzTitle="按模板统计">
  419. <nz-table
  420. #templateTable
  421. [nzData]="templateStats"
  422. [nzFrontPagination]="false"
  423. [nzShowPagination]="false"
  424. [nzBordered]="true"
  425. [nzSize]="'small'"
  426. nzTableLayout="fixed"
  427. >
  428. <thead>
  429. <tr>
  430. <th nzWidth="50px"></th>
  431. <th (click)="sortTemplateTable('templateName')">
  432. 模板名称
  433. <span *ngIf="templateSortField === 'templateName'">
  434. <i
  435. nz-icon
  436. [nzType]="
  437. templateSortDirection === 'ascend'
  438. ? 'caret-up'
  439. : 'caret-down'
  440. "
  441. ></i>
  442. </span>
  443. </th>
  444. <th (click)="sortTemplateTable('totalRecords')">
  445. 总发送量
  446. <span *ngIf="templateSortField === 'totalRecords'">
  447. <i
  448. nz-icon
  449. [nzType]="
  450. templateSortDirection === 'ascend'
  451. ? 'caret-up'
  452. : 'caret-down'
  453. "
  454. ></i>
  455. </span>
  456. </th>
  457. <th (click)="sortTemplateTable('sent')">
  458. 成功数
  459. <span *ngIf="templateSortField === 'sent'">
  460. <i
  461. nz-icon
  462. [nzType]="
  463. templateSortDirection === 'ascend'
  464. ? 'caret-up'
  465. : 'caret-down'
  466. "
  467. ></i>
  468. </span>
  469. </th>
  470. <th (click)="sortTemplateTable('delivered')">
  471. 送达数
  472. <span *ngIf="templateSortField === 'delivered'">
  473. <i
  474. nz-icon
  475. [nzType]="
  476. templateSortDirection === 'ascend'
  477. ? 'caret-up'
  478. : 'caret-down'
  479. "
  480. ></i>
  481. </span>
  482. </th>
  483. <th (click)="sortTemplateTable('displayCount')">
  484. 展示数
  485. <span *ngIf="templateSortField === 'displayCount'">
  486. <i
  487. nz-icon
  488. [nzType]="
  489. templateSortDirection === 'ascend'
  490. ? 'caret-up'
  491. : 'caret-down'
  492. "
  493. ></i>
  494. </span>
  495. </th>
  496. <th (click)="sortTemplateTable('opened')">
  497. 打开数
  498. <span *ngIf="templateSortField === 'opened'">
  499. <i
  500. nz-icon
  501. [nzType]="
  502. templateSortDirection === 'ascend'
  503. ? 'caret-up'
  504. : 'caret-down'
  505. "
  506. ></i>
  507. </span>
  508. </th>
  509. <th (click)="sortTemplateTable('failed')">
  510. 失败数
  511. <span *ngIf="templateSortField === 'failed'">
  512. <i
  513. nz-icon
  514. [nzType]="
  515. templateSortDirection === 'ascend'
  516. ? 'caret-up'
  517. : 'caret-down'
  518. "
  519. ></i>
  520. </span>
  521. </th>
  522. <th (click)="sortTemplateTable('deliveredRate')">
  523. 送达率
  524. <span *ngIf="templateSortField === 'deliveredRate'">
  525. <i
  526. nz-icon
  527. [nzType]="
  528. templateSortDirection === 'ascend'
  529. ? 'caret-up'
  530. : 'caret-down'
  531. "
  532. ></i>
  533. </span>
  534. </th>
  535. <th (click)="sortTemplateTable('displayRate')">
  536. 展示率
  537. <span *ngIf="templateSortField === 'displayRate'">
  538. <i
  539. nz-icon
  540. [nzType]="
  541. templateSortDirection === 'ascend'
  542. ? 'caret-up'
  543. : 'caret-down'
  544. "
  545. ></i>
  546. </span>
  547. </th>
  548. <th (click)="sortTemplateTable('clickThroughRate')">
  549. 点击率
  550. <span *ngIf="templateSortField === 'clickThroughRate'">
  551. <i
  552. nz-icon
  553. [nzType]="
  554. templateSortDirection === 'ascend'
  555. ? 'caret-up'
  556. : 'caret-down'
  557. "
  558. ></i>
  559. </span>
  560. </th>
  561. <th (click)="sortTemplateTable('tokenInvalidationRate')">
  562. 失败率
  563. <span *ngIf="templateSortField === 'tokenInvalidationRate'">
  564. <i
  565. nz-icon
  566. [nzType]="
  567. templateSortDirection === 'ascend'
  568. ? 'caret-up'
  569. : 'caret-down'
  570. "
  571. ></i>
  572. </span>
  573. </th>
  574. </tr>
  575. </thead>
  576. <tbody>
  577. <ng-template ngFor let-item [ngForOf]="templateTable.data">
  578. <tr>
  579. <td
  580. (click)="toggleExpand(item, 'template')"
  581. class="expand-icon-cell"
  582. >
  583. <i
  584. nz-icon
  585. [nzType]="item.expanded ? 'down' : 'right'"
  586. class="expand-icon"
  587. ></i>
  588. </td>
  589. <td class="template-name-col">
  590. <a
  591. (click)="navigateToTemplate(item.templateName)"
  592. *ngIf="item.templateName"
  593. >
  594. {{ item.templateName || "-" }}
  595. </a>
  596. <span *ngIf="!item.templateName">-</span>
  597. </td>
  598. <td>{{ item.totalRecords || 0 }}</td>
  599. <td>{{ item.sent || 0 }}</td>
  600. <td>{{ item.delivered || 0 }}</td>
  601. <td>{{ item.displayCount || 0 }}</td>
  602. <td>{{ item.opened || 0 }}</td>
  603. <td>{{ item.failed || 0 }}</td>
  604. <td>{{ formatPercentage(item.deliveredRate || 0) }}</td>
  605. <td>{{ formatPercentage(item.displayRate || 0) }}</td>
  606. <td>{{ formatPercentage(item.clickThroughRate || 0) }}</td>
  607. <td>{{ formatPercentage(item.tokenInvalidationRate || 0) }}</td>
  608. </tr>
  609. <tr [nzExpand]="item.expanded">
  610. <td colspan="12" *ngIf="item.expanded" class="expanded-row">
  611. <div *ngIf="item.loading" class="loading-container">
  612. <nz-spin></nz-spin>
  613. </div>
  614. <div
  615. *ngIf="item.dailyData && !item.loading"
  616. class="expanded-content"
  617. >
  618. <nz-table
  619. class="expanded-table"
  620. [nzData]="item.dailyData"
  621. [nzShowPagination]="false"
  622. [nzSize]="'small'"
  623. nzBordered
  624. >
  625. <thead>
  626. <tr>
  627. <th>日期</th>
  628. <th>总发送量</th>
  629. <th>成功数</th>
  630. <th>送达数</th>
  631. <th>展示数</th>
  632. <th>打开数</th>
  633. <th>失败数</th>
  634. <th>送达率</th>
  635. <th>展示率</th>
  636. <th>点击率</th>
  637. <th>失败率</th>
  638. </tr>
  639. </thead>
  640. <tbody>
  641. <tr *ngFor="let daily of item.dailyData">
  642. <td>{{ formatDate(daily.date) }}</td>
  643. <td>{{ daily.totalRecords || 0 }}</td>
  644. <td>{{ daily.sent || 0 }}</td>
  645. <td>{{ daily.delivered || 0 }}</td>
  646. <td>{{ daily.displayCount || 0 }}</td>
  647. <td>{{ daily.opened || 0 }}</td>
  648. <td>{{ daily.failed || 0 }}</td>
  649. <td>
  650. {{ formatPercentage(daily.deliveredRate || 0) }}
  651. </td>
  652. <td>
  653. {{ formatPercentage(daily.displayRate || 0) }}
  654. </td>
  655. <td>
  656. {{ formatPercentage(daily.clickThroughRate || 0) }}
  657. </td>
  658. <td>
  659. {{
  660. formatPercentage(daily.tokenInvalidationRate || 0)
  661. }}
  662. </td>
  663. </tr>
  664. </tbody>
  665. </nz-table>
  666. </div>
  667. </td>
  668. </tr>
  669. </ng-template>
  670. </tbody>
  671. </nz-table>
  672. <nz-empty *ngIf="templateStats.length === 0 && !isLoading"></nz-empty>
  673. </nz-tab>
  674. <!-- 按国家统计表格 -->
  675. <nz-tab nzTitle="按国家统计">
  676. <nz-table
  677. #ccTable
  678. [nzData]="ccStats"
  679. [nzFrontPagination]="false"
  680. [nzShowPagination]="false"
  681. [nzBordered]="true"
  682. [nzSize]="'small'"
  683. nzTableLayout="fixed"
  684. >
  685. <thead>
  686. <tr>
  687. <th nzWidth="50px"></th>
  688. <th (click)="sortCcTable('cc')">
  689. 国家/地区
  690. <span *ngIf="ccSortField === 'cc'">
  691. <i
  692. nz-icon
  693. [nzType]="
  694. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  695. "
  696. ></i>
  697. </span>
  698. </th>
  699. <th (click)="sortCcTable('totalRecords')">
  700. 总发送量
  701. <span *ngIf="ccSortField === 'totalRecords'">
  702. <i
  703. nz-icon
  704. [nzType]="
  705. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  706. "
  707. ></i>
  708. </span>
  709. </th>
  710. <th (click)="sortCcTable('sent')">
  711. 成功数
  712. <span *ngIf="ccSortField === 'sent'">
  713. <i
  714. nz-icon
  715. [nzType]="
  716. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  717. "
  718. ></i>
  719. </span>
  720. </th>
  721. <th (click)="sortCcTable('delivered')">
  722. 送达数
  723. <span *ngIf="ccSortField === 'delivered'">
  724. <i
  725. nz-icon
  726. [nzType]="
  727. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  728. "
  729. ></i>
  730. </span>
  731. </th>
  732. <th (click)="sortCcTable('displayCount')">
  733. 展示数
  734. <span *ngIf="ccSortField === 'displayCount'">
  735. <i
  736. nz-icon
  737. [nzType]="
  738. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  739. "
  740. ></i>
  741. </span>
  742. </th>
  743. <th (click)="sortCcTable('opened')">
  744. 打开数
  745. <span *ngIf="ccSortField === 'opened'">
  746. <i
  747. nz-icon
  748. [nzType]="
  749. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  750. "
  751. ></i>
  752. </span>
  753. </th>
  754. <th (click)="sortCcTable('failed')">
  755. 失败数
  756. <span *ngIf="ccSortField === 'failed'">
  757. <i
  758. nz-icon
  759. [nzType]="
  760. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  761. "
  762. ></i>
  763. </span>
  764. </th>
  765. <th (click)="sortCcTable('deliveredRate')">
  766. 送达率
  767. <span *ngIf="ccSortField === 'deliveredRate'">
  768. <i
  769. nz-icon
  770. [nzType]="
  771. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  772. "
  773. ></i>
  774. </span>
  775. </th>
  776. <th (click)="sortCcTable('displayRate')">
  777. 展示率
  778. <span *ngIf="ccSortField === 'displayRate'">
  779. <i
  780. nz-icon
  781. [nzType]="
  782. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  783. "
  784. ></i>
  785. </span>
  786. </th>
  787. <th (click)="sortCcTable('clickThroughRate')">
  788. 点击率
  789. <span *ngIf="ccSortField === 'clickThroughRate'">
  790. <i
  791. nz-icon
  792. [nzType]="
  793. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  794. "
  795. ></i>
  796. </span>
  797. </th>
  798. <th (click)="sortCcTable('tokenInvalidationRate')">
  799. 失败率
  800. <span *ngIf="ccSortField === 'tokenInvalidationRate'">
  801. <i
  802. nz-icon
  803. [nzType]="
  804. ccSortDirection === 'ascend' ? 'caret-up' : 'caret-down'
  805. "
  806. ></i>
  807. </span>
  808. </th>
  809. </tr>
  810. </thead>
  811. <tbody>
  812. <ng-template ngFor let-item [ngForOf]="ccTable.data">
  813. <tr>
  814. <td (click)="toggleExpand(item, 'cc')" class="expand-icon-cell">
  815. <i
  816. nz-icon
  817. [nzType]="item.expanded ? 'down' : 'right'"
  818. class="expand-icon"
  819. ></i>
  820. </td>
  821. <td>
  822. {{ formatCountry(item.cc) }}
  823. </td>
  824. <td>{{ item.totalRecords || 0 }}</td>
  825. <td>{{ item.sent || 0 }}</td>
  826. <td>{{ item.delivered || 0 }}</td>
  827. <td>{{ item.displayCount || 0 }}</td>
  828. <td>{{ item.opened || 0 }}</td>
  829. <td>{{ item.failed || 0 }}</td>
  830. <td>{{ formatPercentage(item.deliveredRate || 0) }}</td>
  831. <td>{{ formatPercentage(item.displayRate || 0) }}</td>
  832. <td>{{ formatPercentage(item.clickThroughRate || 0) }}</td>
  833. <td>{{ formatPercentage(item.tokenInvalidationRate || 0) }}</td>
  834. </tr>
  835. <tr [nzExpand]="item.expanded">
  836. <td colspan="12" *ngIf="item.expanded" class="expanded-row">
  837. <div *ngIf="item.loading" class="loading-container">
  838. <nz-spin></nz-spin>
  839. </div>
  840. <div
  841. *ngIf="item.dailyData && !item.loading"
  842. class="expanded-content"
  843. >
  844. <nz-table
  845. class="expanded-table"
  846. [nzData]="item.dailyData"
  847. [nzShowPagination]="false"
  848. [nzSize]="'small'"
  849. nzBordered
  850. >
  851. <thead>
  852. <tr>
  853. <th>日期</th>
  854. <th>总发送量</th>
  855. <th>成功数</th>
  856. <th>送达数</th>
  857. <th>展示数</th>
  858. <th>打开数</th>
  859. <th>失败数</th>
  860. <th>送达率</th>
  861. <th>展示率</th>
  862. <th>点击率</th>
  863. <th>失败率</th>
  864. </tr>
  865. </thead>
  866. <tbody>
  867. <tr *ngFor="let daily of item.dailyData">
  868. <td>{{ formatDate(daily.date) }}</td>
  869. <td>{{ daily.totalRecords || 0 }}</td>
  870. <td>{{ daily.sent || 0 }}</td>
  871. <td>{{ daily.delivered || 0 }}</td>
  872. <td>{{ daily.displayCount || 0 }}</td>
  873. <td>{{ daily.opened || 0 }}</td>
  874. <td>{{ daily.failed || 0 }}</td>
  875. <td>
  876. {{ formatPercentage(daily.deliveredRate || 0) }}
  877. </td>
  878. <td>
  879. {{ formatPercentage(daily.displayRate || 0) }}
  880. </td>
  881. <td>
  882. {{ formatPercentage(daily.clickThroughRate || 0) }}
  883. </td>
  884. <td>
  885. {{
  886. formatPercentage(daily.tokenInvalidationRate || 0)
  887. }}
  888. </td>
  889. </tr>
  890. </tbody>
  891. </nz-table>
  892. </div>
  893. </td>
  894. </tr>
  895. </ng-template>
  896. </tbody>
  897. </nz-table>
  898. <nz-empty *ngIf="ccStats.length === 0 && !isLoading"></nz-empty>
  899. </nz-tab>
  900. <!-- 按图片统计表格 -->
  901. <nz-tab nzTitle="按图片统计">
  902. <nz-table
  903. #imageTable
  904. [nzData]="imageStats"
  905. [nzFrontPagination]="false"
  906. [nzShowPagination]="false"
  907. [nzBordered]="true"
  908. [nzSize]="'small'"
  909. nzTableLayout="fixed"
  910. >
  911. <thead>
  912. <tr>
  913. <th nzWidth="50px"></th>
  914. <th>图片</th>
  915. <th (click)="sortImageTable('totalRecords')">
  916. 总发送量
  917. <span *ngIf="imageSortField === 'totalRecords'">
  918. <i
  919. nz-icon
  920. [nzType]="
  921. imageSortDirection === 'ascend'
  922. ? 'caret-up'
  923. : 'caret-down'
  924. "
  925. ></i>
  926. </span>
  927. </th>
  928. <th (click)="sortImageTable('sent')">
  929. 成功数
  930. <span *ngIf="imageSortField === 'sent'">
  931. <i
  932. nz-icon
  933. [nzType]="
  934. imageSortDirection === 'ascend'
  935. ? 'caret-up'
  936. : 'caret-down'
  937. "
  938. ></i>
  939. </span>
  940. </th>
  941. <th (click)="sortImageTable('delivered')">
  942. 送达数
  943. <span *ngIf="imageSortField === 'delivered'">
  944. <i
  945. nz-icon
  946. [nzType]="
  947. imageSortDirection === 'ascend'
  948. ? 'caret-up'
  949. : 'caret-down'
  950. "
  951. ></i>
  952. </span>
  953. </th>
  954. <th (click)="sortImageTable('displayCount')">
  955. 展示数
  956. <span *ngIf="imageSortField === 'displayCount'">
  957. <i
  958. nz-icon
  959. [nzType]="
  960. imageSortDirection === 'ascend'
  961. ? 'caret-up'
  962. : 'caret-down'
  963. "
  964. ></i>
  965. </span>
  966. </th>
  967. <th (click)="sortImageTable('opened')">
  968. 打开数
  969. <span *ngIf="imageSortField === 'opened'">
  970. <i
  971. nz-icon
  972. [nzType]="
  973. imageSortDirection === 'ascend'
  974. ? 'caret-up'
  975. : 'caret-down'
  976. "
  977. ></i>
  978. </span>
  979. </th>
  980. <th (click)="sortImageTable('failed')">
  981. 失败数
  982. <span *ngIf="imageSortField === 'failed'">
  983. <i
  984. nz-icon
  985. [nzType]="
  986. imageSortDirection === 'ascend'
  987. ? 'caret-up'
  988. : 'caret-down'
  989. "
  990. ></i>
  991. </span>
  992. </th>
  993. <th (click)="sortImageTable('deliveredRate')">
  994. 送达率
  995. <span *ngIf="imageSortField === 'deliveredRate'">
  996. <i
  997. nz-icon
  998. [nzType]="
  999. imageSortDirection === 'ascend'
  1000. ? 'caret-up'
  1001. : 'caret-down'
  1002. "
  1003. ></i>
  1004. </span>
  1005. </th>
  1006. <th (click)="sortImageTable('displayRate')">
  1007. 展示率
  1008. <span *ngIf="imageSortField === 'displayRate'">
  1009. <i
  1010. nz-icon
  1011. [nzType]="
  1012. imageSortDirection === 'ascend'
  1013. ? 'caret-up'
  1014. : 'caret-down'
  1015. "
  1016. ></i>
  1017. </span>
  1018. </th>
  1019. <th (click)="sortImageTable('clickThroughRate')">
  1020. 点击率
  1021. <span *ngIf="imageSortField === 'clickThroughRate'">
  1022. <i
  1023. nz-icon
  1024. [nzType]="
  1025. imageSortDirection === 'ascend'
  1026. ? 'caret-up'
  1027. : 'caret-down'
  1028. "
  1029. ></i>
  1030. </span>
  1031. </th>
  1032. <th (click)="sortImageTable('tokenInvalidationRate')">
  1033. 失败率
  1034. <span *ngIf="imageSortField === 'tokenInvalidationRate'">
  1035. <i
  1036. nz-icon
  1037. [nzType]="
  1038. imageSortDirection === 'ascend'
  1039. ? 'caret-up'
  1040. : 'caret-down'
  1041. "
  1042. ></i>
  1043. </span>
  1044. </th>
  1045. </tr>
  1046. </thead>
  1047. <tbody>
  1048. <ng-template ngFor let-item [ngForOf]="imageTable.data">
  1049. <tr>
  1050. <td
  1051. (click)="toggleExpand(item, 'image')"
  1052. class="expand-icon-cell"
  1053. >
  1054. <i
  1055. nz-icon
  1056. [nzType]="item.expanded ? 'down' : 'right'"
  1057. class="expand-icon"
  1058. ></i>
  1059. </td>
  1060. <td>
  1061. <img
  1062. nz-image
  1063. width="80px"
  1064. height="80px"
  1065. *ngIf="item.image"
  1066. nzSrc="{{ item.image }}"
  1067. alt="统计图片"
  1068. />
  1069. <span *ngIf="!item.image">-</span>
  1070. </td>
  1071. <td>{{ item.totalRecords || 0 }}</td>
  1072. <td>{{ item.sent || 0 }}</td>
  1073. <td>{{ item.delivered || 0 }}</td>
  1074. <td>{{ item.displayCount || 0 }}</td>
  1075. <td>{{ item.opened || 0 }}</td>
  1076. <td>{{ item.failed || 0 }}</td>
  1077. <td>{{ formatPercentage(item.deliveredRate || 0) }}</td>
  1078. <td>{{ formatPercentage(item.displayRate || 0) }}</td>
  1079. <td>{{ formatPercentage(item.clickThroughRate || 0) }}</td>
  1080. <td>{{ formatPercentage(item.tokenInvalidationRate || 0) }}</td>
  1081. </tr>
  1082. <tr [nzExpand]="item.expanded">
  1083. <td colspan="12" *ngIf="item.expanded" class="expanded-row">
  1084. <div *ngIf="item.loading" class="loading-container">
  1085. <nz-spin></nz-spin>
  1086. </div>
  1087. <div
  1088. *ngIf="item.dailyData && !item.loading"
  1089. class="expanded-content"
  1090. >
  1091. <nz-table
  1092. class="expanded-table"
  1093. [nzData]="item.dailyData"
  1094. [nzShowPagination]="false"
  1095. [nzSize]="'small'"
  1096. nzBordered
  1097. >
  1098. <thead>
  1099. <tr>
  1100. <th>日期</th>
  1101. <th>总发送量</th>
  1102. <th>成功数</th>
  1103. <th>送达数</th>
  1104. <th>展示数</th>
  1105. <th>打开数</th>
  1106. <th>失败数</th>
  1107. <th>送达率</th>
  1108. <th>展示率</th>
  1109. <th>点击率</th>
  1110. <th>失败率</th>
  1111. </tr>
  1112. </thead>
  1113. <tbody>
  1114. <tr *ngFor="let daily of item.dailyData">
  1115. <td>{{ formatDate(daily.date) }}</td>
  1116. <td>{{ daily.totalRecords || 0 }}</td>
  1117. <td>{{ daily.sent || 0 }}</td>
  1118. <td>{{ daily.delivered || 0 }}</td>
  1119. <td>{{ daily.displayCount || 0 }}</td>
  1120. <td>{{ daily.opened || 0 }}</td>
  1121. <td>{{ daily.failed || 0 }}</td>
  1122. <td>
  1123. {{ formatPercentage(daily.deliveredRate || 0) }}
  1124. </td>
  1125. <td>
  1126. {{ formatPercentage(daily.displayRate || 0) }}
  1127. </td>
  1128. <td>
  1129. {{ formatPercentage(daily.clickThroughRate || 0) }}
  1130. </td>
  1131. <td>
  1132. {{
  1133. formatPercentage(daily.tokenInvalidationRate || 0)
  1134. }}
  1135. </td>
  1136. </tr>
  1137. </tbody>
  1138. </nz-table>
  1139. </div>
  1140. </td>
  1141. </tr>
  1142. </ng-template>
  1143. </tbody>
  1144. </nz-table>
  1145. <nz-empty *ngIf="imageStats.length === 0 && !isLoading"></nz-empty>
  1146. </nz-tab>
  1147. </nz-tabset>
  1148. </nz-spin>
  1149. </nz-card>