Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

totalSstatistics.vue 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div>
  3. <div class="content_top">
  4. <div class="block">
  5. <span>查询时间:</span>
  6. <el-date-picker
  7. v-model="time_month"
  8. type="month"
  9. placeholder="选择月">
  10. </el-date-picker>
  11. </div>
  12. <div>
  13. <el-date-picker
  14. v-model="stat_time"
  15. type="date"
  16. placeholder="选择日期">
  17. </el-date-picker>
  18. <span>-</span>
  19. <el-date-picker
  20. v-model="end_time"
  21. type="date"
  22. placeholder="选择日期">
  23. </el-date-picker>
  24. </div>
  25. <div style="width: 200px;">
  26. <el-input v-model="input" placeholder="请输入内容"></el-input>
  27. </div>
  28. <el-button type="primary">查询</el-button>
  29. </div>
  30. <div class="cell clearfix">
  31. <p class="chartTitle">统计图</p>
  32. </div>
  33. <div class="echart" id="mychart" :style={width:width,height:height}></div>
  34. <div style="width: 80%;margin: auto;">
  35. <el-table
  36. :data="tableData"
  37. :show-summary = true
  38. border
  39. style="width: 100%;">
  40. <el-table-column
  41. prop="date"
  42. align="center"
  43. label="甲状旁腺激素"
  44. >
  45. </el-table-column>
  46. <el-table-column
  47. prop="name"
  48. label="人数"
  49. >
  50. </el-table-column>
  51. <el-table-column
  52. prop="address"
  53. align="center"
  54. label="操作">
  55. <template slot-scope="scope">
  56. <el-button @click="handleClick(scope.row)" style="font-size:16px;"
  57. type="text" >查看详情
  58. </el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import * as echarts from "echarts";
  67. export default{
  68. props: {
  69. width: {
  70. type: String,
  71. default: "100%"
  72. },
  73. height: {
  74. type: String,
  75. default: "400px"
  76. },
  77. },
  78. data() {
  79. return {
  80. time_month:'',
  81. stat_time:'',
  82. end_time:'',
  83. input:'',
  84. myChart: {},
  85. pieData : [
  86. {
  87. value: 463,
  88. name: "不达标值患者"
  89. },
  90. {
  91. value: 395,
  92. name: "未检查患者"
  93. },
  94. {
  95. value: 157,
  96. name: "达标值患者"
  97. },
  98. // {
  99. // value: 149,
  100. // name: "广东"
  101. // },
  102. // {
  103. // value: 147,
  104. // name: "湖南"
  105. // }
  106. ],
  107. pieName: [],
  108. // myChartStyle:{float: "right", width: "100%", height: "400px"},
  109. tableData:[],
  110. }
  111. },
  112. mounted() {
  113. this.initDate(); //数据初始化
  114. this.initEcharts();
  115. },
  116. methods: {
  117. initDate() {
  118. for (let i = 0; i < this.pieData.length; i++) {
  119. this.pieName[i] = this.pieData[i].name;
  120. }
  121. },
  122. initEcharts() {
  123. // 饼图
  124. const option = {
  125. legend: {
  126. // 图例
  127. data: this.pieName,
  128. left: "10%",
  129. top: "30%",
  130. orient: "vertical"
  131. },
  132. color:['#ff7f9f','#fff67f','#1e5feb'],
  133. title: {
  134. // 设置饼图标题,位置设为顶部居中
  135. // text: "国内院士前五省份图示",
  136. top: "0%",
  137. left: "center"
  138. },
  139. series: [
  140. {
  141. type: "pie",
  142. label: {
  143. show: true,
  144. formatter:"{b} : {d}% ({c})"
  145. // b代表名称,c代表对应值,d代表百分比"{b} : {d}% ({c})"
  146. },
  147. radius: "65%", //饼图半径
  148. data: this.pieData
  149. }
  150. ]
  151. };
  152. // console.log(this.seriesData);
  153. const optionFree = {
  154. series: [
  155. {
  156. data: this.seriesData,
  157. type: "line",
  158. smooth: true
  159. }
  160. ]
  161. };
  162. this.myChart = echarts.init(document.getElementById("mychart"));
  163. this.myChart.setOption(option);
  164. //随着屏幕大小调节图表
  165. // window.addEventListener("resize", () => {
  166. // this.myChart.resize();
  167. // });
  168. },
  169. getSummaries(param) {
  170. const { columns, data } = param;
  171. const sums = [];
  172. columns.forEach((column, index) => {
  173. if (index === 0) {
  174. sums[index] = '总价';
  175. return;
  176. }
  177. const values = data.map(item => Number(item[column.property]));
  178. if (!values.every(value => isNaN(value))) {
  179. sums[index] = values.reduce((prev, curr) => {
  180. const value = Number(curr);
  181. if (!isNaN(value)) {
  182. return prev + curr;
  183. } else {
  184. return prev;
  185. }
  186. }, 0);
  187. sums[index] += ' 元';
  188. } else {
  189. sums[index] = 'N/A';
  190. }
  191. });
  192. return sums;
  193. },
  194. handleClick(id){
  195. console.log(id);
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .content_top{
  202. display: flex;
  203. justify-content: space-around;
  204. color: #1e5feb;
  205. }
  206. </style>