增加配置管理
BIN
.image/javafx/API-访问日志1.png
Normal file
After Width: | Height: | Size: 204 KiB |
BIN
.image/javafx/API-访问日志2.png
Normal file
After Width: | Height: | Size: 222 KiB |
BIN
.image/javafx/API-访问日志3.png
Normal file
After Width: | Height: | Size: 220 KiB |
BIN
.image/javafx/API-错误日志1.png
Normal file
After Width: | Height: | Size: 349 KiB |
BIN
.image/javafx/API-错误日志2.png
Normal file
After Width: | Height: | Size: 386 KiB |
BIN
.image/javafx/API-错误日志3.png
Normal file
After Width: | Height: | Size: 435 KiB |
BIN
.image/javafx/配置管理1.png
Normal file
After Width: | Height: | Size: 224 KiB |
BIN
.image/javafx/配置管理2.png
Normal file
After Width: | Height: | Size: 242 KiB |
BIN
.image/javafx/配置管理3.png
Normal file
After Width: | Height: | Size: 241 KiB |
BIN
.image/swing/API-访问日志1.png
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
.image/swing/API-访问日志2.png
Normal file
After Width: | Height: | Size: 260 KiB |
BIN
.image/swing/API-访问日志3.png
Normal file
After Width: | Height: | Size: 611 KiB |
BIN
.image/swing/API-错误日志1.png
Normal file
After Width: | Height: | Size: 285 KiB |
BIN
.image/swing/API-错误日志2.png
Normal file
After Width: | Height: | Size: 366 KiB |
BIN
.image/swing/API-错误日志3.png
Normal file
After Width: | Height: | Size: 735 KiB |
BIN
.image/swing/配置管理1.png
Normal file
After Width: | Height: | Size: 226 KiB |
BIN
.image/swing/配置管理2.png
Normal file
After Width: | Height: | Size: 283 KiB |
BIN
.image/swing/配置管理3.png
Normal file
After Width: | Height: | Size: 637 KiB |
10
README.md
@ -126,7 +126,7 @@ HTTP库:使用 OpenFeign HTTP库,该库提供了方便的 HTTP 请求和响
|
||||
### JavaFX
|
||||
|
||||
| 模块 | 浅色 | 深色 | glass |
|
||||
|------|------------------------------------|------------------------------------|-----------------------------------|
|
||||
|----------|-------------------------------------------|-------------------------------------------|-------------------------------------------|
|
||||
| 登录 |  | - | - |
|
||||
| 主页 |  |  |  |
|
||||
| 主页2 |  |  |  |
|
||||
@ -148,11 +148,14 @@ HTTP库:使用 OpenFeign HTTP库,该库提供了方便的 HTTP 请求和响
|
||||
| 文件列表 |  |  |  |
|
||||
| 定时任务 |  |  |  |
|
||||
| 执行日志 |  |  |  |
|
||||
| API-访问日志 |  |  |  |
|
||||
| API-错误日志 |  |  |  |
|
||||
| 配置管理 |  |  |  |
|
||||
|
||||
### Java Swing
|
||||
|
||||
| 模块 | 浅色 | 深色1 | 深色2 |
|
||||
|------|-----------------------------------|-----------------------------------|-----------------------------------|
|
||||
|------|-------------------------------------------|-----------------------------------|-----------------------------------|
|
||||
| 登录 |  | - | - |
|
||||
| 用户管理 |  |  |  |
|
||||
| 角色管理 |  |  |  |
|
||||
@ -171,3 +174,6 @@ HTTP库:使用 OpenFeign HTTP库,该库提供了方便的 HTTP 请求和响
|
||||
| 文件列表 |  |  |  |
|
||||
| 定时任务 |  |  |  |
|
||||
| 执行日志 |  |  |  |
|
||||
| API-访问日志 |  |  |  |
|
||||
| API-错误日志 |  |  |  |
|
||||
| 配置管理 |  |  |  |
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.lw.dillon.admin.module.system.dal.dataobject.logger;
|
||||
|
||||
import com.lw.dillon.admin.framework.common.enums.UserTypeEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.lw.dillon.admin.framework.common.enums.UserTypeEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.lw.dillon.admin.module.system.dal.dataobject.notice;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.lw.dillon.admin.framework.common.enums.CommonStatusEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.lw.dillon.admin.module.system.enums.notice.NoticeTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
package com.lw.dillon.admin.module.system.dal.dataobject.notify;
|
||||
|
||||
import com.lw.dillon.admin.framework.common.enums.UserTypeEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.lw.dillon.admin.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.lw.dillon.admin.framework.common.enums.UserTypeEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.lw.dillon.admin.module.system.dal.dataobject.notify;
|
||||
|
||||
import com.lw.dillon.admin.framework.common.enums.CommonStatusEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.lw.dillon.admin.framework.common.enums.CommonStatusEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.lw.dillon.admin.module.system.dal.dataobject.oauth2;
|
||||
|
||||
import com.lw.dillon.admin.framework.common.enums.UserTypeEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.lw.dillon.admin.framework.common.enums.UserTypeEnum;
|
||||
import com.lw.dillon.admin.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.lw.ui.request.api.config;
|
||||
|
||||
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||
import com.lw.dillon.admin.framework.common.pojo.PageResult;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.lw.ui.request.api.BaseFeignApi;
|
||||
import feign.Param;
|
||||
import feign.QueryMap;
|
||||
import feign.RequestLine;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConfigFeign extends BaseFeignApi {
|
||||
|
||||
//"创建参数配置")
|
||||
@RequestLine("POST /admin-api/infra/config/create")
|
||||
public CommonResult<Long> createConfig(ConfigSaveReqVO createReqVO);
|
||||
|
||||
//"修改参数配置")
|
||||
@RequestLine("PUT /admin-api/infra/config/update")
|
||||
public CommonResult<Boolean> updateConfig(ConfigSaveReqVO updateReqVO);
|
||||
|
||||
//"删除参数配置")
|
||||
@RequestLine("DELETE /admin-api/infra/config/delete?id={id}")
|
||||
public CommonResult<Boolean> deleteConfig(@Param("id") Long id);
|
||||
|
||||
//"获得参数配置")
|
||||
@RequestLine("GET /admin-api/infra/config/get?id={id}")
|
||||
public CommonResult<ConfigRespVO> getConfig(@Param("id") Long id);
|
||||
|
||||
//"根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
||||
@RequestLine("GET /admin-api/infra/config/get-value-by-key?key={key}")
|
||||
public CommonResult<String> getConfigKey(@Param("key") String key);
|
||||
|
||||
//"获取参数配置分页")
|
||||
@RequestLine("GET /admin-api/infra/config/page")
|
||||
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@QueryMap Map<String, Object> pageReqVO);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,482 @@
|
||||
package com.lw.fx.view.infra.apilog;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.dlsc.gemsfx.DialogPane;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.store.AppStore;
|
||||
import com.lw.fx.view.control.PagingControl;
|
||||
import com.lw.fx.view.control.WFXGenericDialog;
|
||||
import com.lw.ui.utils.DictTypeEnum;
|
||||
import de.saxsys.mvvmfx.FxmlView;
|
||||
import de.saxsys.mvvmfx.InjectViewModel;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import org.kordamp.ikonli.feather.Feather;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static atlantafx.base.theme.Styles.*;
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_OPERATE_TYPE;
|
||||
import static com.lw.ui.utils.DictTypeEnum.USER_TYPE;
|
||||
|
||||
public class ApiAccessLogView implements FxmlView<ApiAccessLogViewModel>, Initializable {
|
||||
|
||||
@InjectViewModel
|
||||
private ApiAccessLogViewModel viewModel;
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> applicationNameCol;
|
||||
|
||||
@FXML
|
||||
private TextField applicationNameField;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, LocalDateTime> beginTimeCol;
|
||||
|
||||
@FXML
|
||||
private VBox contentPane;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> durationCol;
|
||||
|
||||
@FXML
|
||||
private TextField durationField;
|
||||
|
||||
@FXML
|
||||
private DatePicker endDatePicker;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> idCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> operateModuleCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> operateNameCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, Integer> operateTypeCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, Long> optCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> requestMethodCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> requestUrlCol;
|
||||
|
||||
@FXML
|
||||
private Button resetBut;
|
||||
|
||||
@FXML
|
||||
private TextField resultCodeField;
|
||||
|
||||
@FXML
|
||||
private StackPane rootPane;
|
||||
|
||||
@FXML
|
||||
private Button searchBut;
|
||||
|
||||
@FXML
|
||||
private DatePicker startDatePicker;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, Integer> statusCol;
|
||||
|
||||
@FXML
|
||||
private TableView<ApiAccessLogRespVO> tableView;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, ?> userIdCol;
|
||||
|
||||
@FXML
|
||||
private TextField userIdField;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiAccessLogRespVO, Integer> userTypeCol;
|
||||
|
||||
@FXML
|
||||
private ComboBox<DictDataSimpleRespVO> userTypeComboBox;
|
||||
|
||||
private PagingControl pagingControl;
|
||||
|
||||
private DialogPane dialogPane;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
|
||||
dialogPane = new DialogPane();
|
||||
rootPane.getChildren().add(dialogPane);
|
||||
pagingControl = new PagingControl();
|
||||
contentPane.getChildren().add(pagingControl);
|
||||
|
||||
pagingControl.totalProperty().bind(viewModel.totalProperty());
|
||||
viewModel.pageNumProperty().bind(pagingControl.pageNumProperty());
|
||||
viewModel.pageSizeProperty().bind(pagingControl.pageSizeProperty());
|
||||
pagingControl.pageNumProperty().addListener((observable, oldValue, newValue) -> {
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
|
||||
pagingControl.pageSizeProperty().addListener((observable, oldValue, newValue) -> {
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
idCol.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
idCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
userIdCol.setCellValueFactory(new PropertyValueFactory<>("userId"));
|
||||
userIdCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
userTypeCol.setCellValueFactory(new PropertyValueFactory<>("userType"));
|
||||
userTypeCol.setStyle("-fx-alignment: CENTER");
|
||||
userTypeCol.setCellFactory(new Callback<TableColumn<ApiAccessLogRespVO, Integer>, TableCell<ApiAccessLogRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ApiAccessLogRespVO, Integer> call(TableColumn<ApiAccessLogRespVO, Integer> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(USER_TYPE).get(item + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
operateTypeCol.setCellValueFactory(new PropertyValueFactory<>("operateType"));
|
||||
operateTypeCol.setStyle("-fx-alignment: CENTER");
|
||||
operateTypeCol.setCellFactory(new Callback<TableColumn<ApiAccessLogRespVO, Integer>, TableCell<ApiAccessLogRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ApiAccessLogRespVO, Integer> call(TableColumn<ApiAccessLogRespVO, Integer> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(INFRA_OPERATE_TYPE).get(item + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
applicationNameCol.setCellValueFactory(new PropertyValueFactory<>("applicationName"));
|
||||
applicationNameCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
requestMethodCol.setCellValueFactory(new PropertyValueFactory<>("requestMethod"));
|
||||
requestMethodCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
requestUrlCol.setCellValueFactory(new PropertyValueFactory<>("requestUrl"));
|
||||
requestUrlCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
durationCol.setCellValueFactory(new PropertyValueFactory<>("duration"));
|
||||
durationCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
operateModuleCol.setCellValueFactory(new PropertyValueFactory<>("operateModule"));
|
||||
operateModuleCol.setStyle("-fx-alignment: CENTER");
|
||||
operateNameCol.setCellValueFactory(new PropertyValueFactory<>("operateName"));
|
||||
operateNameCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
statusCol.setCellValueFactory(new PropertyValueFactory<>("resultCode"));
|
||||
statusCol.setStyle("-fx-alignment: CENTER");
|
||||
statusCol.setCellFactory(new Callback<TableColumn<ApiAccessLogRespVO, Integer>, TableCell<ApiAccessLogRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ApiAccessLogRespVO, Integer> call(TableColumn<ApiAccessLogRespVO, Integer> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
String text = "";
|
||||
String colorType = "";
|
||||
if (item == 0) {
|
||||
text = "成功";
|
||||
colorType = "success";
|
||||
} else {
|
||||
text = "失败(" + getTableRow().getItem().getResultMsg() + ")";
|
||||
colorType = "danger";
|
||||
}
|
||||
Button state = new Button(text);
|
||||
switch (colorType) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
beginTimeCol.setCellValueFactory(new PropertyValueFactory<>("beginTime"));
|
||||
beginTimeCol.setStyle("-fx-alignment: CENTER");
|
||||
beginTimeCol.setCellFactory(new Callback<TableColumn<ApiAccessLogRespVO, LocalDateTime>, TableCell<ApiAccessLogRespVO, LocalDateTime>>() {
|
||||
@Override
|
||||
public TableCell<ApiAccessLogRespVO, LocalDateTime> call(TableColumn<ApiAccessLogRespVO, LocalDateTime> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(LocalDateTime item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
} else {
|
||||
|
||||
|
||||
if (item != null) {
|
||||
this.setText(DateUtil.format(item, "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
optCol.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
optCol.setCellFactory(new Callback<TableColumn<ApiAccessLogRespVO, Long>, TableCell<ApiAccessLogRespVO, Long>>() {
|
||||
@Override
|
||||
public TableCell<ApiAccessLogRespVO, Long> call(TableColumn<ApiAccessLogRespVO, Long> param) {
|
||||
|
||||
TableCell cell = new TableCell<ApiAccessLogRespVO, Long>() {
|
||||
@Override
|
||||
protected void updateItem(Long item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
Button editBut = new Button("详情");
|
||||
editBut.setOnAction(event -> showFormView(getTableRow().getItem()));
|
||||
editBut.setGraphic(FontIcon.of(Feather.EYE));
|
||||
editBut.getStyleClass().addAll(FLAT, ACCENT);
|
||||
|
||||
HBox box = new HBox(editBut);
|
||||
box.setAlignment(Pos.CENTER);
|
||||
// box.setSpacing(7);
|
||||
setGraphic(box);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
tableView.itemsProperty().bind(viewModel.tableItemsProperty());
|
||||
|
||||
userIdField.textProperty().bindBidirectional(viewModel.userIdProperty());
|
||||
applicationNameField.textProperty().bindBidirectional(viewModel.applicationNameProperty());
|
||||
durationField.textProperty().bindBidirectional(viewModel.durationProperty());
|
||||
resultCodeField.textProperty().bindBidirectional(viewModel.resultCodeProperty());
|
||||
|
||||
searchBut.setOnAction(actionEvent -> viewModel.loadTableData());
|
||||
resetBut.setOnAction(actionEvent -> {
|
||||
userIdField.setText(null);
|
||||
applicationNameField.setText(null);
|
||||
durationField.setText(null);
|
||||
resultCodeField.setText(null);
|
||||
startDatePicker.setValue(null);
|
||||
endDatePicker.setValue(null);
|
||||
userTypeComboBox.getSelectionModel().select(null);
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
startDatePicker.valueProperty().bindBidirectional(viewModel.beginDateProperty());
|
||||
endDatePicker.valueProperty().bindBidirectional(viewModel.endDateProperty());
|
||||
userTypeComboBox.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(USER_TYPE)));
|
||||
userTypeComboBox.valueProperty().bindBidirectional(viewModel.selUserTypeProperty());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示编辑对话框
|
||||
*/
|
||||
private void showFormView(ApiAccessLogRespVO respVO) {
|
||||
WFXGenericDialog dialog = new WFXGenericDialog();
|
||||
|
||||
|
||||
dialog.addActions(
|
||||
|
||||
Map.entry(new Button("确定"), event -> {
|
||||
dialog.close();
|
||||
})
|
||||
);
|
||||
|
||||
VBox vBox = new VBox(10,
|
||||
createTextField("日志编号", respVO.getId()+"")
|
||||
, createTextField("链路追踪", respVO.getTraceId() )
|
||||
, createTextField("应用名", respVO.getApplicationName())
|
||||
, createDictBut("用户信息", respVO.getUserType(),USER_TYPE)
|
||||
, createTextField("用户 IP", respVO.getUserIp())
|
||||
, createTextField("用户 UA", respVO.getUserAgent())
|
||||
, createTextField("请求信息", respVO.getRequestMethod()+" "+respVO.getRequestUrl())
|
||||
, createTextField("请求参数", respVO.getRequestParams())
|
||||
, createTextField("请求结果", respVO.getResponseBody())
|
||||
, createTextField("请求时间", DateUtil.format(respVO.getBeginTime(), "yyyy-MM-dd HH:mm:ss") + " ~ " + DateUtil.format(respVO.getEndTime(), "yyyy-MM-dd HH:mm:ss"))
|
||||
, createTextField("请求耗时", respVO.getDuration() + "毫秒")
|
||||
, createTextField("操作结果", respVO.getResultCode()==0?"正常":("失败 | "+respVO.getResultCode()+" | "+respVO.getResultMsg()))
|
||||
, createTextField("操作模块", respVO.getOperateModule())
|
||||
, createTextField("操作名", respVO.getOperateName())
|
||||
, createDictBut("操作类型", respVO.getOperateType(),INFRA_OPERATE_TYPE)
|
||||
|
||||
);
|
||||
|
||||
vBox.setPrefWidth(500);
|
||||
|
||||
dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
|
||||
dialog.setHeaderText("详情");
|
||||
dialog.setContent(vBox);
|
||||
dialog.show(rootPane.getScene());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private HBox createTextField(String text, String value) {
|
||||
Label label = new Label(text);
|
||||
label.setAlignment(Pos.CENTER_RIGHT);
|
||||
label.setPrefWidth(100);
|
||||
TextField textField = new TextField(value);
|
||||
textField.setEditable(false);
|
||||
HBox.setHgrow(textField, Priority.ALWAYS);
|
||||
HBox hBox = new HBox(7, label, textField);
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
private HBox createDictBut(String text, Object value, DictTypeEnum dictTypeEnum) {
|
||||
Label label = new Label(text);
|
||||
label.setAlignment(Pos.CENTER_RIGHT);
|
||||
label.setPrefWidth(100);
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(dictTypeEnum).get(value + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
HBox hBox = new HBox(7, label, state);
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
package com.lw.fx.view.infra.apilog;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.ui.request.api.apilog.ApiAccessLogFeign;
|
||||
import de.saxsys.mvvmfx.SceneLifecycle;
|
||||
import de.saxsys.mvvmfx.ViewModel;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ApiAccessLogViewModel implements ViewModel, SceneLifecycle {
|
||||
|
||||
private SimpleIntegerProperty total = new SimpleIntegerProperty(0);
|
||||
private IntegerProperty pageNum = new SimpleIntegerProperty(0);
|
||||
private IntegerProperty pageSize = new SimpleIntegerProperty(10);
|
||||
|
||||
private ObjectProperty<ObservableList<ApiAccessLogRespVO>> tableItems = new SimpleObjectProperty<>();
|
||||
|
||||
|
||||
private ObjectProperty<LocalDate> beginDate = new SimpleObjectProperty<>();
|
||||
private ObjectProperty<LocalDate> endDate = new SimpleObjectProperty<>();
|
||||
private StringProperty userId = new SimpleStringProperty();
|
||||
private StringProperty applicationName = new SimpleStringProperty();
|
||||
private StringProperty duration = new SimpleStringProperty();
|
||||
private StringProperty resultCode = new SimpleStringProperty();
|
||||
|
||||
private ObjectProperty<DictDataSimpleRespVO> selUserType = new SimpleObjectProperty<>();
|
||||
|
||||
|
||||
public ApiAccessLogViewModel() {
|
||||
loadTableData();
|
||||
}
|
||||
|
||||
|
||||
public void loadTableData() {
|
||||
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("pageNo", pageNum.get() + 1);
|
||||
queryMap.put("pageSize", pageSize.get());
|
||||
|
||||
queryMap.put("userId", userId.get());
|
||||
queryMap.put("userType", Optional.ofNullable(selUserType.get()).map(DictDataSimpleRespVO::getValue).orElse(null));
|
||||
queryMap.put("applicationName", applicationName.get());
|
||||
queryMap.put("duration", duration.get());
|
||||
queryMap.put("resultCode", resultCode.get());
|
||||
|
||||
if (ObjectUtil.isAllNotEmpty(getBeginDate(), getEndDate())) {
|
||||
String sd = getBeginDate().atTime(0, 0, 0).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String ed = getEndDate().atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
queryMap.put("beginTime", new String[]{sd, ed});
|
||||
}
|
||||
|
||||
ProcessChain.create()
|
||||
|
||||
.addSupplierInExecutor(() -> Request.connector(ApiAccessLogFeign.class).getApiAccessLogPage(queryMap))
|
||||
.addConsumerInPlatformThread(listCommonResult -> {
|
||||
if (listCommonResult.isSuccess()) {
|
||||
ObservableList<ApiAccessLogRespVO> respVOS = FXCollections.observableArrayList();
|
||||
respVOS.addAll(listCommonResult.getData().getList());
|
||||
tableItems.set(respVOS);
|
||||
totalProperty().set(listCommonResult.getData().getTotal().intValue());
|
||||
}
|
||||
})
|
||||
.run();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ObjectProperty<ObservableList<ApiAccessLogRespVO>> tableItemsProperty() {
|
||||
return tableItems;
|
||||
}
|
||||
|
||||
|
||||
public LocalDate getBeginDate() {
|
||||
return beginDate.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<LocalDate> beginDateProperty() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<LocalDate> endDateProperty() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
||||
public int getTotal() {
|
||||
return total.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty totalProperty() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum.get();
|
||||
}
|
||||
|
||||
public IntegerProperty pageNumProperty() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize.get();
|
||||
}
|
||||
|
||||
public IntegerProperty pageSizeProperty() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId.get();
|
||||
}
|
||||
|
||||
public StringProperty userIdProperty() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
return applicationName.get();
|
||||
}
|
||||
|
||||
public StringProperty applicationNameProperty() {
|
||||
return applicationName;
|
||||
}
|
||||
|
||||
public DictDataSimpleRespVO getSelUserType() {
|
||||
return selUserType.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<DictDataSimpleRespVO> selUserTypeProperty() {
|
||||
return selUserType;
|
||||
}
|
||||
|
||||
public String getDuration() {
|
||||
return duration.get();
|
||||
}
|
||||
|
||||
public StringProperty durationProperty() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public String getResultCode() {
|
||||
return resultCode.get();
|
||||
}
|
||||
|
||||
public StringProperty resultCodeProperty() {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,453 @@
|
||||
package com.lw.fx.view.infra.apilog;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.dlsc.gemsfx.DialogPane;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.fx.store.AppStore;
|
||||
import com.lw.fx.util.MessageType;
|
||||
import com.lw.fx.view.control.PagingControl;
|
||||
import com.lw.fx.view.control.WFXGenericDialog;
|
||||
import com.lw.ui.request.api.apilog.ApiErrorLogFeign;
|
||||
import com.lw.ui.utils.DictTypeEnum;
|
||||
import de.saxsys.mvvmfx.FxmlView;
|
||||
import de.saxsys.mvvmfx.InjectViewModel;
|
||||
import de.saxsys.mvvmfx.MvvmFX;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import org.kordamp.ikonli.feather.Feather;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static atlantafx.base.theme.Styles.*;
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_API_ERROR_LOG_PROCESS_STATUS;
|
||||
import static com.lw.ui.utils.DictTypeEnum.USER_TYPE;
|
||||
|
||||
public class ApiErrorLogView implements FxmlView<ApiErrorLogViewModel>, Initializable {
|
||||
|
||||
@InjectViewModel
|
||||
private ApiErrorLogViewModel viewModel;
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, ?> applicationNameCol;
|
||||
|
||||
@FXML
|
||||
private TextField applicationNameField;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, LocalDateTime> exceptionTimeCol;
|
||||
|
||||
@FXML
|
||||
private VBox contentPane;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, ?> exceptionNameCol;
|
||||
|
||||
|
||||
@FXML
|
||||
private DatePicker endDatePicker;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, ?> idCol;
|
||||
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, Integer> optCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, ?> requestMethodCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, ?> requestUrlCol;
|
||||
|
||||
@FXML
|
||||
private Button resetBut;
|
||||
|
||||
@FXML
|
||||
private ComboBox<DictDataSimpleRespVO> processStatusComBox;
|
||||
|
||||
@FXML
|
||||
private StackPane rootPane;
|
||||
|
||||
@FXML
|
||||
private Button searchBut;
|
||||
|
||||
@FXML
|
||||
private DatePicker startDatePicker;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, Integer> processStatusCol;
|
||||
|
||||
@FXML
|
||||
private TableView<ApiErrorLogRespVO> tableView;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, ?> userIdCol;
|
||||
|
||||
@FXML
|
||||
private TextField userIdField;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ApiErrorLogRespVO, Integer> userTypeCol;
|
||||
|
||||
@FXML
|
||||
private ComboBox<DictDataSimpleRespVO> userTypeComboBox;
|
||||
|
||||
private PagingControl pagingControl;
|
||||
|
||||
private DialogPane dialogPane;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
|
||||
dialogPane = new DialogPane();
|
||||
rootPane.getChildren().add(dialogPane);
|
||||
pagingControl = new PagingControl();
|
||||
contentPane.getChildren().add(pagingControl);
|
||||
|
||||
pagingControl.totalProperty().bind(viewModel.totalProperty());
|
||||
viewModel.pageNumProperty().bind(pagingControl.pageNumProperty());
|
||||
viewModel.pageSizeProperty().bind(pagingControl.pageSizeProperty());
|
||||
pagingControl.pageNumProperty().addListener((observable, oldValue, newValue) -> {
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
|
||||
pagingControl.pageSizeProperty().addListener((observable, oldValue, newValue) -> {
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
idCol.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
idCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
userIdCol.setCellValueFactory(new PropertyValueFactory<>("userId"));
|
||||
userIdCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
userTypeCol.setCellValueFactory(new PropertyValueFactory<>("userType"));
|
||||
userTypeCol.setStyle("-fx-alignment: CENTER");
|
||||
userTypeCol.setCellFactory(new Callback<TableColumn<ApiErrorLogRespVO, Integer>, TableCell<ApiErrorLogRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ApiErrorLogRespVO, Integer> call(TableColumn<ApiErrorLogRespVO, Integer> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(USER_TYPE).get(item + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
processStatusCol.setCellValueFactory(new PropertyValueFactory<>("processStatus"));
|
||||
processStatusCol.setStyle("-fx-alignment: CENTER");
|
||||
processStatusCol.setCellFactory(new Callback<TableColumn<ApiErrorLogRespVO, Integer>, TableCell<ApiErrorLogRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ApiErrorLogRespVO, Integer> call(TableColumn<ApiErrorLogRespVO, Integer> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(INFRA_API_ERROR_LOG_PROCESS_STATUS).get(item + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
applicationNameCol.setCellValueFactory(new PropertyValueFactory<>("applicationName"));
|
||||
applicationNameCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
requestMethodCol.setCellValueFactory(new PropertyValueFactory<>("requestMethod"));
|
||||
requestMethodCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
requestUrlCol.setCellValueFactory(new PropertyValueFactory<>("requestUrl"));
|
||||
requestUrlCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
exceptionNameCol.setCellValueFactory(new PropertyValueFactory<>("exceptionName"));
|
||||
exceptionNameCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
|
||||
exceptionTimeCol.setCellValueFactory(new PropertyValueFactory<>("exceptionTime"));
|
||||
exceptionTimeCol.setStyle("-fx-alignment: CENTER");
|
||||
exceptionTimeCol.setCellFactory(new Callback<TableColumn<ApiErrorLogRespVO, LocalDateTime>, TableCell<ApiErrorLogRespVO, LocalDateTime>>() {
|
||||
@Override
|
||||
public TableCell<ApiErrorLogRespVO, LocalDateTime> call(TableColumn<ApiErrorLogRespVO, LocalDateTime> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(LocalDateTime item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
} else {
|
||||
|
||||
|
||||
if (item != null) {
|
||||
this.setText(DateUtil.format(item, "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
optCol.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
optCol.setCellFactory(new Callback<TableColumn<ApiErrorLogRespVO, Integer>, TableCell<ApiErrorLogRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ApiErrorLogRespVO, Integer> call(TableColumn<ApiErrorLogRespVO, Integer> param) {
|
||||
|
||||
TableCell cell = new TableCell<ApiErrorLogRespVO, Integer>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
Button editBut = new Button("详情");
|
||||
editBut.setOnAction(event -> showFormView(getTableRow().getItem()));
|
||||
editBut.setGraphic(FontIcon.of(Feather.EYE));
|
||||
editBut.getStyleClass().addAll(FLAT, ACCENT);
|
||||
|
||||
Button processedBut = new Button("已处理");
|
||||
processedBut.setOnAction(event -> showDelDialog(getTableRow().getItem().getId(),1));
|
||||
processedBut.getStyleClass().addAll(FLAT, ACCENT);
|
||||
|
||||
Button ignoredBut = new Button("已忽略");
|
||||
ignoredBut.setOnAction(event -> showDelDialog(getTableRow().getItem().getId(),2));
|
||||
ignoredBut.getStyleClass().addAll(FLAT, ACCENT);
|
||||
|
||||
HBox box = new HBox(editBut, processedBut, ignoredBut);
|
||||
box.setAlignment(Pos.CENTER);
|
||||
// box.setSpacing(7);
|
||||
setGraphic(box);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
tableView.itemsProperty().bind(viewModel.tableItemsProperty());
|
||||
|
||||
userIdField.textProperty().bindBidirectional(viewModel.userIdProperty());
|
||||
applicationNameField.textProperty().bindBidirectional(viewModel.applicationNameProperty());
|
||||
|
||||
searchBut.setOnAction(actionEvent -> viewModel.loadTableData());
|
||||
resetBut.setOnAction(actionEvent -> {
|
||||
userIdField.setText(null);
|
||||
applicationNameField.setText(null);
|
||||
startDatePicker.setValue(null);
|
||||
endDatePicker.setValue(null);
|
||||
userTypeComboBox.getSelectionModel().select(null);
|
||||
processStatusComBox.getSelectionModel().select(null);
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
startDatePicker.valueProperty().bindBidirectional(viewModel.beginDateProperty());
|
||||
endDatePicker.valueProperty().bindBidirectional(viewModel.endDateProperty());
|
||||
userTypeComboBox.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(USER_TYPE)));
|
||||
userTypeComboBox.valueProperty().bindBidirectional(viewModel.selUserTypeProperty());
|
||||
|
||||
processStatusComBox.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(INFRA_API_ERROR_LOG_PROCESS_STATUS)));
|
||||
processStatusComBox.valueProperty().bindBidirectional(viewModel.processStatusProperty());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示编辑对话框
|
||||
*/
|
||||
private void showFormView(ApiErrorLogRespVO respVO) {
|
||||
WFXGenericDialog dialog = new WFXGenericDialog();
|
||||
|
||||
|
||||
dialog.addActions(
|
||||
|
||||
Map.entry(new Button("确定"), event -> {
|
||||
dialog.close();
|
||||
})
|
||||
);
|
||||
|
||||
VBox vBox = new VBox(10,
|
||||
createTextField("日志编号", respVO.getId() + "")
|
||||
, createTextField("链路追踪", respVO.getTraceId())
|
||||
, createTextField("应用名", respVO.getApplicationName())
|
||||
, createDictBut("用户信息", respVO.getUserType(), USER_TYPE)
|
||||
, createTextField("用户 IP", respVO.getUserIp())
|
||||
, createTextField("用户 UA", respVO.getUserAgent())
|
||||
, createTextField("请求信息", respVO.getRequestMethod() + " " + respVO.getRequestUrl())
|
||||
, createTextField("请求参数", respVO.getRequestParams())
|
||||
, createTextField("异常时间", DateUtil.format(respVO.getExceptionTime(), "yyyy-MM-dd HH:mm:ss"))
|
||||
, createTextField("异常名", respVO.getExceptionName())
|
||||
, createTextField("异常堆栈", respVO.getExceptionStackTrace())
|
||||
, createDictBut("处理状态", respVO.getProcessStatus(), INFRA_API_ERROR_LOG_PROCESS_STATUS)
|
||||
, createTextField("处理人", respVO.getProcessUserId() + "")
|
||||
, createTextField("处理时间", DateUtil.format(respVO.getProcessTime(), "yyyy-MM-dd HH:mm:ss"))
|
||||
|
||||
);
|
||||
|
||||
vBox.setPrefWidth(500);
|
||||
|
||||
dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
|
||||
dialog.setHeaderText("详情");
|
||||
dialog.setContent(vBox);
|
||||
dialog.show(rootPane.getScene());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private HBox createTextField(String text, String value) {
|
||||
Label label = new Label(text);
|
||||
label.setAlignment(Pos.CENTER_RIGHT);
|
||||
label.setPrefWidth(100);
|
||||
TextField textField = new TextField(value);
|
||||
textField.setEditable(false);
|
||||
HBox.setHgrow(textField, Priority.ALWAYS);
|
||||
HBox hBox = new HBox(7, label, textField);
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
private HBox createDictBut(String text, Object value, DictTypeEnum dictTypeEnum) {
|
||||
Label label = new Label(text);
|
||||
label.setAlignment(Pos.CENTER_RIGHT);
|
||||
label.setPrefWidth(100);
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(dictTypeEnum).get(value + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
HBox hBox = new HBox(7, label, state);
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
|
||||
private void showDelDialog(Integer id, Integer processStatus) {
|
||||
|
||||
String type = processStatus == 1 ? "已处理" : "已忽略";
|
||||
WFXGenericDialog dialog = new WFXGenericDialog();
|
||||
dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
|
||||
dialog.setHeaderText("系统提示");
|
||||
dialog.addActions(
|
||||
Map.entry(new Button("取消"), event -> dialog.close()),
|
||||
Map.entry(new Button("确定"), event -> {
|
||||
ProcessChain.create()
|
||||
.addSupplierInExecutor(() -> {
|
||||
return Request.connector(ApiErrorLogFeign.class).updateApiErrorLogProcess(id.longValue(), processStatus);
|
||||
})
|
||||
.addConsumerInPlatformThread(r -> {
|
||||
if (r.isSuccess()) {
|
||||
MvvmFX.getNotificationCenter().publish("message", "删除成功", MessageType.SUCCESS);
|
||||
|
||||
dialog.close();
|
||||
viewModel.loadTableData();
|
||||
}
|
||||
}).onException(e -> e.printStackTrace())
|
||||
.run();
|
||||
})
|
||||
);
|
||||
|
||||
dialog.setContent(new Label("确认标记为" + type + "?"));
|
||||
dialog.show(rootPane.getScene());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
package com.lw.fx.view.infra.apilog;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.ui.request.api.apilog.ApiErrorLogFeign;
|
||||
import de.saxsys.mvvmfx.SceneLifecycle;
|
||||
import de.saxsys.mvvmfx.ViewModel;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ApiErrorLogViewModel implements ViewModel, SceneLifecycle {
|
||||
|
||||
private SimpleIntegerProperty total = new SimpleIntegerProperty(0);
|
||||
private IntegerProperty pageNum = new SimpleIntegerProperty(0);
|
||||
private IntegerProperty pageSize = new SimpleIntegerProperty(10);
|
||||
|
||||
private ObjectProperty<ObservableList<ApiErrorLogRespVO>> tableItems = new SimpleObjectProperty<>();
|
||||
|
||||
|
||||
private ObjectProperty<LocalDate> beginDate = new SimpleObjectProperty<>();
|
||||
private ObjectProperty<LocalDate> endDate = new SimpleObjectProperty<>();
|
||||
private StringProperty userId = new SimpleStringProperty();
|
||||
private StringProperty applicationName = new SimpleStringProperty();
|
||||
|
||||
private ObjectProperty<DictDataSimpleRespVO> selUserType = new SimpleObjectProperty<>();
|
||||
private ObjectProperty<DictDataSimpleRespVO> processStatus = new SimpleObjectProperty<>();
|
||||
|
||||
|
||||
public ApiErrorLogViewModel() {
|
||||
loadTableData();
|
||||
}
|
||||
|
||||
|
||||
public void loadTableData() {
|
||||
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("pageNo", pageNum.get() + 1);
|
||||
queryMap.put("pageSize", pageSize.get());
|
||||
|
||||
queryMap.put("userId", userId.get());
|
||||
queryMap.put("userType", Optional.ofNullable(selUserType.get()).map(DictDataSimpleRespVO::getValue).orElse(null));
|
||||
queryMap.put("applicationName", applicationName.get());
|
||||
queryMap.put("processStatus", Optional.ofNullable(processStatus.get()).map(DictDataSimpleRespVO::getValue).orElse(null));
|
||||
|
||||
if (ObjectUtil.isAllNotEmpty(getBeginDate(), getEndDate())) {
|
||||
String sd = getBeginDate().atTime(0, 0, 0).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String ed = getEndDate().atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
queryMap.put("exceptionTime", new String[]{sd, ed});
|
||||
}
|
||||
|
||||
ProcessChain.create()
|
||||
|
||||
.addSupplierInExecutor(() -> Request.connector(ApiErrorLogFeign.class).getApiErrorLogPage(queryMap))
|
||||
.addConsumerInPlatformThread(listCommonResult -> {
|
||||
if (listCommonResult.isSuccess()) {
|
||||
ObservableList<ApiErrorLogRespVO> respVOS = FXCollections.observableArrayList();
|
||||
respVOS.addAll(listCommonResult.getData().getList());
|
||||
tableItems.set(respVOS);
|
||||
totalProperty().set(listCommonResult.getData().getTotal().intValue());
|
||||
}
|
||||
})
|
||||
.run();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ObjectProperty<ObservableList<ApiErrorLogRespVO>> tableItemsProperty() {
|
||||
return tableItems;
|
||||
}
|
||||
|
||||
|
||||
public LocalDate getBeginDate() {
|
||||
return beginDate.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<LocalDate> beginDateProperty() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<LocalDate> endDateProperty() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
||||
public int getTotal() {
|
||||
return total.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty totalProperty() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum.get();
|
||||
}
|
||||
|
||||
public IntegerProperty pageNumProperty() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize.get();
|
||||
}
|
||||
|
||||
public IntegerProperty pageSizeProperty() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId.get();
|
||||
}
|
||||
|
||||
public StringProperty userIdProperty() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
return applicationName.get();
|
||||
}
|
||||
|
||||
public StringProperty applicationNameProperty() {
|
||||
return applicationName;
|
||||
}
|
||||
|
||||
public DictDataSimpleRespVO getSelUserType() {
|
||||
return selUserType.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<DictDataSimpleRespVO> selUserTypeProperty() {
|
||||
return selUserType;
|
||||
}
|
||||
|
||||
public DictDataSimpleRespVO getProcessStatus() {
|
||||
return processStatus.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<DictDataSimpleRespVO> processStatusProperty() {
|
||||
return processStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.lw.fx.view.infra.config;
|
||||
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.store.AppStore;
|
||||
import de.saxsys.mvvmfx.FxmlView;
|
||||
import de.saxsys.mvvmfx.InjectViewModel;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
|
||||
|
||||
public class ConfigFormView implements FxmlView<ConfigFormViewModel>, Initializable {
|
||||
@InjectViewModel
|
||||
private ConfigFormViewModel viewModel;
|
||||
@FXML
|
||||
private TextField categoryField;
|
||||
|
||||
@FXML
|
||||
private TextField keyField;
|
||||
|
||||
@FXML
|
||||
private TextField nameField;
|
||||
|
||||
@FXML
|
||||
private TextArea remarksTextArea;
|
||||
|
||||
@FXML
|
||||
private TextField valueField;
|
||||
|
||||
@FXML
|
||||
private ComboBox<DictDataSimpleRespVO> visibleComboBox;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
|
||||
nameField.textProperty().bindBidirectional(viewModel.nameProperty());
|
||||
categoryField.textProperty().bindBidirectional(viewModel.categoryProperty());
|
||||
keyField.textProperty().bindBidirectional(viewModel.keyProperty());
|
||||
valueField.textProperty().bindBidirectional(viewModel.valueProperty());
|
||||
remarksTextArea.textProperty().bindBidirectional(viewModel.remartProperty());
|
||||
|
||||
visibleComboBox.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(INFRA_BOOLEAN_STRING)));
|
||||
visibleComboBox.valueProperty().bindBidirectional(viewModel.visbleSelProperty());
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.lw.fx.view.infra.config;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.fx.store.AppStore;
|
||||
import com.lw.ui.request.api.config.ConfigFeign;
|
||||
import de.saxsys.mvvmfx.ViewModel;
|
||||
import de.saxsys.mvvmfx.utils.mapping.ModelWrapper;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
|
||||
|
||||
public class ConfigFormViewModel implements ViewModel {
|
||||
|
||||
private ModelWrapper<ConfigSaveReqVO> wrapper = new ModelWrapper<>();
|
||||
private ObjectProperty<DictDataSimpleRespVO> visbleSel = new SimpleObjectProperty<>();
|
||||
|
||||
|
||||
public ConfigFormViewModel() {
|
||||
}
|
||||
|
||||
public ConfigSaveReqVO getSaveReqVO() {
|
||||
visibleProperty().set(Convert.toBool(visbleSel.get().getValue(),false));
|
||||
wrapper.commit();
|
||||
return wrapper.get();
|
||||
}
|
||||
|
||||
|
||||
public void query(Long id) {
|
||||
|
||||
ProcessChain.create()
|
||||
.addSupplierInExecutor(() -> {
|
||||
if (id == null) {
|
||||
return new ConfigSaveReqVO();
|
||||
}
|
||||
return Request.connector(ConfigFeign.class).getConfig(id).getData();
|
||||
})
|
||||
.addConsumerInPlatformThread(r -> {
|
||||
ConfigSaveReqVO reqVO = new ConfigSaveReqVO();
|
||||
BeanUtil.copyProperties(r, reqVO);
|
||||
setValue(reqVO);
|
||||
|
||||
})
|
||||
.onException(e -> e.printStackTrace())
|
||||
.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统设置菜单
|
||||
*/
|
||||
public void setValue(ConfigSaveReqVO roleRespVO) {
|
||||
DictDataSimpleRespVO sel = AppStore.getDictDataValueMap(INFRA_BOOLEAN_STRING).get(Optional.ofNullable(roleRespVO).map(ConfigSaveReqVO::getVisible).orElse(false) + "");
|
||||
visbleSel.set(sel);
|
||||
wrapper.set(roleRespVO);
|
||||
wrapper.reload();
|
||||
}
|
||||
|
||||
public CommonResult save(boolean isAdd) {
|
||||
|
||||
if (isAdd) {
|
||||
return Request.connector(ConfigFeign.class).createConfig(getSaveReqVO());
|
||||
} else {
|
||||
return Request.connector(ConfigFeign.class).updateConfig(getSaveReqVO());
|
||||
}
|
||||
}
|
||||
|
||||
public StringProperty nameProperty() {
|
||||
return wrapper.field("name", ConfigSaveReqVO::getName, ConfigSaveReqVO::setName, "");
|
||||
}
|
||||
|
||||
public StringProperty categoryProperty() {
|
||||
return wrapper.field("category", ConfigSaveReqVO::getCategory, ConfigSaveReqVO::setCategory, "");
|
||||
}
|
||||
|
||||
public StringProperty keyProperty() {
|
||||
return wrapper.field("key", ConfigSaveReqVO::getKey, ConfigSaveReqVO::setKey);
|
||||
}
|
||||
|
||||
public StringProperty valueProperty() {
|
||||
return wrapper.field("value", ConfigSaveReqVO::getValue, ConfigSaveReqVO::setValue);
|
||||
}
|
||||
|
||||
public BooleanProperty visibleProperty() {
|
||||
return wrapper.field("visible", ConfigSaveReqVO::getVisible, ConfigSaveReqVO::setVisible);
|
||||
}
|
||||
|
||||
|
||||
public StringProperty remartProperty() {
|
||||
return wrapper.field("remark", ConfigSaveReqVO::getRemark, ConfigSaveReqVO::setRemark);
|
||||
}
|
||||
|
||||
public DictDataSimpleRespVO getVisbleSel() {
|
||||
return visbleSel.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<DictDataSimpleRespVO> visbleSelProperty() {
|
||||
return visbleSel;
|
||||
}
|
||||
|
||||
public void setVisbleSel(DictDataSimpleRespVO visbleSel) {
|
||||
this.visbleSel.set(visbleSel);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,377 @@
|
||||
package com.lw.fx.view.infra.config;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.dlsc.gemsfx.DialogPane;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.fx.store.AppStore;
|
||||
import com.lw.fx.util.MessageType;
|
||||
import com.lw.fx.view.control.PagingControl;
|
||||
import com.lw.fx.view.control.WFXGenericDialog;
|
||||
import com.lw.ui.request.api.config.ConfigFeign;
|
||||
import de.saxsys.mvvmfx.*;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import org.kordamp.ikonli.feather.Feather;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static atlantafx.base.theme.Styles.*;
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_CONFIG_TYPE;
|
||||
|
||||
public class ConfigView implements FxmlView<ConfigViewModel>, Initializable {
|
||||
|
||||
@InjectViewModel
|
||||
private ConfigViewModel viewModel;
|
||||
@FXML
|
||||
private Button addBut;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, ?> categoryCol;
|
||||
|
||||
@FXML
|
||||
private TextField keyField;
|
||||
|
||||
@FXML
|
||||
private VBox contentPane;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, LocalDateTime> createTimeCol;
|
||||
|
||||
@FXML
|
||||
private DatePicker endDatePicker;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, ?> idCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, ?> keyCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, ?> nameCol;
|
||||
|
||||
@FXML
|
||||
private TextField nameField;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, Long> optCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, ?> remarkCol;
|
||||
|
||||
@FXML
|
||||
private Button resetBut;
|
||||
|
||||
@FXML
|
||||
private StackPane rootPane;
|
||||
|
||||
@FXML
|
||||
private Button searchBut;
|
||||
|
||||
@FXML
|
||||
private DatePicker startDatePicker;
|
||||
|
||||
@FXML
|
||||
private ComboBox<DictDataSimpleRespVO> typeCombo;
|
||||
|
||||
@FXML
|
||||
private TableView<ConfigRespVO> tableView;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, Integer> typeCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, ?> valueCol;
|
||||
|
||||
@FXML
|
||||
private TableColumn<ConfigRespVO, Boolean> visibleCol;
|
||||
|
||||
private PagingControl pagingControl;
|
||||
|
||||
private DialogPane dialogPane;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
dialogPane = new DialogPane();
|
||||
rootPane.getChildren().add(dialogPane);
|
||||
pagingControl = new PagingControl();
|
||||
contentPane.getChildren().add(pagingControl);
|
||||
|
||||
pagingControl.totalProperty().bind(viewModel.totalProperty());
|
||||
viewModel.pageNumProperty().bind(pagingControl.pageNumProperty());
|
||||
viewModel.pageSizeProperty().bind(pagingControl.pageSizeProperty());
|
||||
pagingControl.pageNumProperty().addListener((observable, oldValue, newValue) -> {
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
|
||||
pagingControl.pageSizeProperty().addListener((observable, oldValue, newValue) -> {
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
|
||||
|
||||
idCol.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
idCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
categoryCol.setCellValueFactory(new PropertyValueFactory<>("category"));
|
||||
categoryCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
|
||||
nameCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
keyCol.setCellValueFactory(new PropertyValueFactory<>("key"));
|
||||
keyCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
valueCol.setCellValueFactory(new PropertyValueFactory<>("value"));
|
||||
valueCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
visibleCol.setCellValueFactory(new PropertyValueFactory<>("visible"));
|
||||
visibleCol.setStyle("-fx-alignment: CENTER");
|
||||
visibleCol.setCellFactory(new Callback<TableColumn<ConfigRespVO, Boolean>, TableCell<ConfigRespVO, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ConfigRespVO, Boolean> call(TableColumn<ConfigRespVO, Boolean> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Boolean item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(INFRA_BOOLEAN_STRING).get(item + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
createTimeCol.setCellValueFactory(new PropertyValueFactory<>("createTime"));
|
||||
createTimeCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
typeCol.setCellValueFactory(new PropertyValueFactory<>("type"));
|
||||
typeCol.setStyle("-fx-alignment: CENTER");
|
||||
typeCol.setCellFactory(new Callback<TableColumn<ConfigRespVO, Integer>, TableCell<ConfigRespVO, Integer>>() {
|
||||
@Override
|
||||
public TableCell<ConfigRespVO, Integer> call(TableColumn<ConfigRespVO, Integer> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(Integer item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
|
||||
DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(INFRA_CONFIG_TYPE).get(item + "");
|
||||
Button state = new Button(dict.getLabel());
|
||||
switch (dict.getColorType()) {
|
||||
case "primary":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
|
||||
break;
|
||||
case "success":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
|
||||
break;
|
||||
case "info":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
break;
|
||||
case "warning":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
|
||||
break;
|
||||
case "danger":
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
|
||||
break;
|
||||
default:
|
||||
state.getStyleClass().addAll(BUTTON_OUTLINED);
|
||||
}
|
||||
|
||||
HBox box = new HBox(state);
|
||||
box.setPadding(new Insets(7, 7, 7, 7));
|
||||
box.setAlignment(Pos.CENTER);
|
||||
setGraphic(box);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
remarkCol.setCellValueFactory(new PropertyValueFactory<>("remark"));
|
||||
remarkCol.setStyle("-fx-alignment: CENTER");
|
||||
|
||||
createTimeCol.setCellFactory(new Callback<TableColumn<ConfigRespVO, LocalDateTime>, TableCell<ConfigRespVO, LocalDateTime>>() {
|
||||
@Override
|
||||
public TableCell<ConfigRespVO, LocalDateTime> call(TableColumn<ConfigRespVO, LocalDateTime> param) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
protected void updateItem(LocalDateTime item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
} else {
|
||||
if (item != null) {
|
||||
this.setText(DateUtil.format(item, "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
optCol.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
optCol.setCellFactory(new Callback<TableColumn<ConfigRespVO, Long>, TableCell<ConfigRespVO, Long>>() {
|
||||
@Override
|
||||
public TableCell<ConfigRespVO, Long> call(TableColumn<ConfigRespVO, Long> param) {
|
||||
|
||||
TableCell cell = new TableCell<ConfigRespVO, Long>() {
|
||||
@Override
|
||||
protected void updateItem(Long item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
|
||||
Button editBut = new Button("修改");
|
||||
editBut.setOnAction(event -> showFormView(getTableRow().getItem().getId()));
|
||||
editBut.setGraphic(FontIcon.of(Feather.EDIT));
|
||||
editBut.getStyleClass().addAll(FLAT, ACCENT);
|
||||
|
||||
Button delBut = new Button("删除");
|
||||
delBut.setOnAction(actionEvent -> showDelDialog(getTableRow().getItem()));
|
||||
delBut.setGraphic(FontIcon.of(Feather.TRASH));
|
||||
delBut.getStyleClass().addAll(FLAT, DANGER);
|
||||
HBox box = new HBox(editBut, delBut);
|
||||
box.setAlignment(Pos.CENTER);
|
||||
// box.setSpacing(7);
|
||||
setGraphic(box);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
tableView.itemsProperty().bind(viewModel.tableItemsProperty());
|
||||
|
||||
nameField.textProperty().bindBidirectional(viewModel.nameProperty());
|
||||
keyField.textProperty().bindBidirectional(viewModel.keyProperty());
|
||||
|
||||
|
||||
searchBut.setOnAction(actionEvent -> viewModel.loadTableData());
|
||||
resetBut.setOnAction(actionEvent -> {
|
||||
nameField.setText(null);
|
||||
keyField.setText(null);
|
||||
typeCombo.getSelectionModel().select(null);
|
||||
startDatePicker.setValue(null);
|
||||
endDatePicker.setValue(null);
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
startDatePicker.valueProperty().bindBidirectional(viewModel.beginDateProperty());
|
||||
endDatePicker.valueProperty().bindBidirectional(viewModel.endDateProperty());
|
||||
|
||||
addBut.setOnAction(actionEvent -> showFormView(null));
|
||||
|
||||
typeCombo.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(INFRA_CONFIG_TYPE)));
|
||||
typeCombo.valueProperty().bindBidirectional(viewModel.typeProperty());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示编辑对话框
|
||||
*/
|
||||
private void showFormView(Long id) {
|
||||
WFXGenericDialog dialog = new WFXGenericDialog();
|
||||
|
||||
boolean isAdd = (id == null);
|
||||
ViewTuple<ConfigFormView, ConfigFormViewModel> load = FluentViewLoader.fxmlView(ConfigFormView.class).load();
|
||||
load.getViewModel().query(id);
|
||||
dialog.addActions(Map.entry(new Button("取消"), event -> dialog.close()), Map.entry(new Button("确定"), event -> {
|
||||
ProcessChain.create().addSupplierInExecutor(() -> {
|
||||
return load.getViewModel().save(isAdd);
|
||||
}).addConsumerInPlatformThread(r -> {
|
||||
if (r.isSuccess()) {
|
||||
MvvmFX.getNotificationCenter().publish("message", "保存成功", MessageType.SUCCESS);
|
||||
|
||||
dialog.close();
|
||||
viewModel.loadTableData();
|
||||
|
||||
}
|
||||
}).onException(e -> e.printStackTrace()).run();
|
||||
}));
|
||||
|
||||
dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
|
||||
dialog.setHeaderText(id != null ? "编辑配置" : "添加配置");
|
||||
dialog.setContent(load.getView());
|
||||
dialog.show(rootPane.getScene());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void showDelDialog(ConfigRespVO respVO) {
|
||||
WFXGenericDialog dialog = new WFXGenericDialog();
|
||||
dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
|
||||
dialog.setHeaderText("删除配置");
|
||||
dialog.addActions(Map.entry(new Button("取消"), event -> dialog.close()), Map.entry(new Button("确定"), event -> {
|
||||
ProcessChain.create().addSupplierInExecutor(() -> {
|
||||
return Request.connector(ConfigFeign.class).deleteConfig(respVO.getId());
|
||||
}).addConsumerInPlatformThread(r -> {
|
||||
if (r.isSuccess()) {
|
||||
MvvmFX.getNotificationCenter().publish("message", "删除成功", MessageType.SUCCESS);
|
||||
|
||||
dialog.close();
|
||||
viewModel.loadTableData();
|
||||
}
|
||||
}).onException(e -> e.printStackTrace()).run();
|
||||
}));
|
||||
|
||||
dialog.setContent(new Label("是否确认删除名称为" + respVO.getName() + "的数据项?"));
|
||||
dialog.show(rootPane.getScene());
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.lw.fx.view.infra.config;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.ui.request.api.config.ConfigFeign;
|
||||
import de.saxsys.mvvmfx.SceneLifecycle;
|
||||
import de.saxsys.mvvmfx.ViewModel;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ConfigViewModel implements ViewModel, SceneLifecycle {
|
||||
|
||||
private SimpleIntegerProperty total = new SimpleIntegerProperty(0);
|
||||
private IntegerProperty pageNum = new SimpleIntegerProperty(0);
|
||||
private IntegerProperty pageSize = new SimpleIntegerProperty(10);
|
||||
|
||||
private ObjectProperty<ObservableList<ConfigRespVO>> tableItems = new SimpleObjectProperty<>();
|
||||
|
||||
private ObjectProperty<LocalDate> beginDate = new SimpleObjectProperty<>();
|
||||
private ObjectProperty<LocalDate> endDate = new SimpleObjectProperty<>();
|
||||
private StringProperty name = new SimpleStringProperty();
|
||||
private StringProperty key = new SimpleStringProperty();
|
||||
private ObjectProperty<DictDataSimpleRespVO> type = new SimpleObjectProperty<>();
|
||||
|
||||
public ConfigViewModel() {
|
||||
|
||||
loadTableData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void loadTableData() {
|
||||
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("pageNo", pageNum.get() + 1);
|
||||
queryMap.put("pageSize", pageSize.get());
|
||||
|
||||
queryMap.put("name", name.get());
|
||||
queryMap.put("key", key.get());
|
||||
queryMap.put("type", Optional.ofNullable(type.get()).map(DictDataSimpleRespVO::getValue).orElse(null));
|
||||
|
||||
|
||||
if (ObjectUtil.isAllNotEmpty(getBeginDate(), getEndDate())) {
|
||||
String sd = getBeginDate().atTime(0, 0, 0).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String ed = getEndDate().atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
queryMap.put("createTime", new String[]{sd, ed});
|
||||
}
|
||||
|
||||
ProcessChain.create()
|
||||
.addSupplierInExecutor(() -> Request.connector(ConfigFeign.class).getConfigPage(queryMap))
|
||||
.addConsumerInPlatformThread(listCommonResult -> {
|
||||
|
||||
if (listCommonResult.isSuccess()) {
|
||||
ObservableList<ConfigRespVO> userRespVOS = FXCollections.observableArrayList();
|
||||
userRespVOS.addAll(listCommonResult.getData().getList());
|
||||
tableItems.set(userRespVOS);
|
||||
totalProperty().set(listCommonResult.getData().getTotal().intValue());
|
||||
}
|
||||
})
|
||||
.run();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ObjectProperty<ObservableList<ConfigRespVO>> tableItemsProperty() {
|
||||
return tableItems;
|
||||
}
|
||||
|
||||
public DictDataSimpleRespVO getType() {
|
||||
return type.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<DictDataSimpleRespVO> typeProperty() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name.get();
|
||||
}
|
||||
|
||||
public StringProperty nameProperty() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key.get();
|
||||
}
|
||||
|
||||
public StringProperty keyProperty() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public LocalDate getBeginDate() {
|
||||
return beginDate.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<LocalDate> beginDateProperty() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate.get();
|
||||
}
|
||||
|
||||
public ObjectProperty<LocalDate> endDateProperty() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
||||
public int getTotal() {
|
||||
return total.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty totalProperty() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum.get();
|
||||
}
|
||||
|
||||
public IntegerProperty pageNumProperty() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize.get();
|
||||
}
|
||||
|
||||
public IntegerProperty pageSizeProperty() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved() {
|
||||
|
||||
}
|
||||
}
|
@ -294,6 +294,7 @@ public class LoginLogView implements FxmlView<LoginLogViewModel>, Initializable
|
||||
userIpField.setText(null);
|
||||
startDatePicker.setValue(null);
|
||||
endDatePicker.setValue(null);
|
||||
viewModel.loadTableData();
|
||||
});
|
||||
startDatePicker.valueProperty().bindBidirectional(viewModel.beginDateProperty());
|
||||
endDatePicker.valueProperty().bindBidirectional(viewModel.endDateProperty());
|
||||
|
@ -2,14 +2,9 @@ package com.lw.fx.websocket;
|
||||
|
||||
import com.lw.dillon.admin.framework.common.util.json.JsonUtils;
|
||||
import com.lw.dillon.admin.framework.websocket.core.message.JsonWebSocketMessage;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.notice.vo.NoticeRespVO;
|
||||
import com.lw.fx.request.Request;
|
||||
import com.lw.fx.store.AppStore;
|
||||
import com.lw.fx.util.MessageType;
|
||||
import com.lw.ui.request.api.system.AuthFeign;
|
||||
import de.saxsys.mvvmfx.MvvmFX;
|
||||
import io.datafx.core.concurrent.ProcessChain;
|
||||
import javafx.application.Platform;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
|
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<StackPane fx:id="rootPane" prefHeight="609.0" prefWidth="1223.0" styleClass="tab-center-pane" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.lw.fx.view.infra.apilog.ApiAccessLogView">
|
||||
<children>
|
||||
<VBox fx:id="contentPane" prefHeight="200.0" prefWidth="100.0" spacing="7.0" styleClass="sample">
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" spacing="5.0">
|
||||
<children>
|
||||
<TextField fx:id="userIdField" prefWidth="150.0" promptText="请输入用户编号" />
|
||||
<ComboBox fx:id="userTypeComboBox" prefWidth="150.0" promptText="请选择用户类型" />
|
||||
<TextField fx:id="applicationNameField" promptText="请输入应用名" />
|
||||
<TextField fx:id="durationField" promptText="请输入执行时长" />
|
||||
<TextField fx:id="resultCodeField" promptText="请输入结果码" />
|
||||
<Label text="请求时间" />
|
||||
<DatePicker fx:id="startDatePicker" prefWidth="140.0" />
|
||||
<Label text="-" />
|
||||
<DatePicker fx:id="endDatePicker" prefWidth="140.0" />
|
||||
<Button fx:id="searchBut" mnemonicParsing="false" text="查询">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-search" />
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="resetBut" mnemonicParsing="false" text="重置">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-refresh-cw" />
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</HBox>
|
||||
<TableView fx:id="tableView" editable="true" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn fx:id="idCol" text="日志编号" />
|
||||
<TableColumn fx:id="userIdCol" text="用户编号" />
|
||||
<TableColumn fx:id="userTypeCol" text="用户类型" />
|
||||
<TableColumn fx:id="applicationNameCol" text="应用名" />
|
||||
<TableColumn fx:id="requestMethodCol" text="请求方法" />
|
||||
<TableColumn fx:id="requestUrlCol" text="请求地址" />
|
||||
<TableColumn fx:id="beginTimeCol" text="请求时间" />
|
||||
<TableColumn fx:id="durationCol" text="执行时长" />
|
||||
<TableColumn fx:id="statusCol" text="操作结果" />
|
||||
<TableColumn fx:id="operateModuleCol" text="操作模块" />
|
||||
<TableColumn fx:id="operateNameCol" text="操作名" />
|
||||
<TableColumn fx:id="operateTypeCol" text="操作类型" />
|
||||
<TableColumn fx:id="optCol" text="操作" />
|
||||
</columns>
|
||||
<columnResizePolicy>
|
||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||
</columnResizePolicy>
|
||||
</TableView>
|
||||
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</StackPane>
|
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.DatePicker?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
|
||||
<StackPane fx:id="rootPane" prefHeight="609.0" prefWidth="1223.0" styleClass="tab-center-pane" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.lw.fx.view.infra.apilog.ApiErrorLogView">
|
||||
<children>
|
||||
<VBox fx:id="contentPane" prefHeight="200.0" prefWidth="100.0" spacing="7.0" styleClass="sample">
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" spacing="5.0">
|
||||
<children>
|
||||
<TextField fx:id="userIdField" prefWidth="150.0" promptText="请输入用户编号" />
|
||||
<ComboBox fx:id="userTypeComboBox" prefWidth="150.0" promptText="请选择用户类型" />
|
||||
<TextField fx:id="applicationNameField" promptText="请输入应用名" />
|
||||
<ComboBox fx:id="processStatusComBox" prefWidth="150.0" promptText="请选择处理状态" />
|
||||
<Label text="异常时间" />
|
||||
<DatePicker fx:id="startDatePicker" prefWidth="140.0" />
|
||||
<Label text="-" />
|
||||
<DatePicker fx:id="endDatePicker" prefWidth="140.0" />
|
||||
<Button fx:id="searchBut" mnemonicParsing="false" text="查询">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-search" />
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="resetBut" mnemonicParsing="false" text="重置">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-refresh-cw" />
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</HBox>
|
||||
<TableView fx:id="tableView" editable="true" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn fx:id="idCol" text="日志编号" />
|
||||
<TableColumn fx:id="userIdCol" text="用户编号" />
|
||||
<TableColumn fx:id="userTypeCol" text="用户类型" />
|
||||
<TableColumn fx:id="applicationNameCol" text="应用名" />
|
||||
<TableColumn fx:id="requestMethodCol" text="请求方法" />
|
||||
<TableColumn fx:id="requestUrlCol" text="请求地址" />
|
||||
<TableColumn fx:id="exceptionTimeCol" text="异常发生时间" />
|
||||
<TableColumn fx:id="exceptionNameCol" text="异常名" />
|
||||
<TableColumn fx:id="processStatusCol" text="处理状态" />
|
||||
<TableColumn fx:id="optCol" minWidth="180.0" text="操作" />
|
||||
</columns>
|
||||
<columnResizePolicy>
|
||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||
</columnResizePolicy>
|
||||
</TableView>
|
||||
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</StackPane>
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<VBox spacing="10.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.lw.fx.view.infra.config.ConfigFormView">
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10.0">
|
||||
<children>
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" text="*参数分类:" />
|
||||
<TextField fx:id="categoryField" promptText="请输入参数分类" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10.0">
|
||||
<children>
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" text="*参数名称:" />
|
||||
<TextField fx:id="nameField" promptText="请输入参数名称" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10.0">
|
||||
<children>
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" text="*参数键名:" />
|
||||
<TextField fx:id="keyField" promptText="请输入参数键名" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10.0">
|
||||
<children>
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" text="*参数键值:" />
|
||||
<TextField fx:id="valueField" promptText="请输入参数键值" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10.0">
|
||||
<children>
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" text="*是否可见:" />
|
||||
<ComboBox fx:id="visibleComboBox" prefWidth="150.0" promptText="请选择" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox spacing="10.0" VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<Label alignment="CENTER_RIGHT" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" text="备注:" />
|
||||
<TextArea fx:id="remarksTextArea" prefHeight="92.0" prefWidth="375.0" promptText="请输入内容" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.String?>
|
||||
<?import javafx.collections.FXCollections?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.DatePicker?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
|
||||
<StackPane fx:id="rootPane" prefHeight="609.0" prefWidth="1223.0" styleClass="tab-center-pane" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.lw.fx.view.infra.config.ConfigView">
|
||||
<children>
|
||||
<VBox fx:id="contentPane" prefHeight="200.0" prefWidth="100.0" spacing="7.0" styleClass="sample">
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" spacing="5.0">
|
||||
<children>
|
||||
<TextField fx:id="nameField" prefWidth="151.0" promptText="请输入参数名称" />
|
||||
<TextField fx:id="keyField" promptText="请输入参数键名" />
|
||||
<ComboBox fx:id="typeCombo" promptText="请选择参数类型">
|
||||
<items>
|
||||
<FXCollections fx:factory="observableArrayList">
|
||||
<String fx:value="" />
|
||||
<String fx:value="0" />
|
||||
<String fx:value="1" />
|
||||
</FXCollections>
|
||||
</items>
|
||||
</ComboBox>
|
||||
<Label text="创建时间" />
|
||||
<DatePicker fx:id="startDatePicker" prefWidth="140.0" />
|
||||
<Label text="-" />
|
||||
<DatePicker fx:id="endDatePicker" prefWidth="140.0" />
|
||||
<Button fx:id="searchBut" mnemonicParsing="false" text="查询">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-search" />
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="resetBut" mnemonicParsing="false" text="重置">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-refresh-cw" />
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="addBut" mnemonicParsing="false" text="新增">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fth-plus" />
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</HBox>
|
||||
<TableView fx:id="tableView" editable="true" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn fx:id="idCol" text="参数主键" />
|
||||
<TableColumn fx:id="categoryCol" text="参数分类" />
|
||||
<TableColumn fx:id="nameCol" text="参数名称" />
|
||||
<TableColumn fx:id="keyCol" text="参数键名" />
|
||||
<TableColumn fx:id="valueCol" text="参数键值" />
|
||||
<TableColumn fx:id="visibleCol" text="是否可见" />
|
||||
<TableColumn fx:id="typeCol" text="参数类型" />
|
||||
<TableColumn fx:id="remarkCol" text="备注" />
|
||||
<TableColumn fx:id="createTimeCol" text="创建时间" />
|
||||
<TableColumn fx:id="optCol" minWidth="120.0" text="操作" />
|
||||
</columns>
|
||||
<columnResizePolicy>
|
||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||
</columnResizePolicy>
|
||||
</TableView>
|
||||
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</StackPane>
|
@ -1,17 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import com.dlsc.gemsfx.AvatarView?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
|
||||
<BorderPane fx:id="rootPane" prefHeight="511.0" prefWidth="833.0" styleClass="main-pane" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.lw.fx.view.main.MainView">
|
||||
<bottom>
|
||||
<HBox fx:id="statusBarBox" prefHeight="40.0" prefWidth="200.0" style="-fx-border-width: 1 0 0 0; -fx-border-color: -color-border-default;" BorderPane.alignment="CENTER">
|
||||
|
@ -40,7 +40,7 @@ public class DillonSwingUiApplication {
|
||||
ChartFactory.setChartTheme(chartTheme);
|
||||
|
||||
MainFrame frame = MainFrame.getInstance();
|
||||
frame.setTitle("Dillon-Pro-管理系统");
|
||||
frame.setTitle("后台管理系统");
|
||||
frame.showLogin();
|
||||
});
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class WOptionPane extends JOptionPane {
|
||||
|
||||
public WOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue) {
|
||||
super(message, messageType, optionType, icon, options, initialValue);
|
||||
setBackground(UIManager.getColor("App.optionPaneBackground"));
|
||||
// setBackground(UIManager.getColor("App.optionPaneBackground"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class OptButtonTableCellRenderer extends DefaultTableCellRenderer {
|
||||
Object v = table.getValueAt(row, hideCol);
|
||||
this.component.setVisible(!ObjectUtil.equal(v, hideValue));
|
||||
}
|
||||
panel.setOpaque(isSelected);
|
||||
panel.setOpaque(hasFocus||isSelected);
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ import java.awt.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Observable;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -360,7 +360,7 @@ public class MainFrame extends JFrame {
|
||||
|
||||
public JLabel getTitleLabel() {
|
||||
if (titleLabel == null) {
|
||||
titleLabel = new JLabel("Dillon-Pro-管理系统");
|
||||
titleLabel = new JLabel("后台管理系统");
|
||||
titleLabel.putClientProperty("FlatLaf.styleClass", "h1");
|
||||
titleLabel.setIcon(new FlatSVGIcon("icons/guanli.svg", 45, 45));
|
||||
titleLabel.setBorder(BorderFactory.createEmptyBorder(7, 3, 7, 7));
|
||||
|
@ -33,7 +33,8 @@ import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static com.lw.ui.utils.DictTypeEnum.*;
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_API_ERROR_LOG_PROCESS_STATUS;
|
||||
import static com.lw.ui.utils.DictTypeEnum.USER_TYPE;
|
||||
import static javax.swing.JOptionPane.*;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Created by JFormDesigner on Sun Jun 16 15:15:27 CST 2024
|
||||
*/
|
||||
|
||||
package com.lw.swing.view.intra.config;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.swing.request.Request;
|
||||
import com.lw.swing.store.AppStore;
|
||||
import com.lw.ui.request.api.config.ConfigFeign;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
|
||||
|
||||
/**
|
||||
* @author wenli
|
||||
*/
|
||||
public class ConfigFormPane extends JPanel {
|
||||
private Long id = null;
|
||||
|
||||
public ConfigFormPane() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
||||
// Generated using JFormDesigner non-commercial license
|
||||
label1 = new JLabel();
|
||||
categoryField = new JTextField();
|
||||
label2 = new JLabel();
|
||||
nameField = new JTextField();
|
||||
label3 = new JLabel();
|
||||
keyField = new JTextField();
|
||||
label6 = new JLabel();
|
||||
valueField = new JTextField();
|
||||
label4 = new JLabel();
|
||||
visibleComboBox = new JComboBox();
|
||||
label5 = new JLabel();
|
||||
scrollPane1 = new JScrollPane();
|
||||
remarkTextArea = new JTextArea();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"fill,hidemode 3",
|
||||
// columns
|
||||
"[right]" +
|
||||
"[320:n,grow,shrink 0,fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[280:n,grow]"));
|
||||
|
||||
//---- label1 ----
|
||||
label1.setText("*\u53c2\u6570\u5206\u7c7b");
|
||||
add(label1, "cell 0 0");
|
||||
add(categoryField, "cell 1 0");
|
||||
|
||||
//---- label2 ----
|
||||
label2.setText("*\u53c2\u6570\u540d\u79f0");
|
||||
add(label2, "cell 0 1");
|
||||
add(nameField, "cell 1 1");
|
||||
|
||||
//---- label3 ----
|
||||
label3.setText("*\u53c2\u6570\u952e\u540d");
|
||||
add(label3, "cell 0 2");
|
||||
add(keyField, "cell 1 2");
|
||||
|
||||
//---- label6 ----
|
||||
label6.setText("*\u53c2\u6570\u952e\u503c");
|
||||
add(label6, "cell 0 3");
|
||||
add(valueField, "cell 1 3");
|
||||
|
||||
//---- label4 ----
|
||||
label4.setText("*\u662f\u5426\u53ef\u89c1");
|
||||
add(label4, "cell 0 4");
|
||||
add(visibleComboBox, "cell 1 4");
|
||||
|
||||
//---- label5 ----
|
||||
label5.setText("\u5907\u6ce8");
|
||||
add(label5, "cell 0 5,aligny top,growy 0");
|
||||
|
||||
//======== scrollPane1 ========
|
||||
{
|
||||
scrollPane1.setViewportView(remarkTextArea);
|
||||
}
|
||||
add(scrollPane1, "cell 1 5,growy");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
|
||||
|
||||
AppStore.getDictDataList(INFRA_BOOLEAN_STRING).forEach(dictDataSimpleRespVO -> {
|
||||
visibleComboBox.addItem(dictDataSimpleRespVO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setValue(ConfigRespVO respVO) {
|
||||
categoryField.setText(respVO.getCategory());
|
||||
nameField.setText(respVO.getName());
|
||||
keyField.setText(respVO.getKey());
|
||||
valueField.setText(respVO.getValue());
|
||||
visibleComboBox.setSelectedItem(AppStore.getDictDataValueMap(INFRA_BOOLEAN_STRING).get(respVO.getVisible() + ""));
|
||||
remarkTextArea.setText(respVO.getRemark());
|
||||
|
||||
}
|
||||
|
||||
public ConfigSaveReqVO getValue() {
|
||||
ConfigSaveReqVO reqVO = new ConfigSaveReqVO();
|
||||
reqVO.setId(id);
|
||||
reqVO.setCategory(categoryField.getText());
|
||||
reqVO.setName(nameField.getText());
|
||||
reqVO.setKey(keyField.getText());
|
||||
reqVO.setValue(valueField.getText());
|
||||
reqVO.setRemark(remarkTextArea.getText());
|
||||
reqVO.setVisible(Convert.toBool(((DictDataSimpleRespVO) visibleComboBox.getSelectedItem()).getValue()));
|
||||
return reqVO;
|
||||
}
|
||||
|
||||
|
||||
public void updateData(Long id) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
|
||||
SwingWorker<ConfigRespVO, ConfigRespVO> swingWorker = new SwingWorker<ConfigRespVO, ConfigRespVO>() {
|
||||
@Override
|
||||
protected ConfigRespVO doInBackground() throws Exception {
|
||||
ConfigRespVO postRespVO = new ConfigRespVO();
|
||||
if (id != null) {
|
||||
CommonResult<ConfigRespVO> userResult = Request.connector(ConfigFeign.class).getConfig(id);
|
||||
postRespVO = userResult.getData();
|
||||
}
|
||||
|
||||
return postRespVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
|
||||
try {
|
||||
setValue(get());
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
swingWorker.execute();
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
||||
// Generated using JFormDesigner non-commercial license
|
||||
private JLabel label1;
|
||||
private JTextField categoryField;
|
||||
private JLabel label2;
|
||||
private JTextField nameField;
|
||||
private JLabel label3;
|
||||
private JTextField keyField;
|
||||
private JLabel label6;
|
||||
private JTextField valueField;
|
||||
private JLabel label4;
|
||||
private JComboBox visibleComboBox;
|
||||
private JLabel label5;
|
||||
private JScrollPane scrollPane1;
|
||||
private JTextArea remarkTextArea;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
JFDML JFormDesigner: "8.2.3.0.386" Java: "17.0.11" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
root: new FormRoot {
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "fill,hidemode 3"
|
||||
"$columnConstraints": "[right][320:n,grow,shrink 0,fill]"
|
||||
"$rowConstraints": "[][][][][][280:n,grow]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label1"
|
||||
"text": "*参数分类"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "categoryField"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label2"
|
||||
"text": "*参数名称"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "nameField"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
"text": "*参数键名"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "keyField"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label6"
|
||||
"text": "*参数键值"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "valueField"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label4"
|
||||
"text": "*是否可见"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "visibleComboBox"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label5"
|
||||
"text": "备注"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 5,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane1"
|
||||
add( new FormComponent( "javax.swing.JTextArea" ) {
|
||||
name: "remarkTextArea"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5,growy"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 615, 570 )
|
||||
} )
|
||||
}
|
||||
}
|
@ -0,0 +1,449 @@
|
||||
/*
|
||||
* Created by JFormDesigner on Thu Jun 13 19:52:21 CST 2024
|
||||
*/
|
||||
|
||||
package com.lw.swing.view.intra.config;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||
import com.lw.dillon.admin.framework.common.pojo.CommonResult;
|
||||
import com.lw.dillon.admin.framework.common.pojo.PageResult;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.lw.dillon.admin.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
||||
import com.lw.swing.components.*;
|
||||
import com.lw.swing.components.notice.WMessage;
|
||||
import com.lw.swing.components.table.renderer.OptButtonTableCellEditor;
|
||||
import com.lw.swing.components.table.renderer.OptButtonTableCellRenderer;
|
||||
import com.lw.swing.request.Request;
|
||||
import com.lw.swing.store.AppStore;
|
||||
import com.lw.swing.utils.BadgeLabelUtil;
|
||||
import com.lw.swing.view.MainFrame;
|
||||
import com.lw.ui.request.api.config.ConfigFeign;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.jdesktop.swingx.JXTable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
|
||||
import static com.lw.ui.utils.DictTypeEnum.INFRA_CONFIG_TYPE;
|
||||
import static javax.swing.JOptionPane.*;
|
||||
|
||||
/**
|
||||
* @author wenli
|
||||
*/
|
||||
public class ConfigPane extends JPanel {
|
||||
private String[] COLUMN_ID = {"参数主键", "参数分类","参数名称","参数键名", "参数键值", "是否可见","系统内置","备注", "创建时间", "操作"};
|
||||
|
||||
private DefaultTableModel tableModel;
|
||||
|
||||
private WPaginationPane paginationPane;
|
||||
|
||||
public ConfigPane() {
|
||||
initComponents();
|
||||
initListeners();
|
||||
updateData();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
textField = new JTextField();
|
||||
scrollPane1 = new WScrollPane();
|
||||
centerPane = new JPanel();
|
||||
scrollPane2 = new WScrollPane();
|
||||
table = new JXTable(tableModel = new DefaultTableModel());
|
||||
toolPane = new WPanel();
|
||||
label7 = new JLabel();
|
||||
nameTextField = new JTextField();
|
||||
label8 = new JLabel();
|
||||
keyField = new JTextField();
|
||||
label9 = new JLabel();
|
||||
typeComboBox = new JComboBox();
|
||||
searchBut = new JButton();
|
||||
reseBut = new JButton();
|
||||
newBut = new JButton();
|
||||
|
||||
//======== this ========
|
||||
setOpaque(false);
|
||||
setLayout(new BorderLayout(10, 10));
|
||||
|
||||
|
||||
|
||||
//======== centerPane ========
|
||||
{
|
||||
centerPane.setOpaque(false);
|
||||
centerPane.setLayout(new BorderLayout(10, 10));
|
||||
|
||||
//======== scrollPane2 ========
|
||||
{
|
||||
tableModel.setColumnIdentifiers(COLUMN_ID);
|
||||
scrollPane2.setViewportView(table);
|
||||
}
|
||||
|
||||
JPanel panel = new WPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
panel.add(scrollPane2);
|
||||
paginationPane = new WPaginationPane() {
|
||||
@Override
|
||||
public void setPageIndex(long pageIndex) {
|
||||
super.setPageIndex(pageIndex);
|
||||
updateData();
|
||||
}
|
||||
};
|
||||
paginationPane.setOpaque(false);
|
||||
panel.add(paginationPane, BorderLayout.SOUTH);
|
||||
centerPane.add(panel, BorderLayout.CENTER);
|
||||
|
||||
//======== toolPane ========
|
||||
{
|
||||
toolPane.setLayout(new MigLayout(
|
||||
"fill,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[left]",
|
||||
// rows
|
||||
"[]"));
|
||||
toolPane.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
//---- label7 ----
|
||||
label7.setText("参数名称");
|
||||
toolPane.add(label7, "cell 0 0");
|
||||
|
||||
//---- postNameTextField ----
|
||||
nameTextField.setColumns(15);
|
||||
toolPane.add(nameTextField, "cell 0 0");
|
||||
|
||||
//---- label8 ----
|
||||
label8.setText("参数键名");
|
||||
toolPane.add(label8, "cell 0 0");
|
||||
|
||||
//---- phoneTextField ----
|
||||
keyField.setColumns(15);
|
||||
toolPane.add(keyField, "cell 0 0");
|
||||
|
||||
//---- label9 ----
|
||||
label9.setText("系统类型");
|
||||
toolPane.add(label9, "cell 0 0");
|
||||
toolPane.add(typeComboBox, "cell 0 0");
|
||||
|
||||
//---- button1 ----
|
||||
searchBut.setText("\u641c\u7d22");
|
||||
toolPane.add(searchBut, "cell 0 0");
|
||||
|
||||
//---- reseBut ----
|
||||
reseBut.setText("\u91cd\u7f6e");
|
||||
toolPane.add(reseBut, "cell 0 0");
|
||||
|
||||
//---- newBut ----
|
||||
newBut.setText("\u65b0\u589e");
|
||||
toolPane.add(newBut, "cell 0 0");
|
||||
}
|
||||
centerPane.add(toolPane, BorderLayout.NORTH);
|
||||
}
|
||||
add(centerPane, BorderLayout.CENTER);
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
|
||||
|
||||
table.setRowHeight(40);
|
||||
|
||||
table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
|
||||
|
||||
AppStore.getDictDataList(INFRA_CONFIG_TYPE).forEach(dictDataSimpleRespVO -> {
|
||||
typeComboBox.addItem(dictDataSimpleRespVO);
|
||||
});
|
||||
typeComboBox.setSelectedItem(null);
|
||||
}
|
||||
|
||||
private JToolBar creatBar() {
|
||||
JToolBar optBar = new JToolBar();
|
||||
optBar.setOpaque(false);
|
||||
JButton edit = new JButton("修改");
|
||||
edit.setForeground(UIManager.getColor("App.accentColor"));
|
||||
edit.setIcon(new FlatSVGIcon("icons/xiugai.svg", 15, 15));
|
||||
edit.addActionListener(e -> showEditDialog());
|
||||
edit.setForeground(UIManager.getColor("App.accentColor"));
|
||||
|
||||
JButton del = new JButton("删除");
|
||||
del.setIcon(new FlatSVGIcon("icons/delte.svg", 15, 15));
|
||||
del.addActionListener(e -> delMenu());
|
||||
del.setForeground(UIManager.getColor("app-error-color-5"));
|
||||
|
||||
|
||||
optBar.add(Box.createGlue());
|
||||
optBar.add(edit);
|
||||
optBar.add(del);
|
||||
optBar.add(Box.createGlue());
|
||||
optBar.setPreferredSize(new Dimension(210, 45));
|
||||
return optBar;
|
||||
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
|
||||
reseBut.addActionListener(e -> reset());
|
||||
searchBut.addActionListener(e -> updateData());
|
||||
newBut.addActionListener(e -> showAddDialog(null));
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
nameTextField.setText("");
|
||||
keyField.setText("");
|
||||
typeComboBox.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
private void showAddDialog(Long id) {
|
||||
ConfigFormPane postFormPane = new ConfigFormPane();
|
||||
postFormPane.updateData(id);
|
||||
int opt = WOptionPane.showOptionDialog(null, postFormPane, "添加", OK_CANCEL_OPTION, PLAIN_MESSAGE, null, new Object[]{"确定", "取消"}, "确定");
|
||||
if (opt == 0) {
|
||||
add(postFormPane.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private void showEditDialog() {
|
||||
|
||||
|
||||
int selRow = table.getSelectedRow();
|
||||
Long postId = null;
|
||||
if (selRow != -1) {
|
||||
postId = Convert.toLong(table.getValueAt(selRow, 0));
|
||||
}
|
||||
|
||||
ConfigFormPane formPane = new ConfigFormPane();
|
||||
formPane.updateData(postId);
|
||||
int opt = WOptionPane.showOptionDialog(null, formPane, "修改", OK_CANCEL_OPTION, PLAIN_MESSAGE, null, new Object[]{"确定", "取消"}, "确定");
|
||||
if (opt == 0) {
|
||||
edit(formPane.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
private void add(ConfigSaveReqVO saveReqVO) {
|
||||
|
||||
SwingWorker<CommonResult<Long>, Object> swingWorker = new SwingWorker<CommonResult<Long>, Object>() {
|
||||
@Override
|
||||
protected CommonResult<Long> doInBackground() throws Exception {
|
||||
return Request.connector(ConfigFeign.class).createConfig(saveReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
try {
|
||||
if (get().isSuccess()) {
|
||||
WMessage.showMessageSuccess(MainFrame.getInstance(),"添加成功!");
|
||||
updateData();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
swingWorker.execute();
|
||||
|
||||
}
|
||||
|
||||
private void edit(ConfigSaveReqVO saveReqVO) {
|
||||
|
||||
|
||||
SwingWorker<CommonResult<Boolean>, Object> swingWorker = new SwingWorker<CommonResult<Boolean>, Object>() {
|
||||
@Override
|
||||
protected CommonResult<Boolean> doInBackground() throws Exception {
|
||||
return Request.connector(ConfigFeign.class).updateConfig(saveReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
try {
|
||||
if (get().isSuccess()) {
|
||||
WMessage.showMessageSuccess(MainFrame.getInstance(),"修改成功!");
|
||||
|
||||
updateData();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
swingWorker.execute();
|
||||
|
||||
}
|
||||
|
||||
private void delMenu() {
|
||||
Long id = null;
|
||||
String name = null;
|
||||
|
||||
int selRow = table.getSelectedRow();
|
||||
if (selRow != -1) {
|
||||
id = Convert.toLong(table.getValueAt(selRow, 0));
|
||||
name = Convert.toStr(table.getValueAt(selRow, 1));
|
||||
}
|
||||
|
||||
int opt = WOptionPane.showOptionDialog(this, "是否确定删除[" + name + "]?", "提示", OK_CANCEL_OPTION, WARNING_MESSAGE, null, null, null);
|
||||
|
||||
if (opt != 0) {
|
||||
return;
|
||||
}
|
||||
Long finalId = id;
|
||||
SwingWorker<CommonResult<Boolean>, Object> swingWorker = new SwingWorker<CommonResult<Boolean>, Object>() {
|
||||
@Override
|
||||
protected CommonResult<Boolean> doInBackground() throws Exception {
|
||||
return Request.connector(ConfigFeign.class).deleteConfig(finalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
try {
|
||||
if (get().isSuccess()) {
|
||||
WMessage.showMessageSuccess(MainFrame.getInstance(),"删除成功!");
|
||||
|
||||
updateData();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
swingWorker.execute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
if (table != null) {
|
||||
table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateData() {
|
||||
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("pageNo", paginationPane.getPageIndex());
|
||||
queryMap.put("pageSize", paginationPane.getPageSize());
|
||||
|
||||
if (StrUtil.isNotBlank(nameTextField.getText())) {
|
||||
queryMap.put("name", nameTextField.getText());
|
||||
}
|
||||
if (StrUtil.isNotBlank(keyField.getText())) {
|
||||
queryMap.put("key", keyField.getText());
|
||||
}
|
||||
if (typeComboBox.getSelectedItem() != null) {
|
||||
DictDataSimpleRespVO selectedItem = (DictDataSimpleRespVO) typeComboBox.getSelectedItem();
|
||||
queryMap.put("type", selectedItem.getValue());
|
||||
}
|
||||
|
||||
SwingWorker<Vector<Vector>, Long> swingWorker = new SwingWorker<Vector<Vector>, Long>() {
|
||||
@Override
|
||||
protected Vector<Vector> doInBackground() throws Exception {
|
||||
CommonResult<PageResult<ConfigRespVO>> result = Request.connector(ConfigFeign.class).getConfigPage(queryMap);
|
||||
|
||||
Vector<Vector> tableData = new Vector<>();
|
||||
|
||||
|
||||
if (result.isSuccess()) {
|
||||
|
||||
result.getData().getList().forEach(respVO -> {
|
||||
Vector rowV = new Vector();
|
||||
rowV.add(respVO.getId());
|
||||
rowV.add(respVO.getCategory());
|
||||
rowV.add(respVO.getName());
|
||||
rowV.add(respVO.getKey());
|
||||
rowV.add(respVO.getValue());
|
||||
rowV.add(respVO.getVisible());
|
||||
rowV.add(respVO.getType());
|
||||
rowV.add(respVO.getRemark());
|
||||
rowV.add(DateUtil.format(respVO.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
rowV.add(respVO);
|
||||
tableData.add(rowV);
|
||||
});
|
||||
|
||||
publish(result.getData().getTotal());
|
||||
}
|
||||
return tableData;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void process(List<Long> chunks) {
|
||||
chunks.forEach(total -> paginationPane.setTotal(total));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
try {
|
||||
|
||||
|
||||
tableModel.setDataVector(get(), new Vector<>(Arrays.asList(COLUMN_ID)));
|
||||
table.getColumn("操作").setCellRenderer(new OptButtonTableCellRenderer(creatBar()));
|
||||
table.getColumn("操作").setCellEditor(new OptButtonTableCellEditor(creatBar()));
|
||||
|
||||
table.getColumn("是否可见").setCellRenderer(new DefaultTableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 10));
|
||||
JLabel label = BadgeLabelUtil.getBadgeLabel(INFRA_BOOLEAN_STRING, value);
|
||||
|
||||
panel.add(label);
|
||||
panel.setBackground(component.getBackground());
|
||||
panel.setOpaque(isSelected);
|
||||
return panel;
|
||||
}
|
||||
}); table.getColumn("系统内置").setCellRenderer(new DefaultTableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 10));
|
||||
JLabel label = BadgeLabelUtil.getBadgeLabel(INFRA_CONFIG_TYPE, value);
|
||||
|
||||
panel.add(label);
|
||||
panel.setBackground(component.getBackground());
|
||||
panel.setOpaque(isSelected);
|
||||
return panel;
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
swingWorker.execute();
|
||||
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
||||
// Generated using JFormDesigner non-commercial license
|
||||
private JTextField textField;
|
||||
private JScrollPane scrollPane1;
|
||||
private JPanel centerPane;
|
||||
private JScrollPane scrollPane2;
|
||||
private JTable table;
|
||||
private JPanel toolPane;
|
||||
private JLabel label7;
|
||||
private JTextField nameTextField;
|
||||
private JLabel label8;
|
||||
private JTextField keyField;
|
||||
private JLabel label9;
|
||||
private JComboBox typeComboBox;
|
||||
private JButton searchBut;
|
||||
private JButton reseBut;
|
||||
private JButton newBut;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||
}
|
@ -75,7 +75,6 @@ App.hoverBackground=$Button.hoverBackground
|
||||
|
||||
|
||||
|
||||
|
||||
Button.margin = @componentMargin
|
||||
|
||||
|
||||
|