人民医院前端

Hardware.vue 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="wrapper">
  3. <view class="contentbox">
  4. <view class="titlebox">{{titlebox}}</view>
  5. <view id="echartbox">
  6. <qiun-data-charts type="bar" :opts="opts" :chartData="chartData" />
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. // import * as echarts from 'echarts'
  13. export default {
  14. data() {
  15. return {
  16. chartData: {},
  17. opts: {
  18. color: ["#7b9df2", "#8ebb75", "#dabe4f", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  19. "#ea7ccc"
  20. ],
  21. padding: [15, 30, 0, 5],
  22. enableScroll: false,
  23. legend: {
  24. position:'top',
  25. float:'left'
  26. },
  27. xAxis: {
  28. boundaryGap: "justify",
  29. disableGrid: false,
  30. min: 0,
  31. axisLine: false,
  32. max: 70
  33. },
  34. yAxis: {},
  35. extra: {
  36. bar: {
  37. type: "stack",
  38. width: 30,
  39. meterBorde: 1,
  40. meterFillColor: "#FFFFFF",
  41. activeBgColor: "#000000",
  42. activeBgOpacity: 0.08,
  43. categoryGap: 2
  44. }
  45. }
  46. },
  47. titlebox: "硬件服务TOP20"
  48. }
  49. },
  50. onLoad(option) {
  51. if (option.waretype == 0) {
  52. uni.setNavigationBarTitle({
  53. title: '软件服务'
  54. })
  55. this.titlebox = "软件服务TOP20"
  56. }
  57. this.getListData(option)
  58. },
  59. onReady() {
  60. // this.chart = echarts.init(document.getElementById('echartbox'))
  61. // this.chartData()
  62. },
  63. methods: {
  64. getListData(option) {
  65. const params = {
  66. starttime: option.starttime,
  67. endtime: option.endtime,
  68. type: option.waretype
  69. }
  70. this.$http.get("FaultRepair/DayReportDetail", params).then((response) => {
  71. if (response.state == "success") {
  72. var rowData = []
  73. var colData1 = []
  74. var colData2 = []
  75. var colData3 = []
  76. var res = {}
  77. if (response.data.length > 0) {
  78. response.data.forEach((item, index) => {
  79. rowData.push(item.deptname || '')
  80. colData1.push(Number(item.finish))
  81. colData2.push(Number(item.unfinish))
  82. colData3.push(Number(item.fx))
  83. // if (item.deptname) {
  84. // rowData.push(item.deptname)
  85. // }
  86. // if (Number(item.finish) != 0) {
  87. // colData1.push(Number(item.finish))
  88. // }
  89. // if (Number(item.unfinish) != 0) {
  90. // colData2.push(Number(item.unfinish))
  91. // }
  92. // if (Number(item.fx) != 0) {
  93. // colData3.push(Number(item.fx))
  94. // }
  95. res = {
  96. categories: rowData,
  97. series: [{
  98. name: "完成量",
  99. data: colData1
  100. },
  101. {
  102. name: "未完成量",
  103. data: colData2
  104. },
  105. {
  106. name: "返修量",
  107. data: colData3
  108. }
  109. ]
  110. };
  111. this.chartData = JSON.parse(JSON.stringify(res));
  112. // this.chartData(rowData, colData1, colData2, colData3)
  113. })
  114. } else {
  115. rowData = ['科室名称', '科室名称', '科室名称']
  116. colData1 = [0, 0, 0]
  117. colData2 = [0, 0, 0]
  118. colData3 = [0, 0, 0]
  119. this.chartData(rowData, colData1, colData2, colData3)
  120. }
  121. }
  122. })
  123. },
  124. //图表
  125. // chartData(rowd, cold1, cold2, cold3) {
  126. // this.chart.setOption({
  127. // tooltip: {
  128. // trigger: 'axis',
  129. // axisPointer: {
  130. // type: 'shadow'
  131. // }
  132. // },
  133. // legend: {
  134. // x: 'left',
  135. // y: 'left',
  136. // data: ['完成量', '未完成量', '返修量'],
  137. // selectedMode: false
  138. // },
  139. // color: ["#7b9df2", "#8ebb75", "#dabe4f"],
  140. // grid: {
  141. // left: '1%',
  142. // right: '1%',
  143. // bottom: '3%',
  144. // containLabel: true
  145. // },
  146. // xAxis: {
  147. // axisLine: false,
  148. // type: 'value'
  149. // },
  150. // yAxis: {
  151. // type: 'category',
  152. // data: rowd
  153. // },
  154. // series: [{
  155. // name: '完成量',
  156. // type: 'bar',
  157. // stack: 'total',
  158. // label: {
  159. // show: true
  160. // },
  161. // data: cold1
  162. // },
  163. // {
  164. // name: '未完成量',
  165. // type: 'bar',
  166. // stack: 'total',
  167. // label: {
  168. // show: true
  169. // },
  170. // data: cold2
  171. // },
  172. // {
  173. // name: '返修量',
  174. // type: 'bar',
  175. // stack: 'total',
  176. // label: {
  177. // show: true
  178. // },
  179. // data: cold3
  180. // },
  181. // ]
  182. // })
  183. // },
  184. }
  185. }
  186. </script>
  187. <style scoped>
  188. .contentbox {
  189. padding: 10px 10px;
  190. background-color: #f2f2f2;
  191. }
  192. .titlebox {
  193. margin-bottom: 15px;
  194. margin-left: 5px;
  195. }
  196. .wrapper {
  197. padding: 10px 10px;
  198. background-color: #fff;
  199. }
  200. #echartbox {
  201. width: 100%;
  202. height: 800rpx;
  203. }
  204. </style>