refactor(controller): 重构枚举类型相关代码,优化类型转换和显示逻辑

重构枚举类型的处理逻辑,统一使用Vo对象替代Model对象
- 修改ComboBoxUtils初始化逻辑,支持更多类型转换
- 实现VendorCatalogStringConverter用于类型转换
- 更新ContractFileTypeListCell和ContractFileTypeTableCell显示逻辑
- 调整VendorTabSkinFile和CompanyVendorTabSkinBase使用新的类型转换方式
- 更新相关服务类接口,添加类型转换方法
- 修改FXML文件添加类型选择控件
This commit is contained in:
2025-09-23 18:24:00 +08:00
parent 73cbb4e19e
commit 543311c676
21 changed files with 396 additions and 248 deletions

View File

@@ -1,13 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToolBar?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.text.Font?>
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="600.0"
prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.ecep.contract.controller.vendor.CompanyVendorWindowController">
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.controller.vendor.CompanyVendorWindowController">
<center>
<TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE" tabMaxWidth="100.0" tabMinWidth="40.0">
<tabs>
@@ -17,94 +32,72 @@
<content>
<VBox>
<children>
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
minWidth="150.0" VBox.vgrow="NEVER">
<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 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" maxHeight="1.7976931348623157E308"
minHeight="30.0" prefHeight="120.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 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="120.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="分组"/>
<ComboBox fx:id="catalogField" GridPane.columnIndex="1"/>
<Label text="分组" />
<ComboBox fx:id="catalogField" GridPane.columnIndex="1" />
<Label text="联系人" GridPane.rowIndex="3"/>
<TextField fx:id="contactField" GridPane.columnIndex="1"
GridPane.rowIndex="3"/>
<Label text="分类" GridPane.rowIndex="1" />
<ComboBox fx:id="typeField" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="发展日期" GridPane.rowIndex="2"/>
<DatePicker fx:id="developDateField" promptText="yyyy-MM-dd"
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label layoutX="20.0" layoutY="28.0" text="备注" GridPane.rowIndex="7"/>
<Label text="采购的产品" GridPane.rowIndex="4"/>
<TextField fx:id="purchaseField" GridPane.columnIndex="1"
GridPane.columnSpan="3" GridPane.rowIndex="4"/>
<Label text="存储文件夹" GridPane.rowIndex="5"/>
<TextField fx:id="pathField" GridPane.columnIndex="1"
GridPane.columnSpan="3" GridPane.rowIndex="5">
<Label text="联系人" GridPane.rowIndex="4" />
<TextField fx:id="contactField" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="发展日期" GridPane.rowIndex="3" />
<DatePicker fx:id="developDateField" promptText="yyyy-MM-dd" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label layoutX="20.0" layoutY="28.0" text="备注" GridPane.rowIndex="8" />
<Label text="采购的产品" GridPane.rowIndex="5" />
<TextField fx:id="purchaseField" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="5" />
<Label text="存储文件夹" GridPane.rowIndex="6" />
<TextField fx:id="pathField" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="6">
<GridPane.margin>
<Insets/>
<Insets />
</GridPane.margin>
</TextField>
<TextArea fx:id="descriptionField" GridPane.columnIndex="1"
GridPane.columnSpan="3" GridPane.rowIndex="7"/>
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1"
GridPane.columnSpan="3" GridPane.rowIndex="9">
<TextArea fx:id="descriptionField" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="8" />
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="10">
<children>
</children>
</HBox>
<Label text="创建日期" GridPane.rowIndex="8"/>
<TextField fx:id="createdField" promptText="yyyy-MM-dd"
GridPane.columnIndex="1" GridPane.rowIndex="8"/>
<Label fx:id="versionLabel" text="\@Version" GridPane.rowIndex="9"/>
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1"
GridPane.columnSpan="3" GridPane.rowIndex="6">
<Label text="创建日期" GridPane.rowIndex="9" />
<TextField fx:id="createdField" promptText="yyyy-MM-dd" GridPane.columnIndex="1" GridPane.rowIndex="9" />
<Label fx:id="versionLabel" text="\@Version" GridPane.rowIndex="10" />
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="7">
<children>
<Button fx:id="createPathBtn" mnemonicParsing="false"
text="创建目录"/>
<Button fx:id="changePathBtn" mnemonicParsing="false"
text="变更目录"/>
<Button fx:id="pathAsNameBtn" mnemonicParsing="false"
text="与合同名称同名"/>
<Button fx:id="createPathBtn" mnemonicParsing="false" text="创建目录" />
<Button fx:id="changePathBtn" mnemonicParsing="false" text="变更目录" />
<Button fx:id="pathAsNameBtn" mnemonicParsing="false" text="与合同名称同名" />
</children>
</HBox>
<Label text="协议供货商" GridPane.rowIndex="1"/>
<CheckBox fx:id="protocolProviderField" mnemonicParsing="false"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="协议供货商" GridPane.rowIndex="2" />
<CheckBox fx:id="protocolProviderField" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
</children>
<VBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</VBox.margin>
</GridPane>
<Pane prefHeight="50.0" prefWidth="200.0"/>
<Pane prefHeight="50.0" prefWidth="200.0" />
</children>
</VBox>
</content>
@@ -121,29 +114,28 @@
<top>
<ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<items>
<Button onAction="#onCompanyVendorOpenInExplorerAction" text="打开目录(_F)"/>
<Button fx:id="saveBtn" disable="true" text="保存(_S)"/>
<Button fx:id="relativeCompanyBtn" text="关联公司(_L)"/>
<Button onAction="#onCompanyVendorOpenInExplorerAction" text="打开目录(_F)" />
<Button fx:id="saveBtn" disable="true" text="保存(_S)" />
<Button fx:id="relativeCompanyBtn" text="关联公司(_L)" />
</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">
<Label fx:id="leftStatusLabel" maxHeight="1.7976931348623157E308" text="Left status" HBox.hgrow="ALWAYS">
<font>
<Font size="11.0" fx:id="x3"/>
<Font size="11.0" fx:id="x3" />
</font>
<textFill>
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4"/>
<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"/>
<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"/>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
</HBox>
</bottom>