index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="SilkRoadDetail">
  3. <van-nav-bar :title="title" left-arrow @click-left="onClickLeft" />
  4. <div class="topImg" v-if="width">
  5. <van-image
  6. :width="width"
  7. :height="height"
  8. @load="load"
  9. :src="isOnlyDay"
  10. />
  11. <span class="days">{{ times.join(' 到 ') }}</span>
  12. </div>
  13. <van-cell-group inset v-for="pitem in centerList" :key="pitem.platform">
  14. <template #title> {{ pitem.platform }} </template>
  15. <div
  16. class="mainCell"
  17. style="margin-top: 0.5em"
  18. v-for="item in pitem.data"
  19. :key="item.nickName + 'c'"
  20. >
  21. <div class="headTitle" v-text="item.nickName"></div>
  22. <div class="label">
  23. <van-row>
  24. <van-col span="6"> 实发 / 应发(件) </van-col>
  25. <van-col span="6">完成率</van-col>
  26. <van-col span="6">传播量(次)</van-col>
  27. <van-col span="6">超时发稿量(件)</van-col>
  28. </van-row>
  29. <van-row>
  30. <van-col span="6">
  31. {{ item.onTimeNum | formmate }} /
  32. {{ item.taskNum | formmate }}
  33. </van-col>
  34. <van-col span="6">
  35. {{ ((item.onTimeNum / item.taskNum).toFixed(2) - 0) * 100 }}%
  36. </van-col>
  37. <van-col span="6">{{ item.readNum | formmate }}</van-col>
  38. <van-col span="6">
  39. {{ item.publishNum - item.onTimeNum }}
  40. </van-col>
  41. </van-row>
  42. </div>
  43. </div>
  44. </van-cell-group>
  45. </div>
  46. </template>
  47. <script>
  48. import { getSilkRoadDetail } from '@/api/index.js';
  49. import watermark from 'watermark-package';
  50. import report from '../mixin/index.js';
  51. import {
  52. Image as VanImage,
  53. CellGroup as VanCellGroup,
  54. Col as VanCol,
  55. Row as VanRow,
  56. NavBar as VanNavBar,
  57. } from 'vant';
  58. import "vant/lib/nav-bar/style/index";
  59. import 'vant/lib/image/style/index';
  60. import 'vant/lib/col/style/index';
  61. import 'vant/lib/row/style/index';
  62. import 'vant/lib/cell-group/style/index';
  63. export default {
  64. name: 'SilkRoadData',
  65. data() {
  66. return {
  67. width: 0,
  68. height: 0,
  69. centerList: [],
  70. isOnlyDay: undefined,
  71. };
  72. },
  73. props: ['type', 'time'],
  74. mixins: [report],
  75. watch: {},
  76. mounted() {},
  77. computed: {},
  78. filters: {
  79. formmate(num) {
  80. if (isNaN(num)) return 0;
  81. if (num >= 100000000) return (num / 100000000).toFixed(2) - 0 + '亿';
  82. if (num >= 10000) return (num / 10000).toFixed(2) - 0 + '万';
  83. return num.toFixed(0) - 0;
  84. },
  85. },
  86. methods: {
  87. init() {
  88. watermark.setWaterMark({
  89. w_texts: ['陕西视听大数据'],
  90. w_options: {
  91. w_opacity: '0.1',
  92. },
  93. });
  94. // this.$route.params.date --> default 日期可选 orther 根据传入日期
  95. this.width = document.body.clientWidth;
  96. this.height = (this.width / 16) * 9;
  97. let times = (this.$route.params.time || '').split('+');
  98. if (times.length > 1 && times[0] === times[1]) times = [times[0]];
  99. this.times = times;
  100. this.title = document.title + (this.times.length > 1 ? "累计报表" : "日报表");
  101. document.title = this.title;
  102. if (this.times.length > 1)
  103. this.isOnlyDay = require('@/assets/image/2023slcw.jpg');
  104. else this.isOnlyDay = require('@/assets/image/2023slcw-day.jpg');
  105. getSilkRoadDetail({
  106. start: this.times[0],
  107. end: this.times.length > 1 ? this.times[1] : this.times[0],
  108. center: this.$route.params.name,
  109. }).then(r => {
  110. this.centerList = r || [];
  111. });
  112. },
  113. load(e) {
  114. const ele = e.path[0];
  115. this.height = this.width * (ele.naturalHeight / ele.naturalWidth);
  116. },
  117. onClickLeft(){ this.$router.go(-1) }
  118. },
  119. beforeUnmount() {},
  120. components: {
  121. VanCol,
  122. VanRow,
  123. VanImage,
  124. VanNavBar,
  125. VanCellGroup,
  126. },
  127. };
  128. </script>
  129. <style scoped>
  130. .SilkRoadDetail {
  131. width: 100%;
  132. height: 100%;
  133. font-size: 16px;
  134. overflow-y: auto;
  135. background-color: #eee;
  136. padding-bottom: 0.5em;
  137. }
  138. .SilkRoadDetail .mainCell {
  139. padding: 0.5em;
  140. font-weight: 500;
  141. }
  142. .SilkRoadDetail .headTitle {
  143. padding: 0 0 0.5em 0;
  144. }
  145. .SilkRoadDetail .label {
  146. font-size: 12px;
  147. line-height: 1.5em;
  148. text-align: center;
  149. color: #969799;
  150. white-space: nowrap;
  151. }
  152. .SilkRoadDetail .van-cell-group__title {
  153. font-size: 20px;
  154. color: #000;
  155. }
  156. .SilkRoadDetail .topImg {
  157. position: relative;
  158. }
  159. .SilkRoadDetail .days {
  160. position: absolute;
  161. left: 5%;
  162. top: 72%;
  163. color: #ffffff;
  164. font-size: 14px;
  165. }
  166. </style>