| | |
| | | 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; |
| | |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | | import com.example.server.progressTrack.service.*; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | JPanel panel = new JPanel(); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | 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.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(105, jFrame))); |
| | | centerJpanel.setBackground(Color.WHITE); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | 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[]{ |
| | | "","改装", "加装", "换装", "修理","改进性修理" |
| | | }; |
| | | JComboBoxItem[] isealCabin = { |
| | | new JComboBoxItem(10000L, ""), |
| | | new JComboBoxItem(0L, "否"), |
| | | new JComboBoxItem(1L, "是"), |
| | | }; |
| | | |
| | | 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)); |
| | | |
| | | JLabel JLabel5 = new JLabel("是否影响封舱"); |
| | | JComboBox<JComboBoxItem> comboBox5 = new JComboBox<>(isealCabin); |
| | | comboBox5.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(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)); |
| | | |
| | | 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], Math.toIntExact(isealCabin[0].getId()), 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("序号", "", 100, "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("类别", "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("操作", "", 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); |
| | | |
| | | tableModelListener(list, table, jFrame); |
| | | } else { |
| | | isFirstLoadData[0] = false; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | for (int i = 0; i < shipList.size(); i++) { |
| | | shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId()); |
| | | comboBox.addItem(shipList.get(i).getShipNo()); |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | comboBox.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(); |
| | | JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),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)); |
| | | |
| | | 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(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),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(); |
| | | JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),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(); |
| | | JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),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(); |
| | | JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | |
| | | comboBox5.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(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),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,null, sb.getText()); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | |
| | | tableModelListener(list, table, jFrame); |
| | | |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | jFrame.setEnabled(false); |
| | | insert(jFrame); |
| | | } |
| | | }); |
| | |
| | | btnImport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | jFrame.setEnabled(false); |
| | | importService.FileUpload(columnDto, table, jFrame); |
| | | } |
| | | }); |
| | |
| | | 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(105, jFrame))); |
| | | centerJpanel.add(scrollPane); |
| | | jFrame.addComponentListener(new ComponentAdapter() { |
| | | @Override |
| | | public void componentResized(ComponentEvent e) { |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(105, jFrame))); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(105, jFrame))); |
| | | centerJpanel.revalidate(); |
| | | centerJpanel.repaint(); |
| | | scrollPane.revalidate(); |
| | | scrollPane.repaint(); |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | | |
| | | private void insert(JFrame jFrame) { |
| | | JFrame frame1 = new JFrame("新增三级网络图"); |
| | | frame1.setSize(470, 430); |
| | | frame1.setSize(500, 460); |
| | | frame1.setResizable(true); |
| | | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame1.setLocationRelativeTo(null); |
| | |
| | | JComboBoxItem[] projectList = level1Service.getProjectList(); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | String[] typeList = new String[]{ |
| | | "改装","加装","换装","改进性修理" |
| | | "","改装", "加装", "换装", "修理","改进性修理" |
| | | }; |
| | | JComboBoxItem[] isealCabin = { |
| | | new JComboBoxItem(0L, "否"), |
| | | new JComboBoxItem(1L, "是"), |
| | | }; |
| | | |
| | | JLabel JLabel1 = new JLabel("工程"); |
| | |
| | | JLabel JLabel7 = new JLabel("类别"); |
| | | JComboBox<String> comboBox6 = new JComboBox<>(typeList); |
| | | |
| | | JLabel JLabel78 = new JLabel("是否影响封舱"); |
| | | JComboBox<JComboBoxItem> comboBox7 = new JComboBox<>(isealCabin); |
| | | comboBox7.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JLabel JLabel8 = new JLabel("三级网络图名称"); |
| | | JTextField level3Name = new JTextField(16); |
| | |
| | | |
| | | frame1.add(JLabel7, new GBC(0, 6, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | 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(JLabel8, new GBC(0, 7, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(level3Name, new GBC(1, 7, 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, 8, 2, 1).setWeight(1, 0)); |
| | | frame1.add(btnSave, new GBC(0, 9, 2, 1).setWeight(1, 0)); |
| | | |
| | | btnSave.addActionListener((e) -> { |
| | | JComboBoxItem level1 = (JComboBoxItem) comboBox0.getSelectedItem(); |
| | |
| | | JComboBoxItem level2Node = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox4.getSelectedItem(); |
| | | JComboBoxItem isealCabinItem = (JComboBoxItem) comboBox7.getSelectedItem(); |
| | | Set<JComboBoxItem> selectedItems = comboBox5.getSelectedItems(); |
| | | StringBuilder selectedIds = new StringBuilder(); |
| | | for (JComboBoxItem item : selectedItems) { |
| | |
| | | data.setLevel2NetworkId(level2.getId()); |
| | | data.setLevel2NodeId(level2Node.getId()); |
| | | data.setName(name); |
| | | data.setIsealCabin(Math.toIntExact(isealCabinItem.getId())); |
| | | data.setDeptId(dept.getId()); |
| | | data.setTeamgroupId(team.getId()); |
| | | data.setTeamgroupName(team.getName()); |
| | | 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], Math.toIntExact(isealCabin[0].getId()), null); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | frame1.dispose(); |
| | | jFrame.setEnabled(true);//将主界面再设置为可操作的 |
| | | JOptionPane.showMessageDialog(null, "保存成功", "提示", JOptionPane.WARNING_MESSAGE); |
| | | }); |
| | | } |
| | | |