detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item>
  7. <el-button type="text" @click="backToList" icon="el-icon-back" class="back">返回</el-button>
  8. </el-form-item>
  9. <el-form-item class="divLine"></el-form-item>
  10. <el-form-item>
  11. <span class="workName">{{uName}} / {{uTime}}</span>
  12. </el-form-item>
  13. <el-form-item style="float:right;">
  14. 今日工作时长:<span class="workHours">{{uHours}}h</span>
  15. </el-form-item>
  16. </el-form>
  17. </el-col>
  18. <!-- 卡片列表 -->
  19. <div>
  20. <el-col :span="24" class="one_div">
  21. <div id="pie_echarts"></div>
  22. </el-col>
  23. <el-col :span="6" v-for="(item, index) in 12" :key="item" class="one_div">
  24. <el-card :body-style="{ padding: '0px' }" shadow="hover" class="one_card">
  25. <div class="one_card_img">
  26. <el-image :src="index==0?require('../../assets/image/047_S.jpg'):require('../../assets/image/noPic.png')" :preview-src-list="getSrcList(index)" class="image" lazy></el-image>
  27. </div>
  28. <div class="one_card_txt">
  29. <span>在玩游戏呢!!!!!</span>
  30. <div class="bottom clearfix">
  31. <time class="time">9点59分59秒</time>
  32. </div>
  33. </div>
  34. </el-card>
  35. </el-col>
  36. </div>
  37. </section>
  38. </template>
  39. <script>
  40. import util from "../../common/js/util";
  41. export default {
  42. data() {
  43. return {
  44. detailId: this.$route.params.id,
  45. user: JSON.parse(sessionStorage.getItem('user')),
  46. uName: '周瑞霆',
  47. uTime: '2020-01-03',
  48. uHours: 20,
  49. srcList: [
  50. require('../../assets/image/047_S.jpg'),
  51. require('../../assets/image/noPic.png'),
  52. require('../../assets/image/noPic.png'),
  53. require('../../assets/image/noPic.png'),
  54. require('../../assets/image/noPic.png'),
  55. require('../../assets/image/noPic.png'),
  56. require('../../assets/image/noPic.png'),
  57. require('../../assets/image/noPic.png'),
  58. require('../../assets/image/noPic.png'),
  59. require('../../assets/image/noPic.png'),
  60. require('../../assets/image/noPic.png'),
  61. require('../../assets/image/noPic.png'),
  62. require('../../assets/image/noPic.png'),
  63. ],
  64. myChart: null,
  65. };
  66. },
  67. methods: {
  68. //返回
  69. backToList() {
  70. this.$router.go(-1);
  71. },
  72. setEcharts() {
  73. var myChart = this.echarts.init(document.getElementById('pie_echarts'));
  74. this.myChart = myChart;
  75. var option = {
  76. title: {
  77. text: '工作时长分配',
  78. left: 'left'
  79. },
  80. tooltip: {
  81. trigger: 'item',
  82. formatter: '{a} <br/>{b} : {c} ({d}%)'
  83. },
  84. legend: {
  85. type: 'scroll',
  86. orient: 'vertical',
  87. right: 0,
  88. top: 30,
  89. bottom: 20,
  90. data: ['rose1', 'rose2', 'rose3', 'rose4', 'rose5', 'rose6', 'rose7', 'rose8']
  91. },
  92. toolbox: {
  93. show: true,
  94. feature: {
  95. mark: {show: true},
  96. dataView: {show: true, readOnly: false},
  97. magicType: {
  98. show: true,
  99. type: ['pie', 'funnel']
  100. },
  101. restore: {show: true},
  102. saveAsImage: {show: true}
  103. }
  104. },
  105. series: [
  106. {
  107. name: '面积模式',
  108. type: 'pie',
  109. radius: [30, 110],
  110. roseType: 'area',
  111. data: [
  112. {value: 10, name: 'rose1'},
  113. {value: 5, name: 'rose2'},
  114. {value: 15, name: 'rose3'},
  115. {value: 25, name: 'rose4'},
  116. {value: 20, name: 'rose5'},
  117. {value: 35, name: 'rose6'},
  118. {value: 30, name: 'rose7'},
  119. {value: 40, name: 'rose8'}
  120. ]
  121. }
  122. ]
  123. };
  124. myChart.setOption(option);
  125. },
  126. getSrcList(index){
  127. return this.srcList.slice(index).concat(this.srcList.slice(0,index))
  128. },
  129. getSrcList1(index) {
  130. return this.srcList1.slice(index).concat(this.srcList1.slice(0,index))
  131. }
  132. },
  133. created() {
  134. },
  135. mounted() {
  136. this.setEcharts();
  137. var _this = this;
  138. window.addEventListener("resize", function () {
  139. _this.myChart.resize();
  140. });
  141. }
  142. };
  143. </script>
  144. <style lang="scss" scoped>
  145. .toolbar {
  146. .el-form-item {
  147. font-size: 14px;
  148. vertical-align: middle;
  149. }
  150. .back {
  151. font-size:16px;
  152. cursor: pointer;
  153. }
  154. .divLine {
  155. width: 2px;
  156. background: #c3c3c3;
  157. height: 100%;
  158. }
  159. .workName {
  160. color: #333;
  161. font-size: 18px;
  162. }
  163. .workHours {
  164. color: #20a0ff;
  165. font-size: 18px;
  166. }
  167. }
  168. .one_div {
  169. padding: 15px;
  170. .one_card {
  171. .image {
  172. width: 100%;
  173. }
  174. .one_card_txt {
  175. padding: 13px;
  176. .bottom {
  177. margin-top: 13px;
  178. line-height: 12px;
  179. i {
  180. color: #9ED0FF;
  181. margin-right: 5px;
  182. }
  183. .time {
  184. margin-top: 2px;
  185. color: #999;
  186. }
  187. }
  188. }
  189. }
  190. #pie_echarts {
  191. display: inline-block;
  192. width: 100%;
  193. height: 100%;
  194. min-height: 350px;
  195. }
  196. }
  197. </style>
  198. <style lang="scss">
  199. .image {
  200. .el-image__inner {
  201. height: 11.6vw!important;
  202. }
  203. }
  204. </style>