index.vue 4.6 KB

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