{"remainingRequest":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\cssc-fvue\\src\\views\\OperationInfo\\components\\ChartDialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\cssc-fvue\\src\\views\\OperationInfo\\components\\ChartDialog.vue","mtime":1667804639665},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"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":["import \"core-js/modules/web.dom.iterable\";\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//\nimport { Chart } from '@antv/g2';\nexport default {\n name: 'chart-dialog',\n data: function data() {\n return {\n co2: 0,\n cost: 0,\n befortotalcost: 0,\n // 优化前费用\n aftertotalcost: 0,\n // 优化后总费用\n statisticsRate: {},\n //环图统计列表\n statisticsTotal: [],\n //柱状图统计列表\n statisticsData: {},\n beforeData: [{\n item: '交通成本',\n count: 0,\n percent: 0\n }, {\n item: '人工成本',\n count: 0,\n percent: 0\n }, {\n item: '发电损失',\n count: 0,\n percent: 0\n }],\n afterData: [{\n item: '交通成本',\n count: 0,\n percent: 0\n }, {\n item: '人工成本',\n count: 0,\n percent: 0\n }, {\n item: '发电损失',\n count: 0,\n percent: 0\n }],\n chartBefore: null,\n chartAfter: null,\n dataOrigin: {\n aftertotalcost: 0,\n afterhumancostrate: 0,\n afterroutecostrate: 0,\n afterwindpowerrate: 0,\n befortotalcost: 0,\n beforhumancostrate: 0,\n beforroutecostrate: 0,\n beforwindpowerrate: 0\n },\n barChart: null,\n barData: [{\n date: '',\n costvalue: 0\n }],\n optimization: 0\n };\n },\n mounted: function mounted() {\n var _this = this;\n\n this.$nextTick(function () {\n _this.initChart();\n\n _this.initChart1();\n\n _this.initChart2();\n });\n },\n methods: {\n changeData: function changeData(data) {\n this.formatStatistics(data.statisticsRate);\n\n if (data.statisticsTotal) {\n this.barData = data.statisticsTotal;\n this.calculateData(data.statisticsTotal);\n } else {\n this.barData = [{\n date: '',\n costvalue: 0\n }];\n }\n\n this.barChart.changeData(this.barData);\n },\n calculateData: function calculateData(data) {\n var _this2 = this;\n\n this.co2 = 0;\n this.cost = 0;\n var beforewindpower = 0;\n var windpower = 0;\n var beforeroutecost = 0;\n var routecost = 0;\n data.forEach(function (item) {\n _this2.cost += item.costvalue;\n beforewindpower += item.beforewindpower;\n windpower += item.windpower;\n beforeroutecost += item.beforeroutecost;\n routecost += item.routecost;\n });\n this.co2 = (((beforewindpower - windpower) / 0.85 + (beforeroutecost - routecost) * 2.63 / 7) / 10000).toFixed(2);\n this.cost = (this.cost / 10000).toFixed(2);\n console.log(this.co2, this.cost, beforewindpower, windpower, beforeroutecost, routecost);\n },\n formatStatistics: function formatStatistics(data) {\n if (data && data.befortotalcost && data.aftertotalcost) {\n for (var key in data) {\n data[key] = parseFloat(data[key]);\n }\n\n this.befortotalcost = data.befortotalcost;\n this.aftertotalcost = data.aftertotalcost;\n this.beforeData[0].count = data.beforroutecostrate;\n this.beforeData[0].percent = (data.beforroutecostrate / data.befortotalcost).toFixed(4);\n this.beforeData[1].count = data.beforhumancostrate;\n this.beforeData[1].percent = (data.beforhumancostrate / data.befortotalcost).toFixed(4);\n this.beforeData[2].count = data.beforwindpowerrate;\n this.beforeData[2].percent = (data.beforwindpowerrate / data.befortotalcost).toFixed(4);\n this.afterData[0].count = data.afterroutecostrate;\n this.afterData[0].percent = (data.afterroutecostrate / data.aftertotalcost).toFixed(4);\n this.afterData[1].count = data.afterhumancostrate;\n this.afterData[1].percent = (data.afterhumancostrate / data.aftertotalcost).toFixed(4);\n this.afterData[2].count = data.afterwindpowerrate;\n this.afterData[2].percent = (data.afterwindpowerrate / data.aftertotalcost).toFixed(4);\n this.optimization = ((1 - this.aftertotalcost / this.befortotalcost) * 100).toFixed(2);\n } else {\n this.befortotalcost = 0;\n this.aftertotalcost = 0;\n this.optimization = 0;\n this.beforeData = [{\n item: '交通成本',\n count: 0,\n percent: 0\n }, {\n item: '人工成本',\n count: 0,\n percent: 0\n }, {\n item: '发电损失',\n count: 0,\n percent: 0\n }];\n this.afterData = [{\n item: '交通成本',\n count: 0,\n percent: 0\n }, {\n item: '人工成本',\n count: 0,\n percent: 0\n }, {\n item: '发电损失',\n count: 0,\n percent: 0\n }];\n }\n\n console.log(this.beforeData, 'this.beforeData', this.afterData);\n this.chartBefore.changeData(this.beforeData);\n this.chartAfter.changeData(this.afterData);\n },\n initChart: function initChart() {\n var _this3 = this;\n\n this.chartBefore = new Chart({\n container: 'container',\n autoFit: true,\n height: 500\n });\n this.chartBefore.coordinate('theta', {\n radius: 0.6,\n innerRadius: 0.6\n });\n this.chartBefore.data(this.beforeData);\n this.chartBefore.scale('count', {\n formatter: function formatter(val) {\n return val;\n }\n });\n this.chartBefore.legend('item', {\n itemName: {\n style: {\n fill: '#ccf2ff'\n }\n },\n itemValue: {\n style: {\n fill: '#23bbff'\n },\n // 配置 itemValue 样式\n formatter: function formatter(text, item, index) {\n var textShow = (parseFloat(_this3.beforeData[index].percent) * 100).toFixed(2) + '';\n return textShow.slice(0, 5) + '%';\n }\n },\n position: 'right',\n // 配置图例显示位置\n offsetX: -45,\n offsetY: 15\n });\n this.chartBefore.annotation().text({\n position: ['70%', '40%'],\n content: '总费用:',\n style: {\n fontSize: 14,\n fill: '#ccf2ff'\n },\n offsetX: 47,\n offsetY: -25\n }).text({\n position: ['85%', '40%'],\n content: function content(obj) {\n return _this3.befortotalcost + '元';\n },\n style: {\n fontSize: 14,\n fill: '#23bbff'\n },\n offsetX: 50,\n offsetY: -25\n });\n this.chartBefore.tooltip({\n showTitle: false,\n showMarkers: false,\n domStyles: {\n 'g2-tooltip': {\n background: 'rgba(0,0,0, 0.8)',\n color: '#d6e0ec'\n }\n }\n });\n this.chartBefore.interval().position('count').color('item').adjust('stack');\n this.chartBefore.interaction('element-active');\n this.chartBefore.render();\n },\n initChart1: function initChart1() {\n var _this4 = this;\n\n this.chartAfter = new Chart({\n container: 'container1',\n autoFit: true,\n height: 500\n });\n this.chartAfter.coordinate('theta', {\n radius: 0.6,\n innerRadius: 0.6\n });\n this.chartAfter.data(this.afterData);\n this.chartAfter.scale('count', {\n formatter: function formatter(val) {\n return val;\n }\n });\n this.chartAfter.legend('item', {\n itemName: {\n style: {\n fill: '#ccf2ff'\n }\n },\n itemValue: {\n style: {\n fill: '#23bbff'\n },\n // 配置 itemValue 样式\n formatter: function formatter(text, item, index) {\n var showText = (parseFloat(_this4.afterData[index].percent) * 100).toFixed(2) + '';\n return showText.slice(0, 5) + '%';\n } // 格式化 itemValue 内容\n\n },\n position: 'right',\n // 配置图例显示位置\n offsetX: -45,\n //图例与图表的距离\n offsetY: 15\n });\n this.chartAfter.tooltip({\n showTitle: false,\n showMarkers: false,\n domStyles: {\n 'g2-tooltip': {\n background: 'rgba(0,0,0, 0.8)',\n color: '#d6e0ec'\n }\n }\n });\n this.chartAfter.annotation().text({\n position: ['70%', '35%'],\n content: '总费用:',\n style: {\n fontSize: 14,\n fill: '#ccf2ff'\n },\n offsetX: 47,\n offsetY: -25\n }).text({\n position: ['85%', '35%'],\n content: function content() {\n return _this4.aftertotalcost + '元';\n },\n style: {\n fontSize: 14,\n fill: '#23bbff'\n },\n offsetX: 50,\n offsetY: -25\n }).text({\n position: ['70%', '35%'],\n content: '优化率:',\n style: {\n fontSize: 14,\n fill: '#ccf2ff'\n },\n offsetX: 47,\n offsetY: -2\n }).text({\n position: ['85%', '35%'],\n content: function content() {\n return _this4.optimization + '%';\n },\n style: {\n fontSize: 14,\n fill: '#23bbff'\n },\n offsetX: 50,\n offsetY: -2\n });\n this.chartAfter.interval().position('count').color('item').adjust('stack');\n this.chartAfter.interaction('element-active');\n this.chartAfter.render();\n },\n initChart2: function initChart2() {\n this.barChart = new Chart({\n container: 'container2',\n autoFit: true,\n height: 500\n });\n this.barChart.data(this.barData);\n this.barChart.scale('costvalue', {\n tickLine: null,\n alias: '成本',\n nice: true\n });\n this.barChart.axis('date', {\n tickLine: null\n });\n this.barChart.axis('costvalue', {\n label: {\n style: {\n fill: '#979ba4'\n }\n },\n line: {\n style: {\n stroke: '#414959'\n }\n },\n grid: {\n line: {\n style: {\n stroke: '#414959',\n lineWidth: 1,\n lineDash: [3, 3]\n }\n },\n alignTick: true\n }\n });\n this.barChart.legend(false);\n this.barChart.tooltip({\n shared: false,\n showMarkers: false,\n domStyles: {\n 'g2-tooltip': {\n background: 'rgba(0,0,0, 0.8)',\n color: '#d6e0ec'\n }\n }\n });\n this.barChart.interaction('active-region');\n this.barChart.interval().position('date*costvalue');\n this.barChart.render();\n }\n }\n};",null]}