b7feaba654176bbdfe8fa1ae84a1af1f70c7048a.svn-base 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <!-- -->
  2. <template>
  3. <div>
  4. <el-container>
  5. <el-aside width="40%">
  6. <el-tree
  7. :style="{'max-height': maxHeight +'px'}"
  8. style="overflow:auto;"
  9. class="filter-tree"
  10. :data="treeData"
  11. accordion
  12. :props="defaultProps"
  13. node-key="id"
  14. default-expand-all
  15. ref="tree">
  16. <div class="custom-tree-node" slot-scope="{ node, data }">
  17. <span style="float:left;">{{ data.type=='1'? '签到 ':'签退 '}}</span>
  18. <span style="margin-left: 10px;">{{ data.stTm }}</span>
  19. <span> - </span>
  20. <span>{{ data.enTm }}</span>
  21. </div>
  22. </el-tree>
  23. </el-aside>
  24. <el-main style="width:100%;height:100%;padding:10px;">
  25. <div style="width:27vw;height:20vh;" ref="lineChart"></div>
  26. </el-main>
  27. </el-container>
  28. </div>
  29. </template>
  30. <script>
  31. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  32. //例如:import 《组件名称》 from '《组件路径》';
  33. import echarts from 'echarts'
  34. import { getSginListsNoPage } from "../../api/meetingAPI.js";
  35. export default {
  36. //import引入的组件需要注入到对象中才能使用
  37. components: {},
  38. props:['meetingInfoRow'],
  39. data() {
  40. //这里存放数据
  41. return {
  42. maxHeight:200,
  43. treeData:[],
  44. defaultProps: {
  45. // children: 'children',
  46. label: 'type'
  47. },
  48. };
  49. },
  50. //监听属性 类似于data概念
  51. computed: {},
  52. //监控data中的数据变化
  53. watch: {},
  54. //方法集合
  55. methods: {
  56. //获取签到基准数据
  57. getSginTableData(){
  58. var _self = this;
  59. let obj = {
  60. "meetId":_self.meetingInfoRow.id,
  61. }
  62. getSginListsNoPage(obj).then(response => {
  63. _self.treeData = response.data;
  64. });
  65. },
  66. //绘制图表
  67. initIncChart:function(){
  68. var _this = this;
  69. let chart = echarts.init(this.$refs['lineChart']);
  70. let option = {
  71. backgroundColor: '#FFF',
  72. grid: {
  73. top: '9%',
  74. bottom: '19%',
  75. left: '6%',
  76. right: '4%'
  77. },
  78. tooltip: {
  79. trigger: 'axis',
  80. label: {
  81. show: true
  82. }
  83. },
  84. xAxis: {
  85. boundaryGap: true, //默认,坐标轴留白策略
  86. axisLine: {
  87. show: false
  88. },
  89. splitLine: {
  90. show: false
  91. },
  92. axisTick: {
  93. show: false,
  94. alignWithLabel: true
  95. },
  96. data: ['2:00','2:30','3:00','3:30','4:00']
  97. },
  98. yAxis: {
  99. axisLine: {
  100. show: false
  101. },
  102. splitLine: {
  103. show: true,
  104. lineStyle: {
  105. type: 'dashed',
  106. color: 'rgba(33,148,246,0.2)'
  107. }
  108. },
  109. axisTick: {
  110. show: false
  111. },
  112. splitArea: {
  113. show: true,
  114. areaStyle: {
  115. color: 'rgb(245,250,254)'
  116. }
  117. }
  118. },
  119. series: [{
  120. type: 'line',
  121. symbol: 'circle',
  122. symbolSize: 7,
  123. lineStyle: {
  124. color: 'rgb(33,148,246)',
  125. shadowBlur: 12,
  126. shadowColor: 'rgb(33,148,246,0.9)',
  127. shadowOffsetX: 1,
  128. shadowOffsetY: 1
  129. },
  130. itemStyle: {
  131. color: 'rgb(33,148,246)',
  132. borderWidth: 1,
  133. borderColor: '#FFF'
  134. },
  135. label: {
  136. show: false,
  137. distance: 1,
  138. emphasis: {
  139. show: true,
  140. offset: [25, -2],
  141. color: '#FFF',
  142. padding: [8, 20, 8, 6],
  143. height: 36,
  144. formatter: function(params) {
  145. var name = params.name;
  146. var value = params.data;
  147. var str = name + '\n数据量:' + value;
  148. return str;
  149. },
  150. rich: {
  151. bg: {
  152. width: 78,
  153. //height:42,
  154. color: '#FFF',
  155. padding: [20, 0, 20, 10]
  156. },
  157. br: {
  158. width: '100%',
  159. height: '100%'
  160. }
  161. }
  162. }
  163. },
  164. data: [2,10,14,20,33]
  165. }]
  166. };
  167. chart.setOption(option);
  168. },
  169. },
  170. //生命周期 - 创建完成(可以访问当前this实例)
  171. created() {
  172. },
  173. //生命周期 - 挂载完成(可以访问DOM元素)
  174. mounted() {
  175. this.getSginTableData();
  176. this.initIncChart();
  177. },
  178. beforeCreate() {}, //生命周期 - 创建之前
  179. beforeMount() {}, //生命周期 - 挂载之前
  180. beforeUpdate() {}, //生命周期 - 更新之前
  181. updated() {}, //生命周期 - 更新之后
  182. beforeDestroy() {}, //生命周期 - 销毁之前
  183. destroyed() {}, //生命周期 - 销毁完成
  184. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  185. }
  186. </script>
  187. <style scoped>
  188. </style>