jinlin
2025-04-28 efce7ce3e63712ecc8b4c3039a73b508fc3ea880
src/main/java/com/example/client/service/DismantTrackService.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;
@@ -43,9 +44,13 @@
        JPanel jLeft = new JPanel(new BorderLayout());
        JPanel top = new JPanel();
        JPanel center = new JPanel();
        jLeft.setPreferredSize(new Dimension(600, height));
        top.setPreferredSize(new Dimension(600, 100));
        center.setPreferredSize(new Dimension(600, Compute.ComputeHeight(100,frame)));
        jLeft.setPreferredSize(new Dimension(600, Compute.ComputeHeight(0,frame)));
        jLeft.add(center, BorderLayout.CENTER);
        jLeft.add(top, BorderLayout.NORTH);
        GridBagLayout layout = new GridBagLayout();
        top.setLayout(layout);
@@ -57,7 +62,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<>();
@@ -65,7 +70,7 @@
        JLabel JLabel0 = new JLabel("工程");
        JComboBox comboBox = new JComboBox();
        comboBox.setPreferredSize(new Dimension(112, 28));
        comboBox.setPreferredSize(new Dimension(110, 28));
        for (int i = 0; i < shipList.size(); i++) {
            shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId());
            comboBox.addItem(shipList.get(i).getShipNo());
@@ -74,23 +79,24 @@
        JLabel JLabel1 = new JLabel("部门");
        JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList);
        comboBox1.setPreferredSize(new Dimension(112, 28));
        comboBox1.setPreferredSize(new Dimension(110, 28));
        JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId());
        JLabel JLabel2 = new JLabel("专业");
        JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(teamList1);
        comboBox2.setPreferredSize(new Dimension(112, 28));
        comboBox2.setPreferredSize(new Dimension(110, 28));
        JLabel JLabel3 = new JLabel("舱室");
        JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(cabinList);
        comboBox3.setPreferredSize(new Dimension(112, 28));
        comboBox3.setPreferredSize(new Dimension(110, 28));
        JLabel JLabel4 = new JLabel("类别");
        JComboBox<String> comboBox4 = new JComboBox<>(typeList);
        comboBox4.setPreferredSize(new Dimension(112, 28));
        comboBox4.setPreferredSize(new Dimension(110, 28));
        JTextField sb = new JTextField(10);
        JTextField sb = new JTextField();
        sb.setPreferredSize(new Dimension(130, 28));
        JButton query = new JButton("查询");
        top.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
@@ -107,21 +113,23 @@
        top.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
        top.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
        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,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", 112, null, false, null, null));
        columnDto.add(new ColumnDto("部门", "deptId", 100, "dict", false, null, deptList));
        columnDto.add(new ColumnDto("专业", "teamgroupId", 100, "dict", false, null, teamList));
        columnDto.add(new ColumnDto("设备名称", "name", 200, null, false, null, null));
        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", 100, "dict", false, null, cabinList));
        columnDto.add(new ColumnDto("类别", "type", 100, 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) {
@@ -132,11 +140,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,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) {
@@ -171,11 +179,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,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) {
@@ -201,11 +209,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,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) {
@@ -229,11 +237,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,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) {
@@ -257,11 +265,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,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) {
@@ -280,11 +288,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,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) {
@@ -300,11 +308,26 @@
            }
        });
        JScrollPane scrollTable = new JScrollPane(subTable);
        jLeft.add(scrollTable, BorderLayout.CENTER);
        JScrollPane scrollTable = new JScrollPane(subTable,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scrollTable.setViewportView(subTable);
        scrollTable.setPreferredSize(new Dimension(600,Compute.ComputeHeightWithScroll(100,frame)));
        center.add(scrollTable);
        frame.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                center.setPreferredSize(new Dimension(600, Compute.ComputeHeight(100,frame)));
                jLeft.setPreferredSize(new Dimension(600, Compute.ComputeHeight(0,frame)));
                scrollTable.setPreferredSize(new Dimension(600,Compute.ComputeHeightWithScroll(100,frame)));
                jLeft.revalidate();
                jLeft.repaint();
                center.revalidate();
                center.repaint();
                scrollTable.revalidate();
                scrollTable.repaint();
            }
        });
        JPanel track = addOrUpdate.createTrack(width - 620, height, list.get(0),frame);
        JPanel track = addOrUpdate.createTrack(width - 620, height, list.get(0), frame);
        // 创建水平分割面板
        JSplitPane hSplitPane = new JSplitPane(