From 24f9ec55af2b803ecbbe0b13494b5740ead74052 Mon Sep 17 00:00:00 2001 From: zch Date: Thu, 28 Nov 2024 10:46:03 +0800 Subject: [PATCH] =?UTF-8?q?change(views):=20=EF=BC=88=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=EF=BC=8C=E5=90=8E=E7=AB=AF=E4=BB=A5?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=EF=BC=89=E6=B7=BB=E5=8A=A0=E6=A0=91=E7=8A=B6?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E6=95=B0=E6=8D=AE=E6=8E=92=E5=BA=8F=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在多个组件中添加了 sortByPrefixOrder 函数,用于对树状结构数据进行排序(冗余,暂时不需要,注释掉) - 根据客户提供的特定顺序对数据进行分组和排序 --- .../record/recordLatestSteamInstant/index.vue | 29 +++++++++++++ .../ems/record/recordSteamInstant/index.vue | 31 ++++++++++++++ .../ems/report/currentSteamCurve/index.vue | 10 +++++ .../ems/report/pointSteamCurve/index.vue | 42 +++++++++++++++++++ .../ems/report/reportPointSteam/index.vue | 34 +++++++++++++++ 5 files changed, 146 insertions(+) diff --git a/src/views/ems/record/recordLatestSteamInstant/index.vue b/src/views/ems/record/recordLatestSteamInstant/index.vue index c80978a..c351a7d 100644 --- a/src/views/ems/record/recordLatestSteamInstant/index.vue +++ b/src/views/ems/record/recordLatestSteamInstant/index.vue @@ -493,4 +493,33 @@ export default { } } } + + +/*function sortByPrefixOrder(data, order) { + // 将数据按前缀分组 + const groupedData = {}; + data.forEach(item => { + const prefix = item.code.split('_')[0]; + if (!groupedData[prefix]) { + groupedData[prefix] = []; + } + groupedData[prefix].push(item); + }); + + // 按照特定顺序排序 + const sortedData = []; + order.forEach(prefix => { + if (groupedData[prefix]) { + sortedData.push(...groupedData[prefix]); + } + }); + // 处理不在特定顺序中的数据 + data.forEach(item => { + if (!sortedData.includes(item)) { + sortedData.push(item); + } + }); + + return sortedData; +}*/ diff --git a/src/views/ems/record/recordSteamInstant/index.vue b/src/views/ems/record/recordSteamInstant/index.vue index 7cca1ff..da031a6 100644 --- a/src/views/ems/record/recordSteamInstant/index.vue +++ b/src/views/ems/record/recordSteamInstant/index.vue @@ -514,4 +514,35 @@ export default { } } } +/* + +function sortByPrefixOrder(data, order) { + // 将数据按前缀分组 + const groupedData = {}; + data.forEach(item => { + const prefix = item.code.split('_')[0]; + if (!groupedData[prefix]) { + groupedData[prefix] = []; + } + groupedData[prefix].push(item); + }); + + // 按照特定顺序排序 + const sortedData = []; + order.forEach(prefix => { + if (groupedData[prefix]) { + sortedData.push(...groupedData[prefix]); + } + }); + // 处理不在特定顺序中的数据 + data.forEach(item => { + if (!sortedData.includes(item)) { + sortedData.push(item); + } + }); + + return sortedData; +} +*/ + diff --git a/src/views/ems/report/currentSteamCurve/index.vue b/src/views/ems/report/currentSteamCurve/index.vue index 08b1653..7795a68 100644 --- a/src/views/ems/report/currentSteamCurve/index.vue +++ b/src/views/ems/report/currentSteamCurve/index.vue @@ -88,6 +88,16 @@ export default { //左侧树结构List monitorInfoOptions: [], workUnitName: undefined, + +/* + //树状结构按照客户给定顺序排序 + monitorInfoOptionsData: [], + specificOrder: ["赛轮沈阳","公用橡胶","三像","维航","维", + "米其林高压","米其林低压","米其林","橡胶四厂", + "三聚凯特","世源","联盛","正兴","天峰药业","中科北方","沃得","管理中心","沈阳经济技术升发区管理委员会办","科创","博泰","亿纬","普利司通" + ], // 客户提供的特定顺序 +*/ + //左侧树结构 检索设备名称 selectMonitorName: null, //计量设备信息 diff --git a/src/views/ems/report/pointSteamCurve/index.vue b/src/views/ems/report/pointSteamCurve/index.vue index 2aa5c48..593c5a8 100644 --- a/src/views/ems/report/pointSteamCurve/index.vue +++ b/src/views/ems/report/pointSteamCurve/index.vue @@ -87,6 +87,16 @@ export default { //左侧树结构List monitorInfoOptions: [], workUnitName: undefined, + +/* + //树状结构按照客户给定顺序排序 + monitorInfoOptionsData: [], + specificOrder: ["赛轮沈阳","公用橡胶","三像","维航","维", + "米其林高压","米其林低压","米其林","橡胶四厂", + "三聚凯特","世源","联盛","正兴","天峰药业","中科北方","沃得","管理中心","沈阳经济技术升发区管理委员会办","科创","博泰","亿纬","普利司通" + ], // 客户提供的特定顺序 +*/ + //左侧树结构 检索设备名称 selectMonitorName: null, //计量设备信息 @@ -651,6 +661,38 @@ export default { } } } +/* +function sortByPrefixOrder(data, order) { + // 将数据按前缀分组 + const groupedData = {}; + data.forEach(item => { + const prefix = item.code ? item.code.split('_')[0] : ''; // 确保没有 code 时也能处理 + if (!groupedData[prefix]) { + groupedData[prefix] = []; + } + groupedData[prefix].push(item); + }); + + // 按照特定顺序排序 + const sortedData = []; + order.forEach(prefix => { + if (groupedData[prefix]) { + sortedData.push(...groupedData[prefix]); + } + }); + + // 处理不在特定顺序中的数据 + data.forEach(item => { + if (!sortedData.includes(item)) { + sortedData.push(item); + } + }); + + return sortedData; +} +*/ + +