index.vue 5.5 KB

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