| | |
| | | import com.example.client.dto.ColumnDto; |
| | | 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.client.utils.*; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | jFrame.setEnabled(false); |
| | | insert(jFrame); |
| | | DjJdgzNetworkLevel3 data = new DjJdgzNetworkLevel3(); |
| | | insert(jFrame,data); |
| | | } |
| | | }); |
| | | |
| | |
| | | return panel; |
| | | } |
| | | |
| | | private void insert(JFrame jFrame) { |
| | | public void insert(JFrame jFrame,DjJdgzNetworkLevel3 data) { |
| | | JFrame frame1 = new JFrame("新增三级网络图"); |
| | | frame1.setSize(500, 460); |
| | | frame1.setResizable(true); |
| | |
| | | JComboBox<JComboBoxItem> comboBox0 = new JComboBox<>(projectList); |
| | | comboBox0.setPreferredSize(new Dimension(185, 28)); |
| | | comboBox0.setSelectedIndex(-1); |
| | | if (data.getLevel1NetworkId()!=null){ |
| | | comboBox0.setSelectedItem(BoxIteUtils.GetSelectItemById(projectList, data.getLevel1NetworkId())); |
| | | } |
| | | |
| | | JLabel JLabel2 = new JLabel("二级网络图"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(); |
| | | comboBox1.setPreferredSize(new Dimension(185, 28)); |
| | | if (data.getLevel2NetworkId()!=null){ |
| | | JComboBoxItem[] level2List = level2Service.getLevel2List(data.getLevel1NetworkId()); |
| | | comboBox1.setModel(new DefaultComboBoxModel<>(level2List)); |
| | | comboBox1.setSelectedItem(BoxIteUtils.GetSelectItemById(level2List, data.getLevel2NetworkId())); |
| | | } |
| | | |
| | | JLabel JLabel3 = new JLabel("二级网络图节点"); |
| | | JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(); |
| | | comboBox2.setPreferredSize(new Dimension(185, 28)); |
| | | if (data.getLevel2NodeId()!=null){ |
| | | JComboBoxItem[] level2NodeList = level2ListService.getNode(data.getLevel2NetworkId()); |
| | | comboBox2.setModel(new DefaultComboBoxModel<>(level2NodeList)); |
| | | comboBox2.setSelectedItem(BoxIteUtils.GetSelectItemById(level2NodeList, data.getLevel2NodeId())); |
| | | } |
| | | |
| | | JLabel JLabel4 = new JLabel("部门"); |
| | | JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(deptList); |
| | | comboBox3.setPreferredSize(new Dimension(185, 28)); |
| | | if (data.getDeptId()!=null){ |
| | | comboBox3.setSelectedItem(BoxIteUtils.GetSelectItemById(deptList, data.getDeptId())); |
| | | } |
| | | |
| | | JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId()); |
| | | |
| | | JLabel JLabel5 = new JLabel("专业"); |
| | | JComboBox<JComboBoxItem> comboBox4 = new JComboBox<>(teamList1); |
| | | comboBox4.setPreferredSize(new Dimension(185, 28)); |
| | | if (data.getTeamgroupId()!=null){ |
| | | JComboBoxItem[] teamList3 = sysTeamGroupClassService.getTeamList(data.getDeptId()); |
| | | comboBox4.setModel(new DefaultComboBoxModel<>(teamList3)); |
| | | comboBox4.setSelectedItem(BoxIteUtils.GetSelectItemById(teamList3, data.getTeamgroupId())); |
| | | } |
| | | |
| | | JLabel JLabel6 = new JLabel("舱室"); |
| | | MultiSelectComboBox comboBox5 = new MultiSelectComboBox(cabinList); |
| | | comboBox5.setPreferredSize(new Dimension(200, 25)); |
| | | if (data.getCabinId()!=null){ |
| | | Set<Long> selectedIds = new HashSet<>(); |
| | | String[] idParts = data.getCabinId().split(","); |
| | | for (String idPart : idParts) { |
| | | selectedIds.add(Long.parseLong(idPart.trim())); // 将字符串转换为 Long 类型并添加到集合中 |
| | | } |
| | | |
| | | // 将 ID 转换为对应的 JComboBoxItem 对象 |
| | | Set<JComboBoxItem> selectedItems = new HashSet<>(); |
| | | for (JComboBoxItem item : cabinList) { |
| | | if (selectedIds.contains(item.getId())) { // 检查 Long 类型的 ID 是否匹配 |
| | | selectedItems.add(item); // 添加到选中项集合 |
| | | } |
| | | } |
| | | comboBox5.setSelectedItems(selectedItems); |
| | | } |
| | | |
| | | JLabel JLabel7 = new JLabel("类别"); |
| | | JComboBox<String> comboBox6 = new JComboBox<>(typeList); |
| | | if (data.getType()!=null){ |
| | | comboBox6.setSelectedItem(data.getType()); |
| | | } |
| | | |
| | | JLabel JLabel78 = new JLabel("是否影响封舱"); |
| | | JComboBox<JComboBoxItem> comboBox7 = new JComboBox<>(isealCabin); |
| | | comboBox7.setPreferredSize(new Dimension(185, 28)); |
| | | if (data.getIsealCabin()!=null){ |
| | | comboBox7.setSelectedItem(BoxIteUtils.GetSelectItemById(isealCabin, Long.valueOf(data.getIsealCabin()))); |
| | | } |
| | | |
| | | JLabel JLabel8 = new JLabel("三级网络图名称"); |
| | | JTextField level3Name = new JTextField(16); |
| | | if (StringUtils.isNotBlank(data.getName())){ |
| | | level3Name.setText(data.getName()); |
| | | } |
| | | |
| | | comboBox0.addItemListener(new ItemListener() { |
| | | @Override |
| | |
| | | selectedIds.append(item.getId()).append(","); |
| | | } |
| | | String name = level3Name.getText(); |
| | | DjJdgzNetworkLevel3 data = new DjJdgzNetworkLevel3(); |
| | | DjJdgzNetworkLevel1 level1Data = level1Service.get(level1.getId()); |
| | | data.setLevel1NetworkId(level1.getId()); |
| | | data.setLevel2NetworkId(level2.getId()); |
| | |
| | | data.setTeamgroupName(team.getName()); |
| | | data.setCabinId(String.valueOf(selectedIds)); |
| | | data.setType(comboBox6.getSelectedItem().toString()); |
| | | level3Service.insert(data); |
| | | if (data.getId()!=null){ |
| | | level3Service.update(data); |
| | | }else{ |
| | | 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); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |