From 66f0597bf6a1e79540c6bc51dedf561c22f3bdb5 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 13 五月 2025 17:49:26 +0800
Subject: [PATCH] 修改

---
 src/main/java/com/example/client/service/Level3ManageService.java |  111 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 87 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 fdf9ad3..f74e8db 100644
--- a/src/main/java/com/example/client/service/Level3ManageService.java
+++ b/src/main/java/com/example/client/service/Level3ManageService.java
@@ -16,6 +16,7 @@
 
 import javax.swing.*;
 import javax.swing.event.TableModelEvent;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
 import javax.swing.table.DefaultTableModel;
 import java.awt.*;
 import java.awt.event.*;
@@ -75,7 +76,7 @@
         JComboBoxItem[] cabinList = cabinService.getList();
         JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList();
         String[] typeList = new String[]{
-                "","鏀硅", "鍔犺", "鎹㈣", "淇悊","鏀硅繘鎬т慨鐞�"
+                "","鏀规崲瑁�","淇悊","鏀硅繘鎬т慨鐞�","涓嶅瑁呰澶�"
         };
         JComboBoxItem[] isealCabin = {
                 new JComboBoxItem(10000L, ""),
@@ -109,6 +110,10 @@
         JComboBox<JComboBoxItem> comboBox5 = new JComboBox<>(isealCabin);
         comboBox5.setPreferredSize(new Dimension(185, 28));
 
+        JLabel JLabel6 = new JLabel("鏄惁鑱旇皟");
+        JComboBox<JComboBoxItem> comboBox6 = new JComboBox<>(isealCabin);
+        comboBox6.setPreferredSize(new Dimension(185, 28));
+
         JTextField sb = new JTextField(16);
         JButton query = new JButton("鏌ヨ");
 
@@ -128,12 +133,14 @@
 
         topJpanel.add(JLabel5, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
         topJpanel.add(comboBox5, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
-        topJpanel.add(sb, new GBC(2, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
-        topJpanel.add(query, new GBC(4, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
-        topJpanel.add(btnInsert, new GBC(5, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
-        topJpanel.add(btnImport, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(JLabel6, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(comboBox6, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(btnInsert, new GBC(7, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(btnImport, new GBC(8, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()), null);
+        list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()),Math.toIntExact(isealCabin[0].getId()), null);
         List<TableButton> buttonList = new ArrayList<>();
         buttonList.add(new TableButton("edit", "缂栬緫"));
         buttonList.add(new TableButton("del", "鍒犻櫎"));
@@ -141,16 +148,17 @@
 
         columnDto = new ArrayList<>();
         //columnDto.add(new ColumnDto("ID", "id", -1, null,false));
-        columnDto.add(new ColumnDto("搴忓彿", "", 100, "autoCreate", false, null, null));
+        columnDto.add(new ColumnDto("搴忓彿", "", 80, "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", 100, "dict", false, null, cabinList));
+        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", 80, "dict", false, null, cabinList));
         columnDto.add(new ColumnDto("绫诲埆", "type", 120, null, false, null, null));
         columnDto.add(new ColumnDto("涓�绾х綉缁滃浘鑺傜偣鍚嶇О", "level1NodeName", 185, 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("鏄惁褰卞搷灏佽埍", "isealCabin", 176, "dict", false, null, isealCabin));
+        columnDto.add(new ColumnDto("鏄惁褰卞搷灏佽埍", "isealCabin", 160, "dict", false, null, isealCabin));
+        columnDto.add(new ColumnDto("鏄惁鑱旇皟", "islt", 100, "dict", false, null, isealCabin));
         columnDto.add(new ColumnDto("鎿嶄綔", "", 190, "", true, buttonList, null));
 
         table = CommonTable.createCommonTable(list, columnDto);
@@ -171,9 +179,10 @@
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
                 JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
@@ -199,9 +208,10 @@
                         JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
                         JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                         String type = comboBox4.getSelectedItem().toString();
+                        JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                         Long shipId = shipMap.get(content);
-                        list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null);
+                        list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
                         CommonTable.refreshTable(list, columnDto, table);
                         table.setRowHeight(25);
 
@@ -222,8 +232,10 @@
                 JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
 
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
+
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
@@ -240,9 +252,10 @@
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
                 JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
@@ -259,9 +272,10 @@
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
                 JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
@@ -280,8 +294,31 @@
                 JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
 
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
+
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
+
+                CommonTable.refreshTable(list, columnDto, table);
+                table.setRowHeight(25);
+
+                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+                tableModelListener(list, table, jFrame);
+            }
+        });
+        comboBox6.addItemListener(new ItemListener() {
+            public void itemStateChanged(final ItemEvent event) {
+                String content = comboBox.getSelectedItem().toString();
+                JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
+                JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
+                JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
+                String type = comboBox4.getSelectedItem().toString();
+
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
+
+                Long shipId = shipMap.get(content);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
@@ -295,7 +332,7 @@
         query.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                list = level3Service.getList(null, null, null, null, null,null, sb.getText());
+                list = level3Service.getList(null, null, null, null, null,null,null, sb.getText());
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
@@ -346,7 +383,7 @@
 
     public void insert(JFrame jFrame,DjJdgzNetworkLevel3 data) {
         JFrame frame1 = new JFrame("鏂板涓夌骇缃戠粶鍥�");
-        frame1.setSize(500, 460);
+        frame1.setSize(500, 500);
         frame1.setResizable(true);
         frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         frame1.setLocationRelativeTo(null);
@@ -366,7 +403,7 @@
         JComboBoxItem[] cabinList = cabinService.getList();
         JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null);
         String[] typeList = new String[]{
-                "","鏀硅", "鍔犺", "鎹㈣", "淇悊","鏀硅繘鎬т慨鐞�"
+                "","鏀规崲瑁�","淇悊","鏀硅繘鎬т慨鐞�","涓嶅瑁呰澶�"
         };
         JComboBoxItem[] isealCabin = {
                 new JComboBoxItem(0L, "鍚�"),
@@ -392,6 +429,20 @@
 
         JLabel JLabel3 = new JLabel("浜岀骇缃戠粶鍥捐妭鐐�");
         JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>();
+        comboBox2.setRenderer(new BasicComboBoxRenderer() {
+            @Override
+            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+                super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+
+                // 璁剧疆宸ュ叿鎻愮ず
+                if (value != null) {
+                    setText(value.toString());
+                    setToolTipText(value.toString()); // 璁剧疆宸ュ叿鎻愮ず涓哄畬鏁寸殑閫夐」鏂囨湰
+                }
+
+                return this;
+            }
+        });
         comboBox2.setPreferredSize(new Dimension(185, 28));
         if (data.getLevel2NodeId()!=null){
             JComboBoxItem[] level2NodeList = level2ListService.getNode(data.getLevel2NetworkId());
@@ -448,6 +499,13 @@
         comboBox7.setPreferredSize(new Dimension(185, 28));
         if (data.getIsealCabin()!=null){
             comboBox7.setSelectedItem(BoxIteUtils.GetSelectItemById(isealCabin, Long.valueOf(data.getIsealCabin())));
+        }
+
+        JLabel JLabel789 = new JLabel("鏄惁鑱旇皟");
+        JComboBox<JComboBoxItem> comboBox78 = new JComboBox<>(isealCabin);
+        comboBox78.setPreferredSize(new Dimension(185, 28));
+        if (data.getIslt()!=null){
+            comboBox78.setSelectedItem(BoxIteUtils.GetSelectItemById(isealCabin, Long.valueOf(data.getIslt())));
         }
 
         JLabel JLabel8 = new JLabel("涓夌骇缃戠粶鍥惧悕绉�");
@@ -526,11 +584,14 @@
         frame1.add(comboBox6, new GBC(1, 6, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
         frame1.add(JLabel78, new GBC(0, 7, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
         frame1.add(comboBox7, new GBC(1, 7, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        frame1.add(JLabel789, new GBC(0, 8, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        frame1.add(comboBox78, new GBC(1, 8, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        frame1.add(JLabel8, new GBC(0, 8, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
-        frame1.add(level3Name, new GBC(1, 8, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        frame1.add(btnSave, new GBC(0, 9, 2, 1).setWeight(1, 0));
+        frame1.add(JLabel8, new GBC(0, 9, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        frame1.add(level3Name, new GBC(1, 9, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
+        frame1.add(btnSave, new GBC(0, 10, 2, 1).setWeight(1, 0));
 
         btnSave.addActionListener((e) -> {
             JComboBoxItem level1 = (JComboBoxItem) comboBox0.getSelectedItem();
@@ -539,6 +600,7 @@
             JComboBoxItem dept = (JComboBoxItem) comboBox3.getSelectedItem();
             JComboBoxItem team = (JComboBoxItem) comboBox4.getSelectedItem();
             JComboBoxItem isealCabinItem = (JComboBoxItem) comboBox7.getSelectedItem();
+            JComboBoxItem iltItem = (JComboBoxItem) comboBox78.getSelectedItem();
             Set<JComboBoxItem> selectedItems = comboBox5.getSelectedItems();
             StringBuilder selectedIds = new StringBuilder();
             for (JComboBoxItem item : selectedItems) {
@@ -551,6 +613,7 @@
             data.setLevel2NodeId(level2Node.getId());
             data.setName(name);
             data.setIsealCabin(Math.toIntExact(isealCabinItem.getId()));
+            data.setIslt(Math.toIntExact(iltItem.getId()));
             data.setDeptId(dept.getId());
             data.setTeamgroupId(team.getId());
             data.setTeamgroupName(team.getName());
@@ -562,7 +625,7 @@
                 level3Service.insert(data);
             }
 
-            list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()), null);
+            list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()),Math.toIntExact(isealCabin[0].getId()), null);
             CommonTable.refreshTable(list, columnDto, table);
             table.setRowHeight(25);
 

--
Gitblit v1.9.1