jinlin
2025-04-05 92705ac08a97ddc4904795f024723aab69e1abd8
src/main/java/com/example/client/service/SubunitService.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;
@@ -47,11 +48,16 @@
        JPanel jLeft = new JPanel(new BorderLayout());
        JPanel top = new JPanel();
        JPanel center = new JPanel();
        GridBagLayout layout = new GridBagLayout();
        top.setLayout(layout);
        jLeft.setPreferredSize(new Dimension(width / 2 - 20, height));
        top.setPreferredSize(new Dimension(width / 2 - 20, 100));
        jLeft.setPreferredSize(new Dimension(width / 2 - 20, Compute.ComputeHeight(0,frame)));
        center.setPreferredSize(new Dimension(width / 2 - 20, Compute.ComputeHeight(100,frame)));
        jLeft.add(center,BorderLayout.CENTER);
        // 创建左侧表格
@@ -60,7 +66,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<>();
@@ -114,18 +120,23 @@
        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(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null,null);
        if (list == null || list.size() == 0) {
            JOptionPane.showMessageDialog(null, "还未录入三级网络图数据", "提示", JOptionPane.WARNING_MESSAGE);
            return null;
        }
        columnDto.add(new ColumnDto("序号", "", 60, "autoCreate", false, null, null));
        columnDto.add(new ColumnDto("设备名称", "name", 180, null, false, null, null));
        columnDto.add(new ColumnDto("部门", "deptId", 180, "dict", false, null, deptList));
        columnDto.add(new ColumnDto("专业", "teamgroupId", 180, "dict", false, null, teamList));
        columnDto.add(new ColumnDto("舱室", "cabinId", 180, "dict", false, null, cabinList));
        columnDto.add(new ColumnDto("类别", "type", 180, null, false, null, null));
        columnDto.add(new ColumnDto("设备名称", "name", 152, null, false, null, null));
        columnDto.add(new ColumnDto("部门", "deptId", 152, "dict", false, null, deptList));
        columnDto.add(new ColumnDto("专业", "teamgroupId", 152, "dict", false, null, teamList));
        columnDto.add(new ColumnDto("舱室", "cabinId", 150, "dict", false, null, cabinList));
        columnDto.add(new ColumnDto("类别", "type", 150, 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) {
@@ -136,11 +147,10 @@
                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,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) {
@@ -175,11 +185,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,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) {
@@ -205,11 +215,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,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) {
@@ -233,11 +243,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,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) {
@@ -261,11 +271,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,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) {
@@ -284,11 +294,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,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) {
@@ -306,7 +316,22 @@
        JScrollPane scrollTable = new JScrollPane(subTable);
        jLeft.add(scrollTable, BorderLayout.CENTER);
        scrollTable.setPreferredSize(new Dimension(width / 2 - 20, Compute.ComputeHeightWithScroll(100,frame)));
        center.add(scrollTable);
        frame.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                jLeft.setPreferredSize(new Dimension(width / 2 - 20, Compute.ComputeHeight(0,frame)));
                center.setPreferredSize(new Dimension(width / 2 - 20, Compute.ComputeHeight(100,frame)));
                scrollTable.setPreferredSize(new Dimension(width / 2 - 20,Compute.ComputeHeightWithScroll(100,frame)));
                jLeft.revalidate();
                jLeft.repaint();
                center.revalidate();
                center.repaint();
                scrollTable.revalidate();
                scrollTable.repaint();
            }
        });
        JPanel track = addOrUpdate.createTrack(width / 2, height, list.get(0),  frame);