| | |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.ComplexTable; |
| | | import com.example.client.utils.Compute; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.Dto.StatistReportsDto; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3Service djJdgzNetworkLevel3Service; |
| | | @Autowired |
| | | private StatisDismantService statisDismantService; |
| | | @Autowired |
| | | private StatisDismant2Service statisDismant2Service; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | private JTable trackTable; |
| | | private List<ColumnDto> columnDto; |
| | | private DjJdgzNetworkLevel3 nowLevel3; |
| | | private List<DjJdgzDismantTrack> list; |
| | | |
| | | public JPanel createTrack(Integer width, Integer height, DjJdgzNetworkLevel3 djJdgzNetworkLevel3,JFrame frame) { |
| | | nowLevel3 = djJdgzNetworkLevel3; |
| | | JPanel panel = new JPanel(new BorderLayout()); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width - 10, 37)); |
| | | topJpanel.setPreferredSize(new Dimension(width - 10, 40)); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,frame))); |
| | | |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | |
| | | JButton btnTj = new JButton("统计报表"); |
| | | JButton btnTjz = new JButton("拆卸进度统计总表"); |
| | | JButton btnTj = new JButton("拆卸进度详情表"); |
| | | JButton btnExport = new JButton("导出拆卸报表"); |
| | | JButton btnSave = new JButton("保存"); |
| | | JButton btnImport = new JButton("批量导入"); |
| | | |
| | | topJpanel.add(btnTjz); |
| | | topJpanel.add(btnTj); |
| | | topJpanel.add(btnExport); |
| | | topJpanel.add(btnSave); |
| | | topJpanel.add(btnImport); |
| | | |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(djJdgzNetworkLevel3.getId(), null); |
| | | list = djJdgzDismantTrackService.getList(nowLevel3.getId(), null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "编辑")); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] statusList = { |
| | | new JComboBoxItem(0, "进行中"), |
| | | new JComboBoxItem(1, "已完成"), |
| | | new JComboBoxItem(0L, "进行中"), |
| | | new JComboBoxItem(1L, "已完成"), |
| | | }; |
| | | |
| | | // 创建左侧表格 |
| | |
| | | columnDto.add(new ColumnDto("入库时间", "warehouseTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("入库人员", "warehouseStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("当前存放位置", "currentLocation", 160, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("状态", "status", 120, "dict", true, null, statusList)); |
| | | columnDto.add(new ColumnDto("状态", "status", 120, "dicts", true, null, statusList)); |
| | | |
| | | trackTable = CommonTable.createCommonTable(list, columnDto); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | |
| | |
| | | trackTable = new ComplexTable(headerRows,body); |
| | | CommonTable.setColumnType(columnDto, trackTable);*/ |
| | | |
| | | btnTjz.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | statisDismantService.createTable(frame,nowLevel3.getLevel1NetworkId()); |
| | | } |
| | | }); |
| | | btnTj.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | statisDismantService.createTable(frame,djJdgzNetworkLevel3.getLevel1NetworkId()); |
| | | statisDismant2Service.createTable(frame,nowLevel3.getLevel1NetworkId()); |
| | | } |
| | | }); |
| | | |
| | |
| | | btnSave.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | trackTable.getCellEditor().stopCellEditing(); |
| | | SysUser user = (SysUser) CacheUtils.get("user", "user"); |
| | | if (user.getTeamgroup()==null||user.getTeamgroup().equals(djJdgzNetworkLevel3.getTeamgroupId())){ |
| | | if (user.getTeamgroup()==null||user.getTeamgroup().equals(nowLevel3.getTeamgroupId().toString())){ |
| | | CommonTable.saveTableList(list, trackTable, columnDto); |
| | | djJdgzDismantTrackService.save(list); |
| | | }else{ |
| | | JOptionPane.showMessageDialog(null, "不可操作其他专业数据", "提示", JOptionPane.WARNING_MESSAGE); |
| | | JOptionPane.showMessageDialog(null, "当前用户不可操作其他专业数据", "提示", JOptionPane.WARNING_MESSAGE); |
| | | } |
| | | } |
| | | }); |
| | |
| | | btnImport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | importDismantTrackService.FileUpload(djJdgzNetworkLevel3.getId(),frame); |
| | | importDismantTrackService.FileUpload(nowLevel3.getId(),frame); |
| | | } |
| | | }); |
| | | |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(trackTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(trackTable); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 130)); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(40,frame))); |
| | | centerJpanel.add(scrollPane); |
| | | frame.addComponentListener(new ComponentAdapter() { |
| | | @Override |
| | | public void componentResized(ComponentEvent e) { |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,frame))); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20,Compute.ComputeHeightWithScroll(40,frame))); |
| | | centerJpanel.revalidate(); |
| | | centerJpanel.repaint(); |
| | | scrollPane.revalidate(); |
| | | scrollPane.repaint(); |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | | public void refreshTable(Long level3Id){ |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(level3Id, null); |
| | | nowLevel3 = djJdgzNetworkLevel3Service.get(level3Id); |
| | | list = djJdgzDismantTrackService.getList(level3Id, null); |
| | | CommonTable.refreshTable(list, columnDto, trackTable); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | } |
| | | |