index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="block">
  5. <el-date-picker v-model="monthDate" :clearable="false" type="monthrange" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeMonth()" />
  6. </div>
  7. </div>
  8. <el-row v-if="isChart1" style="position: relative;">
  9. <p style="position: absolute;top:-12px;left:40%;color:rgb(130, 165, 252);background:rgb(230, 243, 255);border:1px solid rgb(130, 165, 252);padding:10px;border-radius:10px">
  10. 燃动费用{{ total }}万元
  11. </p>
  12. <el-radio-group v-model="radio1" class="group" @change="changeGroup">
  13. <el-radio :label="'集团'">集团</el-radio>
  14. <el-radio :label="'一中心'"></el-radio>
  15. <el-radio :label="'二中心'"></el-radio>
  16. <el-radio :label="'三中心'"></el-radio>
  17. </el-radio-group>
  18. <el-col :span="24">
  19. <div id="chart1" style="width: 100%;height:400px;" />
  20. </el-col>
  21. </el-row>
  22. <el-row v-if="isChart1" style="position: relative;">
  23. <p style="position: absolute;top:-12px;left:40%;color:rgb(130, 165, 252);background:rgb(230, 243, 255);border:1px solid rgb(130, 165, 252);padding:10px;border-radius:10px">
  24. 柴油用量
  25. </p>
  26. <el-col :span="24">
  27. <div id="chart11" style="width: 100%;height:400px;" />
  28. </el-col>
  29. </el-row>
  30. <el-row v-if="isChart1" style="position: relative;">
  31. <el-col :span="24">
  32. <div id="chart12" style="width: 100%;height:400px;" />
  33. </el-col>
  34. </el-row>
  35. <el-row v-if="isChart1" style="position: relative;">
  36. <el-col :span="24">
  37. <div id="chart2" style="width: 100%;height:400px;" />
  38. </el-col>
  39. </el-row>
  40. <el-row style="position: relative;">
  41. <el-col :span="12">
  42. <div style="height: 50px;">
  43. <el-select style="float: right;margin-right: 20px;" v-model="pastureName" multiple :multiple-limit="5" collapse-tags placeholder="牧场" @change="changePasture()">
  44. <el-option v-for="item in pastureList" :key="item.id" :label="item.name" :value="item.name"> </el-option>
  45. </el-select>
  46. </div>
  47. <div id="chart4" style="width: 100%;height:400px;" />
  48. </el-col>
  49. <el-col :span="12">
  50. <div style="height: 50px;">
  51. <el-select style="float: right;margin-right: 20px;" v-model="getChart5Parm.parammaps.deptName" placeholder="部门" @change="changeDept()">
  52. <el-option v-for="item in deptList" :key="item.id" :label="item.name" :value="item.name"> </el-option>
  53. </el-select>
  54. </div>
  55. <div id="chart5" style="width: 100%;height:400px;" />
  56. </el-col>
  57. </el-row>
  58. <el-row style="position: relative;">
  59. <el-col :span="12">
  60. <div id="chart6" style="width: 100%;height:400px;" />
  61. </el-col>
  62. <el-col :span="12">
  63. <div id="chart7" style="width: 100%;height:400px;" />
  64. </el-col>
  65. </el-row>
  66. <el-row style="position: relative;">
  67. <el-col :span="12">
  68. <div id="chart8" style="width: 100%;height:400px;" />
  69. </el-col>
  70. <el-col :span="12">
  71. <div id="chart9" style="width: 100%;height:400px;" />
  72. </el-col>
  73. </el-row>
  74. </div>
  75. </template>
  76. <script>
  77. import echarts from 'echarts'
  78. import { GetDataByName,GetDataByNames, GetReportform, checkButtons,getJson } from '@/api/common'
  79. import Cookies from 'js-cookie'
  80. import { parseTime } from '@/utils/index.js'
  81. export default {
  82. name: 'QueryCombustion',
  83. data() {
  84. return {
  85. monthDate: [new Date(),new Date()],
  86. pastureName:'',
  87. yearDate: new Date(),
  88. year: new Date().getFullYear(),
  89. month: new Date().getMonth() < 9 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1,
  90. type:0,
  91. typeList:[{id:0,name:'柴油'},{id:1,name:'天然气'},{id:2,name:'煤炭'},{id:3,name:'生物质颗粒'}],
  92. pastureList:[],
  93. deptList:[{id:0,name:'挤奶处'},{id:1,name:'犊牛处'},{id:2,name:'办公室'},{id:3,name:'饲养处'},{id:4,name:'兽医处'},{id:5,name:'品控处'},{id:6,name:'设备处'}],
  94. total: '',
  95. radio1:'集团',
  96. pastureName:'',
  97. isChart1: [],
  98. chart_data1: {},
  99. getChart1Parm: {
  100. name: '',
  101. parammaps: {
  102. receiveTime: new Date().getFullYear(),
  103. pastureName: Cookies.get('pasturename')
  104. }
  105. },
  106. isChart11: [],
  107. chart_data11: {},
  108. getChart11Parm: {
  109. name: '',
  110. parammaps: {
  111. receiveTime: new Date().getFullYear(),
  112. pastureName: Cookies.get('pasturename')
  113. }
  114. },
  115. isChart12: [],
  116. chart_data12: {},
  117. getChart12Parm: {
  118. name: '',
  119. parammaps: {
  120. receiveTime: new Date().getFullYear(),
  121. pastureName: Cookies.get('pasturename')
  122. }
  123. },
  124. radio2:1,
  125. isChart2: [],
  126. chart_data2: {},
  127. getChart2Parm: {
  128. name: '',
  129. parammaps: {
  130. receiveTime: new Date().getFullYear(),
  131. pastureName: Cookies.get('pasturename')
  132. }
  133. },
  134. radio3:1,
  135. isChart3: [],
  136. chart_data3: {},
  137. getChart3Parm: {
  138. name: '',
  139. parammaps: {
  140. receiveTime: new Date().getFullYear(),
  141. pastureName: Cookies.get('pasturename')
  142. }
  143. },
  144. isChart4: [],
  145. chart_data4: {},
  146. getChart4Parm: {
  147. name: '',
  148. parammaps: {
  149. receiveTime: new Date().getFullYear(),
  150. pastureName: Cookies.get('pasturename')
  151. }
  152. },
  153. isChart5: [],
  154. chart_data5: {},
  155. getChart5Parm: {
  156. name: '',
  157. parammaps: {
  158. receiveTime: new Date().getFullYear(),
  159. pastureName: Cookies.get('pasturename'),
  160. deptName:''
  161. }
  162. },
  163. isChart6: [],
  164. chart_data6: {},
  165. getChart6Parm: {
  166. name: '',
  167. parammaps: {
  168. receiveTime: new Date().getFullYear(),
  169. pastureName: Cookies.get('pasturename')
  170. }
  171. },
  172. isChart7: [],
  173. chart_data7: {},
  174. getChart7Parm: {
  175. name: '',
  176. parammaps: {
  177. receiveTime: new Date().getFullYear(),
  178. pastureName: Cookies.get('pasturename')
  179. }
  180. },
  181. isChart8: [],
  182. chart_data8: {},
  183. getChart8Parm: {
  184. name: '',
  185. parammaps: {
  186. receiveTime: new Date().getFullYear(),
  187. pastureName: Cookies.get('pasturename')
  188. }
  189. },
  190. isChart9: [],
  191. chart_data9: {},
  192. getChart9Parm: {
  193. name: '',
  194. parammaps: {
  195. receiveTime: new Date().getFullYear(),
  196. pastureName: Cookies.get('pasturename')
  197. }
  198. },
  199. }
  200. },
  201. created() {
  202. this.get_select_list()
  203. const that = this
  204. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  205. that.buttons = response.data.list
  206. that.get_auto_buttons()
  207. })
  208. },
  209. mounted() {
  210. },
  211. methods: {
  212. get_select_list() {
  213. var send_data = [
  214. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  215. ]
  216. GetDataByNames(send_data).then(response => {
  217. this.pastureList = response.data.findAllPasture.list
  218. })
  219. },
  220. changeMonth(){
  221. if(this.isChart1){
  222. this.getChart1()
  223. this.getChart11()
  224. this.getChart12()
  225. this.getChart2()
  226. }else{
  227. this.pastureName = [Cookies.get('pasturename')]
  228. this.getChart4()
  229. this.getChart6()
  230. }
  231. },
  232. changeGroup(){
  233. this.getChart1()
  234. this.getChart11()
  235. this.getChart12()
  236. this.getChart2()
  237. },
  238. changePasture(){
  239. this.getChart4()
  240. this.getChart5()
  241. this.getChart6()
  242. this.getChart7()
  243. },
  244. changeDept(){
  245. this.getChart5()
  246. },
  247. changeType(){
  248. },
  249. get_auto_buttons() {
  250. // 图1
  251. const chart1 = 'report:queryCombustion:pastures'
  252. const isChart1 = checkButtons(this.$store.state.user.buttons, chart1)
  253. this.isChart1 = isChart1
  254. if(this.isChart1){
  255. this.getChart1()
  256. this.getChart11()
  257. this.getChart12()
  258. this.getChart2()
  259. }else{
  260. this.pastureName = [Cookies.get('pasturename')]
  261. this.getChart4()
  262. this.getChart6()
  263. }
  264. },
  265. // 各牧场燃动费用对比
  266. getChart1() {
  267. let url = '/authdata/ignition/nowwater?'
  268. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  269. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  270. let radio = ''
  271. if(this.radio1 == '集团'){
  272. radio = ''
  273. }else{
  274. radio = this.radio1
  275. }
  276. let data = 'startTime=' + startTime
  277. + '&endTime=' + endTime
  278. + '&center=' + radio
  279. getJson(url,data).then(response => {
  280. console.log('图1', response)
  281. if(response.data){
  282. this.chart_data1.data1 = response.data.nowYear
  283. this.chart_data1.data2 = response.data.lastYear
  284. this.chart_data1.xdata = response.data.pasture
  285. this.pastureName = [response.data.pasture[0]]
  286. this.total = response.data.all
  287. }else{
  288. this.chart_data1.data1 = []
  289. this.chart_data1.data2 = []
  290. this.chart_data1.xdata = []
  291. this.total = 0
  292. }
  293. this.roadChart1(this.chart_data1)
  294. this.getChart4()
  295. this.getChart6()
  296. })
  297. },
  298. // 各牧场柴油用量对比
  299. getChart11() {
  300. let url = '/authdata/diesel/nowwater?'
  301. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  302. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  303. let radio = ''
  304. if(this.radio1 == '集团'){
  305. radio = ''
  306. }else{
  307. radio = this.radio1
  308. }
  309. let data = 'startTime=' + startTime
  310. + '&endTime=' + endTime
  311. + '&center=' + radio
  312. getJson(url,data).then(response => {
  313. console.log('图11', response)
  314. if(response.data){
  315. this.chart_data11.data1 = response.data.nowYear
  316. this.chart_data11.data2 = response.data.lastYear
  317. this.chart_data11.xdata = response.data.pasture
  318. }else{
  319. this.chart_data11.data1 = []
  320. this.chart_data11.data2 = []
  321. this.chart_data11.xdata = []
  322. }
  323. this.roadChart11(this.chart_data11)
  324. })
  325. },
  326. // 单头牛柴油用量
  327. getChart12() {
  328. let url = '/authdata/diesel/rate?'
  329. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  330. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  331. let radio = ''
  332. if(this.radio1 == '集团'){
  333. radio = ''
  334. }else{
  335. radio = this.radio1
  336. }
  337. let data = 'startTime=' + startTime
  338. + '&endTime=' + endTime
  339. + '&center=' + radio
  340. getJson(url,data).then(response => {
  341. console.log('图12', response)
  342. if(response.data){
  343. this.chart_data12.data1 = response.data.actual
  344. this.chart_data12.line = response.data.line
  345. this.chart_data12.xdata = response.data.pasture
  346. }else{
  347. this.chart_data12.data1 = []
  348. this.chart_data12.line = 0
  349. this.chart_data12.xdata = []
  350. }
  351. this.roadChart12(this.chart_data12)
  352. })
  353. },
  354. // 单头牛燃动费用
  355. getChart2() {
  356. let url = '/authdata/ignition/rate?'
  357. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  358. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  359. let radio = ''
  360. if(this.radio1 == '集团'){
  361. radio = ''
  362. }else{
  363. radio = this.radio1
  364. }
  365. let data = 'startTime=' + startTime
  366. + '&endTime=' + endTime
  367. + '&center=' + radio
  368. getJson(url,data).then(response => {
  369. console.log('图2', response)
  370. if(response.data){
  371. this.chart_data2.data1 = response.data.actual
  372. this.chart_data2.data2 = response.data.budget
  373. this.chart_data2.xdata = response.data.pasture
  374. this.chart_data2.line = response.data.line
  375. }else{
  376. this.chart_data2.data1 = []
  377. this.chart_data2.data2 = []
  378. this.chart_data2.xdata = []
  379. this.chart_data2.line = 0
  380. }
  381. this.roadChart2(this.chart_data2)
  382. })
  383. },
  384. // 牧场每月单头牛用油量对比
  385. getChart4() {
  386. this.getChart5Parm.parammaps.deptName = this.deptList[0].name
  387. let url = '/authdata/diesel/perhead?'
  388. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  389. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  390. let radio = ''
  391. if(this.radio1 == '集团'){
  392. radio = ''
  393. }else{
  394. radio = this.radio1
  395. }
  396. let pastureId = []
  397. console.log(this.pastureList,'pastureList')
  398. this.pastureList.forEach((item)=>{
  399. if(this.pastureName){
  400. this.pastureName.forEach((item1)=>{
  401. if(item.name == item1){
  402. pastureId.push(item.id)
  403. }
  404. })
  405. }
  406. })
  407. console.log(pastureId,'pastureId')
  408. let data = 'startTime=' + startTime
  409. + '&endTime=' + endTime
  410. + '&center=' + radio
  411. + '&pastureId=' + pastureId.toString()
  412. getJson(url,data).then(response => {
  413. console.log('图4', response)
  414. if(response.data){
  415. this.chart_data4.data1 = response.data.data3
  416. this.chart_data4.data_name = response.data.data1
  417. this.chart_data4.xdata = response.data.data2
  418. }else{
  419. this.chart_data4.data1 = []
  420. this.chart_data4.data_name = []
  421. this.chart_data4.xdata = []
  422. }
  423. if(response.data.data1 == null){
  424. this.chart_data4.data_name = []
  425. }
  426. if(response.data.data2 == null ){
  427. this.chart_data4.xdata = []
  428. this.getChart5Parm.parammaps.date = ''
  429. }else{
  430. this.getChart5Parm.parammaps.date = response.data.data2[0]
  431. }
  432. if(response.data.data3 == null){
  433. this.chart_data4.data1 = []
  434. }
  435. console.log(this.chart_data4,'chart_data4')
  436. this.roadChart4(this.chart_data4)
  437. this.getChart5()
  438. })
  439. },
  440. // XX月部门统计
  441. getChart5() {
  442. let startTime = ''
  443. let endTime = ''
  444. if(this.getChart5Parm.parammaps.date !== ''){
  445. startTime = parseTime(this.getChart5Parm.parammaps.date,'{y}-{m}') + '-01'
  446. let date = new Date(this.getChart5Parm.parammaps.date);
  447. let year = date.getFullYear()
  448. let month = date.getMonth() + 1
  449. let lastDay = new Date(year, month, 0).getDate();
  450. endTime = parseTime(this.getChart5Parm.parammaps.date,'{y}-{m}') + '-' + lastDay
  451. }else{
  452. startTime = ''
  453. endTime = ''
  454. }
  455. let data = {
  456. name:"getdeptSumMonthDiesel",
  457. parammaps:{
  458. startTime:startTime,
  459. endTime:endTime,
  460. pastureName:this.pastureName.toString(),
  461. departmentName:this.getChart5Parm.parammaps.deptName,
  462. },
  463. }
  464. GetDataByName(data).then(response => {
  465. console.log('图5', response)
  466. let data1 = []
  467. let xdata = []
  468. if(response.data){
  469. response.data.list.forEach((item)=>{
  470. data1.push(item.value)
  471. xdata.push(item.name)
  472. })
  473. }
  474. this.chart_data5 = {
  475. data1:data1,
  476. xdata:xdata
  477. }
  478. this.roadChart5(this.chart_data5)
  479. })
  480. },
  481. // 牧场每月用油量对比
  482. getChart6() {
  483. let startTime = parseTime(this.monthDate[0],'{y}-{m}') + '-01'
  484. let date = this.monthDate[1];
  485. let year = date.getFullYear()
  486. let month = date.getMonth() + 1
  487. let lastDay = new Date(year, month, 0).getDate();
  488. let endTime = parseTime(this.monthDate[1],'{y}-{m}') + '-' + lastDay
  489. let data = {
  490. name:"getPastureSumMonthDiesel",
  491. parammaps:{
  492. startTime:startTime,
  493. endTime:endTime,
  494. pastureName:this.pastureName.toString(),
  495. },
  496. }
  497. GetReportform(data).then(response => {
  498. console.log('图6', response)
  499. if(response.data.chart_data){
  500. this.chart_data6 = {
  501. data1:response.data.chart_data.nowYear,
  502. data_name:response.data.chart_data.pastureName,
  503. xdata:response.data.chart_data.months
  504. }
  505. }else{
  506. this.chart_data6 = {
  507. data1:[],
  508. data_name:[],
  509. xdata:[]
  510. }
  511. }
  512. if(response.data.chart_data.months == null ){
  513. this.getChart7Parm.parammaps.date = ''
  514. }else{
  515. this.getChart7Parm.parammaps.date = response.data.chart_data.months[0]
  516. this.getChart8Parm.parammaps.date = response.data.chart_data.months[0]
  517. this.getChart9Parm.parammaps.date = response.data.chart_data.months[0]
  518. }
  519. this.roadChart6(this.chart_data6)
  520. this.getChart7()
  521. this.getChart8()
  522. })
  523. },
  524. // XX月每日用油量
  525. getChart7() {
  526. let data = {
  527. name:"getPastureSumDayDiesel",
  528. parammaps:{
  529. startTime:this.getChart7Parm.parammaps.date,
  530. pastureName:this.pastureName.toString(),
  531. },
  532. }
  533. GetReportform(data).then(response => {
  534. console.log('图7', response)
  535. if(response.data.chart_data){
  536. this.chart_data7 = {
  537. data1:response.data.chart_data.nowYear,
  538. data_name:response.data.chart_data.pastureName,
  539. xdata:response.data.chart_data.day
  540. }
  541. }else{
  542. this.chart_data7 = {
  543. data1:[],
  544. data_name:[],
  545. xdata:[]
  546. }
  547. }
  548. this.roadChart7(this.chart_data7)
  549. })
  550. },
  551. // XX月部门统计
  552. getChart8() {
  553. let startTime = parseTime(this.getChart8Parm.parammaps.date,'{y}-{m}') + '-01'
  554. let date = new Date(this.getChart8Parm.parammaps.date);
  555. let year = date.getFullYear()
  556. let month = date.getMonth() + 1
  557. let lastDay = new Date(year, month, 0).getDate();
  558. let endTime = parseTime(this.getChart8Parm.parammaps.date,'{y}-{m}') + '-' + lastDay
  559. let data = {
  560. name:"getdeptSumMonthDiesel",
  561. parammaps:{
  562. startTime:startTime,
  563. endTime:endTime,
  564. pastureName:this.pastureName.toString(),
  565. departmentName:''
  566. },
  567. }
  568. GetDataByName (data).then(response => {
  569. console.log('图8', response)
  570. let data1 = []
  571. let xdata = []
  572. if(response.data){
  573. response.data.list.forEach((item)=>{
  574. data1.push(item.value)
  575. xdata.push(item.name)
  576. })
  577. }
  578. this.chart_data8 = {
  579. data1:data1,
  580. xdata:xdata
  581. }
  582. if(response.data.list){
  583. this.getChart9Parm.parammaps.deptName = response.data.list[0].name
  584. }
  585. this.roadChart8(this.chart_data8)
  586. this.getChart9()
  587. })
  588. },
  589. // XX部门用油量
  590. getChart9() {
  591. let data = {
  592. name:"geteqclassSumMonthDiesel",
  593. parammaps:{
  594. startTime:this.getChart9Parm.parammaps.date,
  595. pastureName:this.pastureName.toString(),
  596. deptName:this.getChart9Parm.parammaps.deptName
  597. },
  598. }
  599. GetReportform(data).then(response => {
  600. console.log('图9', response)
  601. if(response.data.chart_data){
  602. this.chart_data9 = {
  603. data1:response.data.eqCost,
  604. xdata:response.data.typeName
  605. }
  606. }else{
  607. this.chart_data9 = {
  608. data1:[],
  609. xdata:[]
  610. }
  611. }
  612. this.roadChart9(this.chart_data9)
  613. })
  614. },
  615. // 各牧场燃动费用对比
  616. roadChart1(chart_data) {
  617. if (this.chart1 != null) {
  618. this.chart1.dispose()
  619. }
  620. this.chart1 = echarts.init(document.getElementById('chart1'))
  621. var option = {
  622. title: { text: '各牧场燃动费用对比', textStyle: { color: '#769cfc' }},
  623. tooltip: { trigger: 'axis' },
  624. legend: {
  625. data: ['燃动费用', '预算'],
  626. right: 40
  627. },
  628. color: ['#2dc0e8', '#769cfc'],
  629. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  630. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  631. yAxis: [{ type: 'value', name: '元', axisLabel: { formatter: '{value}万' }}],
  632. series: [
  633. {
  634. name: '燃动费用',
  635. type: 'bar',
  636. data: chart_data.data1,
  637. barMaxWidth:20,
  638. emphasis: { label: { show: true, position: 'inside' }}
  639. },
  640. {
  641. name: '预算',
  642. type: 'bar',
  643. barMaxWidth:20,
  644. data: chart_data.data2,
  645. emphasis: { label: { show: true, position: 'inside' }}
  646. }
  647. ]
  648. }
  649. this.chart1.setOption(option)
  650. window.onresize = function() {
  651. this.chart1.resize()
  652. }
  653. var that = this
  654. that.chart1.on('click', function(param, i) {
  655. console.log(param,'图一点击')
  656. that.pastureName = [param.name]
  657. that.getChart4()
  658. that.getChart5()
  659. that.getChart6()
  660. that.getChart7()
  661. that.getChart8()
  662. that.getChart9()
  663. })
  664. },
  665. // 各牧场柴油用量对比
  666. roadChart11(chart_data) {
  667. if (this.chart11 != null) {
  668. this.chart11.dispose()
  669. }
  670. this.chart11 = echarts.init(document.getElementById('chart11'))
  671. var option = {
  672. title: { text: '各牧场柴油用量对比', textStyle: { color: '#769cfc' }},
  673. tooltip: { trigger: 'axis' },
  674. legend: {
  675. data: ['柴油用量', '去年同期'],
  676. right: 40
  677. },
  678. color: ['#2dc0e8', '#769cfc'],
  679. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  680. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  681. yAxis: [{ type: 'value', name: '用量(万升)', axisLabel: { formatter: '{value}' }}],
  682. series: [
  683. {
  684. name: '柴油用量',
  685. type: 'bar',
  686. data: chart_data.data1,
  687. barMaxWidth:20,
  688. emphasis: { label: { show: true, position: 'inside' }}
  689. },
  690. {
  691. name: '去年同期',
  692. type: 'bar',
  693. barMaxWidth:20,
  694. data: chart_data.data2,
  695. emphasis: { label: { show: true, position: 'inside' }}
  696. }
  697. ]
  698. }
  699. this.chart11.setOption(option)
  700. window.onresize = function() {
  701. this.chart11.resize()
  702. }
  703. var that = this
  704. this.chart11.on('click', function(param, i) {
  705. console.log(param)
  706. })
  707. },
  708. // 单头牛柴油用量
  709. roadChart12(chart_data) {
  710. if (this.chart12 != null) {
  711. this.chart12.dispose()
  712. }
  713. this.chart12 = echarts.init(document.getElementById('chart12'))
  714. var option = {
  715. title: { text: '单头牛柴油用量',left:'center', textStyle: { color: '#769cfc' }},
  716. tooltip: { trigger: 'axis' },
  717. legend: {
  718. data: ['实际费用'],
  719. right: 40
  720. },
  721. color: ['#2dc0e8', '#769cfc'],
  722. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  723. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  724. yAxis: [{ type: 'value', name: '用量(升)', axisLabel: { formatter: '{value}' }}],
  725. series: [
  726. {
  727. name: '实际费用',
  728. type: 'bar',
  729. data: chart_data.data1,
  730. barMaxWidth:20,
  731. markLine:{ data:[ {yAxis:chart_data.line} ] },
  732. emphasis: { label: { show: true, position: 'inside' }}
  733. },
  734. ]
  735. }
  736. this.chart12.setOption(option)
  737. window.onresize = function() {
  738. this.chart12.resize()
  739. }
  740. var that = this
  741. this.chart12.on('click', function(param, i) {
  742. console.log(param)
  743. })
  744. },
  745. // 单头牛燃动费用
  746. roadChart2(chart_data) {
  747. if (this.chart2 != null) {
  748. this.chart2.dispose()
  749. }
  750. this.chart2 = echarts.init(document.getElementById('chart2'))
  751. var option = {
  752. title: { text: '单头牛燃动费用', left:'center',textStyle: { color: '#769cfc' }},
  753. tooltip: { trigger: 'axis' },
  754. legend: {
  755. data: ['实际费用','预算',],
  756. right: 40
  757. },
  758. color: ['#2dc0e8', '#769cfc', '#FFB800'],
  759. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  760. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  761. yAxis: [{ type: 'value', name: '价格(元)'}],
  762. series: [
  763. {
  764. name: '实际费用',
  765. type: 'bar',
  766. data: chart_data.data1,
  767. emphasis: { label: { show: true, position: 'inside' }},
  768. barMaxWidth:20,
  769. markLine:{ data:[ {yAxis:chart_data.line} ] }
  770. },
  771. {
  772. name: '预算',
  773. type: 'bar',
  774. data: chart_data.data2,
  775. emphasis: { label: { show: true, position: 'inside' }},
  776. barMaxWidth:20
  777. },
  778. ]
  779. }
  780. this.chart2.setOption(option)
  781. window.onresize = function() {
  782. this.chart2.resize()
  783. }
  784. var that = this
  785. this.chart2.on('click', function(param, i) {
  786. console.log(param)
  787. })
  788. },
  789. // 牧场每月单头牛用油量对比
  790. roadChart4(chart_data) {
  791. if (this.chart4 != null) {
  792. this.chart4.dispose()
  793. }
  794. this.chart4 = echarts.init(document.getElementById('chart4'))
  795. var text = '牧场每月单头牛用油量对比'
  796. var option = {
  797. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  798. tooltip: { trigger: 'axis' },
  799. legend: {
  800. data: chart_data.data_name,
  801. left: 40,
  802. bottom:0
  803. },
  804. color: ['#2dc0e8', '#769cfc', '#FFB800'],
  805. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  806. xAxis: [{ type: 'category', name: '月份',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  807. yAxis: [{ type: 'value',name: '油量(升)'}],
  808. series: (function() {
  809. var serie = []
  810. if(chart_data.data1 !== null){
  811. for (var i = 0; i < chart_data.data1.length; i++) {
  812. var item = {
  813. name: chart_data.data_name[i],
  814. type: 'line',
  815. data: chart_data.data1[i]
  816. }
  817. serie.push(item)
  818. }
  819. }
  820. return serie
  821. }())
  822. }
  823. this.chart4.setOption(option)
  824. window.onresize = function() {
  825. this.chart4.resize()
  826. }
  827. var that = this
  828. that.chart4.on('click', function(param, i) {
  829. console.log(param)
  830. that.getChart5Parm.parammaps.date = param.name
  831. that.getChart5()
  832. })
  833. },
  834. // XX月部门统计
  835. roadChart5(chart_data) {
  836. if (this.chart5 != null) {
  837. this.chart5.dispose()
  838. }
  839. this.chart5 = echarts.init(document.getElementById('chart5'))
  840. var text = this.getChart5Parm.parammaps.date + '月部门统计'
  841. var option = {
  842. title: { text: text, left:'center',textStyle: { color: '#769cfc' }},
  843. tooltip: { trigger: 'axis' },
  844. legend: {
  845. data: ['实际', '预算'],
  846. right: 40,
  847. bottom:0
  848. },
  849. color: ['#2dc0e8', '#769cfc'],
  850. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  851. xAxis: [{ type: 'category', name: '部门',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  852. yAxis: [{ type: 'value',name: '油量(升)', axisLabel: { formatter:'{value} 万'}}],
  853. series: [
  854. {
  855. name: '实际',
  856. type: 'bar',
  857. data: chart_data.data1,
  858. emphasis: { label: { show: true, position: 'inside' }},
  859. barMaxWidth:20
  860. },
  861. {
  862. name: '预算',
  863. type: 'bar',
  864. data: chart_data.data2,
  865. emphasis: { label: { show: true, position: 'inside' }},
  866. barMaxWidth:20
  867. }
  868. ]
  869. }
  870. this.chart5.setOption(option)
  871. window.onresize = function() {
  872. this.chart5.resize()
  873. }
  874. var that = this
  875. this.chart5.on('click', function(param, i) {
  876. console.log(param)
  877. })
  878. },
  879. // 牧场每月用油量对比
  880. roadChart6(chart_data) {
  881. if (this.chart6 != null) {
  882. this.chart6.dispose()
  883. }
  884. this.chart6 = echarts.init(document.getElementById('chart6'))
  885. var option = {
  886. title: { text: '牧场每月用油量对比', left:'center',textStyle: { color: '#769cfc' }},
  887. tooltip: { trigger: 'axis' },
  888. legend: {
  889. data: chart_data.data_name,
  890. right: 40,
  891. bottom:0
  892. },
  893. color: ['#2dc0e8', '#769cfc'],
  894. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  895. xAxis: [{ type: 'category', name: '月份',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  896. yAxis: [{ type: 'value',name: '油量(升)' }],
  897. series: (function() {
  898. var serie = []
  899. if(chart_data.data1 !== null){
  900. for (var i = 0; i < chart_data.data1.length; i++) {
  901. var item = {
  902. name: chart_data.data_name[i],
  903. type: 'line',
  904. data: chart_data.data1[i]
  905. }
  906. serie.push(item)
  907. }
  908. }
  909. return serie
  910. }())
  911. }
  912. this.chart6.setOption(option)
  913. window.onresize = function() {
  914. this.chart6.resize()
  915. }
  916. var that = this
  917. that.chart6.on('click', function(param, i) {
  918. console.log(param,'======6')
  919. that.getChart7Parm.parammaps.date = param.name
  920. that.getChart7()
  921. that.getChart8Parm.parammaps.date = param.name
  922. that.getChart8()
  923. })
  924. },
  925. // XX月每日用油量
  926. roadChart7(chart_data) {
  927. console.log(chart_data,'====you')
  928. if (this.chart7 != null) {
  929. this.chart7.dispose()
  930. }
  931. this.chart7 = echarts.init(document.getElementById('chart7'))
  932. var text = this.getChart7Parm.parammaps.date+ '月每日用油量'
  933. var option = {
  934. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  935. tooltip: { trigger: 'axis' },
  936. legend: {
  937. data: chart_data.data_name,
  938. left: 40,
  939. bottom:0
  940. },
  941. color: ['#2dc0e8', '#769cfc', '#FFB800'],
  942. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  943. xAxis: [{ type: 'category', name: '日',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  944. yAxis: [{ type: 'value', name: '油量(升)'}],
  945. series: (function() {
  946. var serie = []
  947. if(chart_data.data1 !== null){
  948. for (var i = 0; i < chart_data.data1.length; i++) {
  949. var item = {
  950. name: chart_data.data_name[i],
  951. type: 'line',
  952. data: chart_data.data1[i]
  953. }
  954. serie.push(item)
  955. }
  956. }
  957. return serie
  958. }())
  959. }
  960. this.chart7.setOption(option)
  961. window.onresize = function() {
  962. this.chart7.resize()
  963. }
  964. var that = this
  965. this.chart7.on('click', function(param, i) {
  966. console.log(param)
  967. })
  968. },
  969. // XX月部门统计
  970. roadChart8(chart_data) {
  971. if (this.chart8 != null) {
  972. this.chart8.dispose()
  973. }
  974. this.chart8 = echarts.init(document.getElementById('chart8'))
  975. var text = this.getChart8Parm.parammaps.date + '月部门统计'
  976. var option = {
  977. title: { text: text, left:'center',textStyle: { color: '#769cfc' }},
  978. tooltip: { trigger: 'axis' },
  979. legend: {
  980. data: ['实际用量'],
  981. right: 40,
  982. bottom:0
  983. },
  984. color: ['#2dc0e8', '#769cfc'],
  985. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  986. xAxis: [{ type: 'category', name: '部门',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  987. yAxis: [{ type: 'value',name: '油量(升)', axisLabel: { formatter:'{value} 万'}}],
  988. series: [
  989. {
  990. name: '实际用量',
  991. type: 'bar',
  992. data: chart_data.data1,
  993. emphasis: { label: { show: true, position: 'inside' }},
  994. barMaxWidth:20
  995. },
  996. ]
  997. }
  998. this.chart8.setOption(option)
  999. window.onresize = function() {
  1000. this.chart8.resize()
  1001. }
  1002. var that = this
  1003. that.chart8.on('click', function(param, i) {
  1004. console.log(param)
  1005. that.getChart9Parm.parammaps.deptName = param.name
  1006. that.getChart9()
  1007. })
  1008. },
  1009. // XX部门用X量
  1010. roadChart9(chart_data) {
  1011. if (this.chart9 != null) {
  1012. this.chart9.dispose()
  1013. }
  1014. this.chart9 = echarts.init(document.getElementById('chart9'))
  1015. var text = this.getChart9Parm.parammaps.deptName +'用油量'
  1016. var option = {
  1017. title: { text: text, left:'center',textStyle: { color: '#769cfc' }},
  1018. tooltip: { trigger: 'axis' },
  1019. legend: {
  1020. data: ['实际费用'],
  1021. right: 40,
  1022. bottom:0
  1023. },
  1024. color: ['#2dc0e8', '#769cfc'],
  1025. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  1026. xAxis: [{ type: 'category', name: '设备',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  1027. yAxis: [{ type: 'value',name: '油量(升)', axisLabel: { formatter:'{value} 万'}}],
  1028. series: [
  1029. {
  1030. name: '实际费用',
  1031. type: 'bar',
  1032. data: chart_data.data1,
  1033. emphasis: { label: { show: true, position: 'inside' }},
  1034. barMaxWidth:20
  1035. },
  1036. ]
  1037. }
  1038. this.chart9.setOption(option)
  1039. window.onresize = function() {
  1040. this.chart9.resize()
  1041. }
  1042. var that = this
  1043. this.chart9.on('click', function(param, i) {
  1044. console.log(param)
  1045. })
  1046. },
  1047. }
  1048. }
  1049. </script>
  1050. <style>
  1051. .el-row {
  1052. margin-bottom: 40px;
  1053. &:last-child {
  1054. margin-bottom: 0;
  1055. }
  1056. }
  1057. </style>
  1058. <style lang="scss" scoped>
  1059. .group{
  1060. float: right;margin-bottom: 20px;
  1061. }
  1062. </style>