feat: 添加功能模块相关字段和界面优化
- 在FUNC表中添加CONTROLLER、ICON和DESCRIPTION字段 - 重构角色管理相关类名和路径 - 优化公司表格单元格显示逻辑 - 添加功能权限管理界面 - 优化日志配置和FXML文件引用 - 移除冗余代码和注释
This commit is contained in:
4
docs/add_function_columns.sql
Normal file
4
docs/add_function_columns.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- 添加CONTROLLER、ICON和DESCRIPTION字段到FUNC表
|
||||
ALTER TABLE supplier_ms.FUNC
|
||||
ADD COLUMN DESCRIPTION VARCHAR(255);
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
package com.ecep.contract.manager.cloud.rk;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ecep.contract.manager.ds.MyRepository;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
|
||||
@Repository
|
||||
public interface CloudRkRepository
|
||||
// curd
|
||||
extends CrudRepository<CloudRk, Integer>, PagingAndSortingRepository<CloudRk, Integer>,
|
||||
// JPA interfaces
|
||||
JpaRepository<CloudRk, Integer>, JpaSpecificationExecutor<CloudRk> {
|
||||
public interface CloudRkRepository extends MyRepository<CloudRk, Integer> {
|
||||
|
||||
Stream<CloudRk> findByCloudLatestAfter(Instant timestamp);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.model.CompanyContact;
|
||||
import com.ecep.contract.manager.ds.company.model.CompanyOldName;
|
||||
import com.ecep.contract.manager.ds.company.repository.CompanyContactRepository;
|
||||
import com.ecep.contract.manager.ds.company.repository.CompanyOldNameRepository;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyOldNameService;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
package com.ecep.contract.manager.cloud.tyc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.manager.SpringApp;
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.ui.util.LocalDateTimeTableCell;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.ContextMenu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CloudTycManagerSkin
|
||||
extends AbstEntityManagerSkin<CloudTyc, CloudTycInfoViewModel, CloudTycManagerSkin, CloudTycManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends
|
||||
AbstEntityManagerSkin<CloudTyc, CloudTycInfoViewModel, CloudTycManagerSkin, CloudTycManagerWindowController> {
|
||||
@Setter
|
||||
private CloudTycService cloudTycService;
|
||||
|
||||
@@ -58,8 +59,7 @@ public class CloudTycManagerSkin
|
||||
Path<Object> company = root.get("company");
|
||||
return builder.or(
|
||||
builder.like(company.get("name"), "%" + searchText + "%"),
|
||||
builder.like(company.get("shortName"), "%" + searchText + "%")
|
||||
);
|
||||
builder.like(company.get("shortName"), "%" + searchText + "%"));
|
||||
};
|
||||
|
||||
Specification<CloudTyc> cloudIdSpec = (root, query, builder) -> {
|
||||
|
||||
@@ -1,40 +1,26 @@
|
||||
package com.ecep.contract.manager.cloud.tyc;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.manager.SpringApp;
|
||||
import com.ecep.contract.manager.cloud.CloudBaseInfo;
|
||||
import com.ecep.contract.manager.cloud.CloudInfo;
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import com.ecep.contract.manager.ui.util.DelayOnceExecutor;
|
||||
import com.ecep.contract.manager.ui.util.LocalDateTimeTableCell;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.ecep.contract.manager.util.TableViewUtils.getTableViewVisibleRows;
|
||||
|
||||
/**
|
||||
* 天眼查信息管理窗口控制器
|
||||
@@ -56,23 +42,28 @@ public class CloudTycManagerWindowController
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
|
||||
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, LocalDateTime> latestUpdateColumn;
|
||||
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, Company> companyColumn;
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, String> cloudIdColumn;
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, LocalDateTime> cloudLatestColumn;
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, Number> scoreColumn;
|
||||
|
||||
@FXML
|
||||
public TableColumn<CloudTycInfoViewModel, String> descriptionColumn;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CloudTycService getViewModelService() {
|
||||
return cloudTycService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CloudTycManagerSkin createDefaultSkin() {
|
||||
return new CloudTycManagerSkin(this);
|
||||
@@ -80,7 +71,8 @@ public class CloudTycManagerWindowController
|
||||
|
||||
@Override
|
||||
public void show(Stage stage) {
|
||||
super.show(stage);getTitle().set("数据源:天眼查");
|
||||
super.show(stage);
|
||||
getTitle().set("数据源:天眼查");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +80,8 @@ public class CloudTycManagerWindowController
|
||||
*/
|
||||
public void onDateTransferAction(ActionEvent event) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
com.ecep.contract.manager.cloud.CloudInfoRepository cloudInfoRepository = SpringApp.getBean(com.ecep.contract.manager.cloud.CloudInfoRepository.class);
|
||||
com.ecep.contract.manager.cloud.CloudInfoRepository cloudInfoRepository = SpringApp
|
||||
.getBean(com.ecep.contract.manager.cloud.CloudInfoRepository.class);
|
||||
cloudInfoRepository.findAll().forEach(v -> {
|
||||
try {
|
||||
CloudTyc cloudTyc = cloudTycService.getOrCreateCloudTyc(v);
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
package com.ecep.contract.manager.cloud.tyc;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ecep.contract.manager.ds.MyRepository;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
|
||||
@Repository
|
||||
public interface CloudTycRepository
|
||||
// curd
|
||||
extends CrudRepository<CloudTyc, Integer>, PagingAndSortingRepository<CloudTyc, Integer>,
|
||||
// JPA interfaces
|
||||
JpaRepository<CloudTyc, Integer>, JpaSpecificationExecutor<CloudTyc> {
|
||||
public interface CloudTycRepository extends MyRepository<CloudTyc, Integer> {
|
||||
|
||||
List<CloudTyc> findAllByCompanyId(Integer companyId);
|
||||
|
||||
@@ -27,5 +21,4 @@ public interface CloudTycRepository
|
||||
@Transactional
|
||||
int deleteAllByCompany(Company company);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.ecep.contract.manager.cloud.u8;
|
||||
|
||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
||||
import com.ecep.contract.manager.ds.contract.tasker.AbstContractRepairTasker;
|
||||
import com.ecep.contract.manager.ui.MessageHolder;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
import com.ecep.contract.manager.ds.contract.tasker.AbstContractRepairTasker;
|
||||
import com.ecep.contract.manager.ui.MessageHolder;
|
||||
|
||||
/**
|
||||
* 用友U8系统-同步全量合同
|
||||
|
||||
@@ -16,8 +16,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CompanyManagerSkin
|
||||
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyOldNameService companyOldNameService;
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -27,11 +28,17 @@ public class CompanyManagerWindowController
|
||||
extends AbstManagerWindowController<Company, CompanyViewModel, CompanyManagerSkin> {
|
||||
|
||||
// columns
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> uniscidColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> entStatusColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, LocalDate> createdColumn;
|
||||
@FXML
|
||||
public TableColumn<CompanyViewModel, String> memoColumn;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.ecep.contract.manager.ds.company.controller;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import static com.ecep.contract.manager.SpringApp.getBean;
|
||||
|
||||
public class CompanyTableCell<V> extends javafx.scene.control.TableCell<V, com.ecep.contract.manager.ds.company.model.Company> {
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.manager.Desktop;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
public class CompanyTableCell<V>
|
||||
extends javafx.scene.control.TableCell<V, com.ecep.contract.manager.ds.company.model.Company> {
|
||||
|
||||
private CompanyService companyService;
|
||||
|
||||
|
||||
public CompanyTableCell() {
|
||||
}
|
||||
|
||||
@@ -33,9 +38,27 @@ public class CompanyTableCell<V> extends javafx.scene.control.TableCell<V, com.e
|
||||
setText(null);
|
||||
return;
|
||||
}
|
||||
if (!Hibernate.isInitialized(item)) {
|
||||
item = getCompanyService().findById(item.getId());
|
||||
if (Hibernate.isInitialized(item)) {
|
||||
setText(formart(item));
|
||||
return;
|
||||
}
|
||||
setText(item.getName());
|
||||
setText("# " + item.getId());
|
||||
submit(this::asyncLoadAndUpdate);
|
||||
}
|
||||
|
||||
Future<?> submit(Runnable var1){
|
||||
return Desktop.instance.getExecutorService().submit(var1);
|
||||
}
|
||||
|
||||
private String formart(Company company) {
|
||||
return company.getName();
|
||||
}
|
||||
|
||||
private void asyncLoadAndUpdate() {
|
||||
Company company = getCompanyService().findById(getItem().getId());
|
||||
Platform.runLater(() -> {
|
||||
setText(formart(company));
|
||||
setItem(company);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
package com.ecep.contract.manager.ds.company.model;
|
||||
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.model.NamedEntity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.model.NamedEntity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Version;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 公司信息类,保存企业信息
|
||||
*/
|
||||
@@ -21,7 +28,7 @@ import java.util.Objects;
|
||||
@Entity
|
||||
@Table(name = "COMPANY")
|
||||
@ToString
|
||||
public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.manager.ds.other.model.Entity {
|
||||
public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.manager.ds.other.model.Entity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -32,21 +39,22 @@ public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
* <p>
|
||||
* 编码结构
|
||||
*
|
||||
* <pre>
|
||||
* 1 | 1 | 6 | 9 | 1 <br>
|
||||
* 登记管理部门代码|机构类别代码|登记管理机关行政区划码|主体标识码|校验码
|
||||
* 1 | 1 | 6 | 9 | 1 < br > 登记管理部门代码 | 机构类别代码 | 登记管理机关行政区划码 | 主体标识码 | 校验码
|
||||
* </pre>
|
||||
* <ul>
|
||||
* <li>登记管理部门代码(第 1 位):<br>
|
||||
* 例如,9 代表工商部门登记的企业等。</li>
|
||||
* <li>机构类别代码(第 2 位):不同的数字表示不同类型的机构。如 1 表示企业,2 表示个体工商户等。</li>
|
||||
* <li>登记管理机关行政区划码(第 3 - 8 位):这 6 位数字代表了登记管理机关所在的行政区划,与身份证号码的前 6 位类似,可对应到具体的地区。</li>
|
||||
* <li>主体标识码(组织机构代码,第 9 - 17 位):它是对中华人民共和国境内依法注册、依法登记的机关、企事业单位、社会团体和民办非企业单位等机构颁发的一个在全国范围内唯一的、始终不变的代码。</li>
|
||||
* <li>登记管理机关行政区划码(第 3 - 8 位):这 6 位数字代表了登记管理机关所在的行政区划,与身份证号码的前 6
|
||||
* 位类似,可对应到具体的地区。</li>
|
||||
* <li>主体标识码(组织机构代码,第 9 - 17
|
||||
* 位):它是对中华人民共和国境内依法注册、依法登记的机关、企事业单位、社会团体和民办非企业单位等机构颁发的一个在全国范围内唯一的、始终不变的代码。</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*/
|
||||
@@ -176,19 +184,27 @@ public class Company implements IdentityEntity, NamedEntity, com.ecep.contract.
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object object) {
|
||||
if (this == object) return true;
|
||||
if (object == null) return false;
|
||||
Class<?> oEffectiveClass = object instanceof HibernateProxy ? ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass() : object.getClass();
|
||||
Class<?> thisEffectiveClass = this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass() : this.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass) return false;
|
||||
if (this == object)
|
||||
return true;
|
||||
if (object == null)
|
||||
return false;
|
||||
Class<?> oEffectiveClass = object instanceof HibernateProxy
|
||||
? ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass()
|
||||
: object.getClass();
|
||||
Class<?> thisEffectiveClass = this instanceof HibernateProxy
|
||||
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass()
|
||||
: this.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass)
|
||||
return false;
|
||||
Company company = (Company) object;
|
||||
return getId() != null && Objects.equals(getId(), company.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
|
||||
return this instanceof HibernateProxy
|
||||
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode()
|
||||
: getClass().hashCode();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.ecep.contract.manager.ds.contract.controller;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.contract.ContractPayWay;
|
||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
||||
import com.ecep.contract.manager.ds.contract.model.ContractGroup;
|
||||
@@ -12,31 +17,33 @@ import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.util.converter.CurrencyStringConverter;
|
||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class ContractManagerSkin
|
||||
extends AbstEntityManagerSkin<Contract, ContractViewModel, ContractManagerSkin, ContractManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
@Setter
|
||||
private ContractService contractService;
|
||||
private CompanyService companyService;
|
||||
|
||||
public ContractManagerSkin(ContractManagerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
public ContractService getContractService() {
|
||||
if (contractService == null) {
|
||||
contractService = getBean(ContractService.class);
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
public CompanyService getCompanyService() {
|
||||
if (companyService == null) {
|
||||
companyService = getBean(CompanyService.class);
|
||||
}
|
||||
return contractService;
|
||||
return companyService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,10 +59,7 @@ public class ContractManagerSkin
|
||||
builder.equal(payWay, ContractPayWay.PAY),
|
||||
builder.or(
|
||||
builder.equal(parentCode, ""),
|
||||
parentCode.isNull()
|
||||
)
|
||||
)
|
||||
);
|
||||
parentCode.isNull())));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +75,7 @@ public class ContractManagerSkin
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
ComboBoxUtils.initialComboBox(controller.groupSelector, contractService.findAllGroups(), true);
|
||||
ComboBoxUtils.initialComboBox(controller.groupSelector, getContractService().findAllGroups(), true);
|
||||
controller.groupSelector.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
loadTableDataSet(false);
|
||||
});
|
||||
@@ -80,32 +84,33 @@ public class ContractManagerSkin
|
||||
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
controller.codeColumn.setCellValueFactory(param -> param.getValue().getCode());
|
||||
controller.groupColumn.setCellValueFactory(param -> param.getValue().getGroup());
|
||||
controller.groupColumn.setCellFactory(param -> new ContractGroupTableCell(contractService));
|
||||
controller.groupColumn.setCellFactory(param -> new ContractGroupTableCell(getContractService()));
|
||||
controller.typeColumn.setCellValueFactory(param -> param.getValue().getType());
|
||||
controller.typeColumn.setCellFactory(param -> new ContractTypeTableCell(contractService));
|
||||
controller.typeColumn.setCellFactory(param -> new ContractTypeTableCell(getContractService()));
|
||||
controller.kindColumn.setCellValueFactory(param -> param.getValue().getKind());
|
||||
controller.kindColumn.setCellFactory(param -> new ContractKindTableCell(contractService));
|
||||
controller.kindColumn.setCellFactory(param -> new ContractKindTableCell(getContractService()));
|
||||
|
||||
controller.parentCodeColumn.setCellValueFactory(param -> param.getValue().getParentCode());
|
||||
|
||||
|
||||
controller.setupDateColumn.setCellValueFactory(param -> param.getValue().getSetupDate());
|
||||
controller.orderDateColumn.setCellValueFactory(param -> param.getValue().getOrderDate());
|
||||
controller.startDateColumn.setCellValueFactory(param -> param.getValue().getStartDate());
|
||||
|
||||
|
||||
controller.employeeColumn.setCellValueFactory(param -> param.getValue().getEmployee());
|
||||
controller.employeeColumn.setCellFactory(TextFieldTableCell.forTableColumn(getBean(EmployeeStringConverter.class)));
|
||||
controller.employeeColumn
|
||||
.setCellFactory(TextFieldTableCell.forTableColumn(getBean(EmployeeStringConverter.class)));
|
||||
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATETIME_FORMAT_PATTERN);
|
||||
controller.createdColumn.setCellFactory(TextFieldTableCell.forTableColumn(new LocalDateTimeStringConverter(formatter, null)));
|
||||
controller.createdColumn
|
||||
.setCellFactory(TextFieldTableCell.forTableColumn(new LocalDateTimeStringConverter(formatter, null)));
|
||||
|
||||
controller.amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
|
||||
controller.amountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale(), "#,##0")));
|
||||
controller.amountColumn
|
||||
.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale(), "#,##0")));
|
||||
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>());
|
||||
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
||||
|
||||
Platform.runLater(() -> {
|
||||
controller.composeViewBtn.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
|
||||
@@ -66,7 +66,6 @@ public class ContractManagerWindowController
|
||||
@Override
|
||||
protected ContractManagerSkin createDefaultSkin() {
|
||||
ContractManagerSkin skin = new ContractManagerSkin(this);
|
||||
skin.setContractService(contractService);
|
||||
return skin;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.ecep.contract.manager.ds.contract.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.manager.SpringApp;
|
||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
||||
import com.ecep.contract.manager.ds.contract.model.ExtendVendorInfo;
|
||||
@@ -9,34 +14,38 @@ import com.ecep.contract.manager.ds.vendor.model.VendorGroup;
|
||||
import com.ecep.contract.manager.ds.vendor.service.VendorGroupService;
|
||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.TabSkin;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.util.converter.NumberStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@FxmlPath("/ui/contract/contract-tab-ext-vendor-info.fxml")
|
||||
public class ContractTabSkinExtendVendorInfo
|
||||
extends AbstContractBasedTabSkin
|
||||
implements TabSkin {
|
||||
|
||||
extends AbstContractBasedTabSkin {
|
||||
|
||||
@Setter
|
||||
private ExtendVendorInfoService extendVendorInfoService;
|
||||
@Setter
|
||||
private VendorGroupService vendorGroupService;
|
||||
|
||||
@FXML
|
||||
public ComboBox<VendorGroup> vendorGroupField;
|
||||
@FXML
|
||||
public Label vendorGroupLabel;
|
||||
@FXML
|
||||
public TextField sequenceNumberField;
|
||||
@FXML
|
||||
public CheckBox assignedProviderField;
|
||||
@FXML
|
||||
public CheckBox prePurchaseField;
|
||||
|
||||
CompletableFuture<ExtendVendorInfo> loadedFuture;
|
||||
@@ -114,8 +123,8 @@ public class ContractTabSkinExtendVendorInfo
|
||||
return v.getDescription();
|
||||
}));
|
||||
|
||||
|
||||
sequenceNumberField.textProperty().bindBidirectional(viewModel.getCodeSequenceNumber(), new NumberStringConverter());
|
||||
sequenceNumberField.textProperty().bindBidirectional(viewModel.getCodeSequenceNumber(),
|
||||
new NumberStringConverter());
|
||||
assignedProviderField.selectedProperty().bindBidirectional(viewModel.getAssignedProvider());
|
||||
assignedProviderField.disableProperty().bind(Bindings.createBooleanBinding(() -> {
|
||||
VendorGroup group = viewModel.getGroup().get();
|
||||
@@ -128,7 +137,6 @@ public class ContractTabSkinExtendVendorInfo
|
||||
prePurchaseField.selectedProperty().bindBidirectional(viewModel.getPrePurchase());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (loadedFuture != null) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.*;
|
||||
@@ -177,29 +178,46 @@ public class ContractVerifyWindowController extends BaseController {
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
@FXML
|
||||
public DatePicker setupDateBeginSelector;
|
||||
@FXML
|
||||
public DatePicker setupDateEndSelector;
|
||||
// 企业验证开关
|
||||
@FXML
|
||||
public CheckMenuItem verifyCompanyStatusChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCompanyPathChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCompanyCreditChecker;
|
||||
// 供应商验证开关
|
||||
@FXML
|
||||
public CheckMenuItem verifyVendorChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyVendorFileChecker;
|
||||
// 客户验证开关
|
||||
@FXML
|
||||
public CheckMenuItem verifyCustomerChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCustomerFileChecker;
|
||||
@FXML
|
||||
public CheckMenuItem verifyCustomerSubContractDateChecker;
|
||||
|
||||
@FXML
|
||||
public CheckMenuItem onlyShowVerifiedChecker;
|
||||
|
||||
|
||||
@FXML
|
||||
public TableView<Model> viewTable;
|
||||
private final ObservableList<Model> viewTableDataSet = FXCollections.observableArrayList();
|
||||
@FXML
|
||||
public TableColumn<Model, String> viewTable_codeColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, String> viewTable_nameColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, Employee> viewTable_employeeColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, LocalDate> viewTable_setupDateColumn;
|
||||
@FXML
|
||||
public TableColumn<Model, ObservableList<MessageExt>> viewTable_stateColumn;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ecep.contract.manager.ds.customer.controller;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
||||
@@ -8,22 +11,14 @@ import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.MyStringUtils;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CompanyCustomerManagerSkin
|
||||
extends AbstEntityManagerSkin<CompanyCustomer, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends
|
||||
AbstEntityManagerSkin<CompanyCustomer, CompanyCustomerViewModel, CompanyCustomerManagerSkin, CompanyCustomerManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@@ -46,18 +41,14 @@ public class CompanyCustomerManagerSkin
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
controller.companyColumn.setCellValueFactory(param -> Bindings.createStringBinding(() -> {
|
||||
Company company = param.getValue().getCompany().get();
|
||||
if (company != null && !Hibernate.isInitialized(company)) {
|
||||
company = companyService.findById(company.getId());
|
||||
}
|
||||
return company == null ? "-" : company.getName();
|
||||
}, param.getValue().getCompany()));
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||
controller.companyColumn.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
||||
|
||||
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
||||
controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath());
|
||||
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
controller.createdColumn
|
||||
.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
Platform.runLater(() -> {
|
||||
getTableView().getSortOrder().add(controller.idColumn);
|
||||
});
|
||||
|
||||
@@ -1,25 +1,10 @@
|
||||
package com.ecep.contract.manager.ds.customer.controller;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@@ -29,10 +14,31 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@@ -43,7 +49,7 @@ public class CompanyCustomerManagerWindowController
|
||||
|
||||
// columns
|
||||
public TableColumn<CompanyCustomerViewModel, Number> idColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, String> companyColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, Company> companyColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, String> catalogColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, LocalDate> developDateColumn;
|
||||
public TableColumn<CompanyCustomerViewModel, String> pathColumn;
|
||||
@@ -72,7 +78,6 @@ public class CompanyCustomerManagerWindowController
|
||||
return skin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对所有客户的文件进行重置
|
||||
* <p>
|
||||
@@ -108,7 +113,6 @@ public class CompanyCustomerManagerWindowController
|
||||
dialog.initOwner(table.getScene().getWindow());
|
||||
dialog.show();
|
||||
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
Pageable pageRequest = PageRequest.ofSize(50);
|
||||
while (!canceled.get()) {
|
||||
@@ -166,5 +170,4 @@ public class CompanyCustomerManagerWindowController
|
||||
UITools.showTaskDialogAndWait("导出Excel", tasker, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.ecep.contract.manager.ds.other.controller.department.DepartmentManage
|
||||
import com.ecep.contract.manager.ds.other.controller.employee.EmployeeManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.inventory.InventoryManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeFunctionsManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeRolesManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeRoleManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.project.controller.ProjectManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.vendor.controller.CompanyVendorManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.BaseController;
|
||||
@@ -198,7 +198,7 @@ public class HomeWindowController extends BaseController {
|
||||
}
|
||||
|
||||
public void onShowRolesManagerWindowAction(ActionEvent event) {
|
||||
showInOwner(EmployeeRolesManagerWindowController.class);
|
||||
showInOwner(EmployeeRoleManagerWindowController.class);
|
||||
}
|
||||
|
||||
public void onShowFunctionManagerWindowAction(ActionEvent event) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
@@ -27,17 +28,29 @@ import java.time.LocalDate;
|
||||
public class EmployeeManagerWindowController
|
||||
extends AbstManagerWindowController<Employee, EmployeeViewModel, EmployeeManagerSkin> {
|
||||
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> accountColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, Department> departmentColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> aliasColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> codeColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, String> emailColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, LocalDate> createdColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, LocalDate> entryDateColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, LocalDate> leaveDateColumn;
|
||||
@FXML
|
||||
public TableColumn<EmployeeViewModel, Boolean> activeColumn;
|
||||
@FXML
|
||||
public CheckBox activeCheckBox;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,7 @@ import java.util.List;
|
||||
|
||||
@FxmlPath("/ui/employee/employee-auth-bind.fxml")
|
||||
public class EmployeeTabSkinAuthBind
|
||||
extends AbstEmployeeTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel>
|
||||
implements EditableEntityTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel> {
|
||||
extends AbstEmployeeTableTabSkin<EmployeeAuthBind, EmployeeAuthBindViewModel> {
|
||||
public TableColumn<EmployeeAuthBindViewModel, Number> idColumn;
|
||||
public TableColumn<EmployeeAuthBindViewModel, String> ipColumn;
|
||||
public TableColumn<EmployeeAuthBindViewModel, String> macColumn;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -27,18 +28,31 @@ import javafx.stage.Stage;
|
||||
public class InventoryManagerWindowController
|
||||
extends AbstManagerWindowController<Inventory, InventoryViewModel, InventoryManagerSkin> {
|
||||
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> codeColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, InventoryCatalog> catalogColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> specificationColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> unitColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> purchaseTaxRateColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> purchasePriceColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> saleTaxRateColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, Number> salePriceColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, LocalDate> createTimeColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, LocalDateTime> updateDateColumn;
|
||||
@FXML
|
||||
public TableColumn<InventoryViewModel, String> descriptionColumn;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.stage.WindowEvent;
|
||||
@@ -19,44 +20,81 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@FxmlPath("/ui/inventory/inventory.fxml")
|
||||
public class InventoryWindowController extends AbstEntityController<Inventory, InventoryViewModel> {
|
||||
@FXML
|
||||
public BorderPane root;
|
||||
@FXML
|
||||
public TabPane tabPane;
|
||||
@FXML
|
||||
public Tab baseInfoTab;
|
||||
@FXML
|
||||
public Tab historyPriceTab;
|
||||
@FXML
|
||||
public Tab contractsTab;
|
||||
|
||||
|
||||
@FXML
|
||||
public TextField nameField;
|
||||
@FXML
|
||||
public CheckBox nameLockField;
|
||||
@FXML
|
||||
public TextField catalogField;
|
||||
@FXML
|
||||
public TextField unitField;
|
||||
@FXML
|
||||
public TextField codeField;
|
||||
@FXML
|
||||
public TextField specificationField;
|
||||
@FXML
|
||||
public CheckBox specificationLockField;
|
||||
@FXML
|
||||
public TextField purchasePriceField;
|
||||
@FXML
|
||||
public TextField purchaseTaxRateField;
|
||||
@FXML
|
||||
public TextField purchaseTaxPriceField;
|
||||
@FXML
|
||||
public TextField creatorField;
|
||||
@FXML
|
||||
public TextField createTimeField;
|
||||
@FXML
|
||||
public TextField updaterField;
|
||||
@FXML
|
||||
public TextField updateDateField;
|
||||
@FXML
|
||||
public TextField saleTaxRateField;
|
||||
@FXML
|
||||
public TextField salePriceField;
|
||||
@FXML
|
||||
public TextField saleTaxPriceField;
|
||||
@FXML
|
||||
public TextArea descriptionField;
|
||||
@FXML
|
||||
public Button syncBtn;
|
||||
@FXML
|
||||
public TextField weightUnitField;
|
||||
@FXML
|
||||
public TextField sizeUnitField;
|
||||
@FXML
|
||||
public TextField volumeUnitField;
|
||||
@FXML
|
||||
public TextField weightField;
|
||||
@FXML
|
||||
public TextField packagedWeightField;
|
||||
@FXML
|
||||
public TextField sizeLengthField;
|
||||
@FXML
|
||||
public TextField sizeWidthField;
|
||||
@FXML
|
||||
public TextField sizeHeightField;
|
||||
@FXML
|
||||
public TextField volumeField;
|
||||
@FXML
|
||||
public TextField packagedSizeLengthField;
|
||||
@FXML
|
||||
public TextField packagedSizeWidthField;
|
||||
@FXML
|
||||
public TextField packagedSizeHeightField;
|
||||
@FXML
|
||||
public TextField packagedVolumeField;
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@ import com.ecep.contract.manager.ds.other.service.FunctionService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.manager.ui.TabSkin;
|
||||
|
||||
public abstract class AbstEmployeeRoleBasedTabSkin
|
||||
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRole, EmployeeRoleViewModel>
|
||||
implements TabSkin {
|
||||
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRole, EmployeeRoleViewModel> {
|
||||
|
||||
private EmployeeRoleService roleService;
|
||||
private FunctionService functionService;
|
||||
@@ -38,5 +36,4 @@ public abstract class AbstEmployeeRoleBasedTabSkin
|
||||
return controller.permissionService;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.stage.Stage;
|
||||
@@ -32,16 +33,18 @@ public class EmployeeFunctionsManagerWindowController
|
||||
@Autowired
|
||||
FunctionService functionService;
|
||||
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> keyColumn;
|
||||
|
||||
|
||||
public TableView<PermissionViewModel> permissionTable;
|
||||
public TableColumn<PermissionViewModel, Number> permissionTable_idColumn;
|
||||
public TableColumn<PermissionViewModel, String> permissionTable_nameColumn;
|
||||
public TableColumn<PermissionViewModel, String> permissionTable_keyColumn;
|
||||
public TableColumn<PermissionViewModel, String> permissionTable_descriptionColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> controllerColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> iconColumn;
|
||||
@FXML
|
||||
public TableColumn<FunctionViewModel, String> descriptionColumn;
|
||||
|
||||
@Override
|
||||
public void show(Stage stage) {
|
||||
|
||||
@@ -11,13 +11,13 @@ import lombok.Setter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
public class EmployeeRoleManagerSkin
|
||||
extends AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRolesManagerWindowController>
|
||||
extends AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRoleManagerWindowController>
|
||||
implements ManagerSkin, EditableEntityTableTabSkin<EmployeeRole, EmployeeRoleViewModel> {
|
||||
|
||||
@Setter
|
||||
private PermissionService permissionService;
|
||||
|
||||
public EmployeeRoleManagerSkin(EmployeeRolesManagerWindowController controller) {
|
||||
public EmployeeRoleManagerSkin(EmployeeRoleManagerWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityBasedController;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,21 +7,30 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/employee/roles-manager.fxml")
|
||||
public class EmployeeRolesManagerWindowController
|
||||
public class EmployeeRoleManagerWindowController
|
||||
extends AbstManagerWindowController<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeRolesManagerWindowController.class);
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeRoleManagerWindowController.class);
|
||||
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
@Autowired
|
||||
EmployeeRoleService employeeRoleService;
|
||||
|
||||
|
||||
public TableColumn<EmployeeRoleViewModel, Number> idColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, String> codeColumn;
|
||||
public TableColumn<EmployeeRoleViewModel, String> nameColumn;
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.controlsfx.control.ListSelectionView;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ui.TabSkin;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -10,18 +16,13 @@ import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.Tab;
|
||||
import org.controlsfx.control.ListSelectionView;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EmployeeRoleFunctionsTabSkin extends AbstEmployeeRoleBasedTabSkin implements TabSkin {
|
||||
public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
||||
|
||||
private final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||
private ListSelectionView<Function> functionsField;
|
||||
|
||||
public EmployeeRoleFunctionsTabSkin(EmployeeRoleWindowController controller) {
|
||||
public EmployeeRoleTabSkinFunctions(EmployeeRoleWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class EmployeeRoleWindowController extends AbstEntityController<EmployeeR
|
||||
@Override
|
||||
protected void registerTabSkins() {
|
||||
registerTabSkin(baseInfoTab, tab -> new EmployeeRoleTabSkinBase(this));
|
||||
registerTabSkin(functionsTab, tab -> new EmployeeRoleFunctionsTabSkin(this));
|
||||
registerTabSkin(functionsTab, tab -> new EmployeeRoleTabSkinFunctions(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,26 +3,15 @@ package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.BaseViewModel;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.EditableEntityTableTabSkin;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FunctionManagerSkin
|
||||
extends AbstEntityManagerSkin<Function, FunctionViewModel, FunctionManagerSkin, EmployeeFunctionsManagerWindowController>
|
||||
implements ManagerSkin, EditableEntityTableTabSkin<Function, FunctionViewModel> {
|
||||
|
||||
private PermissionManagerSkin permissionManagerSkin;
|
||||
extends
|
||||
AbstEntityManagerSkin<Function, FunctionViewModel, FunctionManagerSkin, EmployeeFunctionsManagerWindowController> {
|
||||
|
||||
public FunctionManagerSkin(EmployeeFunctionsManagerWindowController controller) {
|
||||
super(controller);
|
||||
@@ -30,16 +19,6 @@ public class FunctionManagerSkin
|
||||
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
initializeFunctionTable();
|
||||
if (permissionManagerSkin == null) {
|
||||
permissionManagerSkin = new PermissionManagerSkin(controller);
|
||||
}
|
||||
permissionManagerSkin.install();
|
||||
|
||||
}
|
||||
|
||||
private void initializeFunctionTable() {
|
||||
getTableView().setEditable(true);
|
||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
|
||||
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
@@ -50,10 +29,17 @@ public class FunctionManagerSkin
|
||||
controller.keyColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.keyColumn.setOnEditCommit(this::onKeyColumnEditCommit);
|
||||
|
||||
getTableView().getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||
permissionManagerSkin.setViewModel(newValue);
|
||||
permissionManagerSkin.loadTableDataSet();
|
||||
});
|
||||
controller.controllerColumn.setCellValueFactory(param -> param.getValue().getController());
|
||||
controller.controllerColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.controllerColumn.setOnEditCommit(this::onControllerColumnEditCommit);
|
||||
|
||||
controller.iconColumn.setCellValueFactory(param -> param.getValue().getIcon());
|
||||
controller.iconColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.iconColumn.setOnEditCommit(this::onIconColumnEditCommit);
|
||||
|
||||
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
controller.descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.descriptionColumn.setOnEditCommit(this::onDescriptionColumnEditCommit);
|
||||
}
|
||||
|
||||
private void onNameColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
@@ -64,12 +50,21 @@ public class FunctionManagerSkin
|
||||
acceptCellEditEvent(event, FunctionViewModel::getKey);
|
||||
}
|
||||
|
||||
private void onControllerColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
acceptCellEditEvent(event, FunctionViewModel::getController);
|
||||
}
|
||||
|
||||
private void onIconColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
acceptCellEditEvent(event, FunctionViewModel::getIcon);
|
||||
}
|
||||
|
||||
private void onDescriptionColumnEditCommit(TableColumn.CellEditEvent<FunctionViewModel, String> event) {
|
||||
acceptCellEditEvent(event, FunctionViewModel::getDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (permissionManagerSkin != null) {
|
||||
permissionManagerSkin.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
protected void onTableRowDoubleClickedAction(FunctionViewModel item) {
|
||||
showInOwner(FunctionWindowController.class, item);
|
||||
}
|
||||
|
||||
protected PermissionService getPermissionService() {
|
||||
@@ -80,5 +75,4 @@ public class FunctionManagerSkin
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityBasedTabSkin;
|
||||
|
||||
import javafx.scene.control.Tab;
|
||||
|
||||
public class FunctionTabSkinBase
|
||||
extends AbstEntityBasedTabSkin<FunctionWindowController, Function, FunctionViewModel> {
|
||||
|
||||
public FunctionTabSkinBase(FunctionWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tab getTab() {
|
||||
return controller.baseInfoTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeTab() {
|
||||
// 绑定UI元素与viewModel的属性
|
||||
controller.nameField.textProperty().bindBidirectional(viewModel.getName());
|
||||
controller.keyField.textProperty().bindBidirectional(viewModel.getKey());
|
||||
controller.controllerField.textProperty().bindBidirectional(viewModel.getController());
|
||||
controller.iconField.textProperty().bindBidirectional(viewModel.getIcon());
|
||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.model.Permission;
|
||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ds.other.vo.PermissionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityTableTabSkin;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
|
||||
@FxmlPath("/ui/employee/function-tab-permission.fxml")
|
||||
public class FunctionTabSkinPermission
|
||||
extends
|
||||
AbstEntityTableTabSkin<FunctionWindowController, Function, FunctionViewModel, Permission, PermissionViewModel> {
|
||||
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, Number> idColumn;
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, String> nameColumn;
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, String> keyColumn;
|
||||
@FXML
|
||||
public TableColumn<PermissionViewModel, String> descriptionColumn;
|
||||
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
public FunctionTabSkinPermission(FunctionWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tab getTab() {
|
||||
return controller.permissionTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionService getViewModelService() {
|
||||
return permissionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
super.initializeTable();
|
||||
idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
keyColumn.setCellValueFactory(param -> param.getValue().getKey());
|
||||
// descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Specification<Permission> getSpecification(Function parent) {
|
||||
return SpecificationUtils.and(getSpecification(), (root, query, criteriaBuilder) -> {
|
||||
return criteriaBuilder.equal(root.get("function"), parent);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
import lombok.Getter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/employee/function.fxml")
|
||||
public class FunctionWindowController extends AbstEntityController<Function, FunctionViewModel> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(FunctionWindowController.class);
|
||||
|
||||
/**
|
||||
* 显示界面
|
||||
*/
|
||||
public static void show(FunctionViewModel viewModel, Window window) {
|
||||
show(FunctionWindowController.class, viewModel, window);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public BorderPane root;
|
||||
@FXML
|
||||
public TabPane tabPane;
|
||||
@FXML
|
||||
public Tab baseInfoTab;
|
||||
@FXML
|
||||
public Tab permissionTab;
|
||||
@FXML
|
||||
public TextField nameField;
|
||||
@FXML
|
||||
public TextField keyField;
|
||||
@FXML
|
||||
public TextField controllerField;
|
||||
@FXML
|
||||
public TextField iconField;
|
||||
@FXML
|
||||
public TextField descriptionField;
|
||||
@FXML
|
||||
public Label versionLabel;
|
||||
|
||||
public static void show(Function function, Window owner) {
|
||||
FunctionViewModel model = FunctionViewModel.from(function);
|
||||
show(model, owner);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
FunctionService functionService;
|
||||
|
||||
@Override
|
||||
public void onShown(WindowEvent windowEvent) {
|
||||
super.onShown(windowEvent);
|
||||
getTitle().bind(viewModel.getName().map(name -> "[" + viewModel.getId().get() + "] " + name + " 功能详情"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTabSkins() {
|
||||
registerTabSkin(baseInfoTab, tab -> new FunctionTabSkinBase(this));
|
||||
registerTabSkin(permissionTab, tab -> new FunctionTabSkinPermission(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionService getViewModelService() {
|
||||
return functionService;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
||||
|
||||
@Override
|
||||
public void install() {
|
||||
table = controller.permissionTable;
|
||||
initializeTable();
|
||||
table.setItems(dataSet);
|
||||
loadTableDataSet();
|
||||
@@ -71,17 +70,6 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
||||
public void initializeTable() {
|
||||
table.setEditable(true);
|
||||
|
||||
controller.permissionTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
controller.permissionTable_idColumn.setEditable(false);
|
||||
|
||||
controller.permissionTable_nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||
controller.permissionTable_nameColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.permissionTable_nameColumn.setOnEditCommit(this::onNameColumnEditCommitAction);
|
||||
|
||||
controller.permissionTable_keyColumn.setCellValueFactory(param -> param.getValue().getKey());
|
||||
controller.permissionTable_keyColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
controller.permissionTable_keyColumn.setOnEditCommit(this::onKeyColumnEditCommitAction);
|
||||
|
||||
// controller.permissionTable_descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||
// controller.permissionTable_descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
// controller.permissionTable_descriptionColumn.setOnEditCommit(this::onSignMethodTableDescriptionColumnEditCommitAction);
|
||||
|
||||
@@ -22,4 +22,13 @@ public class Function implements IdentityEntity, NamedEntity {
|
||||
|
||||
@Column(name = "IS_ACTIVE")
|
||||
private boolean active;
|
||||
|
||||
@Column(name = "CONTROLLER", columnDefinition = "VARCHAR(255)")
|
||||
private String controller;
|
||||
|
||||
@Column(name = "ICON", columnDefinition = "VARCHAR(255)")
|
||||
private String icon;
|
||||
|
||||
@Column(name = "DESCRIPTION", columnDefinition = "VARCHAR(255)")
|
||||
private String description;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.ecep.contract.manager.ds.other.service;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.repository.FunctionRepository;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -16,6 +12,11 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.repository.FunctionRepository;
|
||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
||||
import com.ecep.contract.manager.ui.ViewModelService;
|
||||
|
||||
@Lazy
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "function")
|
||||
@@ -24,29 +25,26 @@ public class FunctionService implements ViewModelService<Function, FunctionViewM
|
||||
@Autowired
|
||||
private FunctionRepository functionRepository;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@Cacheable(key = "'func-'+#p0")
|
||||
@Cacheable(key = "#p0")
|
||||
public Function findById(Integer id) {
|
||||
return functionRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
@Cacheable(key = "'func-code-'+#p0")
|
||||
@Cacheable(key = "'code-'+#p0")
|
||||
public Function findByCode(String code) {
|
||||
// return functionRepository.findByCode(code).orElse(null);
|
||||
// return functionRepository.findByCode(code).orElse(null);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "'func-'+#p0.id"),
|
||||
// @CacheEvict(key = "'func-code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public Function save(Function role) {
|
||||
return functionRepository.save(role);
|
||||
}
|
||||
@@ -56,12 +54,10 @@ public class FunctionService implements ViewModelService<Function, FunctionViewM
|
||||
return FunctionViewModel.from(entity);
|
||||
}
|
||||
|
||||
@Caching(
|
||||
evict = {
|
||||
@CacheEvict(key = "'func-'+#p0.id"),
|
||||
// @CacheEvict(key = "'func-code-'+#p0.code")
|
||||
}
|
||||
)
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public void delete(Function entity) {
|
||||
functionRepository.delete(entity);
|
||||
}
|
||||
@@ -78,7 +74,9 @@ public class FunctionService implements ViewModelService<Function, FunctionViewM
|
||||
return (root, query, builder) -> {
|
||||
return builder.or(
|
||||
builder.like(root.get("key"), "%" + searchText + "%"),
|
||||
builder.like(root.get("name"), "%" + searchText + "%")
|
||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||
builder.like(root.get("controller"), "%" + searchText + "%"),
|
||||
builder.like(root.get("icon"), "%" + searchText + "%")
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package com.ecep.contract.manager.ds.other.vo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
private SimpleStringProperty name = new SimpleStringProperty();
|
||||
private SimpleStringProperty key = new SimpleStringProperty();
|
||||
private SimpleStringProperty controller = new SimpleStringProperty();
|
||||
private SimpleStringProperty icon = new SimpleStringProperty();
|
||||
private SimpleStringProperty description = new SimpleStringProperty();
|
||||
|
||||
public static FunctionViewModel from(Function v) {
|
||||
FunctionViewModel model = new FunctionViewModel();
|
||||
@@ -26,6 +29,9 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
super.updateFrom(v);
|
||||
getName().set(v.getName());
|
||||
getKey().set(v.getKey());
|
||||
getController().set(v.getController());
|
||||
getIcon().set(v.getIcon());
|
||||
getDescription().set(v.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,6 +45,18 @@ public class FunctionViewModel extends IdentityViewModel<Function> {
|
||||
v.setKey(key.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(controller.get(), v.getController())) {
|
||||
v.setController(controller.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(icon.get(), v.getIcon())) {
|
||||
v.setIcon(icon.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(description.get(), v.getDescription())) {
|
||||
v.setDescription(description.get());
|
||||
modified = true;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.ecep.contract.manager.ds.other.vo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.Function;
|
||||
import com.ecep.contract.manager.ds.other.model.Permission;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PermissionViewModel extends IdentityViewModel<Permission> {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ecep.contract.manager.ds.project.controller;
|
||||
|
||||
import com.ecep.contract.manager.SpringApp;
|
||||
import com.ecep.contract.manager.ds.company.CompanyStringConverter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
||||
import com.ecep.contract.manager.ds.project.model.ProductType;
|
||||
import com.ecep.contract.manager.ds.project.model.Project;
|
||||
@@ -17,6 +20,7 @@ import com.ecep.contract.manager.ui.BaseController;
|
||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
@@ -24,13 +28,12 @@ import javafx.scene.control.cell.CheckBoxTableCell;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.util.converter.CurrencyStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
public class ProjectManagerSkin
|
||||
extends AbstEntityManagerSkin<Project, ProjectViewModel, ProjectManagerSkin, ProjectManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
@Setter
|
||||
private ProjectService projectService;
|
||||
private CompanyService companyService;
|
||||
@Setter
|
||||
private ProjectTypeService projectTypeService;
|
||||
@Setter
|
||||
@@ -44,10 +47,14 @@ public class ProjectManagerSkin
|
||||
}
|
||||
|
||||
public ProjectService getProjectService() {
|
||||
if (projectService == null) {
|
||||
projectService = getBean(ProjectService.class);
|
||||
return controller.getViewModelService();
|
||||
}
|
||||
|
||||
public CompanyService getCompanyService(){
|
||||
if (companyService == null) {
|
||||
companyService = getBean(CompanyService.class);
|
||||
}
|
||||
return projectService;
|
||||
return companyService;
|
||||
}
|
||||
|
||||
public SaleTypeService getSaleTypeService() {
|
||||
@@ -116,9 +123,9 @@ public class ProjectManagerSkin
|
||||
}
|
||||
|
||||
|
||||
private void initializeCustomerColumn(TableColumn<ProjectViewModel, String> column) {
|
||||
CompanyStringConverter converter = SpringApp.getBean(CompanyStringConverter.class);
|
||||
column.setCellValueFactory(param -> param.getValue().getCustomer().map(converter::toString));
|
||||
private void initializeCustomerColumn(TableColumn<ProjectViewModel, Company> column) {
|
||||
column.setCellValueFactory(param -> param.getValue().getCustomer());
|
||||
column.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
||||
}
|
||||
|
||||
private void initializeProductTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ecep.contract.manager.ds.project.controller;
|
||||
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.project.controller.industry.ProjectIndustryManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.project.controller.product_type.ProductTypeManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.project.controller.project_type.ProjectTypeManagerWindowController;
|
||||
@@ -45,7 +46,7 @@ public class ProjectManagerWindowController
|
||||
public TableColumn<ProjectViewModel, String> projectTypeColumn;
|
||||
public TableColumn<ProjectViewModel, String> productTypeColumn;
|
||||
public TableColumn<ProjectViewModel, LocalDate> createdColumn;
|
||||
public TableColumn<ProjectViewModel, String> customerColumn;
|
||||
public TableColumn<ProjectViewModel, Company> customerColumn;
|
||||
public TableColumn<ProjectViewModel, Boolean> useBidColumn;
|
||||
public TableColumn<ProjectViewModel, Boolean> useOfferColumn;
|
||||
public TableColumn<ProjectViewModel, Number> amountColumn;
|
||||
@@ -67,9 +68,7 @@ public class ProjectManagerWindowController
|
||||
|
||||
@Override
|
||||
protected ProjectManagerSkin createDefaultSkin() {
|
||||
ProjectManagerSkin skin = new ProjectManagerSkin(this);
|
||||
skin.setProjectService(projectService);
|
||||
return skin;
|
||||
return new ProjectManagerSkin(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
@Setter
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
|
||||
|
||||
public ProjectTabSkinCustomerSatisfactionSurvey(ProjectWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
@@ -79,12 +78,11 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
public CompletableFuture<?> refresh() {
|
||||
CompletableFuture<?> future = new CompletableFuture<>();
|
||||
runAsync(() -> {
|
||||
try {
|
||||
loadTableDataSet();
|
||||
future.complete(null);
|
||||
} catch (Exception e) {
|
||||
future.completeExceptionally(e);
|
||||
}
|
||||
loadTableDataSet();
|
||||
future.complete(null);
|
||||
}).exceptionally(ex -> {
|
||||
future.completeExceptionally(ex);
|
||||
return null;
|
||||
});
|
||||
return future;
|
||||
}
|
||||
@@ -125,7 +123,6 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
showInOwner(CustomerSatisfactionSurveyWindowController.class, item);
|
||||
}
|
||||
|
||||
|
||||
private CustomerSatisfactionSurveyService getCustomerSatisfactionSurveyService() {
|
||||
if (satisfactionSurveyService == null) {
|
||||
satisfactionSurveyService = getBean(CustomerSatisfactionSurveyService.class);
|
||||
@@ -175,7 +172,8 @@ public class ProjectTabSkinCustomerSatisfactionSurvey
|
||||
return customerFileService;
|
||||
}
|
||||
|
||||
private static class EvaluationFileTableCell extends TableCell<ProjectBidViewModel, CompanyCustomerEvaluationFormFile> {
|
||||
private static class EvaluationFileTableCell
|
||||
extends TableCell<ProjectBidViewModel, CompanyCustomerEvaluationFormFile> {
|
||||
private CompanyCustomerFileService fileService;
|
||||
|
||||
public CompanyCustomerFileService getFileService() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ecep.contract.manager.ui.AbstEntityController;
|
||||
import com.ecep.contract.manager.ui.FxmlPath;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
@@ -25,29 +26,50 @@ import org.springframework.stereotype.Component;
|
||||
@FxmlPath("/ui/project/project-quotation.fxml")
|
||||
public class ProjectQuotationWindowController
|
||||
extends AbstEntityController<ProjectQuotation, ProjectQuotationViewModel> {
|
||||
@FXML
|
||||
public BorderPane root;
|
||||
@FXML
|
||||
public Tab baseInfoTab;
|
||||
|
||||
@FXML
|
||||
public Button importExcelBtn;
|
||||
@FXML
|
||||
public Button exportExcelBtn;
|
||||
|
||||
@FXML
|
||||
public TextField applicantField;
|
||||
@FXML
|
||||
public TextField applyTimeField;
|
||||
@FXML
|
||||
public TextField authorizerField;
|
||||
@FXML
|
||||
public TextField authorizationTimeField;
|
||||
@FXML
|
||||
public HBox levelGroup;
|
||||
@FXML
|
||||
public RadioButton good_radio_btn;
|
||||
@FXML
|
||||
public RadioButton bad_radio_btn;
|
||||
@FXML
|
||||
public RadioButton poor_radio_btn;
|
||||
@FXML
|
||||
public CheckBox standardPayWayField;
|
||||
@FXML
|
||||
public TextField noStandardPayWayTextField;
|
||||
@FXML
|
||||
public TextField amountField;
|
||||
@FXML
|
||||
public TextField evaluationFileField;
|
||||
@FXML
|
||||
public Button evaluationFileBtn;
|
||||
|
||||
@FXML
|
||||
public TextField authorizationFileField;
|
||||
@FXML
|
||||
public Button openFileBtn;
|
||||
@FXML
|
||||
public Button changeFileBtn;
|
||||
@FXML
|
||||
public TextArea descriptionField;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
package com.ecep.contract.manager.ds.vendor.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.controller.CompanyTableCell;
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.vendor.model.CompanyVendor;
|
||||
import com.ecep.contract.manager.ds.vendor.model.VendorCatalog;
|
||||
@@ -10,24 +19,17 @@ import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
||||
import com.ecep.contract.manager.util.MyStringUtils;
|
||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CompanyVendorManagerSkin
|
||||
extends AbstEntityManagerSkin<CompanyVendor, CompanyVendorViewModel, CompanyVendorManagerSkin, CompanyVendorManagerWindowController>
|
||||
implements ManagerSkin {
|
||||
extends
|
||||
AbstEntityManagerSkin<CompanyVendor, CompanyVendorViewModel, CompanyVendorManagerSkin, CompanyVendorManagerWindowController> {
|
||||
|
||||
@Setter
|
||||
private CompanyService companyService;
|
||||
@@ -66,7 +68,8 @@ public class CompanyVendorManagerSkin
|
||||
@Override
|
||||
public void initializeTable() {
|
||||
|
||||
List<VendorTypeLocal> vendorTypeLocals = getCompanyVendorService().findAllTypes(controller.getLocale().toLanguageTag());
|
||||
List<VendorTypeLocal> vendorTypeLocals = getCompanyVendorService()
|
||||
.findAllTypes(controller.getLocale().toLanguageTag());
|
||||
ComboBoxUtils.initialComboBox(controller.typeSelector, vendorTypeLocals, true);
|
||||
controller.typeSelector.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||
loadTableDataSet(true);
|
||||
@@ -75,8 +78,9 @@ public class CompanyVendorManagerSkin
|
||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
controller.codeColumn.setCellValueFactory(param -> param.getValue().getCode());
|
||||
|
||||
Map<Integer, VendorCatalog> vendorClassMap = getCompanyVendorService().findAllCatalogs().stream()
|
||||
.collect(Collectors.toMap(VendorCatalog::getId, v -> v));
|
||||
|
||||
Map<Integer, VendorCatalog> vendorClassMap = getCompanyVendorService().findAllCatalogs().stream().collect(Collectors.toMap(VendorCatalog::getId, v -> v));
|
||||
controller.catalogColumn.setCellValueFactory(param -> Bindings.createStringBinding(() -> {
|
||||
SimpleObjectProperty<VendorCatalog> catalog = param.getValue().getCatalog();
|
||||
VendorCatalog vendorCatalog = catalog.get();
|
||||
@@ -99,7 +103,6 @@ public class CompanyVendorManagerSkin
|
||||
}
|
||||
}, param.getValue().getCatalog()));
|
||||
|
||||
|
||||
controller.typeColumn.setCellValueFactory(param -> param.getValue().getType().map(type -> {
|
||||
VendorTypeLocal local = vendorTypeLocals.stream().filter(v -> v.getType() == type).findFirst().orElse(null);
|
||||
if (local == null) {
|
||||
@@ -110,21 +113,13 @@ public class CompanyVendorManagerSkin
|
||||
}));
|
||||
|
||||
controller.purchaseColumn.setCellValueFactory(param -> param.getValue().getPurchase());
|
||||
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany().map(v -> {
|
||||
if (v == null) {
|
||||
return "-";
|
||||
}
|
||||
if (!Hibernate.isInitialized(v)) {
|
||||
v = companyService.findById(v.getId());
|
||||
param.getValue().getCompany().set(v);
|
||||
}
|
||||
return v.getName();
|
||||
}));
|
||||
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||
controller.companyColumn.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
||||
|
||||
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
||||
controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath());
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
controller.createdColumn
|
||||
.setCellValueFactory(param -> param.getValue().getCreated().map(MyDateTimeUtils::format));
|
||||
|
||||
Platform.runLater(() -> {
|
||||
getTableView().getSortOrder().add(controller.idColumn);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ecep.contract.manager.ds.vendor.controller;
|
||||
|
||||
import com.ecep.contract.manager.ds.company.model.Company;
|
||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
||||
import com.ecep.contract.manager.ds.vendor.controller.approved_list.CompanyVendorApprovedListManagerWindowController;
|
||||
import com.ecep.contract.manager.ds.vendor.controller.group.VendorGroupManagerWindowController;
|
||||
@@ -40,7 +41,7 @@ public class CompanyVendorManagerWindowController
|
||||
|
||||
// columns
|
||||
public TableColumn<CompanyVendorViewModel, Number> idColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> companyColumn;
|
||||
public TableColumn<CompanyVendorViewModel, Company> companyColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> codeColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> catalogColumn;
|
||||
public TableColumn<CompanyVendorViewModel, String> typeColumn;
|
||||
|
||||
@@ -25,8 +25,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public abstract class AbstEntityBasedTabSkin<C extends AbstEntityController<T, V>, T extends IdentityEntity, V extends IdentityViewModel<T>>
|
||||
extends AbstGenericTabSkin<C>
|
||||
implements TabSkin {
|
||||
extends AbstGenericTabSkin<C> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstEntityBasedTabSkin.class);
|
||||
|
||||
@Setter
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
package com.ecep.contract.manager.ui;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Bounds;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.util.converter.NumberStringConverter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -34,18 +8,46 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.geometry.Bounds;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.ContextMenu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.util.converter.NumberStringConverter;
|
||||
|
||||
/**
|
||||
* @param <T> Entity 的类型
|
||||
* @param <TV> Entity 对应的ViewModel
|
||||
* @param <Skin> Skin 的类型
|
||||
* @param <C>
|
||||
*/
|
||||
public abstract class AbstEntityManagerSkin<
|
||||
T extends IdentityEntity,
|
||||
TV extends IdentityViewModel<T>,
|
||||
Skin extends ManagerSkin,
|
||||
C extends AbstManagerWindowController<T, TV, Skin>
|
||||
> implements ManagerSkin, TableTabSkin<T, TV>, EditableEntityTableTabSkin<T, TV> {
|
||||
public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>, Skin extends ManagerSkin, C extends AbstManagerWindowController<T, TV, Skin>>
|
||||
implements ManagerSkin, TableTabSkin<T, TV>, EditableEntityTableTabSkin<T, TV> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstEntityManagerSkin.class);
|
||||
/**
|
||||
*
|
||||
@@ -80,7 +82,6 @@ public abstract class AbstEntityManagerSkin<
|
||||
UITools.showExceptionAndWait(message, ex);
|
||||
}
|
||||
|
||||
|
||||
public Locale getLocale() {
|
||||
return controller.getLocale();
|
||||
}
|
||||
@@ -102,7 +103,6 @@ public abstract class AbstEntityManagerSkin<
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void onShown() {
|
||||
if (loadedFuture == null) {
|
||||
loadedFuture = runAsync(() -> {
|
||||
@@ -135,7 +135,7 @@ public abstract class AbstEntityManagerSkin<
|
||||
});
|
||||
|
||||
loadTableDataSet(true);
|
||||
}).exceptionally(this::handleException);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,14 +156,23 @@ public abstract class AbstEntityManagerSkin<
|
||||
currentPageNumber.addListener(this::currentPageNumberListener);
|
||||
|
||||
//
|
||||
controller.currentPageNumberField.textProperty().bindBidirectional(currentPageNumber, new NumberStringConverter());
|
||||
controller.currentPageNumberField.textProperty().bindBidirectional(currentPageNumber,
|
||||
new NumberStringConverter());
|
||||
controller.previousPageBtn.setOnAction(event -> {
|
||||
currentPageable = currentPageable.previous();
|
||||
loadTableDataSet(true);
|
||||
try {
|
||||
currentPageable = currentPageable.previous();
|
||||
loadTableDataSet(true);
|
||||
} catch (Exception e) {
|
||||
logger.warn("previous page error", e);
|
||||
}
|
||||
});
|
||||
controller.nextPageBtn.setOnAction(event -> {
|
||||
currentPageable = currentPageable.next();
|
||||
loadTableDataSet(true);
|
||||
try {
|
||||
currentPageable = currentPageable.next();
|
||||
loadTableDataSet(true);
|
||||
} catch (Exception e) {
|
||||
logger.warn("next page error", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -275,7 +284,6 @@ public abstract class AbstEntityManagerSkin<
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected T createNewEntity(TV row) {
|
||||
ViewModelService<T, TV> service = getViewModelService();
|
||||
if (service != null) {
|
||||
@@ -341,7 +349,7 @@ public abstract class AbstEntityManagerSkin<
|
||||
try {
|
||||
_reloadTableData().thenRun(() -> loadTableDataSetFuture = null).exceptionally(this::handleException);
|
||||
} catch (Exception ex) {
|
||||
handleException(ex);
|
||||
handleException("加载表格数据出错", ex);
|
||||
}
|
||||
}, reloadNow ? 0 : 618, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@@ -370,13 +378,26 @@ public abstract class AbstEntityManagerSkin<
|
||||
}
|
||||
|
||||
protected void updateTableDataSet(List<TV> models) {
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
dataSet.setAll(models);
|
||||
long timeCost = System.currentTimeMillis() - timeMillis;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("update table dataSet cost: {} ms", timeCost);
|
||||
}
|
||||
}
|
||||
|
||||
protected List<TV> loadTableData() {
|
||||
Specification<T> spec = getSpecification();
|
||||
ViewModelService<T, TV> service = getViewModelService();
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
Page<T> page = service.findAll(spec, getPageable());
|
||||
long timeCost = System.currentTimeMillis() - timeMillis;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("load table data cost: {} ms", timeCost);
|
||||
}
|
||||
if (timeCost > 1000) {
|
||||
controller.setStatus("used " + timeCost + " ms");
|
||||
}
|
||||
updateFooter(page);
|
||||
return page.map(service::from).toList();
|
||||
}
|
||||
@@ -416,7 +437,8 @@ public abstract class AbstEntityManagerSkin<
|
||||
controller.previousPageBtn.setDisable(!page.hasPrevious());
|
||||
controller.nextPageBtn.setDisable(!page.hasNext());
|
||||
currentPageNumber.set(page.getNumber());
|
||||
controller.setStatus((page.getNumber() + 1) + "/" + page.getTotalPages() + " 页, 总 " + page.getTotalElements() + " 条");
|
||||
controller.setStatus(
|
||||
(page.getNumber() + 1) + "/" + page.getTotalPages() + " 页, 总 " + page.getTotalElements() + " 条");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,5 @@
|
||||
package com.ecep.contract.manager.ui;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
||||
import com.ecep.contract.manager.ui.util.LocalDateFieldTableCell;
|
||||
import com.ecep.contract.manager.ui.util.LocalDateTimeTableCell;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.input.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -31,6 +9,48 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
||||
import com.ecep.contract.manager.ui.util.LocalDateFieldTableCell;
|
||||
import com.ecep.contract.manager.ui.util.LocalDateTimeTableCell;
|
||||
import com.ecep.contract.manager.util.TableViewUtils;
|
||||
import com.ecep.contract.manager.util.UITools;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ContextMenu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.DragEvent;
|
||||
import javafx.scene.input.Dragboard;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.TransferMode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 表格显示组件
|
||||
*
|
||||
@@ -39,16 +59,14 @@ import java.util.function.Function;
|
||||
* @param <T> 表格数据类
|
||||
* @param <TV> 表格数据视图类
|
||||
*/
|
||||
public abstract class AbstEntityTableTabSkin<
|
||||
C extends AbstEntityController<K, KV>,
|
||||
public abstract class AbstEntityTableTabSkin<C extends AbstEntityController<K, KV>,
|
||||
// 父数据类
|
||||
K extends IdentityEntity, KV extends IdentityViewModel<K>,
|
||||
// 表格数据类
|
||||
T extends IdentityEntity, TV extends IdentityViewModel<T>
|
||||
>
|
||||
T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||
extends AbstEntityBasedTabSkin<C, K, KV>
|
||||
implements TabSkin, TableOfTabSkin<K, T, TV>, EditableEntityTableTabSkin<T, TV> {
|
||||
|
||||
implements TableOfTabSkin<K, T, TV>, EditableEntityTableTabSkin<T, TV> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstEntityTableTabSkin.class);
|
||||
protected CompletableFuture<Void> loadedFuture;
|
||||
protected final SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||
protected ObservableList<TV> dataSet = FXCollections.observableArrayList();
|
||||
@@ -112,7 +130,7 @@ public abstract class AbstEntityTableTabSkin<
|
||||
|
||||
public Pageable getPageable() {
|
||||
Sort sort = getSortByTable();
|
||||
//TODO 待完善 currentPageable
|
||||
// TODO 待完善 currentPageable
|
||||
// return currentPageable.withSort(sort);
|
||||
return Pageable.unpaged(sort);
|
||||
}
|
||||
@@ -155,8 +173,7 @@ public abstract class AbstEntityTableTabSkin<
|
||||
|
||||
protected <X> void changed(
|
||||
TableColumn.CellEditEvent<TV, X> event,
|
||||
Function<TV, Property<X>> supplier
|
||||
) {
|
||||
Function<TV, Property<X>> supplier) {
|
||||
TV row = event.getRowValue();
|
||||
supplier.apply(row).setValue(event.getNewValue());
|
||||
changed(row);
|
||||
@@ -176,17 +193,18 @@ public abstract class AbstEntityTableTabSkin<
|
||||
column.setOnEditCommit(event -> changed(event, propertyFun));
|
||||
}
|
||||
|
||||
protected void bindLocalDateColumn(TableColumn<TV, LocalDate> column, Function<TV, Property<LocalDate>> propertyFun) {
|
||||
protected void bindLocalDateColumn(TableColumn<TV, LocalDate> column,
|
||||
Function<TV, Property<LocalDate>> propertyFun) {
|
||||
column.setCellValueFactory(param -> propertyFun.apply(param.getValue()));
|
||||
column.setCellFactory(LocalDateFieldTableCell.forTableColumn());
|
||||
}
|
||||
|
||||
protected void bindLocalDateTimeColumn(TableColumn<TV, LocalDateTime> column, Function<TV, Property<LocalDateTime>> propertyFun) {
|
||||
protected void bindLocalDateTimeColumn(TableColumn<TV, LocalDateTime> column,
|
||||
Function<TV, Property<LocalDateTime>> propertyFun) {
|
||||
column.setCellValueFactory(param -> propertyFun.apply(param.getValue()));
|
||||
column.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTabShown() {
|
||||
// 当第一次显示 tab 时,初始化表格
|
||||
@@ -195,7 +213,7 @@ public abstract class AbstEntityTableTabSkin<
|
||||
initializeTab();
|
||||
initializeTable();
|
||||
loadTableDataSet();
|
||||
}).exceptionally(this::handleException);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +246,6 @@ public abstract class AbstEntityTableTabSkin<
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initializeTab() {
|
||||
if (searchKeyField != null) {
|
||||
@@ -313,7 +330,6 @@ public abstract class AbstEntityTableTabSkin<
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 当有东西拖动到表格上时触发
|
||||
* 默认为实现任何处理
|
||||
@@ -364,7 +380,6 @@ public abstract class AbstEntityTableTabSkin<
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 当表格行被双击时触发
|
||||
*
|
||||
@@ -377,24 +392,27 @@ public abstract class AbstEntityTableTabSkin<
|
||||
loadTableDataSet();
|
||||
}
|
||||
|
||||
// @SuppressWarnings("unchecked")
|
||||
// @SuppressWarnings("unchecked")
|
||||
protected TV createNewViewModel() {
|
||||
ViewModelService<T, TV> service = getViewModelService();
|
||||
return service.createNewViewModel();
|
||||
|
||||
// Class<?> clz = getClass();
|
||||
// Method method = BeanUtils.findMethodWithMinimalParameters(clz, "loadRowData");
|
||||
// if (method == null) {
|
||||
// throw new RuntimeException(clz.getName() + " unable find loadRowData method!");
|
||||
// }
|
||||
// Class<?>[] types = method.getParameterTypes();
|
||||
// if (types.length == 0) {
|
||||
// throw new RuntimeException(clz.getName() + " loadRowData method need a parameter!");
|
||||
// }
|
||||
// if (types[0] == BaseViewModel.class) {
|
||||
// throw new RuntimeException(clz.getName() + " 需要继承实现 loadRowData 方法");
|
||||
// }
|
||||
// return (TV) BeanUtils.instantiateClass(types[0]);
|
||||
// Class<?> clz = getClass();
|
||||
// Method method = BeanUtils.findMethodWithMinimalParameters(clz,
|
||||
// "loadRowData");
|
||||
// if (method == null) {
|
||||
// throw new RuntimeException(clz.getName() + " unable find loadRowData
|
||||
// method!");
|
||||
// }
|
||||
// Class<?>[] types = method.getParameterTypes();
|
||||
// if (types.length == 0) {
|
||||
// throw new RuntimeException(clz.getName() + " loadRowData method need a
|
||||
// parameter!");
|
||||
// }
|
||||
// if (types[0] == BaseViewModel.class) {
|
||||
// throw new RuntimeException(clz.getName() + " 需要继承实现 loadRowData 方法");
|
||||
// }
|
||||
// return (TV) BeanUtils.instantiateClass(types[0]);
|
||||
}
|
||||
|
||||
protected void onTableAddAction(ActionEvent event) {
|
||||
@@ -461,16 +479,19 @@ public abstract class AbstEntityTableTabSkin<
|
||||
protected T createNewEntity(TV row) {
|
||||
return getViewModelService().createNewEntity();
|
||||
|
||||
// Class<?> viewModelClz = row.getClass();
|
||||
// Method method = BeanUtils.findMethodWithMinimalParameters(viewModelClz, "copyTo");
|
||||
// if (method == null) {
|
||||
// throw new RuntimeException(viewModelClz.getName() + " unable find copyTo method!");
|
||||
// }
|
||||
// Class<?>[] types = method.getParameterTypes();
|
||||
// if (types.length == 0) {
|
||||
// throw new RuntimeException(viewModelClz.getName() + " copyTo method need a parameter!");
|
||||
// }
|
||||
// return (T) BeanUtils.instantiateClass(types[0]);
|
||||
// Class<?> viewModelClz = row.getClass();
|
||||
// Method method = BeanUtils.findMethodWithMinimalParameters(viewModelClz,
|
||||
// "copyTo");
|
||||
// if (method == null) {
|
||||
// throw new RuntimeException(viewModelClz.getName() + " unable find copyTo
|
||||
// method!");
|
||||
// }
|
||||
// Class<?>[] types = method.getParameterTypes();
|
||||
// if (types.length == 0) {
|
||||
// throw new RuntimeException(viewModelClz.getName() + " copyTo method need a
|
||||
// parameter!");
|
||||
// }
|
||||
// return (T) BeanUtils.instantiateClass(types[0]);
|
||||
}
|
||||
|
||||
protected void saveRow(TV row) {
|
||||
@@ -495,7 +516,6 @@ public abstract class AbstEntityTableTabSkin<
|
||||
return Sort.by(getTableOrders());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteRowData(T entity) {
|
||||
getViewModelService().delete(entity);
|
||||
|
||||
@@ -13,14 +13,19 @@ public abstract class AbstManagerWindowController<T extends IdentityEntity, TV e
|
||||
extends AbstEntityBasedController<T, TV, Skin> {
|
||||
|
||||
// searcher
|
||||
@FXML
|
||||
public TextField searchKeyField;
|
||||
@FXML
|
||||
public Button searchBtn;
|
||||
|
||||
@FXML
|
||||
public HBox footer;
|
||||
// paging
|
||||
@FXML
|
||||
public Button previousPageBtn;
|
||||
@FXML
|
||||
public Button nextPageBtn;
|
||||
@FXML
|
||||
public TextField currentPageNumberField;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<logger name="com.ecep.contract.manager.Desktop" level="debug"/>
|
||||
<logger name="com.ecep.contract.manager.SpringApp" level="debug"/>
|
||||
<logger name="com.ecep.contract.manager.ui.service" level="info"/>
|
||||
|
||||
<logger name="com.ecep.contract.manager.ui.AbstEntityTableTabSkin" level="debug"/>
|
||||
<logger name="com.ecep.contract.manager.ui.AbstEntityManagerSkin" level="debug"/>
|
||||
<logger name="com.ecep.contract.manager.ui.BaseController" level="debug"/>
|
||||
<logger name="com.ecep.contract.manager.ui.controller" level="info"/>
|
||||
<logger name="com.ecep.contract.manager.ui.task.MonitoredTask" level="debug"/>
|
||||
|
||||
39
src/main/resources/ui/employee/function-tab-permission.fxml
Normal file
39
src/main/resources/ui/employee/function-tab-permission.fxml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.ecep.contract.manager.ds.other.controller.permission.FunctionTabSkinPermission">
|
||||
<children>
|
||||
<VBox AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0"
|
||||
AnchorPane.topAnchor="5.0">
|
||||
<children>
|
||||
<HBox spacing="3.0">
|
||||
<children>
|
||||
<TextField fx:id="searchKeyField" promptText="检索关键字"/>
|
||||
<Button fx:id="searchBtn" mnemonicParsing="false" text="检索"/>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="7.0" right="10.0" top="10.0"/>
|
||||
</padding>
|
||||
</HBox>
|
||||
<TableView fx:id="table" prefHeight="300.0" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn fx:id="idColumn" prefWidth="50.0"
|
||||
sortType="DESCENDING" text="ID"/>
|
||||
<TableColumn fx:id="nameColumn" prefWidth="150.0" text="名称"/>
|
||||
<TableColumn fx:id="keyColumn" prefWidth="150" text="KEY"/>
|
||||
<TableColumn fx:id="descriptionColumn" prefWidth="200"
|
||||
text="备注"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
<Pane prefHeight="50.0">
|
||||
<children>
|
||||
<Label layoutX="14.0" layoutY="7.0" text="权限名称"/>
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
128
src/main/resources/ui/employee/function.fxml
Normal file
128
src/main/resources/ui/employee/function.fxml
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.paint.Color?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import org.controlsfx.control.ListSelectionView?>
|
||||
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="500.0"
|
||||
prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.ecep.contract.manager.ds.other.controller.permission.FunctionWindowController">
|
||||
<center>
|
||||
<TabPane fx:id="tabPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minWidth="150.0"
|
||||
tabClosingPolicy="UNAVAILABLE" tabMaxWidth="100.0" tabMinWidth="40.0">
|
||||
<tabs>
|
||||
<Tab fx:id="baseInfoTab" text="基本信息">
|
||||
<content>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" maxHeight="1.7976931348623157E308"
|
||||
maxWidth="1.7976931348623157E308" minWidth="150.0" pannable="true">
|
||||
<content>
|
||||
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
||||
minWidth="150.0">
|
||||
<children>
|
||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
||||
minWidth="150.0" VBox.vgrow="NEVER">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="200.0"
|
||||
minWidth="80.0" prefWidth="120.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308"
|
||||
minWidth="50.0" prefWidth="180.0"/>
|
||||
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="200.0"
|
||||
minWidth="80.0" prefWidth="120.0"/>
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308"
|
||||
minWidth="50.0" prefWidth="180.0"/>
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" minHeight="30.0" prefHeight="30.0"
|
||||
vgrow="NEVER"/>
|
||||
<RowConstraints fillHeight="false" maxHeight="1.7976931348623157E308"
|
||||
minHeight="30.0" prefHeight="42.0" vgrow="NEVER"/>
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label text="名称 *" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="nameField" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<Label text="键 *" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="keyField" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
<Label text="控制器" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="controllerField" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
<Label text="图标" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="iconField" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
<Label text="描述" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="descriptionField" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
||||
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="11">
|
||||
<children>
|
||||
|
||||
</children>
|
||||
</HBox>
|
||||
<Label fx:id="versionLabel" text="\@Version" GridPane.rowIndex="11"/>
|
||||
<!-- <CheckListView fx:id="rolesField" GridPane.columnIndex="3" GridPane.rowSpan="10" />-->
|
||||
<Label text="角色" GridPane.columnIndex="2" GridPane.rowSpan="10">
|
||||
<tooltip>
|
||||
<Tooltip text="用于解决有些姓名错别字,无法匹配"/>
|
||||
</tooltip>
|
||||
</Label>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/>
|
||||
</VBox.margin>
|
||||
</GridPane>
|
||||
<Pane prefHeight="50.0" prefWidth="200.0"/>
|
||||
</children>
|
||||
</VBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="permissionTab" text="权限">
|
||||
</Tab>
|
||||
</tabs>
|
||||
</TabPane>
|
||||
</center>
|
||||
<top>
|
||||
<ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button fx:id="saveBtn" disable="true" text="保存(_S)"/>
|
||||
</items>
|
||||
</ToolBar>
|
||||
</top>
|
||||
<bottom>
|
||||
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0">
|
||||
<children>
|
||||
<Label fx:id="leftStatusLabel" maxHeight="1.7976931348623157E308" text="Left status"
|
||||
HBox.hgrow="ALWAYS">
|
||||
<font>
|
||||
<Font size="11.0" fx:id="x3"/>
|
||||
</font>
|
||||
<textFill>
|
||||
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4"/>
|
||||
</textFill>
|
||||
</Label>
|
||||
<Pane HBox.hgrow="ALWAYS"/>
|
||||
<Label fx:id="rightStatusLabel" font="$x3" text="Right status" textFill="$x4" HBox.hgrow="NEVER"/>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0"/>
|
||||
</padding>
|
||||
</HBox>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
@@ -28,46 +28,16 @@
|
||||
<Button fx:id="searchBtn" mnemonicParsing="false" text="检索"/>
|
||||
</items>
|
||||
</ToolBar>
|
||||
|
||||
<SplitPane dividerPositions="0.5" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<items>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<TitledPane animated="false" collapsible="false" text="功能表" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<TableView fx:id="table" prefHeight="200.0" prefWidth="200.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="idColumn" prefWidth="50.0" sortType="DESCENDING" text="ID"/>
|
||||
<TableColumn fx:id="nameColumn" prefWidth="150.0" text="名称"/>
|
||||
<TableColumn fx:id="keyColumn" prefWidth="150" text="KEY"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<TitledPane animated="false" collapsible="false" text="权限表" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<TableView fx:id="permissionTable" prefHeight="200.0" prefWidth="200.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="permissionTable_idColumn" prefWidth="50.0"
|
||||
sortType="DESCENDING" text="ID"/>
|
||||
<TableColumn fx:id="permissionTable_nameColumn" prefWidth="150.0" text="名称"/>
|
||||
<TableColumn fx:id="permissionTable_keyColumn" prefWidth="150" text="KEY"/>
|
||||
<TableColumn fx:id="permissionTable_descriptionColumn" prefWidth="200"
|
||||
text="备注"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
<TableView fx:id="table" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn fx:id="idColumn" prefWidth="50.0" sortType="DESCENDING" text="ID"/>
|
||||
<TableColumn fx:id="nameColumn" prefWidth="150.0" text="名称"/>
|
||||
<TableColumn fx:id="keyColumn" prefWidth="150" text="KEY"/>
|
||||
<TableColumn fx:id="controllerColumn" prefWidth="150" text="控制器"/>
|
||||
<TableColumn fx:id="iconColumn" prefWidth="150" text="图标"/>
|
||||
<TableColumn fx:id="descriptionColumn" prefWidth="200" text="备注"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
<fx:include source="../part-footer.fxml" fx:id="footer"/>
|
||||
</children>
|
||||
</VBox>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<VBox prefHeight="680.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.manager.ds.other.controller.permission.EmployeeRolesManagerWindowController">
|
||||
<VBox prefHeight="680.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.manager.ds.other.controller.permission.EmployeeRoleManagerWindowController">
|
||||
<children>
|
||||
<MenuBar VBox.vgrow="NEVER">
|
||||
<menus>
|
||||
|
||||
Reference in New Issue
Block a user