history.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="container">
  3. <!-- 多折线图 -->
  4. <view class="tit">成长趋势</view>
  5. <view class="aside_inner">
  6. <view class="moreline_cavcans">
  7. <qiun-data-charts type="mix" :ontouch="true" :opts="opts" :chartData="chartData"></qiun-data-charts>
  8. </view>
  9. </view>
  10. <view class="tit mb16">历史详情</view>
  11. <view class="table">
  12. <zb-table
  13. :show-header="true"
  14. :columns="column2"
  15. :stripe="true"
  16. :fit="false"
  17. @rowClick="rowClick"
  18. @toggleRowSelection="toggleRowSelection"
  19. @toggleAllSelection="toggleAllSelection"
  20. :data="hislist"></zb-table>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import qiunDataCharts from "@/mine/components/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue"
  26. import zbTable from "@/mine/components/zb-table/zb-tables.vue"
  27. import {column2} from '@/mine/components/zb-table/all.js'
  28. import {getoldechFn,getliveListFn} from "@/api/mine/files.js"
  29. export default {
  30. components:{
  31. zbTable,qiunDataCharts
  32. },
  33. data() {
  34. return {
  35. column2,
  36. studentId:'',
  37. hislist:[],
  38. chartData: {},
  39. categories: ["2016", "2017", "2018", "2019", ],
  40. opts: {
  41. color: ["#FFB132", "#419CFF",],
  42. padding: [-10, 10, 30, 15],
  43. dataLabel: false, //是否显示数据文案 true表示显示,false表示不显示
  44. dataPointShape: false, //是否显示数据点数据图表
  45. dataPointShapeType: 'solid', //图形标识点显示类型 solid实心 hollow空心
  46. enableScroll: true,
  47. legend: {
  48. fontColor: '#363636',
  49. fontSize: 12,
  50. position: "top",
  51. margin: 16,
  52. padding: 5,
  53. float: "center"
  54. },
  55. xAxis: {
  56. disabled: false, //不绘制x轴
  57. axisLine: false, //坐标轴线
  58. axisLineColor: "#fff", //坐标轴线颜色
  59. calibration: false, //刻度线
  60. disableGrid: true, //不绘制网格线
  61. fontColor: "#474e5b", //刻度值字体颜色
  62. fontSize: 14,
  63. itemCount: 5,
  64. },
  65. yAxis: {
  66. gridType: "dash", //横向网格样式 solid实线
  67. axisLine: false, //坐标轴线是否显示
  68. axisLineColor: '#fff', //坐标轴颜色
  69. gridColor: 'rgba(86,94,107,0.4)', //网格颜色
  70. dashLength: 3, //网格dash宽度
  71. showTitle: true,
  72. splitNumber: 4,
  73. data: [{ //这里y轴分组 left是下标为0的第一组y数据在最左侧
  74. position: "left",
  75. axisLine: false, //坐标轴轴线是否显示
  76. axisLineColor: '#fff', //坐标轴轴线颜色
  77. fontColor: "#474e5b",
  78. fontSize: 14,
  79. disabled: false, //是否绘画y轴 true不 默认为false
  80. min: 0, //y轴最小值
  81. // max: 260, //y轴最大值 最大值来除以y轴显示的数量=每份的数量
  82. // unit:'焦',//y轴刻度后面的单位
  83. tofix: 2,
  84. title: 'CM',
  85. titleOffsetY: -6,
  86. titleOffsetX: -6,
  87. },
  88. {//这里y轴分组 right是下标为1的第二组y数据在最右侧
  89. position: "right",
  90. axisLine: false, //坐标轴轴线是否显示
  91. axisLineColor: '#fff', //坐标轴轴线颜色
  92. fontColor: "#474e5b",
  93. fontSize: 14,
  94. disabled: false, //是否绘画y轴 true不 默认为false
  95. min: 0, //y轴最小值
  96. // max: 150, //y轴最大值 最大值来除以y轴显示的数量=每份的数量
  97. // unit:'焦',//y轴刻度后面的单位
  98. tofix: 2,
  99. title: 'KG',
  100. titleOffsetY: -6,
  101. titleOffsetX: 10,
  102. },
  103. ]
  104. },
  105. extra: {
  106. tooltip: {
  107. showArrow: true, //是否显示小三角
  108. // showCategory:true,
  109. gridColor: 'rgba(86,94,107,0.4)',
  110. borderRadius: 6,
  111. bgColor: "#546dfb",
  112. gridType: 'dash', //分割线
  113. dashLength: 3,
  114. bgOpacity: 0.8,
  115. labelBgColor: 'red',
  116. fontColor: 'rgba(255, 255, 255, 0.8)'
  117. },
  118. line: {
  119. type: "straight",
  120. width: 2,
  121. activeType: "hollow"
  122. },
  123. mix: {
  124. line: {
  125. width: 3,
  126. }
  127. }
  128. }
  129. }
  130. };
  131. },
  132. onLoad(e) {
  133. this.studentId=e.id;
  134. this.getoldechFn()
  135. this.getoldlistFn()
  136. },
  137. methods: {
  138. getoldechFn(){
  139. var params={
  140. studentId:this.studentId
  141. }
  142. getoldechFn(params).then(res=>{
  143. var x=res.data.X;
  144. var newArr=[]
  145. x.forEach((ite)=>{
  146. var narr=ite.split('-')
  147. ite=narr[1]+'/'+narr[2],
  148. newArr.push(ite)
  149. })
  150. let nobj = {
  151. categories: newArr,
  152. series: [
  153. {
  154. name: "身高",
  155. legendShape: 'circle',
  156. type: "line",
  157. data: res.data.Y1
  158. },
  159. {
  160. name: "体重",
  161. type: "line",
  162. index: 1,//这个是重点 0代表第一组y轴坐标数据,1代表第二组y轴坐标数据
  163. legendShape: 'circle',
  164. data: res.data.Y2
  165. },
  166. ],
  167. };
  168. this.chartData = JSON.parse(JSON.stringify(nobj));
  169. // if(res.code==200){
  170. // this.hislist=res.data
  171. // }else{
  172. // this.$toast(res.msg)
  173. // }
  174. })
  175. },
  176. getoldlistFn(){
  177. var params={
  178. studentId:this.studentId
  179. }
  180. getliveListFn(params).then(res=>{
  181. if(res.code==200){
  182. this.hislist=res.rows
  183. }else{
  184. this.$toast(res.msg)
  185. }
  186. })
  187. },
  188. getServerData() {
  189. //模拟从服务器获取数据时的延时
  190. setTimeout(() => {
  191. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  192. let res = {
  193. categories: this.categories,
  194. series: [
  195. {
  196. name: "身高",
  197. legendShape: 'circle',
  198. type: "line",
  199. data: [120, 150, 153, 185,]
  200. },
  201. {
  202. name: "体重",
  203. type: "line",
  204. index: 1,//这个是重点 0代表第一组y轴坐标数据,1代表第二组y轴坐标数据
  205. legendShape: 'circle',
  206. data: [40, 45, 50, 46,]
  207. },
  208. ],
  209. };
  210. this.chartData = JSON.parse(JSON.stringify(res));
  211. }, 500);
  212. },
  213. },
  214. created() {
  215. // this.getServerData();
  216. }
  217. }
  218. </script>
  219. <style lang="scss" scoped>
  220. .zb-table /deep/ .zb-table-fixed{background: #F1F5FF !important;}
  221. .zb-table /deep/ .item-th{text-align: center !important;padding: 0 4rpx;background: #F1F5FF;text-align: center;border-bottom: none;}
  222. .zb-table /deep/ .item-td{text-align: center !important;padding: 0 4rpx;}
  223. .container{min-height: 100vh;background-color: #ffffff;}
  224. .tit{font-size: 32rpx;font-weight: bold;color: #161616;position: relative;display: flex;align-items: center;padding: 16rpx 60rpx;
  225. &::before{width: 8rpx;height: 36rpx;background: #1f57e6;border-radius: 4rpx;content: '';position: absolute;left: 36rpx;top: 50%;margin-top: -18rpx;}
  226. }
  227. .table{padding: 0 48rpx;}
  228. .aside_inner {
  229. width: 100%;
  230. .moreline_title {
  231. text-align: center;
  232. color: #e6ebf1;
  233. font-size: 32rpx;
  234. padding-top: 50rpx;
  235. font-weight: 500;
  236. }
  237. .moreline_cavcans {
  238. width: 700rpx;
  239. margin: 10rpx;
  240. height: 440rpx;
  241. }
  242. }
  243. </style>