feat(客户评估): 实现客户评估表单的搜索和显示功能
添加客户评估表单文件的搜索功能,支持按公司ID和搜索文本查询 新增CompanyCustomerEvaluationFormFileStringConverter用于文件显示转换 优化自动完成功能,支持自定义搜索逻辑 移除不必要的文件路径属性绑定 重构客户评估表单窗口控制器继承结构
This commit is contained in:
@@ -250,10 +250,16 @@ public class UITools {
|
||||
|
||||
public static <T extends IdentityEntity, TV extends IdentityViewModel<T>> AutoCompletionBinding<T> autoCompletion(
|
||||
TextField textField, ObjectProperty<Integer> idProperty, QueryService<T, TV> queryService) {
|
||||
Integer id = idProperty.get();
|
||||
StringConverter<T> converter = queryService.getStringConverter();
|
||||
|
||||
return autoCompletion(textField, idProperty, queryService, converter, queryService::search);
|
||||
}
|
||||
|
||||
public static <T extends IdentityEntity, TV extends IdentityViewModel<T>> AutoCompletionBinding<T> autoCompletion(
|
||||
TextField textField, ObjectProperty<Integer> idProperty, QueryService<T, TV> service, StringConverter<T> converter, Function<String, List<T>> searcher) {
|
||||
Integer id = idProperty.get();
|
||||
if (id != null) {
|
||||
T entity = queryService.findById(id);
|
||||
T entity = service.findById(id);
|
||||
// 先赋值
|
||||
textField.textProperty().set(converter.toString(entity));
|
||||
}
|
||||
@@ -264,7 +270,7 @@ public class UITools {
|
||||
textField.textProperty().set(null);
|
||||
return;
|
||||
}
|
||||
T newEntity = queryService.findById(newValue);
|
||||
T newEntity = service.findById(newValue);
|
||||
textField.textProperty().set(converter.toString(newEntity));
|
||||
});
|
||||
|
||||
@@ -274,7 +280,7 @@ public class UITools {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return queryService.search(p.getUserText());
|
||||
return searcher.apply(p.getUserText());
|
||||
} catch (Exception e) {
|
||||
textField.setText(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
|
||||
Reference in New Issue
Block a user