From d30e385951ce03335a5023f0775fd144da3c0b88 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 18 三月 2025 11:18:31 +0800
Subject: [PATCH] 修改

---
 src/main/java/com/example/client/service/Level3ManageService.java |   60 ++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/example/client/service/Level3ManageService.java b/src/main/java/com/example/client/service/Level3ManageService.java
index ac2ab59..b4c719c 100644
--- a/src/main/java/com/example/client/service/Level3ManageService.java
+++ b/src/main/java/com/example/client/service/Level3ManageService.java
@@ -4,6 +4,7 @@
 import com.example.client.dto.JComboBoxItem;
 import com.example.client.model.TableButton;
 import com.example.client.utils.CommonTable;
+import com.example.client.utils.Compute;
 import com.example.client.utils.GBC;
 import com.example.client.utils.MultiSelectComboBox;
 import com.example.server.cabin.service.CabinService;
@@ -57,6 +58,7 @@
 
     public JPanel createTable(Integer width, Integer height, JFrame jFrame) {
         JPanel panel = new JPanel();
+        panel.setPreferredSize(new Dimension(width,height));
 
         JPanel topJpanel = new JPanel();
         GridBagLayout layout = new GridBagLayout();
@@ -65,7 +67,7 @@
         topJpanel.setBackground(Color.WHITE);
 
         JPanel centerJpanel = new JPanel();
-        centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100));
+        centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(100,jFrame)));
         centerJpanel.setBackground(Color.WHITE);
         panel.add(topJpanel, BorderLayout.NORTH);
         panel.add(centerJpanel, BorderLayout.CENTER);
@@ -75,7 +77,7 @@
         JComboBoxItem[] cabinList = cabinService.getList();
         JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList();
         String[] typeList = new String[]{
-                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�"
+                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�",""
         };
 
         JLabel JLabel0 = new JLabel("宸ョ▼");
@@ -130,20 +132,20 @@
 
         columnDto = new ArrayList<>();
         //columnDto.add(new ColumnDto("ID", "id", -1, null,false));
-        columnDto.add(new ColumnDto("搴忓彿", "", (width - 10) / 10, "autoCreate", false, null, null));
-        columnDto.add(new ColumnDto("宸ョ▼", "ProjectName", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("閮ㄩ棬", "deptId", (width - 10) / 10, "dict", false, null, deptList));
-        columnDto.add(new ColumnDto("涓撲笟", "teamgroupId", (width - 10) / 10, "dict", false, null, teamList));
-        columnDto.add(new ColumnDto("鑸卞", "cabinId", (width - 10) / 10, "dict", false, null, cabinList));
-        columnDto.add(new ColumnDto("绫诲埆", "type", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("涓�绾х綉缁滃浘鑺傜偣鍚嶇О", "level1NodeName", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("浜岀骇缃戠粶鍥捐妭鐐瑰悕绉�", "level2NodeName", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("涓夌骇缃戠粶鍥惧悕绉�", "name", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("鎿嶄綔", "", (width - 10) / 10, "", true, buttonList, null));
+        columnDto.add(new ColumnDto("搴忓彿", "", 176, "autoCreate", false, null, null));
+        //columnDto.add(new ColumnDto("宸ョ▼", "ProjectName", 150, null, false, null, null));
+        columnDto.add(new ColumnDto("閮ㄩ棬", "deptId", 176, "dict", false, null, deptList));
+        columnDto.add(new ColumnDto("涓撲笟", "teamgroupId", 176, "dict", false, null, teamList));
+        columnDto.add(new ColumnDto("鑸卞", "cabinId", 176, "dict", false, null, cabinList));
+        columnDto.add(new ColumnDto("绫诲埆", "type", 176, null, false, null, null));
+        columnDto.add(new ColumnDto("涓�绾х綉缁滃浘鑺傜偣鍚嶇О", "level1NodeName", 176, null, false, null, null));
+        columnDto.add(new ColumnDto("浜岀骇缃戠粶鍥捐妭鐐瑰悕绉�", "level2NodeName", 185, null, false, null, null));
+        columnDto.add(new ColumnDto("涓夌骇缃戠粶鍥惧悕绉�", "name", 176, null, false, null, null));
+        columnDto.add(new ColumnDto("鎿嶄綔", "", 190, "", true, buttonList, null));
 
         table = CommonTable.createCommonTable(list, columnDto);
         table.setRowHeight(25);
-        table.setAutoCreateRowSorter(true);
+
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
 
         comboBox.addItemListener(new ItemListener() {
@@ -159,7 +161,7 @@
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -170,11 +172,10 @@
                 if (e.getStateChange() == ItemEvent.SELECTED) {
                     JComboBoxItem selectedItem = (JComboBoxItem) comboBox1.getSelectedItem();
                     if (selectedItem != null) {
-                        long selectedId = selectedItem.getId();
+                        Long selectedId = selectedItem.getId();
 
                         JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId);
                         comboBox2.setModel(new DefaultComboBoxModel<>(teamList));
-                        comboBox2.setSelectedIndex(0);
 
                         String content = comboBox.getSelectedItem().toString();
                         JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
@@ -186,7 +187,7 @@
                         list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
                         CommonTable.refreshTable(list, columnDto, table);
                         table.setRowHeight(25);
-                        table.setAutoCreateRowSorter(true);
+
                         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
 
                         tableModelListener(list, table, jFrame);
@@ -208,7 +209,7 @@
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -226,7 +227,7 @@
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -244,7 +245,7 @@
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -257,7 +258,7 @@
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -288,8 +289,19 @@
         JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
         scrollPane.setViewportView(table);
         scrollPane.getViewport().setBackground(Color.WHITE);
-        scrollPane.setPreferredSize(new Dimension(width - 20, height - 120));
+        scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(100,jFrame)));
         centerJpanel.add(scrollPane);
+        jFrame.addComponentListener(new ComponentAdapter() {
+            @Override
+            public void componentResized(ComponentEvent e) {
+                centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(100,jFrame)));
+                scrollPane.setPreferredSize(new Dimension(width - 20,Compute.ComputeHeightWithScroll(100,jFrame)));
+                centerJpanel.revalidate();
+                centerJpanel.repaint();
+                scrollPane.revalidate();
+                scrollPane.repaint();
+            }
+        });
 
         return panel;
     }
@@ -316,7 +328,7 @@
         JComboBoxItem[] cabinList = cabinService.getList();
         JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null);
         String[] typeList = new String[]{
-                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�"
+                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�",""
         };
 
         JLabel JLabel1 = new JLabel("宸ョ▼");
@@ -454,7 +466,7 @@
             list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null);
             CommonTable.refreshTable(list, columnDto, table);
             table.setRowHeight(25);
-            table.setAutoCreateRowSorter(true);
+
             table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
             tableModelListener(list, table, jFrame);
             frame1.dispose();

--
Gitblit v1.9.1