{"remainingRequest":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\cssc-fvue\\src\\views\\HealthManage\\OptimalSchedule.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\cssc-fvue\\src\\views\\HealthManage\\OptimalSchedule.vue","mtime":1681441192473},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport { Chart } from '@antv/g2'\r\nimport { Liquid } from '@antv/g2plot'\r\nimport moment from 'moment' //日期格式化插件\r\nexport default {\r\n name: 'OptimalSchedule', //寿命调度\r\n data() {\r\n return {\r\n dateTime: '',\r\n yesterday: '',\r\n tableData: [],\r\n chartBar: null,\r\n barData: [],\r\n liquid: null,\r\n totalPowerGeneration: 0,\r\n totalGenerEfficiency: 0,\r\n }\r\n },\r\n created() {\r\n this.getDateTime()\r\n this.getLifeSchedule()\r\n },\r\n mounted() { },\r\n methods: {\r\n onClickRefresh() {\r\n this.dateTime = this.yesterday\r\n },\r\n // 获取前一天日期\r\n getDateTime() {\r\n let yesterday = new Date().getTime() - 24 * 60 * 60 * 1000\r\n let date = new Date(yesterday)\r\n var year = date.getFullYear()\r\n var month = date.getMonth() + 1\r\n var day = date.getDate()\r\n if (month >= 1 && month <= 9) {\r\n month = '0' + month\r\n }\r\n if (day >= 0 && day <= 9) {\r\n day = '0' + day\r\n }\r\n this.dateTime = year + '-' + month + '-' + day\r\n this.yesterday = this.dateTime\r\n },\r\n getLifeSchedule() {\r\n let data = this.qs.stringify({ localDate: this.dateTime })\r\n console.log(data, 'this.qs.stringify({localDate: this.dateTime})')\r\n let query = {\r\n url: '${cssc}/biz/jkjc/health/v1/getJsonLifeSchedule',\r\n method: 'post',\r\n data: this.qs.stringify({ localDate: this.dateTime }),\r\n headers: {\r\n 'Content-type': 'application/x-www-form-urlencoded',\r\n },\r\n }\r\n this.$http.request(query).then((res) => {\r\n if (res && res.data && res.data.value) {\r\n console.log(res.data.value)\r\n let realData = res.data.value\r\n\r\n this.tableData = realData.dispatchLog\r\n ? realData.dispatchLog\r\n : []\r\n this.tableData.forEach((item, index) => {\r\n item.statValue = item.statValue.toFixed(2)\r\n item.dataTimee = moment(parseInt(item.dataTime)).format(\r\n 'YYYY-MM-DD HH:mm:ss'\r\n )\r\n item.key = index\r\n item.powerGenerEfficiency = (\r\n item.powerGenerEfficiency * 100\r\n ).toFixed(2)\r\n })\r\n\r\n realData.dispatchPowerList.forEach((item) => {\r\n item.statValue = parseFloat(item.statValue.toFixed(2))\r\n })\r\n this.barData = realData.dispatchPowerList ? realData.dispatchPowerList : []\r\n\r\n if (this.chartBar) {\r\n this.chartBar.changeData(this.barData)\r\n } else {\r\n this.initChartbar()\r\n }\r\n this.totalPowerGeneration = realData.totalPowerGeneration ? realData.totalPowerGeneration : 0\r\n this.totalGenerEfficiency = realData.totalGenerEfficiency ? realData.totalGenerEfficiency : 0\r\n if (this.liquid) {\r\n this.liquid.changeData(this.totalGenerEfficiency)\r\n } else {\r\n this.initLiquid(this.totalGenerEfficiency)\r\n }\r\n }\r\n })\r\n },\r\n initChartbar() {\r\n this.chartBar = new Chart({\r\n container: 'chartbar',\r\n autoFit: true,\r\n height: 500,\r\n forceFit: true,\r\n })\r\n this.chartBar.data(this.barData)\r\n this.chartBar.scale('statValue', {\r\n nice: true,\r\n alias: '调度功率 kW',\r\n })\r\n this.chartBar.axis('statValue', {\r\n label: {\r\n formatter: (val) => {\r\n return val + 'kW'\r\n },\r\n },\r\n grid: {\r\n line: {\r\n style: {\r\n stroke: '#586377',\r\n lineWidth: 1,\r\n lineDash: [3, 3],\r\n },\r\n },\r\n },\r\n })\r\n this.chartBar.option('scrollbar', {\r\n type: 'horizontal',\r\n categorySize: 40,\r\n animate: false,\r\n style: {\r\n thumbColor: '#199FD7', //滚动条背景颜色\r\n thumbHighlightColor: '#199FD7',\r\n },\r\n })\r\n this.chartBar.axis('fanName', {\r\n line: {\r\n style: {\r\n lineWidth: 1,\r\n stroke: '#586377',\r\n },\r\n },\r\n label: {\r\n rotate: 45,\r\n offset: 20,\r\n },\r\n })\r\n this.chartBar.tooltip({\r\n showTitle: true,\r\n showMarkers: false,\r\n domStyles: {\r\n 'g2-tooltip': {\r\n background: 'rgba(0,0,0, 0.8)',\r\n color: '#d6e0ec',\r\n },\r\n },\r\n })\r\n this.chartBar.interaction('element-active')\r\n this.chartBar.interaction('active-region')\r\n\r\n this.chartBar\r\n .interval()\r\n .position('fanName*statValue')\r\n .style({ fill: 'l(90) 0:#22C3FE 0.5:#199FD7 1:#044879' })\r\n\r\n this.chartBar.render()\r\n },\r\n initLiquid(percent) {\r\n this.liquid = new Liquid('liquid', {\r\n percent: percent,\r\n outline: {\r\n border: 4,\r\n distance: 0,\r\n },\r\n wave: {\r\n count: 3,\r\n length: 40,\r\n },\r\n pattern: { type: 'line' },\r\n statistic: {\r\n content: {\r\n style: {\r\n fill: '#fff',\r\n },\r\n },\r\n },\r\n theme: {\r\n styleSheet: {\r\n brandColor: '#10c4b5',\r\n },\r\n },\r\n })\r\n this.liquid.render()\r\n },\r\n },\r\n}\r\n",null]}