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/DismantTrackService.java |   68 +++++++++++++++++++++------------
 1 files changed, 43 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/example/client/service/DismantTrackService.java b/src/main/java/com/example/client/service/DismantTrackService.java
index 730b9f8..d0d0fbd 100644
--- a/src/main/java/com/example/client/service/DismantTrackService.java
+++ b/src/main/java/com/example/client/service/DismantTrackService.java
@@ -3,6 +3,7 @@
 import com.example.client.dto.ColumnDto;
 import com.example.client.dto.JComboBoxItem;
 import com.example.client.utils.CommonTable;
+import com.example.client.utils.Compute;
 import com.example.client.utils.GBC;
 import com.example.server.cabin.service.CabinService;
 import com.example.server.progressTrack.model.DjJdgzNetworkLevel3;
@@ -43,9 +44,13 @@
         JPanel jLeft = new JPanel(new BorderLayout());
 
         JPanel top = new JPanel();
+        JPanel center = new JPanel();
 
-        jLeft.setPreferredSize(new Dimension(600, height));
         top.setPreferredSize(new Dimension(600, 100));
+        center.setPreferredSize(new Dimension(600, Compute.ComputeHeight(100,frame)));
+        jLeft.setPreferredSize(new Dimension(600, Compute.ComputeHeight(0,frame)));
+        jLeft.add(center, BorderLayout.CENTER);
+        jLeft.add(top, BorderLayout.NORTH);
 
         GridBagLayout layout = new GridBagLayout();
         top.setLayout(layout);
@@ -57,7 +62,7 @@
         JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null);
         JComboBoxItem[] cabinList = cabinService.getList();
         String[] typeList = new String[]{
-                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�"
+                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�", ""
         };
         List<DjJdgzShip> shipList = djJdgzShipService.getList();
         Map<String, Long> shipMap = new HashMap<>();
@@ -107,21 +112,19 @@
         top.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
         top.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        jLeft.add(top, BorderLayout.NORTH);
-
         List<ColumnDto> columnDto = new ArrayList<>();
-        list = level3Service.getList(null, deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null);
+        list = level3Service.getList(null, deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], null);
 
         columnDto.add(new ColumnDto("搴忓彿", "", 60, "autoCreate", false, null, null));
-        columnDto.add(new ColumnDto("璁惧鍚嶇О", "name", 112, null, false, null, null));
-        columnDto.add(new ColumnDto("閮ㄩ棬", "deptId", 100, "dict", false, null, deptList));
-        columnDto.add(new ColumnDto("涓撲笟", "teamgroupId", 100, "dict", false, null, teamList));
+        columnDto.add(new ColumnDto("璁惧鍚嶇О", "name", 200, null, false, null, null));
+        columnDto.add(new ColumnDto("閮ㄩ棬", "deptId", 150, "dict", false, null, deptList));
+        columnDto.add(new ColumnDto("涓撲笟", "teamgroupId", 150, "dict", false, null, teamList));
         columnDto.add(new ColumnDto("鑸卞", "cabinId", 100, "dict", false, null, cabinList));
         columnDto.add(new ColumnDto("绫诲埆", "type", 100, null, false, null, null));
 
         JTable subTable = CommonTable.createCommonTable(list, columnDto);
         subTable.setRowHeight(25);
-        subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+        subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
 
         comboBox.addItemListener(new ItemListener() {
             public void itemStateChanged(final ItemEvent event) {
@@ -132,11 +135,11 @@
                 String type = comboBox4.getSelectedItem().toString();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null);
 
                 CommonTable.refreshTable(list, columnDto, subTable);
                 subTable.setRowHeight(25);
-                subTable.setAutoCreateRowSorter(true);
+
                 subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 subTable.addMouseListener(new MouseAdapter() {
                     public void mouseClicked(MouseEvent e) {
@@ -171,11 +174,11 @@
                         String type = comboBox4.getSelectedItem().toString();
 
                         Long shipId = shipMap.get(content);
-                        list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                        list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null);
 
                         CommonTable.refreshTable(list, columnDto, subTable);
                         subTable.setRowHeight(25);
-                        subTable.setAutoCreateRowSorter(true);
+
                         subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                         subTable.addMouseListener(new MouseAdapter() {
                             public void mouseClicked(MouseEvent e) {
@@ -201,11 +204,11 @@
                 String type = comboBox4.getSelectedItem().toString();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null);
 
                 CommonTable.refreshTable(list, columnDto, subTable);
                 subTable.setRowHeight(25);
-                subTable.setAutoCreateRowSorter(true);
+
                 subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 subTable.addMouseListener(new MouseAdapter() {
                     public void mouseClicked(MouseEvent e) {
@@ -229,11 +232,11 @@
                 String type = comboBox4.getSelectedItem().toString();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null);
 
                 CommonTable.refreshTable(list, columnDto, subTable);
                 subTable.setRowHeight(25);
-                subTable.setAutoCreateRowSorter(true);
+
                 subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 subTable.addMouseListener(new MouseAdapter() {
                     public void mouseClicked(MouseEvent e) {
@@ -257,11 +260,11 @@
                 String type = comboBox4.getSelectedItem().toString();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null);
 
                 CommonTable.refreshTable(list, columnDto, subTable);
                 subTable.setRowHeight(25);
-                subTable.setAutoCreateRowSorter(true);
+
                 subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 subTable.addMouseListener(new MouseAdapter() {
                     public void mouseClicked(MouseEvent e) {
@@ -280,11 +283,11 @@
         query.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                list = level3Service.getList(null, null, null, null, null,sb.getText());
+                list = level3Service.getList(null, null, null, null, null, sb.getText());
 
                 CommonTable.refreshTable(list, columnDto, subTable);
                 subTable.setRowHeight(25);
-                subTable.setAutoCreateRowSorter(true);
+
                 subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 subTable.addMouseListener(new MouseAdapter() {
                     public void mouseClicked(MouseEvent e) {
@@ -300,11 +303,26 @@
             }
         });
 
-        JScrollPane scrollTable = new JScrollPane(subTable);
-        jLeft.add(scrollTable, BorderLayout.CENTER);
+        JScrollPane scrollTable = new JScrollPane(subTable,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+        scrollTable.setViewportView(subTable);
+        scrollTable.setPreferredSize(new Dimension(600,Compute.ComputeHeightWithScroll(100,frame)));
+        center.add(scrollTable);
+        frame.addComponentListener(new ComponentAdapter() {
+            @Override
+            public void componentResized(ComponentEvent e) {
+                center.setPreferredSize(new Dimension(600, Compute.ComputeHeight(100,frame)));
+                jLeft.setPreferredSize(new Dimension(600, Compute.ComputeHeight(0,frame)));
+                scrollTable.setPreferredSize(new Dimension(600,Compute.ComputeHeightWithScroll(100,frame)));
+                jLeft.revalidate();
+                jLeft.repaint();
+                center.revalidate();
+                center.repaint();
+                scrollTable.revalidate();
+                scrollTable.repaint();
+            }
+        });
 
-        JPanel track = addOrUpdate.createTrack(width - 620, height, list.get(0),frame);
-
+        JPanel track = addOrUpdate.createTrack(width - 620, height, list.get(0), frame);
 
         // 鍒涘缓姘村钩鍒嗗壊闈㈡澘
         JSplitPane hSplitPane = new JSplitPane(

--
Gitblit v1.9.1