소스 검색

月度工分汇总-样式优化

wanglt 3 달 전
부모
커밋
86e05ad3e4

+ 51 - 4
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtUserScoreController.java

@@ -8,7 +8,10 @@ import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
 
 import com.github.pagehelper.util.StringUtil;
+import com.ygtx.common.constant.HttpStatus;
 import com.ygtx.common.core.domain.entity.SysDept;
+import com.ygtx.common.core.page.PageDomain;
+import com.ygtx.common.core.page.TableSupport;
 import com.ygtx.gxt.domain.*;
 import com.ygtx.gxt.domain.GxtUserScoreSubmissionDTO;
 import com.ygtx.gxt.service.*;
@@ -156,13 +159,57 @@ public class GxtUserScoreController extends BaseController
     }
 
     @GetMapping("/getWorkOrderByMonth")
-    public AjaxResult getWorkOrderByMonth(GxtWorkOrder workOrder) {
-        return success(gxtMonthScoreService.getWorkOrderByMonth(workOrder.getModel(),workOrder.getInspectionType(),workOrder.getPcsStationPid(),workOrder.getMonthPeriod()));
+    public TableDataInfo getWorkOrderByMonth(GxtWorkOrder workOrder) {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+        List<GxtWorkOrder> list = gxtMonthScoreService.getWorkOrderByMonth(workOrder.getModel(),workOrder.getInspectionType(),workOrder.getPcsStationPid(),workOrder.getMonthPeriod());
+        List<GxtWorkOrder> result = new ArrayList<>();
+        int total = list.size();
+        if (pageNum!=null&&pageSize!=null) {
+            if (pageNum!=null && pageSize!=null) {
+                int from = (pageNum-1) * pageSize;
+                int to = pageNum * pageSize;
+                if (to>=total) {
+                    result.addAll(list.subList(from,total));
+                }else {
+                    result.addAll(list.subList(from, to));
+                }
+            }
+        }
+        TableDataInfo dataInfo = new TableDataInfo();
+        dataInfo.setCode(HttpStatus.SUCCESS);
+        dataInfo.setMsg("查询成功");
+        dataInfo.setTotal(total);
+        dataInfo.setRows(result);
+        return dataInfo;
     }
 
     @GetMapping("/getRepairOrderByMonth")
-    public AjaxResult getRepairOrderByMonth(GxtRepairOrder repairOrder) {
-        return success(gxtMonthScoreService.getRepairOrderByMonth(repairOrder.getMaintenanceType(),repairOrder.getPcsStationPid(),repairOrder.getMonthPeriod()));
+    public TableDataInfo getRepairOrderByMonth(GxtRepairOrder repairOrder) {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+        List<GxtRepairOrder> list = gxtMonthScoreService.getRepairOrderByMonth(repairOrder.getMaintenanceType(),repairOrder.getPcsStationPid(),repairOrder.getMonthPeriod());
+        List<GxtRepairOrder> result = new ArrayList<>();
+        int total = list.size();
+        if (pageNum!=null&&pageSize!=null) {
+            if (pageNum!=null && pageSize!=null) {
+                int from = (pageNum-1) * pageSize;
+                int to = pageNum * pageSize;
+                if (to>=total) {
+                    result.addAll(list.subList(from,total));
+                }else {
+                    result.addAll(list.subList(from, to));
+                }
+            }
+        }
+        TableDataInfo dataInfo = new TableDataInfo();
+        dataInfo.setCode(HttpStatus.SUCCESS);
+        dataInfo.setMsg("查询成功");
+        dataInfo.setTotal(total);
+        dataInfo.setRows(result);
+        return dataInfo;
     }
 
     @ApiOperation("根据ID获取月度工分汇总")

+ 108 - 38
ygtx-ui/src/views/gxt/monthScore/index.vue

@@ -113,6 +113,13 @@
               <el-table-column prop="realStartTime" label="停机时间"></el-table-column>
               <el-table-column prop="restartTime" label="恢复运行时间"></el-table-column>
             </el-table>
+            <pagination style="margin-top: 20px;"
+              v-show="wbtotal>0"
+              :total="wbtotal"
+              v-model:page="wbqueryParams.pageNum"
+              v-model:limit="wbqueryParams.pageSize"
+              @pagination="handlePaginationwb"
+            />
           </div>
         </el-card>
       </el-col>
@@ -151,6 +158,13 @@
               <el-table-column prop="occurTime" label="停机时间"></el-table-column>
               <el-table-column prop="restartTime" label="恢复运行时间"></el-table-column>
             </el-table>
+            <pagination style="margin-top: 20px;"
+              v-show="wxtotal>0"
+              :total="wxtotal"
+              v-model:page="wxqueryParams.pageNum"
+              v-model:limit="wxqueryParams.pageSize"
+              @pagination="handlePaginationwx"
+            />
           </div>
         </el-card>
       </el-col>
@@ -249,6 +263,23 @@ export default {
         deptName: null,
         parentName: null,
         monthPeriod: null
+      },
+      wbtotal: 0,
+      wbqueryParams: {
+        pageNum: 1,
+        pageSize: 5,
+        model: null,
+        inspectionType: null,
+        pcsStationPid: null,
+        monthPeriod: null
+      },
+      wxtotal: 0,
+      wxqueryParams: {
+        pageNum: 1,
+        pageSize: 5,
+        maintenanceType: null,
+        pcsStationPid: null,
+        monthPeriod: null
       }
     }
   },
@@ -399,10 +430,22 @@ export default {
           }
 
           if (monthScoreGet.workOrderList) {
-            this.workOrderList = monthScoreGet.workOrderList;
+            const wbSize = monthScoreGet.workOrderList.length;
+            this.wbtotal = wbSize;
+            if (this.wbqueryParams.pageSize>=wbSize) {
+              this.workOrderList = monthScoreGet.workOrderList;
+            }else{
+              this.workOrderList = monthScoreGet.workOrderList.slice(0, this.wbqueryParams.pageSize);
+            }
             if (monthScoreGet.monthFanInspections && monthScoreGet.monthFanInspections.length>0) {
+              const firstItem = monthScoreGet.monthFanInspections[0];
+              this.wbqueryParams.pageNum = 1;
+              this.wbqueryParams.model = firstItem.model;
+              this.wbqueryParams.inspectionType = firstItem.inspectionType;
+              this.wbqueryParams.pcsStationPid = this.monthScore.deptId;
+              this.wbqueryParams.monthPeriod = this.selectedMonth;
               this.currentSelectedModel = monthScoreGet.monthFanInspections[0].model;
-              this.currentSelectedInspectionType = this.getInspectionTypeLabel(monthScoreGet.monthFanInspections[0].inspectionTypeId);
+              this.currentSelectedInspectionType = this.getInspectionTypeLabel(firstItem.inspectionTypeId);
               // 默认选中第一行
               this.currentRowIndex = 0;
             }else{
@@ -423,9 +466,20 @@ export default {
           }
 
           if (monthScoreGet.repairOrderList) {
-            this.repairOrderList = monthScoreGet.repairOrderList;
+            const wxSize = monthScoreGet.repairOrderList.length;
+            this.wxtotal = wxSize;
+            if (this.wxqueryParams.pageSize>=wxSize) {
+              this.repairOrderList = monthScoreGet.repairOrderList;
+            }else{
+              this.repairOrderList = monthScoreGet.repairOrderList.slice(0, this.wxqueryParams.pageSize);
+            }
             if (monthScoreGet.monthRepairProjects && monthScoreGet.monthRepairProjects.length>0) {
-              this.currentSelectedRepairType = this.getMaintenanceTypeLabel(monthScoreGet.monthRepairProjects[0].maintenanceType);
+              const firstItem = monthScoreGet.monthRepairProjects[0];
+              this.wxqueryParams.pageNum = 1;
+              this.wxqueryParams.maintenanceType = firstItem.maintenanceType;
+              this.wxqueryParams.pcsStationPid = this.monthScore.deptId;
+              this.wxqueryParams.monthPeriod = this.selectedMonth;
+              this.currentSelectedRepairType = this.getMaintenanceTypeLabel(firstItem.maintenanceType);
               // 默认选中维修工单统计表格的第一行
               this.currentRepairRowIndex = 0;
             }else{
@@ -550,25 +604,14 @@ export default {
       this.currentSelectedInspectionType = row.inspectionType;
       
       // 构造请求参数
-      const params = {
-        model: row.model,
-        inspectionType: this.getInspectionTypeValue(row.inspectionType), // 需要将显示文本转换为实际值
-        pcsStationPid: this.monthScore.deptId, // 使用当前页面的部门ID
-        monthPeriod: this.selectedMonth // 使用当前选中的月份
-      };
+      this.wbqueryParams.pageNum = 1;
+      this.wbqueryParams.model = row.model;
+      this.wbqueryParams.inspectionType = this.getInspectionTypeValue(row.inspectionType);
+      this.wbqueryParams.pcsStationPid = this.monthScore.deptId;
+      this.wbqueryParams.monthPeriod = this.selectedMonth;
       
       // 调用后端接口
-      getWorkOrderByMonth(params).then(response => {
-        if (response.code === 200) {
-          // 将返回结果赋值给workOrderList
-          this.workOrderList = response.data || [];
-        } else {
-          this.$message.error('获取维保工单数据失败:' + response.msg);
-        }
-      }).catch(error => {
-        console.error('获取维保工单数据异常:', error);
-        this.$message.error('获取维保工单数据异常');
-      });
+      this.queryWbList();
     },
     
     // 处理维修工单统计表格行点击事件
@@ -582,24 +625,13 @@ export default {
       this.currentSelectedRepairType = row.repairType;
       
       // 构造请求参数
-      const params = {
-        maintenanceType: this.getMaintenanceTypeValue(row.repairType), // 需要将显示文本转换为实际值
-        pcsStationPid: this.monthScore.deptId, // 使用当前页面的部门ID
-        monthPeriod: this.selectedMonth // 使用当前选中的月份
-      };
+      this.wxqueryParams.pageNum = 1;
+      this.wxqueryParams.maintenanceType = this.getMaintenanceTypeValue(row.repairType);
+      this.wxqueryParams.pcsStationPid = this.monthScore.deptId;
+      this.wxqueryParams.monthPeriod = this.selectedMonth;
       
       // 调用后端接口
-      getRepairOrderByMonth(params).then(response => {
-        if (response.code === 200) {
-          // 将返回结果赋值给repairOrderList
-          this.repairOrderList = response.data || [];
-        } else {
-          this.$message.error('获取维修工单数据失败:' + response.msg);
-        }
-      }).catch(error => {
-        console.error('获取维修工单数据异常:', error);
-        this.$message.error('获取维修工单数据异常');
-      });
+      this.queryWxList();
     },
     
     // 根据显示标签获取字典值(维修类型)
@@ -654,7 +686,45 @@ export default {
       } else {
         return '#000000'; // 黑色
       }
-    }
+    },
+
+    queryWbList() {
+      getWorkOrderByMonth(this.wbqueryParams).then(response => {
+        if (response.code === 200) {
+          // 将返回结果赋值给workOrderList
+          this.workOrderList = response.rows || [];
+          this.wbtotal = response.total;
+        } else {
+          this.$message.error('获取维保工单数据失败:' + response.msg);
+        }
+      }).catch(error => {
+        console.error('获取维保工单数据异常:', error);
+        this.$message.error('获取维保工单数据异常');
+      });
+    },
+
+    queryWxList() {
+      getRepairOrderByMonth(this.wxqueryParams).then(response => {
+        if (response.code === 200) {
+          // 将返回结果赋值给repairOrderList
+          this.repairOrderList = response.rows || [];
+          this.wxtotal = response.total;
+        } else {
+          this.$message.error('获取维修工单数据失败:' + response.msg);
+        }
+      }).catch(error => {
+        console.error('获取维修工单数据异常:', error);
+        this.$message.error('获取维修工单数据异常');
+      });
+    },
+
+    
+    handlePaginationwb() {
+      this.queryWbList();
+    },
+    handlePaginationwx() {
+      this.queryWxList();
+    },
   }
 }
 </script>

+ 110 - 40
ygtx-ui/src/views/gxt/monthScore/info.vue

@@ -48,6 +48,13 @@
               <el-table-column prop="realStartTime" label="停机时间"></el-table-column>
               <el-table-column prop="restartTime" label="恢复运行时间"></el-table-column>
             </el-table>
+            <pagination style="margin-top: 20px;"
+              v-show="wbtotal>0"
+              :total="wbtotal"
+              v-model:page="wbqueryParams.pageNum"
+              v-model:limit="wbqueryParams.pageSize"
+              @pagination="handlePaginationwb"
+            />
           </div>
         </el-card>
       </el-col>
@@ -87,6 +94,13 @@
               <el-table-column prop="occurTime" label="停机时间"></el-table-column>
               <el-table-column prop="restartTime" label="恢复运行时间"></el-table-column>
             </el-table>
+            <pagination style="margin-top: 20px;"
+              v-show="wxtotal>0"
+              :total="wxtotal"
+              v-model:page="wxqueryParams.pageNum"
+              v-model:limit="wxqueryParams.pageSize"
+              @pagination="handlePaginationwx"
+            />
           </div>
         </el-card>
       </el-col>
@@ -178,7 +192,24 @@ export default {
       repairOrderList: [],
       // 用户筛选相关
       userFilterText: '',
-      originalUserScoreList: []
+      originalUserScoreList: [],
+      wbtotal: 0,
+      wbqueryParams: {
+        pageNum: 1,
+        pageSize: 5,
+        model: null,
+        inspectionType: null,
+        pcsStationPid: null,
+        monthPeriod: null
+      },
+      wxtotal: 0,
+      wxqueryParams: {
+        pageNum: 1,
+        pageSize: 5,
+        maintenanceType: null,
+        pcsStationPid: null,
+        monthPeriod: null
+      }
     }
   },
   created() {
@@ -286,10 +317,22 @@ export default {
           }
 
           if (monthScoreGet.workOrderList) {
-            this.workOrderList = monthScoreGet.workOrderList;
+            const wbSize = monthScoreGet.workOrderList.length;
+            this.wbtotal = wbSize;
+            if (this.wbqueryParams.pageSize>=wbSize) {
+              this.workOrderList = monthScoreGet.workOrderList;
+            }else{
+              this.workOrderList = monthScoreGet.workOrderList.slice(0, this.wbqueryParams.pageSize);
+            }
             if (monthScoreGet.monthFanInspections && monthScoreGet.monthFanInspections.length>0) {
-              this.currentSelectedModel = monthScoreGet.monthFanInspections[0].model;
-              this.currentSelectedInspectionType = this.getInspectionTypeLabel(monthScoreGet.monthFanInspections[0].inspectionTypeId);
+              const firstItem = monthScoreGet.monthFanInspections[0];
+              this.wbqueryParams.pageNum = 1;
+              this.wbqueryParams.model = firstItem.model;
+              this.wbqueryParams.inspectionType = firstItem.inspectionType;
+              this.wbqueryParams.pcsStationPid = this.monthScore.deptId;
+              this.wbqueryParams.monthPeriod = this.selectedMonth;
+              this.currentSelectedModel = firstItem.model;
+              this.currentSelectedInspectionType = this.getInspectionTypeLabel(firstItem.inspectionTypeId);
               // 默认选中第一行
               this.currentRowIndex = 0;
             }else{
@@ -310,9 +353,20 @@ export default {
           }
 
           if (monthScoreGet.repairOrderList) {
-            this.repairOrderList = monthScoreGet.repairOrderList;
+            const wxSize = monthScoreGet.repairOrderList.length;
+            this.wxtotal = wxSize;
+            if (this.wxqueryParams.pageSize>=wxSize) {
+              this.repairOrderList = monthScoreGet.repairOrderList;
+            }else{
+              this.repairOrderList = monthScoreGet.repairOrderList.slice(0, this.wxqueryParams.pageSize);
+            }
             if (monthScoreGet.monthRepairProjects && monthScoreGet.monthRepairProjects.length>0) {
-              this.currentSelectedRepairType = this.getMaintenanceTypeLabel(monthScoreGet.monthRepairProjects[0].maintenanceType);
+              const firstItem = monthScoreGet.monthRepairProjects[0];
+              this.wxqueryParams.pageNum = 1;
+              this.wxqueryParams.maintenanceType = firstItem.maintenanceType;
+              this.wxqueryParams.pcsStationPid = this.monthScore.deptId;
+              this.wxqueryParams.monthPeriod = this.selectedMonth;
+              this.currentSelectedRepairType = this.getMaintenanceTypeLabel(firstItem.maintenanceType);
               // 默认选中维修工单统计表格的第一行
               this.currentRepairRowIndex = 0;
             }else{
@@ -406,25 +460,14 @@ export default {
       this.currentSelectedInspectionType = row.inspectionType;
       
       // 构造请求参数
-      const params = {
-        model: row.model,
-        inspectionType: this.getInspectionTypeValue(row.inspectionType), // 需要将显示文本转换为实际值
-        pcsStationPid: this.monthScore.deptId, // 使用当前页面的部门ID
-        monthPeriod: this.selectedMonth // 使用当前选中的月份
-      };
+      this.wbqueryParams.pageNum = 1;
+      this.wbqueryParams.model = row.model;
+      this.wbqueryParams.inspectionType = this.getInspectionTypeValue(row.inspectionType);
+      this.wbqueryParams.pcsStationPid = this.monthScore.deptId;
+      this.wbqueryParams.monthPeriod = this.selectedMonth;
       
       // 调用后端接口
-      getWorkOrderByMonth(params).then(response => {
-        if (response.code === 200) {
-          // 将返回结果赋值给workOrderList
-          this.workOrderList = response.data || [];
-        } else {
-          this.$message.error('获取维保工单数据失败:' + response.msg);
-        }
-      }).catch(error => {
-        console.error('获取维保工单数据异常:', error);
-        this.$message.error('获取维保工单数据异常');
-      });
+      this.queryWbList();
     },
     
     // 根据显示标签获取字典值
@@ -463,24 +506,13 @@ export default {
       this.currentSelectedRepairType = row.repairType;
       
       // 构造请求参数
-      const params = {
-        maintenanceType: this.getMaintenanceTypeValue(row.repairType), // 需要将显示文本转换为实际值
-        pcsStationPid: this.monthScore.deptId, // 使用当前页面的部门ID
-        monthPeriod: this.selectedMonth // 使用当前选中的月份
-      };
+      this.wxqueryParams.pageNum = 1;
+      this.wxqueryParams.maintenanceType = this.getMaintenanceTypeValue(row.repairType);
+      this.wxqueryParams.pcsStationPid = this.monthScore.deptId;
+      this.wxqueryParams.monthPeriod = this.selectedMonth;
       
       // 调用后端接口
-      getRepairOrderByMonth(params).then(response => {
-        if (response.code === 200) {
-          // 将返回结果赋值给repairOrderList
-          this.repairOrderList = response.data || [];
-        } else {
-          this.$message.error('获取维修工单数据失败:' + response.msg);
-        }
-      }).catch(error => {
-        console.error('获取维修工单数据异常:', error);
-        this.$message.error('获取维修工单数据异常');
-      });
+      this.queryWxList();
     },
     
     // 处理工单编号点击事件
@@ -527,7 +559,45 @@ export default {
       } else {
         return '#000000'; // 黑色
       }
-    }
+    },
+
+    queryWbList() {
+      getWorkOrderByMonth(this.wbqueryParams).then(response => {
+        if (response.code === 200) {
+          // 将返回结果赋值给workOrderList
+          this.workOrderList = response.rows || [];
+          this.wbtotal = response.total;
+        } else {
+          this.$message.error('获取维保工单数据失败:' + response.msg);
+        }
+      }).catch(error => {
+        console.error('获取维保工单数据异常:', error);
+        this.$message.error('获取维保工单数据异常');
+      });
+    },
+
+    queryWxList() {
+      getRepairOrderByMonth(this.wxqueryParams).then(response => {
+        if (response.code === 200) {
+          // 将返回结果赋值给repairOrderList
+          this.repairOrderList = response.rows || [];
+          this.wxtotal = response.total;
+        } else {
+          this.$message.error('获取维修工单数据失败:' + response.msg);
+        }
+      }).catch(error => {
+        console.error('获取维修工单数据异常:', error);
+        this.$message.error('获取维修工单数据异常');
+      });
+    },
+
+    
+    handlePaginationwb() {
+      this.queryWbList();
+    },
+    handlePaginationwx() {
+      this.queryWxList();
+    },
   }
 }
 </script>