feat(权限管理): 为角色和功能添加启用状态字段
- 在EMPLOYEE_ROLE表中添加IS_ACTIVE字段,默认值为TRUE - 在EmployeeRole和Function实体类中添加active字段 - 在角色和功能管理界面添加启用状态列和控件 - 实现TaskMonitorCenter与状态栏标签的绑定 - 更新相关ViewModel以支持启用状态 - 配置Maven仓库地址
This commit is contained in:
@@ -74,6 +74,7 @@ public class HomeWindowController extends BaseController {
|
||||
public Button openVendorManagerWindow;
|
||||
public Button openCustomManagerWindow;
|
||||
public TaskProgressView<Task<?>> taskProgressView;
|
||||
public Label taskMonitorLabel;
|
||||
public Label employeeStatusLabel;
|
||||
|
||||
public void initialize() {
|
||||
@@ -99,7 +100,7 @@ public class HomeWindowController extends BaseController {
|
||||
((Label) placeholder).setText("没有运行的任务");
|
||||
|
||||
employeeStatusLabel.textProperty().bind(Desktop.instance.getActiveEmployee().getName());
|
||||
|
||||
Desktop.instance.getTaskMonitorCenter().bindStatusLabel(taskMonitorLabel);
|
||||
Desktop.instance.getActiveEmployee().initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public class EmployeeFunctionsManagerWindowController
|
||||
public TableColumn<FunctionViewModel, String> iconColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> descriptionColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, Boolean> activeColumn;
|
||||
|
||||
@Override
|
||||
public void show(Stage stage) {
|
||||
|
||||
@@ -29,6 +29,8 @@ public class EmployeeRoleManagerSkin
|
||||
controller.systemAdministratorColumn.setCellFactory(param -> new CheckBoxTableCell<>());
|
||||
controller.managerColumn.setCellValueFactory(param -> param.getValue().getManager());
|
||||
controller.managerColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.managerColumn));
|
||||
controller.activeColumn.setCellValueFactory(param -> param.getValue().getActive());
|
||||
controller.activeColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.activeColumn));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -36,6 +37,7 @@ public class EmployeeRoleManagerWindowController
|
||||
public TableColumn<EmployeeRoleViewModel, String> nameColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, Boolean> systemAdministratorColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, Boolean> managerColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, Boolean> activeColumn;
|
||||
|
||||
@Override
|
||||
protected EmployeeRoleManagerSkin createDefaultSkin() {
|
||||
|
||||
@@ -25,5 +25,6 @@ public class EmployeeRoleTabSkinBase extends AbstEmployeeRoleBasedTabSkin implem
|
||||
controller.systemAdministratorField.selectedProperty().bind(viewModel.getSystemAdministrator());
|
||||
}
|
||||
controller.managerField.selectedProperty().bindBidirectional(viewModel.getManager());
|
||||
controller.activeField.selectedProperty().bindBidirectional(viewModel.getActive());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.stage.Window;
|
||||
@@ -44,6 +46,7 @@ public class EmployeeRoleWindowController extends AbstEntityController<EmployeeR
|
||||
public CheckBox systemAdministratorField;
|
||||
public CheckBox managerField;
|
||||
public DatePicker createdField;
|
||||
@FXML
|
||||
public CheckBox activeField;
|
||||
public Label versionLabel;
|
||||
/*
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
|
||||
public class FunctionManagerSkin
|
||||
@@ -40,6 +41,9 @@ public class FunctionManagerSkin
|
||||
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
controller.descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.descriptionColumn.setOnEditCommit(this::onDescriptionColumnEditCommit);
|
||||
|
||||
controller.activeColumn.setCellValueFactory(param -> param.getValue().getActive());
|
||||
controller.activeColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.activeColumn));
|
||||
}
|
||||
|
||||
private void onNameColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
|
||||
@@ -26,5 +26,6 @@ public class FunctionTabSkinBase
|
||||
controller.controllerField.textProperty().bindBidirectional(viewModel.getController());
|
||||
controller.iconField.textProperty().bindBidirectional(viewModel.getIcon());
|
||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||
controller.activeField.selectedProperty().bindBidirectional(viewModel.getActive());
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,8 @@ public class FunctionWindowController extends AbstEntityController<Function, Fun
|
||||
@FXML
|
||||
public TextField descriptionField;
|
||||
@FXML
|
||||
public CheckBox activeField;
|
||||
@FXML
|
||||
public Label versionLabel;
|
||||
|
||||
public static void show(Function function, Window owner) {
|
||||
|
||||
@@ -32,6 +32,11 @@ public class EmployeeRole implements IdentityEntity, NamedEntity {
|
||||
@Column(name = "MANAGER")
|
||||
private boolean manager;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Column(name = "IS_ACTIVE")
|
||||
private boolean active = true;
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
|
||||
@JoinTable(
|
||||
|
||||
@@ -16,6 +16,7 @@ public class EmployeeRoleViewModel extends IdentityViewModel<EmployeeRole> {
|
||||
private SimpleStringProperty name = new SimpleStringProperty();
|
||||
private SimpleBooleanProperty systemAdministrator = new SimpleBooleanProperty();
|
||||
private SimpleBooleanProperty manager = new SimpleBooleanProperty();
|
||||
private SimpleBooleanProperty active = new SimpleBooleanProperty();
|
||||
|
||||
public static EmployeeRoleViewModel from(EmployeeRole v) {
|
||||
EmployeeRoleViewModel model = new EmployeeRoleViewModel();
|
||||
@@ -30,6 +31,7 @@ public class EmployeeRoleViewModel extends IdentityViewModel<EmployeeRole> {
|
||||
getName().set(v.getName());
|
||||
getSystemAdministrator().set(v.isSystemAdministrator());
|
||||
getManager().set(v.isManager());
|
||||
getActive().set(v.isActive());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,6 +53,10 @@ public class EmployeeRoleViewModel extends IdentityViewModel<EmployeeRole> {
|
||||
v.setManager(getManager().get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(getActive().get(), v.isActive())) {
|
||||
v.setActive(getActive().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -16,6 +17,7 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
private SimpleStringProperty controller = new SimpleStringProperty();
|
||||
private SimpleStringProperty icon = new SimpleStringProperty();
|
||||
private SimpleStringProperty description = new SimpleStringProperty();
|
||||
private SimpleBooleanProperty active = new SimpleBooleanProperty();
|
||||
|
||||
public static FunctionViewModel from(Function v) {
|
||||
FunctionViewModel model = new FunctionViewModel();
|
||||
@@ -32,6 +34,7 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
getController().set(v.getController());
|
||||
getIcon().set(v.getIcon());
|
||||
getDescription().set(v.getDescription());
|
||||
getActive().set(v.isActive());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,6 +60,10 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
v.setDescription(description.get());
|
||||
modified = true;
|
||||
}
|
||||
if (active.get() != v.isActive()) {
|
||||
v.setActive(active.get());
|
||||
modified = true;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user