From 4badcfcc036009ab7db3b9fc3ecc9d21a6b9eb6b Mon Sep 17 00:00:00 2001 From: fengrong Date: Tue, 3 Dec 2024 11:03:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A3=8E=E9=80=9F=E5=8A=9F?= =?UTF-8?q?=E7=8E=87=E7=B3=BB=E6=95=B0=E7=BB=B4=E6=8A=A4=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/backend/powerCurvefactor/index.vue | 117 ++++++++---------- 1 file changed, 53 insertions(+), 64 deletions(-) diff --git a/ui/dasadmin/src/views/backend/powerCurvefactor/index.vue b/ui/dasadmin/src/views/backend/powerCurvefactor/index.vue index 63289552..69ebf072 100644 --- a/ui/dasadmin/src/views/backend/powerCurvefactor/index.vue +++ b/ui/dasadmin/src/views/backend/powerCurvefactor/index.vue @@ -17,18 +17,18 @@ :row-key="getRowKey" :span-method="objectSpanMethod" class="tablePart"> - + - +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -101,8 +55,10 @@ import {powerCurveQuery,powerImport,powerExport} from "/@/api/backend/powerCurve import { ElMessage } from 'element-plus' import { encrypt_aes, generateRandomNumber } from '/@/utils/crypto' import type { TableColumnCtx } from 'element-plus' +import { dataMethods } from './utils' -/*interface User { + +interface User { id:string, turbineId:string, name:string, @@ -110,7 +66,9 @@ import type { TableColumnCtx } from 'element-plus' speedMin:string, speedMax:string, factorK:string, - factorB:string + factorB:string, + NameIndex:string, + count:number } interface SpanMethodProps { @@ -119,27 +77,55 @@ interface SpanMethodProps { rowIndex: number columnIndex: number } -const objectSpanMethod = ({ - row, - column, - rowIndex, - columnIndex, - }: SpanMethodProps) => { + +const objectSpanMethod = ({row, column, rowIndex, columnIndex,}: SpanMethodProps) => { if (columnIndex === 0) { - if (rowIndex % 2 === 0) { + if (rowIndex % 7 === 0) { + return { + rowspan: 7, + colspan: 1, + }; + } else { + return { + rowspan: 0, + colspan: 0, + }; + } + } + + /*if (columnIndex === 0) { + if (rowIndex % row.count === 0) { return { - rowspan: 2, + rowspan: row.count, colspan: 1, - } + }; } else { return { rowspan: 0, colspan: 0, - } + }; } - } -}*/ + }*/ +} const tableData=ref([]) +let obj = {} +const formatData = (list) => { +debugger + list.forEach(item => { + let count = list.filter(listItem => listItem.name === item.name).length + if (obj[item.name] ) { + obj[item.name]++ + + } else { + obj[item.name] = 1 + } + item.NameIndex = obj[item.name] + + item.count = count + }) + tableData.value = list +} + const formQuery = reactive({ pageSize: 20, @@ -152,6 +138,7 @@ const currentPage = ref(1) const currentPageSize = ref(20) const handleSizeChange = (val: number) => { formQuery.pageSize = val + //formQuery.pageNum = 1 getTableData(formQuery) } const handleCurrentChange = (val: number) => { @@ -163,7 +150,7 @@ const getTableData = (formQuery) => { powerCurveQuery(formQuery).then((res: any) => { if (res.code == 200) { pageTotal.value = res.data.total - tableData.value = (res.data.rows || []).map((item: { speedMin?: number | string; speedMax?: number | string }) => { + tableData.value = res.data.rows.map((item: { speedMin?: number | string; speedMax?: number | string }) => { const speedMin = item.speedMin ?? ''; const speedMax = item.speedMax ?? ''; if(speedMax==''){ @@ -179,6 +166,7 @@ const getTableData = (formQuery) => { } }); + // formatData(tableData.value) } else { ElMessage.error(res.msg) } @@ -256,6 +244,7 @@ const Export = () => { document.body.removeChild(a) }) } + onMounted(() => { getTableData(formQuery) })