Browse Source

调整停机页面

wukai 3 weeks ago
parent
commit
187aceee0b

+ 54 - 11
src/views/calc/calcStop/ddStop.vue

@@ -82,7 +82,31 @@
       </el-col>
     </el-row>
 
-    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange">
+    <!-- 高标准差设备提醒 -->
+    <el-card class="statistic-card" v-if="highStdDevDevices.length > 0">
+      <div class="group-analysis">
+        <el-alert
+          :title="`以下 ${highStdDevDevices.length} 台设备标准差超过0.5,请及时检修:${highStdDevDevices.map(d => d.deviceId).join('、')}`"
+          type="warning"
+          show-icon
+          :closable="false"
+        />
+      </div>
+    </el-card>
+    
+    <!-- 正常情况提示 -->
+    <el-card class="statistic-card" v-else>
+      <div class="group-analysis">
+        <el-alert
+          title="所有设备标准差均在正常范围(≤0.5)内,设备运行状态良好。"
+          type="success"
+          show-icon
+          :closable="false"
+        />
+      </div>
+    </el-card>
+
+    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange" :default-sort="{prop: 'stdDev', order: 'descending'}">
       <el-table-column type="selection" width="55" align="center"/>
       <!--      <el-table-column label="ID" align="center" prop="id" />-->
       <el-table-column label="机台号" align="center" prop="deviceId"/>
@@ -92,7 +116,7 @@
           {{ (scope.row.slope).toFixed(2) }}
         </template>
       </el-table-column>
-      <el-table-column label="标准差" align="center" prop="stdDev">
+      <el-table-column label="标准差" align="center" prop="stdDev" sortable>
         <template #default="scope">
           {{ (scope.row.stdDev).toFixed(2) }}
         </template>
@@ -129,7 +153,7 @@
 
 <script setup name="CalcStop">
 import {gzStop} from "@/api/calc/calcStop";
-import {getCurrentInstance, nextTick, reactive, ref, toRefs} from 'vue';
+import {getCurrentInstance, nextTick, reactive, ref, toRefs, watch} from 'vue';
 import * as echarts from 'echarts';
 
 const {proxy} = getCurrentInstance();
@@ -137,7 +161,7 @@ const {proxy} = getCurrentInstance();
 const calcStopList = ref([]);
 const filteredData = ref([]);
 const open = ref(false);
-const chartOpen = ref(false);  // 添加图表弹窗状态
+const chartOpen = ref(false);
 const loading = ref(true);
 const showSearch = ref(true);
 const ids = ref([]);
@@ -145,15 +169,16 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 const title = ref("");
-const currentRow = ref({});  // 添加当前行数据
+const currentRow = ref({});
 const chartRef = ref(null);
-const statistics = ref(null); // 添加统计数据
-const trendChartRef = ref(null); // 趋势图容器引用
-const deviceChartRef = ref(null); // 设备统计图容器引用
-const monthList = ref([]); // 专门用于存储月度数据
+const statistics = ref(null);
+const highStdDevDevices = ref([]); // 存储高标准差设备
+const trendChartRef = ref(null);
+const deviceChartRef = ref(null);
+const monthList = ref([]);
 let chartInstance = null;
-let trendChartInstance = null; // 趋势图实例
-let deviceChartInstance = null; // 设备统计图实例
+let trendChartInstance = null;
+let deviceChartInstance = null;
 
 // 计算默认日期(当前时间减去31小时)
 const getDefaultDate = () => {
@@ -223,6 +248,8 @@ function getList() {
       drawTrendChart();
       drawDeviceChart();
     });
+    // 查找高标准差设备
+    findHighStdDevDevices();
   });
 }
 
@@ -703,6 +730,22 @@ function closeChart() {
   }
 }
 
+// 查找高标准差设备
+function findHighStdDevDevices() {
+  if (!filteredData.value || !Array.isArray(filteredData.value)) {
+    highStdDevDevices.value = [];
+    return;
+  }
+
+  // 查找标准差超过0.5的设备
+  highStdDevDevices.value = filteredData.value.filter(item => item.stdDev > 0.5);
+}
+
+// 监听数据变化,查找高标准差设备
+watch(filteredData, () => {
+  findHighStdDevDevices();
+}, { deep: true });
+
 // 监听窗口大小变化,自动调整图表大小
 const handleResize = () => {
   if (trendChartInstance) {

+ 2 - 2
src/views/calc/calcStop/dsStop.vue

@@ -94,7 +94,7 @@
       </div>
     </el-card>
 
-    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange" :default-sort="{prop: 'stdDev', order: 'descending'}">
       <el-table-column type="selection" width="55" align="center"/>
       <!--      <el-table-column label="ID" align="center" prop="id" />-->
       <el-table-column label="机台号" align="center" prop="deviceId"/>
@@ -104,7 +104,7 @@
           {{ (scope.row.slope).toFixed(2) }}
         </template>
       </el-table-column>
-      <el-table-column label="标准差" align="center" prop="stdDev">
+      <el-table-column label="标准差" align="center" prop="stdDev" sortable>
         <template #default="scope">
           {{ (scope.row.stdDev).toFixed(2) }}
         </template>

+ 54 - 11
src/views/calc/calcStop/gzStop.vue

@@ -82,7 +82,31 @@
       </el-col>
     </el-row>
 
-    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange">
+    <!-- 高标准差设备提醒 -->
+    <el-card class="statistic-card" v-if="highStdDevDevices.length > 0">
+      <div class="group-analysis">
+        <el-alert
+          :title="`以下 ${highStdDevDevices.length} 台设备标准差超过0.5,请及时检修:${highStdDevDevices.map(d => d.deviceId).join('、')}`"
+          type="warning"
+          show-icon
+          :closable="false"
+        />
+      </div>
+    </el-card>
+    
+    <!-- 正常情况提示 -->
+    <el-card class="statistic-card" v-else>
+      <div class="group-analysis">
+        <el-alert
+          title="所有设备标准差均在正常范围(≤0.5)内,设备运行状态良好。"
+          type="success"
+          show-icon
+          :closable="false"
+        />
+      </div>
+    </el-card>
+
+    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange" :default-sort="{prop: 'stdDev', order: 'descending'}">
       <el-table-column type="selection" width="55" align="center"/>
       <!--      <el-table-column label="ID" align="center" prop="id" />-->
       <el-table-column label="机台号" align="center" prop="deviceId"/>
@@ -92,7 +116,7 @@
           {{ (scope.row.slope).toFixed(2) }}
         </template>
       </el-table-column>
-      <el-table-column label="标准差" align="center" prop="stdDev">
+      <el-table-column label="标准差" align="center" prop="stdDev" sortable>
         <template #default="scope">
           {{ (scope.row.stdDev).toFixed(2) }}
         </template>
@@ -129,7 +153,7 @@
 
 <script setup name="CalcStop">
 import {gzStop} from "@/api/calc/calcStop";
-import {getCurrentInstance, nextTick, reactive, ref, toRefs} from 'vue';
+import {getCurrentInstance, nextTick, reactive, ref, toRefs, watch} from 'vue';
 import * as echarts from 'echarts';
 
 const {proxy} = getCurrentInstance();
@@ -137,7 +161,7 @@ const {proxy} = getCurrentInstance();
 const calcStopList = ref([]);
 const filteredData = ref([]);
 const open = ref(false);
-const chartOpen = ref(false);  // 添加图表弹窗状态
+const chartOpen = ref(false);
 const loading = ref(true);
 const showSearch = ref(true);
 const ids = ref([]);
@@ -145,15 +169,16 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 const title = ref("");
-const currentRow = ref({});  // 添加当前行数据
+const currentRow = ref({});
 const chartRef = ref(null);
-const statistics = ref(null); // 添加统计数据
-const trendChartRef = ref(null); // 趋势图容器引用
-const deviceChartRef = ref(null); // 设备统计图容器引用
-const monthList = ref([]); // 专门用于存储月度数据
+const statistics = ref(null);
+const highStdDevDevices = ref([]); // 存储高标准差设备
+const trendChartRef = ref(null);
+const deviceChartRef = ref(null);
+const monthList = ref([]);
 let chartInstance = null;
-let trendChartInstance = null; // 趋势图实例
-let deviceChartInstance = null; // 设备统计图实例
+let trendChartInstance = null;
+let deviceChartInstance = null;
 
 // 计算默认日期(当前时间减去31小时)
 const getDefaultDate = () => {
@@ -223,6 +248,8 @@ function getList() {
       drawTrendChart();
       drawDeviceChart();
     });
+    // 查找高标准差设备
+    findHighStdDevDevices();
   });
 }
 
@@ -703,6 +730,22 @@ function closeChart() {
   }
 }
 
+// 查找高标准差设备
+function findHighStdDevDevices() {
+  if (!filteredData.value || !Array.isArray(filteredData.value)) {
+    highStdDevDevices.value = [];
+    return;
+  }
+
+  // 查找标准差超过0.5的设备
+  highStdDevDevices.value = filteredData.value.filter(item => item.stdDev > 0.5);
+}
+
+// 监听数据变化,查找高标准差设备
+watch(filteredData, () => {
+  findHighStdDevDevices();
+}, { deep: true });
+
 // 监听窗口大小变化,自动调整图表大小
 const handleResize = () => {
   if (trendChartInstance) {

+ 54 - 11
src/views/calc/calcStop/jtStop.vue

@@ -82,7 +82,31 @@
       </el-col>
     </el-row>
 
-    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange">
+    <!-- 高标准差设备提醒 -->
+    <el-card class="statistic-card" v-if="highStdDevDevices.length > 0">
+      <div class="group-analysis">
+        <el-alert
+          :title="`以下 ${highStdDevDevices.length} 台设备标准差超过0.5,请及时检修:${highStdDevDevices.map(d => d.deviceId).join('、')}`"
+          type="warning"
+          show-icon
+          :closable="false"
+        />
+      </div>
+    </el-card>
+    
+    <!-- 正常情况提示 -->
+    <el-card class="statistic-card" v-else>
+      <div class="group-analysis">
+        <el-alert
+          title="所有设备标准差均在正常范围(≤0.5)内,设备运行状态良好。"
+          type="success"
+          show-icon
+          :closable="false"
+        />
+      </div>
+    </el-card>
+
+    <el-table v-loading="loading" :data="filteredData" @selection-change="handleSelectionChange" :default-sort="{prop: 'stdDev', order: 'descending'}">
       <el-table-column type="selection" width="55" align="center"/>
       <!--      <el-table-column label="ID" align="center" prop="id" />-->
       <el-table-column label="机台号" align="center" prop="deviceId"/>
@@ -92,7 +116,7 @@
           {{ (scope.row.slope).toFixed(2) }}
         </template>
       </el-table-column>
-      <el-table-column label="标准差" align="center" prop="stdDev">
+      <el-table-column label="标准差" align="center" prop="stdDev" sortable>
         <template #default="scope">
           {{ (scope.row.stdDev).toFixed(2) }}
         </template>
@@ -129,7 +153,7 @@
 
 <script setup name="CalcStop">
 import {gzStop} from "@/api/calc/calcStop";
-import {getCurrentInstance, nextTick, reactive, ref, toRefs} from 'vue';
+import {getCurrentInstance, nextTick, reactive, ref, toRefs, watch} from 'vue';
 import * as echarts from 'echarts';
 
 const {proxy} = getCurrentInstance();
@@ -137,7 +161,7 @@ const {proxy} = getCurrentInstance();
 const calcStopList = ref([]);
 const filteredData = ref([]);
 const open = ref(false);
-const chartOpen = ref(false);  // 添加图表弹窗状态
+const chartOpen = ref(false);
 const loading = ref(true);
 const showSearch = ref(true);
 const ids = ref([]);
@@ -145,15 +169,16 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 const title = ref("");
-const currentRow = ref({});  // 添加当前行数据
+const currentRow = ref({});
 const chartRef = ref(null);
-const statistics = ref(null); // 添加统计数据
-const trendChartRef = ref(null); // 趋势图容器引用
-const deviceChartRef = ref(null); // 设备统计图容器引用
-const monthList = ref([]); // 专门用于存储月度数据
+const statistics = ref(null);
+const highStdDevDevices = ref([]); // 存储高标准差设备
+const trendChartRef = ref(null);
+const deviceChartRef = ref(null);
+const monthList = ref([]);
 let chartInstance = null;
-let trendChartInstance = null; // 趋势图实例
-let deviceChartInstance = null; // 设备统计图实例
+let trendChartInstance = null;
+let deviceChartInstance = null;
 
 // 计算默认日期(当前时间减去31小时)
 const getDefaultDate = () => {
@@ -223,6 +248,8 @@ function getList() {
       drawTrendChart();
       drawDeviceChart();
     });
+    // 查找高标准差设备
+    findHighStdDevDevices();
   });
 }
 
@@ -543,6 +570,17 @@ function calculateStatistics(data) {
   }
 }
 
+// 查找高标准差设备
+function findHighStdDevDevices() {
+  if (!filteredData.value || !Array.isArray(filteredData.value)) {
+    highStdDevDevices.value = [];
+    return;
+  }
+
+  // 查找标准差超过0.5的设备
+  highStdDevDevices.value = filteredData.value.filter(item => item.stdDev > 0.5);
+}
+
 // 机台号变化处理
 function handleDeviceIdChange() {
   filterData();
@@ -703,6 +741,11 @@ function closeChart() {
   }
 }
 
+// 监听数据变化,查找高标准差设备
+watch(filteredData, () => {
+  findHighStdDevDevices();
+}, { deep: true });
+
 // 监听窗口大小变化,自动调整图表大小
 const handleResize = () => {
   if (trendChartInstance) {