DayReportChart.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="page">
  3. <a-row>
  4. <a-col :span="19">
  5. <div class="chart">
  6. <a-row type="flex" justify="space-between">
  7. <a-col :span="24">
  8. <a-form :form="form">
  9. <a-row type="flex" justify="end">
  10. <a-col :span="6">
  11. <a-form-item label="开始时间" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
  12. <a-date-picker
  13. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  14. v-model="queryParams.dateStart" />
  15. </a-form-item>
  16. </a-col>
  17. <a-col :span="6">
  18. <a-form-item label="结束时间" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
  19. <a-date-picker
  20. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  21. v-model="queryParams.dateEnd" />
  22. </a-form-item>
  23. </a-col>
  24. <a-col :span="3">
  25. <a-form-item >
  26. <a-button type="primary" @click="getInfo">查询</a-button>
  27. </a-form-item>
  28. </a-col>
  29. </a-row>
  30. </a-form>
  31. </a-col>
  32. </a-row>
  33. <div>
  34. <chart-view height="640px" :chartOption="chartOption"></chart-view>
  35. </div>
  36. </div>
  37. </a-col>
  38. <a-col :span="4" :offset="1" >
  39. <div class="options">
  40. <div class="options-list">
  41. <a-checkbox-group v-model="queryParams.noList">
  42. <a-row :gutter="[0,20]">
  43. <a-col v-for="item in projectList" :key="item.value" :span="24" >
  44. <a-checkbox :value="item.value">
  45. {{ item.name }}
  46. </a-checkbox>
  47. </a-col>
  48. <!-- <a-form-item label="数据报表筛选">
  49. <a-select
  50. v-model="queryParams.no"
  51. placeholder="请选择">
  52. <a-select-option key="1" value="scl_0300027">CS-977</a-select-option>
  53. <a-select-option key="18" value="水">水</a-select-option>
  54. <a-select-option key="19" value="电">电</a-select-option>
  55. <a-select-option key="20" value="dl_天然气_hy">天然气</a-select-option>
  56. <a-select-option key="21" value="dl_蒸汽_hy">蒸汽</a-select-option>
  57. <a-select-option key="22" value="dl_污水">河水</a-select-option>
  58. <a-select-option key="23" value="dl_河水">污水</a-select-option>
  59. </a-select>
  60. </a-form-item> -->
  61. </a-row>
  62. </a-checkbox-group>
  63. </div>
  64. </div>
  65. </a-col>
  66. </a-row>
  67. </div>
  68. </template>
  69. <script>
  70. import { queryProduceReport } from '@/api/produce/report'
  71. export default {
  72. data () {
  73. return {
  74. form: this.$form.createForm(this),
  75. queryParams: {
  76. // dateStart: this.BaseTool.Moment().startOf('month'),
  77. dateStart: this.BaseTool.Moment().subtract(1, 'month'),
  78. dateEnd: this.BaseTool.Moment().subtract(1, 'days'),
  79. noList: ['scl_0300027']
  80. },
  81. chart1: null,
  82. typeTreeData: [],
  83. projectList: [
  84. { value: 'scl_0300027', name: 'CS-977' },
  85. { value: 'scl_scl_0600032', name: '902' },
  86. { value: 'hy_0100075', name: '氢氧化钠' },
  87. { value: 'hy_0100065', name: '氢氟酸' },
  88. { value: 'stock_0300083', name: '锂渣(库存)' },
  89. { value: 'stock_0300073', name: '氟化钠(库存)' },
  90. { value: 'hy_0600032', name: 'GS-902' },
  91. { value: 'hy_0100087', name: 'GS-903' },
  92. { value: 'hy_0100074', name: 'GS-904' },
  93. { value: 'hy_0100083', name: 'GS-905' },
  94. { value: 'hy_0100003', name: 'GS-907' },
  95. { value: 'hy_0100026', name: 'F-160C' },
  96. { value: 'hy_0100120', name: '硫酰氯' },
  97. { value: 'hy_0100160', name: '液碱' },
  98. { value: 'hy_0100086', name: '盐酸' },
  99. { value: 'dl_电_hy', name: '电' },
  100. { value: 'dl_天然气_hy', name: '天然气' },
  101. { value: 'dl_蒸汽_hy', name: '蒸汽' },
  102. { value: 'dl_污水', name: '河水' },
  103. { value: 'dl_河水', name: '污水' }
  104. ],
  105. dataList: [
  106. ]
  107. }
  108. },
  109. computed: {
  110. chartOption () {
  111. const x = []
  112. const data = new Map()
  113. this.dataList.forEach(item => {
  114. if (x.indexOf(item.date) === -1) {
  115. x.push(item.date)
  116. }
  117. if (data.has(item.lineOne)) { // 如果有这个key
  118. data.get(item.lineOne).data.push(item.value)
  119. } else {
  120. data.set(item.lineOne, {
  121. name: item.lineOne,
  122. type: 'line',
  123. stack: '总量',
  124. data: [item.value]
  125. })
  126. }
  127. })
  128. return {
  129. tooltip: {
  130. trigger: 'axis',
  131. axisPointer: {
  132. type: 'cross',
  133. label: {
  134. backgroundColor: '#6a7985'
  135. }
  136. }
  137. },
  138. legend: {
  139. data: new Array(...data.keys())
  140. },
  141. grid: {
  142. left: '3%',
  143. right: '4%',
  144. bottom: '3%',
  145. containLabel: true
  146. },
  147. xAxis: [
  148. {
  149. data: x
  150. }
  151. ],
  152. yAxis: [
  153. {
  154. type: 'value'
  155. }
  156. ],
  157. series: new Array(...data.values())
  158. }
  159. }
  160. },
  161. watch: {
  162. queryParams: {
  163. handler () {
  164. this.getInfo()
  165. },
  166. deep: true
  167. }
  168. },
  169. mounted () {
  170. this.getInfo()
  171. },
  172. methods: {
  173. getInfo (parameter) {
  174. const params = {
  175. dateStart: this.BaseTool.Date.formatter(this.queryParams.dateStart, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN),
  176. dateEnd: this.BaseTool.Date.formatter(this.queryParams.dateEnd, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN),
  177. noList: this.queryParams.noList
  178. }
  179. queryProduceReport(params).then(res => {
  180. this.dataList = res.data
  181. })
  182. },
  183. onChange (e, id) {
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="less" scoped>
  189. .page{
  190. width: 100%;
  191. height: 100%;
  192. background: #EEEEEE;
  193. padding:20px;
  194. font-family: PingFang SC;
  195. font-weight: 500;
  196. .title{
  197. width: 172px;
  198. height: 60px;
  199. background: #4688FF;
  200. border-radius: 10px;
  201. line-height: 60px;
  202. font-size: 28px;
  203. text-align: center;
  204. color: #FFFFFF;
  205. margin-bottom:20px;
  206. }
  207. .chart{
  208. width: 100%;
  209. height: 815px;
  210. background: #FFFFFF;
  211. border-radius: 14px;
  212. padding:40px;
  213. .chart-title{
  214. font-size: 26px;
  215. text-align: center;
  216. position: relative;
  217. &::before {
  218. content:'';
  219. width: 100%;
  220. height: 36px;
  221. background: rgba(101, 151, 238, 0.5);
  222. border-radius: 5px;
  223. position: absolute;
  224. bottom:9px;
  225. left: 0;
  226. }
  227. }
  228. }
  229. .options{
  230. width: 100%;
  231. height: 815px;
  232. .options-list{
  233. background: #FFFFFF;
  234. border-radius: 14px;
  235. padding: 20px;
  236. max-height: 717px;
  237. overflow: hidden;
  238. overflow-y: auto;
  239. }
  240. ::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
  241. }
  242. }
  243. </style>