From f0aae4b39afbcbb18fb5a0b32e3ca689662c5ca7 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期一, 10 三月 2025 08:21:31 +0800 Subject: [PATCH] jar --- src/main/java/com/example/client/service/Level3ManageService.java | 210 +++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 175 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/example/client/service/Level3ManageService.java b/src/main/java/com/example/client/service/Level3ManageService.java index dd7bfb1..35e7d8c 100644 --- a/src/main/java/com/example/client/service/Level3ManageService.java +++ b/src/main/java/com/example/client/service/Level3ManageService.java @@ -58,9 +58,12 @@ public JPanel createTable(Integer width, Integer height, JFrame jFrame) { JPanel panel = new JPanel(); - JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - topJpanel.setPreferredSize(new Dimension(width, 37)); + JPanel topJpanel = new JPanel(); + GridBagLayout layout = new GridBagLayout(); + topJpanel.setLayout(layout); + topJpanel.setPreferredSize(new Dimension(width, 100)); topJpanel.setBackground(Color.WHITE); + JPanel centerJpanel = new JPanel(); centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); centerJpanel.setBackground(Color.WHITE); @@ -68,59 +71,195 @@ panel.add(centerJpanel, BorderLayout.CENTER); List<DjJdgzShip> shipList = djJdgzShipService.getList(); + JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); + JComboBoxItem[] cabinList = cabinService.getList(); + JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); + String[] typeList = new String[]{ + "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�","" + }; + + JLabel JLabel0 = new JLabel("宸ョ▼"); JComboBox comboBox = new JComboBox(); + comboBox.setPreferredSize(new Dimension(185, 28)); + + JLabel JLabel1 = new JLabel("閮ㄩ棬"); + JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList); + comboBox1.setPreferredSize(new Dimension(185, 28)); + + JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId()); + + JLabel JLabel2 = new JLabel("涓撲笟"); + JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(teamList1); + comboBox2.setPreferredSize(new Dimension(185, 28)); + + JLabel JLabel3 = new JLabel("鑸卞"); + JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(cabinList); + comboBox3.setPreferredSize(new Dimension(185, 28)); + + JLabel JLabel4 = new JLabel("绫诲埆"); + JComboBox<String> comboBox4 = new JComboBox<>(typeList); + comboBox4.setPreferredSize(new Dimension(185, 28)); + + JTextField sb = new JTextField(16); + JButton query = new JButton("鏌ヨ"); + JButton btnInsert = new JButton("鏂板"); JButton btnImport = new JButton("瀵煎叆"); - topJpanel.add(comboBox); - topJpanel.add(btnInsert); - topJpanel.add(btnImport); + topJpanel.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(comboBox, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); + topJpanel.add(JLabel1, new GBC(2, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(comboBox1, new GBC(3, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); + topJpanel.add(JLabel2, new GBC(4, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(comboBox2, new GBC(5, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); + topJpanel.add(JLabel3, new GBC(6, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(comboBox3, new GBC(7, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); + topJpanel.add(JLabel4, new GBC(8, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(comboBox4, new GBC(9, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); - comboBox.setPreferredSize(new Dimension(300, 28)); + topJpanel.add(sb, new GBC(0, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(query, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); + topJpanel.add(btnInsert, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); + topJpanel.add(btnImport, new GBC(4, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); - list = level3Service.getList(shipList.get(0).getId()); + list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); List<TableButton> buttonList = new ArrayList<>(); buttonList.add(new TableButton("edit", "缂栬緫")); buttonList.add(new TableButton("del", "鍒犻櫎")); - JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); - JComboBoxItem[] cabinList = cabinService.getList(); - JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); 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, "dicts", 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); - final Boolean[] isFirstLoadData = {true}; comboBox.addItemListener(new ItemListener() { public void itemStateChanged(final ItemEvent event) { String content = comboBox.getSelectedItem().toString(); - Long shipId = shipMap.get(content); - list = level3Service.getList(shipId); - if (!isFirstLoadData[0]) { - CommonTable.refreshTable(list, columnDto, table); - table.setRowHeight(25); - table.setAutoCreateRowSorter(true); - table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); + JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); + JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); + String type = comboBox4.getSelectedItem().toString(); - tableModelListener(list, table, jFrame); - } else { - isFirstLoadData[0] = false; + Long shipId = shipMap.get(content); + list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); + + CommonTable.refreshTable(list, columnDto, table); + table.setRowHeight(25); + + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + tableModelListener(list, table, jFrame); + } + }); + comboBox1.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + JComboBoxItem selectedItem = (JComboBoxItem) comboBox1.getSelectedItem(); + if (selectedItem != null) { + 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(); + JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); + JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); + String type = comboBox4.getSelectedItem().toString(); + + Long shipId = shipMap.get(content); + list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); + CommonTable.refreshTable(list, columnDto, table); + table.setRowHeight(25); + + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + + tableModelListener(list, table, jFrame); + } } + } + }); + + comboBox2.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(); + String type = comboBox4.getSelectedItem().toString(); + + Long shipId = shipMap.get(content); + list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); + + CommonTable.refreshTable(list, columnDto, table); + table.setRowHeight(25); + + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + tableModelListener(list, table, jFrame); + } + }); + comboBox3.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(); + String type = comboBox4.getSelectedItem().toString(); + + Long shipId = shipMap.get(content); + list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); + + CommonTable.refreshTable(list, columnDto, table); + table.setRowHeight(25); + + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + tableModelListener(list, table, jFrame); + } + }); + comboBox4.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(); + String type = comboBox4.getSelectedItem().toString(); + + Long shipId = shipMap.get(content); + list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); + + CommonTable.refreshTable(list, columnDto, table); + table.setRowHeight(25); + + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + tableModelListener(list, table, jFrame); + } + }); + + query.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + list = level3Service.getList(null, null, null, null, null,sb.getText()); + + CommonTable.refreshTable(list, columnDto, table); + table.setRowHeight(25); + + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + tableModelListener(list, table, jFrame); } }); @@ -175,8 +314,9 @@ JComboBoxItem[] projectList = level1Service.getProjectList(); JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); JComboBoxItem[] cabinList = cabinService.getList(); + JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); String[] typeList = new String[]{ - "鏀硅","鍔犺","鎹㈣","鏀硅繘鎬т慨鐞�" + "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�","" }; JLabel JLabel1 = new JLabel("宸ョ▼"); @@ -311,10 +451,10 @@ data.setCabinId(String.valueOf(selectedIds)); data.setType(comboBox6.getSelectedItem().toString()); level3Service.insert(data); - list = level3Service.getList(level1Data.getShipId()); + 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