|
|
|
@ -90,16 +90,34 @@ public class Main extends Application {
|
|
|
|
|
leftPanel.setStyle("-fx-background-color: #e8e8e8;");
|
|
|
|
|
leftPanel.setPrefWidth(200);
|
|
|
|
|
|
|
|
|
|
// 创建搜索框
|
|
|
|
|
TextField searchField = new TextField();
|
|
|
|
|
searchField.setPromptText("搜索...");
|
|
|
|
|
|
|
|
|
|
// 创建导航树
|
|
|
|
|
TreeView<String> navigationTree = createNavigationTree();
|
|
|
|
|
|
|
|
|
|
// 添加到左侧面板
|
|
|
|
|
leftPanel.getChildren().addAll(searchField, navigationTree);
|
|
|
|
|
VBox.setVgrow(navigationTree, Priority.ALWAYS);
|
|
|
|
|
// 创建功能按钮
|
|
|
|
|
Button inboundBtn = createFunctionButton("入库管理");
|
|
|
|
|
Button outboundBtn = createFunctionButton("出库管理");
|
|
|
|
|
Button inventoryBtn = createFunctionButton("库存查询");
|
|
|
|
|
Button goodsBtn = createFunctionButton("货物管理");
|
|
|
|
|
Button categoryBtn = createFunctionButton("分类管理");
|
|
|
|
|
Button reportBtn = createFunctionButton("库存报表");
|
|
|
|
|
Button logBtn = createFunctionButton("操作日志");
|
|
|
|
|
|
|
|
|
|
// 添加按钮点击事件
|
|
|
|
|
inboundBtn.setOnAction(e -> showInboundView());
|
|
|
|
|
outboundBtn.setOnAction(e -> showOutboundView());
|
|
|
|
|
inventoryBtn.setOnAction(e -> showInventoryView());
|
|
|
|
|
goodsBtn.setOnAction(e -> showGoodsManagementView());
|
|
|
|
|
categoryBtn.setOnAction(e -> showCategoryManagementView());
|
|
|
|
|
reportBtn.setOnAction(e -> showInventoryReportView());
|
|
|
|
|
logBtn.setOnAction(e -> showOperationLogView());
|
|
|
|
|
|
|
|
|
|
// 添加所有按钮到面板
|
|
|
|
|
leftPanel.getChildren().addAll(
|
|
|
|
|
inboundBtn,
|
|
|
|
|
outboundBtn,
|
|
|
|
|
inventoryBtn,
|
|
|
|
|
goodsBtn,
|
|
|
|
|
categoryBtn,
|
|
|
|
|
reportBtn,
|
|
|
|
|
logBtn
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return leftPanel;
|
|
|
|
|
}
|
|
|
|
@ -177,17 +195,17 @@ public class Main extends Application {
|
|
|
|
|
MenuItem logItem = new MenuItem("操作日志");
|
|
|
|
|
reportMenu.getItems().addAll(inventoryReportItem, logItem);
|
|
|
|
|
|
|
|
|
|
// 为入库管理菜单项添加事件处理
|
|
|
|
|
// 添加所有菜单项的事件处理
|
|
|
|
|
inboundItem.setOnAction(e -> showInboundView());
|
|
|
|
|
|
|
|
|
|
// 为出库管理菜单项添加事件处理。
|
|
|
|
|
outboundItem.setOnAction(e -> showOutboundView());
|
|
|
|
|
|
|
|
|
|
// 为货物信息菜单项添加事件处理
|
|
|
|
|
queryItem.setOnAction(e -> showInventoryView());
|
|
|
|
|
goodsInfoItem.setOnAction(e -> showGoodsManagementView());
|
|
|
|
|
|
|
|
|
|
//为库存报表菜单项添加事件处理
|
|
|
|
|
categoryItem.setOnAction(e -> showCategoryManagementView());
|
|
|
|
|
inventoryReportItem.setOnAction(e -> showInventoryReportView());
|
|
|
|
|
logItem.setOnAction(e -> showOperationLogView());
|
|
|
|
|
|
|
|
|
|
// 退出按钮事件处理
|
|
|
|
|
exitItem.setOnAction(e -> Platform.exit());
|
|
|
|
|
|
|
|
|
|
menuBar.getMenus().addAll(systemMenu, inventoryMenu, goodsMenu, reportMenu);
|
|
|
|
|
return menuBar;
|
|
|
|
@ -298,4 +316,40 @@ public class Main extends Application {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
launch(args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加创建功能按钮的辅助方法
|
|
|
|
|
private Button createFunctionButton(String text) {
|
|
|
|
|
Button button = new Button(text);
|
|
|
|
|
button.setPrefWidth(180);
|
|
|
|
|
button.setStyle(
|
|
|
|
|
"-fx-background-color: #4CAF50;" +
|
|
|
|
|
"-fx-text-fill: white;" +
|
|
|
|
|
"-fx-font-size: 14px;" +
|
|
|
|
|
"-fx-padding: 8px 16px;" +
|
|
|
|
|
"-fx-cursor: hand"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 添加鼠标悬停效果
|
|
|
|
|
button.setOnMouseEntered(e ->
|
|
|
|
|
button.setStyle(
|
|
|
|
|
"-fx-background-color: #45a049;" +
|
|
|
|
|
"-fx-text-fill: white;" +
|
|
|
|
|
"-fx-font-size: 14px;" +
|
|
|
|
|
"-fx-padding: 8px 16px;" +
|
|
|
|
|
"-fx-cursor: hand"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
button.setOnMouseExited(e ->
|
|
|
|
|
button.setStyle(
|
|
|
|
|
"-fx-background-color: #4CAF50;" +
|
|
|
|
|
"-fx-text-fill: white;" +
|
|
|
|
|
"-fx-font-size: 14px;" +
|
|
|
|
|
"-fx-padding: 8px 16px;" +
|
|
|
|
|
"-fx-cursor: hand"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return button;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|