123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798 |
- <template>
- <div class="dataAnalysisAgcAna" :class="!theme ? 'themeDark' : 'themeLight'">
- <div class="dataAnalysisAgcAnaMain">
- <div class="main_top">
- <p class="topPsty">AGC曲线偏差分析</p>
- <search-cop @submit="funSubmit"> </search-cop>
- </div>
- <div class="main">
- <div class="tableDataMain">
- <el-tabs v-model="activeTab" style="width: 100%">
- <el-tab-pane label="图表展示" name="2">
- <div
- :style="{
- height:
- typeof tableHeight === 'string'
- ? 'calc(' + tableHeight + ' + ' + paginationHeight + 'px)'
- : tableHeight + paginationHeight + 'px',
- width: '100%',
- }"
- class="p-[10px]"
- >
- <CurrentScatterChart
- ref="chartRef"
- :width="tableWidth"
- :height="`calc( ${tableHeight} + ${paginationHeight}px - 20px)`"
- :chartTitle="''"
- :xAxisData="xAxisData"
- :yAxisData="{ splitLine: { show: false } }"
- :seriesData="seriesData"
- :showLegend="true"
- :brushSelected="false"
- :dataSet="dataSet"
- @getSelected="funChartSelect"
- />
- </div>
- </el-tab-pane>
- <el-tab-pane label="表格数据" name="1">
- <table-cop
- :data="tableData"
- :loading="tableLoading"
- :column="tableColumn"
- :height="tableHeight"
- :tableId="tableShowId"
- :tableName="tableName"
- >
- </table-cop>
- <el-pagination layout="prev, pager, next" :total="50" />
- </el-tab-pane>
- <el-tab-pane
- :label="`超限测点 (${abnormalPoint.length}个)`"
- name="3"
- >
- <el-table
- :data="abnormalPoint"
- style="width: 100%"
- :max-height="tableHeight"
- >
- <el-table-column
- prop="date"
- label="时间"
- width="180"
- align="center"
- />
- <el-table-column
- filter-class-name="currentFilter"
- prop="name"
- label="超限原因 (点击定位至图表位置)"
- width="400"
- align="center"
- :filters="[
- { text: '低于下限', value: '低于下限' },
- { text: '高于上限', value: '高于上限' },
- ]"
- :filter-method="tableFilterMethod"
- >
- <template #default="scoped">
- <p style="cursor: pointer" @click="createMark(scoped.row)">
- <span
- :style="`color:${scoped.row.color}; margin-right: 8px;`"
- >
- {{ scoped.row.res }}
- </span>
- <el-icon
- ><component
- :is="scoped.row.icon"
- :color="scoped.row.color"
- /></el-icon>
- </p>
- </template>
- </el-table-column>
- <el-table-column
- prop="value"
- label="测点值"
- width="180"
- align="center"
- />
- <el-table-column
- prop="jud"
- label="限值"
- width="180"
- align="center"
- />
- </el-table>
- <!-- <el-pagination
- layout="total, sizes, prev, pager, next, jumper"
- v-model:current-page="paginationCurrentPage"
- v-model:page-size="paginationPageSize"
- :total="paginationTotal"
- :page-sizes="[50, 100, 200, 500, 1000]"
- @size-change="paginationSizeChange"
- @current-change="paginationCurrentChange"
- /> -->
- </el-tab-pane>
- </el-tabs>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup name="prepare">
- import searchCop from "./components/search.vue";
- import tableCop from "@/components/generatingCapacityComponent/table.vue";
- import { ElMessage } from "element-plus";
- import { onMounted, ref, onActivated, watch } from "vue";
- import { useStore } from "vuex";
- import CurrentScatterChart from "./components/current-scatter-chart.vue";
- import httpRequest from "@/utils/request.js";
- import dayjs from "dayjs";
- import agcJson from "./agcJson.json";
- import * as echarts from "echarts";
- import jsonData from "./components/data.json";
- const tableDataSource = ref([]);
- const paginationCurrentPage = ref(1);
- const paginationPageSize = ref(100);
- const paginationTotal = ref(0);
- const paginationSizeChange = (size) => {};
- const paginationCurrentChange = (page) => {};
- const tableFilterMethod = (value, row) => {
- return row.res === value;
- };
- /**配置参数 */
- const paginationHeight = ref(10);
- const tableWidth = ref(window.innerWidth - 200 + "px");
- const tableHeight = ref(
- window.innerHeight - 170 - paginationHeight.value + "px"
- );
- const treeHeight = ref(window.innerHeight - 170 + "px"); //tree高度
- const excelHeight = ref(window.innerHeight - 170 + "px"); //excel高度
- /**excel 开始 */
- const excelList = ref([]);
- const funExcelChange = async (obj) => {
- //点击excel项时
- activeTab.value = "1";
- tableShowId.value = obj.id;
- tableName.value = obj.name;
- tableLoading.value = true;
- const res = await httpRequest.get("/power/prepare/show", {
- params: {
- id: obj.id,
- },
- });
- if (res.code === 200) {
- tableColumn.value = res.data.title.map((o) => {
- return {
- prop: o.key,
- label: o.des,
- width: o.des === "时间" ? 100 : 80,
- };
- });
- tableData.value = res.data.data;
- tableLoading.value = false;
- } else {
- tableLoading.value = false;
- }
- };
- /**tree 开始 */
- const treeData = ref([]);
- const funRepeatMap = (arr) => {
- return arr.map((o) => {
- if (o.children) {
- const findIndex = o.children.findIndex((p) => !!p.type);
- if (findIndex !== -1) {
- o.childs = o.children;
- o.children = [];
- }
- }
- return {
- ...o,
- children: o.children.length ? funRepeatMap(o.children) : [],
- };
- });
- };
- const funGetTree = async () => {
- const res = await httpRequest.get("/power/prepare/tree");
- treeData.value = funRepeatMap(res.data);
- excelList.value = [];
- };
- const funCurrentChange = ({ current, currentNode }) => {
- if (current.childs) {
- excelList.value = current.childs.map((o) => {
- return {
- id: o.id,
- interval: o.interval,
- path: o.path,
- prepareid: o.prepareid,
- station: o.station,
- time: o.time,
- type: o.type,
- windturbine: o.windturbine,
- name: o.path.substring(
- o.path.indexOf(o.station + "_") + (o.station + "_").length
- ),
- };
- });
- } else {
- excelList.value = [];
- }
- };
- /**table 开始 */
- const tableShowId = ref("");
- const tableName = ref("");
- const tableColumn = ref([]);
- const tableLoading = ref(false);
- const tableData = ref([]);
- /**tab */
- const activeTab = ref("1");
- /**chart Data */
- const xAxisData = ref([]);
- const chartRef = ref(); //chart 的ref
- const seriesData = ref([]);
- const dataSet = ref("");
- const funChartSelect = async (batch) => {
- return false;
- };
- const createMark = (markInfo) => {
- activeTab.value = "2";
- chartRef.value.initChart(markInfo);
- };
- /**submit */
- const funSubmit = async (params) => {
- activeTab.value = "2";
- tableShowId.value = "";
- tableName.value = "AGC曲线分析";
- tableLoading.value = true;
- const res = await httpRequest.get("/agc/deviate", {
- params: params,
- });
- // const res = agcJson
- tableColumn.value = [
- {
- prop: "ts",
- label: "时间",
- width: 100,
- },
- {
- prop: "ygsdxz",
- label: "有功设定限值",
- width: 80,
- },
- {
- prop: "sfyg",
- label: "实发有功",
- width: 80,
- },
- {
- prop: "llgl",
- label: "理论功率",
- width: 80,
- },
- {
- prop: "pcsx",
- label: "偏差上限",
- width: 80,
- },
- {
- prop: "pcxx",
- label: "偏差下限",
- width: 100,
- },
- ];
- const tableArr = [];
- const tsArr = [];
- const ygsdxz = [];
- const sfyg = [];
- const llgl = [];
- const pcsx = [];
- const pcxx = [];
- res["有功设定限值"].values.map((o, index) => {
- tsArr.push(dayjs(o.ts).format("YYYY-MM-DD HH:mm:ss"));
- ygsdxz.push(Number(o.value).toFixed(2));
- if (res["实发有功"].values.length > 0) {
- sfyg.push(Number(res["实发有功"].values[index].value).toFixed(2));
- }
- if (res["理论功率"].values.length > 0) {
- llgl.push(Number(res["理论功率"].values[index].value).toFixed(2));
- }
- if (res["偏差上限"].values.length > 0) {
- pcsx.push(Number(res["偏差上限"].values[index].value).toFixed(2));
- }
- if (res["偏差下限"].values.length > 0) {
- pcxx.push(Number(res["偏差下限"].values[index].value).toFixed(2));
- }
- tableArr.push({
- ts: dayjs(o.ts).format("YYYY-MM-DD HH:mm:ss"),
- ygsdxz: Number(o.value).toFixed(2),
- sfyg:
- res["实发有功"].values.length > 0
- ? Number(res["实发有功"].values[index].value).toFixed(2)
- : "-",
- llgl:
- res["理论功率"].values.length > 0
- ? Number(res["理论功率"].values[index].value).toFixed(2)
- : "-",
- pcsx:
- res["偏差上限"].values.length > 0
- ? Number(res["偏差上限"].values[index].value).toFixed(2)
- : "-",
- pcxx:
- res["偏差下限"].values.length > 0
- ? Number(res["偏差下限"].values[index].value).toFixed(2)
- : "-",
- });
- });
- xAxisData.value = tableArr.map((o) => o.ts);
- seriesData.value = [
- {
- name: "有功设定限值",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: ygsdxz,
- xAxisIndex: 0,
- lineStyle: { color: "#67c23a" },
- large: true,
- },
- {
- name: "实发有功",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: sfyg,
- xAxisIndex: 0,
- lineStyle: { color: "rgb(242.5, 208.5, 157.5)" },
- large: true,
- markPoint: {
- symbolSize: 36,
- itemStyle: {
- color: "#f60", // 特殊颜色
- },
- emphasis: {
- itemStyle: {
- color: "#fff",
- },
- },
- blur: {
- itemStyle: {
- opacity: 1,
- },
- },
- data: [],
- },
- },
- {
- name: "理论功率",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: llgl,
- xAxisIndex: 0,
- lineStyle: { color: "#f56c6c" },
- large: true,
- },
- {
- name: "偏差上限",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: pcsx,
- xAxisIndex: 0,
- lineStyle: { color: "#64b5f6", opacity: 0 },
- symbol: "none",
- large: true,
- },
- {
- name: "偏差下限",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: pcxx,
- xAxisIndex: 0,
- lineStyle: { color: "#ffb74d", opacity: 0 },
- symbol: "none",
- large: true,
- },
- ];
- tableData.value = tableArr;
- tableLoading.value = false;
- tableShowId.value = "1";
- let abnormalPointTemp = [];
- seriesData.value[1].data.forEach((ele, index) => {
- if (parseFloat(ele) > parseFloat(seriesData.value[3].data[index])) {
- abnormalPointTemp.push({
- date: tsArr[index],
- value: parseFloat(ele),
- jud: seriesData.value[3].data[index],
- res: "高于上限",
- color: "#f25656",
- icon: "Top",
- dataIndex: index,
- });
- } else if (parseFloat(ele) < parseFloat(seriesData.value[4].data[index])) {
- abnormalPointTemp.push({
- date: tsArr[index],
- value: parseFloat(ele),
- jud: seriesData.value[4].data[index],
- res: "低于下限",
- color: "#1890ff",
- icon: "Bottom",
- dataIndex: index,
- });
- }
- });
- abnormalPoint.value = abnormalPointTemp;
- // if (res.code === 200) {
- // if(res.data.sjgl?.length){
- // for(const wtObj of res.data.sjgl){
- // seriesData.value.push(
- // {
- // name: wtObj.obj.windturbine + "\n实际功率",
- // type: "line",
- // symbol: "line", //设定为实心点
- // symbolSize: 0, //设定实心点的大小
- // smooth: true, //这个是把线变成曲线
- // data: wtObj.sjgl || [],
- // xAxisIndex: 0,
- // },
- // )
- // wtData.value.push(wtObj.obj)
- // }
- // }
- // }
- };
- /**created */
- // funGetTree()
- const theme = ref(null);
- const echartsTheme = ref("");
- const store = useStore();
- watch(
- () => store.state.theme,
- (newVal, oldVal) => {
- theme.value = newVal;
- echartsTheme.value = !newVal ? "dark" : "";
- // funSubmit();
- },
- {
- deep: true,
- }
- );
- const abnormalPoint = ref([]);
- const initPageData = () => {
- activeTab.value = "2";
- tableShowId.value = "";
- tableName.value = "AGC曲线分析";
- tableLoading.value = true;
- const res = JSON.parse(JSON.stringify(jsonData.deviateData));
- // const res = agcJson
- tableColumn.value = [
- {
- prop: "ts",
- label: "时间",
- width: 100,
- },
- {
- prop: "ygsdxz",
- label: "有功设定限值",
- width: 80,
- },
- {
- prop: "sfyg",
- label: "实发有功",
- width: 80,
- },
- {
- prop: "llgl",
- label: "理论功率",
- width: 80,
- },
- {
- prop: "pcsx",
- label: "偏差上限",
- width: 80,
- },
- {
- prop: "pcxx",
- label: "偏差下限",
- width: 100,
- },
- ];
- const tableArr = [];
- const tsArr = [];
- const ygsdxz = [];
- const sfyg = [];
- const llgl = [];
- const pcsx = [];
- const pcxx = [];
- res["有功设定限值"].values.map((o, index) => {
- tsArr.push(dayjs(o.ts).format("YYYY-MM-DD HH:mm:ss"));
- ygsdxz.push(Number(o.value).toFixed(2));
- if (res["实发有功"].values.length > 0) {
- sfyg.push(Number(res["实发有功"].values[index].value).toFixed(2));
- }
- if (res["理论功率"].values.length > 0) {
- llgl.push(Number(res["理论功率"].values[index].value).toFixed(2));
- }
- if (res["偏差上限"].values.length > 0) {
- pcsx.push(Number(res["偏差上限"].values[index].value).toFixed(2));
- }
- if (res["偏差下限"].values.length > 0) {
- pcxx.push(Number(res["偏差下限"].values[index].value).toFixed(2));
- }
- tableArr.push({
- ts: dayjs(o.ts).format("YYYY-MM-DD HH:mm:ss"),
- ygsdxz: Number(o.value).toFixed(2),
- sfyg:
- res["实发有功"].values.length > 0
- ? Number(res["实发有功"].values[index].value).toFixed(2)
- : "-",
- llgl:
- res["理论功率"].values.length > 0
- ? Number(res["理论功率"].values[index].value).toFixed(2)
- : "-",
- pcsx:
- res["偏差上限"].values.length > 0
- ? Number(res["偏差上限"].values[index].value).toFixed(2)
- : "-",
- pcxx:
- res["偏差下限"].values.length > 0
- ? Number(res["偏差下限"].values[index].value).toFixed(2)
- : "-",
- });
- });
- xAxisData.value = tableArr.map((o) => o.ts);
- seriesData.value = [
- {
- name: "有功设定限值",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: ygsdxz,
- xAxisIndex: 0,
- lineStyle: { color: "#67c23a" },
- large: true,
- },
- {
- name: "实发有功",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: sfyg,
- xAxisIndex: 0,
- lineStyle: { color: "rgb(242.5, 208.5, 157.5)" },
- large: true,
- markPoint: {
- symbolSize: 36,
- itemStyle: {
- color: "#f60", // 特殊颜色
- },
- emphasis: {
- itemStyle: {
- color: "#fff",
- },
- },
- blur: {
- itemStyle: {
- opacity: 1,
- },
- },
- data: [],
- },
- },
- {
- name: "理论功率",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: llgl,
- xAxisIndex: 0,
- lineStyle: { color: "#f56c6c" },
- large: true,
- },
- {
- name: "偏差上限",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: pcsx,
- xAxisIndex: 0,
- lineStyle: { color: "#64b5f6", opacity: 0 },
- symbol: "none",
- large: true,
- },
- {
- name: "偏差下限",
- type: "line",
- symbol: "line", //设定为实心点
- symbolSize: 0, //设定实心点的大小
- smooth: false, //这个是把线变成曲线
- data: pcxx,
- xAxisIndex: 0,
- lineStyle: { color: "#ffb74d", opacity: 0 },
- symbol: "none",
- large: true,
- },
- ];
- tableData.value = tableArr;
- tableLoading.value = false;
- tableShowId.value = "1";
- let abnormalPointTemp = [];
- seriesData.value[1].data.forEach((ele, index) => {
- if (parseFloat(ele) > parseFloat(seriesData.value[3].data[index])) {
- abnormalPointTemp.push({
- date: tsArr[index],
- value: parseFloat(ele),
- jud: seriesData.value[3].data[index],
- res: "高于上限",
- color: "#f25656",
- icon: "Top",
- dataIndex: index,
- });
- } else if (parseFloat(ele) < parseFloat(seriesData.value[4].data[index])) {
- abnormalPointTemp.push({
- date: tsArr[index],
- value: parseFloat(ele),
- jud: seriesData.value[4].data[index],
- res: "低于下限",
- color: "#1890ff",
- icon: "Bottom",
- dataIndex: index,
- });
- }
- });
- abnormalPoint.value = abnormalPointTemp;
- };
- /**mounted */
- onMounted(() => {
- initPageData();
- // funSubmit();
- theme.value = store.state.theme;
- echartsTheme.value = !theme.value ? "dark" : "";
- tableWidth.value = window.innerWidth - 200 + "px";
- tableHeight.value = window.innerHeight - 170 - paginationHeight.value + "px";
- excelHeight.value = window.innerHeight - 170 + "px";
- treeHeight.value = window.innerHeight - 170 + "px";
- window.addEventListener("resize", () => {
- tableWidth.value = window.innerWidth - 200 + "px";
- tableHeight.value =
- window.innerHeight - 170 - paginationHeight.value + "px";
- excelHeight.value = window.innerHeight - 170 + "px";
- treeHeight.value = window.innerHeight - 170 + "px";
- });
- });
- /**activated */
- onActivated(() => {
- // funGetTree()
- // funSubmit()
- });
- </script>
- <style lang="less" scoped>
- .dataAnalysisAgcAna {
- height: 100%;
- .dataAnalysisAgcAnaMain {
- height: 100%;
- .main_top {
- height: 40px;
- display: flex;
- align-items: center;
- .topPsty {
- position: relative;
- top: 5px;
- padding: 7px 20px;
- font-size: 12px;
- font-weight: 600;
- margin-left: 10px;
- border-radius: 3px;
- }
- .seach {
- padding: 20px 0 0 20px;
- }
- }
- .main {
- display: flex;
- justify-content: space-between;
- // width: calc(100% - 40px);
- width: 100%;
- .tableDataMain {
- padding: 10px;
- border-radius: 10px;
- width: calc(100% - 20px);
- position: relative;
- .el-tabs__content,
- .el-tab-pane {
- width: 100%;
- }
- .butten_com {
- position: absolute;
- right: 20px;
- z-index: 111111;
- }
- }
- }
- }
- }
- .themeDark {
- .dataAnalysisAgcAnaMain {
- .main_top {
- .topPsty {
- color: #1c99ff;
- background: #1e2126;
- }
- }
- .main {
- background: #13171e;
- .treeDataMain {
- background: transparent;
- }
- .excelDataMain {
- background: #313233;
- }
- .tableDataMain {
- margin-top: 5px;
- background: #212223;
- }
- }
- }
- }
- .themeLight {
- padding: 0;
- .dataAnalysisAgcAnaMain {
- .main_top {
- .topPsty {
- color: #2778ff;
- background: #ffffff;
- }
- }
- .main {
- background: #e6e8f2;
- .treeDataMain {
- background: transparent;
- }
- .excelDataMain {
- background: #f4f6fb;
- }
- .tableDataMain {
- background: #fff;
- margin-top: 5px;
- }
- }
- }
- }
- </style>
|