123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 |
- <template>
- <div id="phdffx">
- <div class="query mg-b-8">
- <div class="query-items">
- <div class="query-item">
- <div class="lable">场站:</div>
- <div class="search-input">
- <el-select v-model="wpId" clearable placeholder="请选择" popper-class="select" @change="(wpId) => { getTurbines() }">
- <el-option v-for="item in wpList" :key="item.id" :value="item.id" :label="item.name"></el-option>
- </el-select>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">机组:</div>
- <div class="search-input">
- <el-select v-model="wtId" placeholder="请选择" popper-class="select">
- <el-option v-for="item in wtList" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">开始日期:</div>
- <div class="search-input">
- <el-date-picker v-model="startDate" type="date" placeholder="开始日期" popper-class="date-select" value-format="YYYY-MM-DD"></el-date-picker>
- </div>
- </div>
- <div class="query-item">
- <div class="lable">结束日期:</div>
- <div class="search-input">
- <el-date-picker v-model="endDate" type="date" placeholder="开始日期" popper-class="date-select" value-format="YYYY-MM-DD"></el-date-picker>
- </div>
- </div>
- <div class="query-actions">
- <button class="btn green" @click="getCharts()">查询</button>
- </div>
- </div>
- </div>
- <div class="mg-b-16">
- <panel :title="'偏航对风风速分析'" :showLine="false">
- <!-- <LineChart :list="statusData" :units="['']" :height="'220px'" /> -->
- <div class="chart" id="linechart1"></div>
- </panel>
- </div>
- <div class="mg-b-16">
- <panel :title="'偏航对风功率分析'" :showLine="false">
- <div class="chart" id="linechart2"></div>
- </panel>
- </div>
- <div class="mg-b-16">
- <panel :title="'偏航对风分析'" :showLine="false">
- <div class="chart" id="linechart3"></div>
- </panel>
- </div>
- <el-dialog :title="'偏航对风分析明细'" v-model="dialogShow" width="80%" top="10vh" custom-class="modal dBody" :close-on-click-modal="true">
- <div class="chart" id="linechartDialog"></div>
- </el-dialog>
- </div>
- </template>
- <script>
- import LineChart from "../../components/chart/line/normal-line-chart.vue";
- import Panel from "../../components/coms/panel/panel.vue";
- import util from "@/helper/util.js";
- import partten from "@/helper/partten.js";
- import * as echarts from "echarts";
- export default {
- name: "phdffx",
- components: { LineChart, Panel },
- data() {
- return {
- wpList: [],
- wpId: "MHS_FDC",
- wtList: [],
- wtId: "MG01_01",
- startDate: "",
- endDate: "",
- line1XData: [],
- line2XData: [],
- dialogShow: false,
- };
- },
- created() {
- this.getStations();
- this.getTurbines();
- let end = new Date();
- let start = new Date();
- start.setDate(1);
- this.endDate = end.formatDate("yyyy-MM-dd");
- this.startDate = start.formatDate("yyyy-MM-dd");
- this.getCharts();
- },
- methods: {
- // 场站
- async getStations() {
- const res = await this.API.requestData({
- method: "GET",
- baseURL: "http://10.155.32.4:9001/",
- subUrl: "benchmarking/wplist",
- });
- this.wpList = res.data.data;
- // this.wpId = res.data.data[0].id;
- },
- async getTurbines() {
- const res = await this.API.requestData({
- method: "GET",
- subUrl: "powercompare/windturbineAjax",
- data: { wpId: this.wpId },
- });
- this.wtList = res.data.data;
- this.wtId = res.data.data[0].id;
- },
- getCharts() {
- this.getChart1();
- this.getChart2();
- this.getChart3();
- },
- async getChart1() {
- const res = await this.API.requestData({
- method: "POST",
- subUrl: "yaw/getPassRate",
- data: {
- wtId: this.wtId,
- beginDate: this.startDate,
- endDate: this.endDate,
- type: 2,
- },
- });
- if (res && res.data && res.data.data) {
- const xData = [];
- const lData = [];
- res.data.data.forEach((e) => {
- xData.push(e.speed);
- lData.push(e.passrate);
- });
- this.line1XData = xData;
- let option = {
- color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
- tooltip: {
- trigger: "axis",
- backgroundColor: "rgba(0,0,0,0.4)",
- borderColor: partten.getColor("gray"),
- textStyle: {
- color: "#fff",
- fontSize: util.vh(16),
- },
- },
- legend: {
- show: false,
- data: ["合格率(%)"],
- right: 56,
- icon: "circle",
- itemWidth: 6,
- inactiveColor: "#606769",
- textStyle: {
- color: partten.getColor("grayl"),
- fontSize: 12,
- },
- },
- grid: {
- top: util.vh(40),
- left: util.vh(60),
- right: util.vh(100),
- bottom: util.vh(24),
- },
- xAxis: [
- {
- name: "风速(m/s)",
- type: "category",
- boundaryGap: false,
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- textStyle: {
- color: partten.getColor("gray"),
- },
- },
- data: xData,
- },
- ],
- yAxis: [
- {
- type: "value",
- name: "合格率(%)",
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- },
- splitLine: {
- lineStyle: {
- color: partten.getColor("gray") + 55,
- type: "dashed",
- },
- },
- },
- ],
- series: [
- {
- name: "合格率",
- type: "line",
- smooth: true,
- zlevel: 0,
- lineStyle: {
- normal: {
- color: "#05bb4c",
- width: 1,
- },
- },
- yAxisIndex: 0,
- data: lData,
- },
- ],
- };
- const chart = echarts.init(document.getElementById("linechart1"));
- chart.clear();
- chart.setOption(option);
- this.resize = function () {
- chart.resize();
- };
- chart.getZr().off("click");
- chart.getZr().on("click", (params) => {
- const pointInPixel = [params.offsetX, params.offsetY];
- if (chart.containPixel("grid", pointInPixel)) {
- let xIndex = chart.convertFromPixel({ seriesIndex: 0 }, [
- params.offsetX,
- params.offsetY,
- ])[0];
- // 图标点击事件
- this.showDetail("2", this.line1XData[xIndex]);
- }
- });
- window.addEventListener("resize", this.resize);
- }
- },
- async getChart2() {
- const res = await this.API.requestData({
- method: "POST",
- subUrl: "yaw/getPassRate",
- data: {
- wtId: this.wtId,
- beginDate: this.startDate,
- endDate: this.endDate,
- type: 1,
- },
- });
- if (res && res.data && res.data.data) {
- const xData = [];
- const lData = [];
- res.data.data.forEach((e) => {
- xData.push(e.power);
- lData.push(e.passrate);
- });
- this.line2XData = xData;
- let option = {
- color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
- tooltip: {
- trigger: "axis",
- backgroundColor: "rgba(0,0,0,0.4)",
- borderColor: partten.getColor("gray"),
- textStyle: {
- color: "#fff",
- fontSize: util.vh(16),
- },
- },
- legend: {
- show: false,
- data: ["合格率(%)"],
- right: 56,
- icon: "circle",
- itemWidth: 6,
- inactiveColor: "#606769",
- textStyle: {
- color: partten.getColor("grayl"),
- fontSize: 12,
- },
- },
- grid: {
- top: util.vh(40),
- left: util.vh(60),
- right: util.vh(100),
- bottom: util.vh(24),
- },
- xAxis: [
- {
- name: "功率(kW)",
- type: "category",
- boundaryGap: false,
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- textStyle: {
- color: partten.getColor("gray"),
- },
- },
- data: xData,
- },
- ],
- yAxis: [
- {
- type: "value",
- name: "合格率(%)",
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- },
- splitLine: {
- lineStyle: {
- color: partten.getColor("gray") + 55,
- type: "dashed",
- },
- },
- },
- ],
- series: [
- {
- name: "合格率",
- type: "line",
- smooth: true,
- zlevel: 0,
- lineStyle: {
- normal: {
- color: "#05bb4c",
- width: 1,
- },
- },
- yAxisIndex: 0,
- data: lData,
- },
- ],
- };
- const chart = echarts.init(document.getElementById("linechart2"));
- chart.clear();
- chart.setOption(option);
- this.resize = function () {
- chart.resize();
- };
- chart.getZr().off("click");
- chart.getZr().on("click", (params) => {
- const pointInPixel = [params.offsetX, params.offsetY];
- if (chart.containPixel("grid", pointInPixel)) {
- let xIndex = chart.convertFromPixel({ seriesIndex: 0 }, [
- params.offsetX,
- params.offsetY,
- ])[0];
- this.showDetail("1", this.line2XData[xIndex] / 100);
- }
- });
- window.addEventListener("resize", this.resize);
- }
- },
- async getChart3() {
- const res = await this.API.requestData({
- method: "POST",
- subUrl: "yaw/getTotalRanges",
- data: {
- wtId: this.wtId,
- beginDate: this.startDate,
- endDate: this.endDate,
- type: 1,
- },
- });
- if (res && res.data && res.data.data) {
- const xData = [];
- const lData = [];
- const dataMap = res.data.data;
- for (let key in dataMap) {
- let tmpKey = key.replace(/r/, "");
- tmpKey = tmpKey.replace(/_/, "-");
- if (tmpKey < 100) {
- xData.push(tmpKey);
- lData.push(dataMap[key]);
- }
- }
- this.line3Data = lData;
- let option = {
- color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
- tooltip: {
- trigger: "axis",
- backgroundColor: "rgba(0,0,0,0.4)",
- borderColor: partten.getColor("gray"),
- textStyle: {
- color: "#fff",
- fontSize: util.vh(16),
- },
- },
- legend: {
- show: false,
- data: ["偏航次数"],
- right: 56,
- icon: "circle",
- itemWidth: 6,
- inactiveColor: "#606769",
- textStyle: {
- color: partten.getColor("grayl"),
- fontSize: 12,
- },
- },
- grid: {
- top: util.vh(40),
- left: util.vh(60),
- right: util.vh(130),
- bottom: util.vh(24),
- },
- xAxis: [
- {
- name: "对风偏差(度)",
- type: "category",
- boundaryGap: false,
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- textStyle: {
- color: partten.getColor("gray"),
- },
- },
- data: xData,
- },
- ],
- yAxis: [
- {
- type: "value",
- name: "数量",
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- },
- splitLine: {
- lineStyle: {
- color: partten.getColor("gray") + 55,
- type: "dashed",
- },
- },
- },
- ],
- series: [
- {
- name: "数量",
- type: "line",
- smooth: true,
- zlevel: 0,
- lineStyle: {
- normal: {
- color: "#05bb4c",
- width: 1,
- },
- },
- yAxisIndex: 0,
- data: lData,
- },
- ],
- };
- const chart = echarts.init(document.getElementById("linechart3"));
- chart.clear();
- chart.setOption(option);
- this.resize = function () {
- chart.resize();
- };
- window.addEventListener("resize", this.resize);
- }
- },
- async showDetail(type, value) {
- this.dialogShow = true;
- const res = await this.API.requestData({
- method: "POST",
- subUrl: "yaw/getRanges",
- data: {
- wtId: this.wtId,
- beginDate: this.startDate,
- endDate: this.endDate,
- type: type,
- value: value,
- },
- });
- if (res && res.data && res.data.data) {
- const xData = [];
- const lData = [];
- const dataMap = res.data.data;
- for (let key in dataMap) {
- let tmpKey = key.replace(/r/, "");
- tmpKey = tmpKey.replace(/_/, "-");
- if (tmpKey < 100) {
- xData.push(tmpKey);
- lData.push(dataMap[key]);
- }
- }
- let option = {
- color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
- tooltip: {
- trigger: "axis",
- backgroundColor: "rgba(0,0,0,0.4)",
- borderColor: partten.getColor("gray"),
- textStyle: {
- color: "#fff",
- fontSize: util.vh(16),
- },
- },
- legend: {
- show: false,
- data: ["偏航次数"],
- right: 56,
- icon: "circle",
- itemWidth: 6,
- inactiveColor: "#606769",
- textStyle: {
- color: partten.getColor("grayl"),
- fontSize: 12,
- },
- },
- grid: {
- top: util.vh(40),
- left: util.vh(60),
- right: util.vh(130),
- bottom: util.vh(24),
- },
- xAxis: [
- {
- name: "对风偏差(度)",
- type: "category",
- boundaryGap: false,
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- textStyle: {
- color: partten.getColor("gray"),
- },
- },
- data: xData,
- },
- ],
- yAxis: [
- {
- type: "value",
- name: "数量",
- axisLabel: {
- formatter: "{value}",
- fontSize: util.vh(14),
- },
- splitLine: {
- lineStyle: {
- color: partten.getColor("gray") + 55,
- type: "dashed",
- },
- },
- },
- ],
- series: [
- {
- name: "数量",
- type: "line",
- smooth: true,
- zlevel: 0,
- lineStyle: {
- normal: {
- color: "#05bb4c",
- width: 1,
- },
- },
- yAxisIndex: 0,
- data: lData,
- },
- ],
- };
- const chart = echarts.init(document.getElementById("linechartDialog"));
- chart.clear();
- chart.setOption(option);
- this.resize = function () {
- chart.resize();
- };
- }
- },
- },
- };
- </script>
- <style lang="less">
- #phdffx {
- .chart {
- width: 100%;
- height: 220px;
- display: block;
- margin: auto;
- }
- }
- </style>
|