2023年7月11日15:37:29 添加layui 表单生成

master
zhangmeng 2023-07-11 15:37:55 +08:00
parent 4c2b9d57d3
commit 58162c6928
8 changed files with 88 additions and 4 deletions

View File

@ -602,4 +602,8 @@ public class HomeController implements Serializable {
public void web_socket_client_menu_item(ActionEvent event) {
load_server_tools(8);
}
public void layui_form_gen_menu_item(ActionEvent actionEvent) {
load_small_tools(17);
}
}

View File

@ -0,0 +1,34 @@
package com.zhangmeng.tools.controller;
import javafx.fxml.FXML;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import lombok.extern.slf4j.Slf4j;
import java.net.URI;
import java.net.URISyntaxException;
/**
* @author zhangmeng
* @date 202371114:48:27
* @version 1.0
*/
@Slf4j
public class LayUiFormController {
@FXML
public WebView webView;
@FXML
public void initialize() {
WebEngine engine = webView.getEngine();
URI url = null;
try {
url = this.getClass().getClassLoader().getResource("templates/form.html").toURI();
} catch (URISyntaxException e) {
e.printStackTrace();
}
engine.load(url.toASCIIString());
}
}

View File

@ -84,6 +84,7 @@ public class SmallToolsController {
private AnchorPane batch_update_file_name;
private AnchorPane capter_screen;
private AnchorPane file_edit;
private AnchorPane layui_form_gen;
@FXML
private ListView<ResourcesUtils.SmallTools> listView;
@ -417,10 +418,32 @@ public class SmallToolsController {
}
file_edit(flag);
}
if (newValue.getIndex() == 17) {
if (layui_form_gen != null) {
flag = true;
}
layui_form_gen(flag);
}
}
});
}
private void layui_form_gen(boolean flag) {
//默认选择第一个
listView.getSelectionModel().select(17);
if (!flag) {
try {
root = FXMLLoader.load(ResourcesUtils.getResource("layui-form"));
} catch (IOException e) {
e.printStackTrace();
}
layui_form_gen = root;
} else {
root = layui_form_gen;
}
common_method();
}
private void file_edit(boolean flag) {
//默认选择第一个
@ -458,6 +481,7 @@ public class SmallToolsController {
case BatchUpdateFileName -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
case Capter_Screent -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
case File_Edit -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
case LayUI_Form_Gen -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
};
}
@ -1011,4 +1035,12 @@ public class SmallToolsController {
public void sql_query_gen_menu_item(ActionEvent event) {
load_mysql_tools(3);
}
public void layui_form_gen_menu_item(ActionEvent actionEvent) {
boolean flag =false;
if (layui_form_gen != null){
flag = true;
}
layui_form_gen(flag);
}
}

View File

@ -133,6 +133,7 @@ public class ResourcesUtils {
BatchUpdateFileName("批量修改文件名", 14),
Capter_Screent("截图", 15),
File_Edit("文件编辑器", 16),
LayUI_Form_Gen("layui-from 表单生成", 17),
;
SmallTools(String title, int index) {

View File

@ -50,6 +50,7 @@
<MenuItem mnemonicParsing="false" text="批量修改文件名" onAction="#batch_update_file_name_menu_item"/>
<MenuItem mnemonicParsing="false" text="截图工具" onAction="#capter_screen_menu_item"/>
<MenuItem mnemonicParsing="false" text="文件编辑器" onAction="#file_edit_menu_item"/>
<MenuItem mnemonicParsing="false" text="LayUI表单代码生成" onAction="#layui_form_gen_menu_item"/>
</items>
</Menu>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.web.WebView?>
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.LayUiFormController">
<children>
<WebView fx:id="webView" layoutX="194.0" layoutY="195.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>

View File

@ -46,6 +46,7 @@
<MenuItem mnemonicParsing="false" text="pdf识别" onAction="#pdf_menu_item"/>
<MenuItem mnemonicParsing="false" text="批量修改文件名" onAction="#batch_update_file_name_menu_item"/>
<MenuItem mnemonicParsing="false" text="截图工具" onAction="#capter_screen_menu_item"/>
<MenuItem mnemonicParsing="false" text="LayUI表单代码生成" onAction="#layui_form_gen_menu_item"/>
</items>
</Menu>

View File

@ -4,9 +4,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="referrer" content="no-referrer" />
<title>layui表单生成器</title>
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css">
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/code/css/style.css">
<link rel="stylesheet" href="../static/component/pear/css/pear.css">
<link rel="stylesheet" href="../static/component/code/css/style.css">
</head>
<body>
<div class="layui-fluid">
@ -73,8 +74,8 @@
</div>
</div>
</body>
<script type="text/javascript" src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
<script type="text/javascript" src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
<script type="text/javascript" src="../static/component/layui/layui.js"></script>
<script type="text/javascript" src="../static/component/pear/pear.js"></script>
<script>
layui.use('design');
</script>