index.vue 4.6 KB

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