master
wangbing 6 years ago
parent 5d2d059c43
commit 46871aa0b9

@ -202,11 +202,6 @@ public class MainController {
Dialog.showVue(); Dialog.showVue();
} }
@FXML
public void generateVueAdmin(ActionEvent actionEvent) {
Dialog.showVueAdmin();
}
@FXML @FXML
public void generateApi(ActionEvent actionEvent) { public void generateApi(ActionEvent actionEvent) {
Dialog.showApi(); Dialog.showApi();

@ -4,19 +4,18 @@ import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
public class OptionVueController { public class OptionVueController {
@FXML @FXML
private TextField name; private TextField name;
@FXML @FXML
private CheckBox elementUI;
@FXML
private CheckBox iView;
@FXML
private Button ok; private Button ok;
@FXML @FXML
private Button cancel; private Button cancel;
@FXML
private ToggleGroup type;
public Button getOk() { public Button getOk() {
return ok; return ok;
@ -42,19 +41,11 @@ public class OptionVueController {
this.name = name; this.name = name;
} }
public CheckBox getElementUI() { public ToggleGroup getType() {
return elementUI; return type;
}
public void setElementUI(CheckBox elementUI) {
this.elementUI = elementUI;
}
public CheckBox getiView() {
return iView;
} }
public void setiView(CheckBox iView) { public void setType(ToggleGroup type) {
this.iView = iView; this.type = type;
} }
} }

@ -39,46 +39,6 @@ public class VueCallable implements Callable {
clear(app); clear(app);
} }
// 目录生成
File src = new File(app, "src");
src.mkdirs();
File assets = new File(src, "assets");
assets.mkdirs();
File components = new File(src, "components");
components.mkdirs();
File plugins = new File(src, "plugins");
plugins.mkdirs();
File publics = new File(app, "public");
publics.mkdirs();
{
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("appName", option.projectName);
ctx.put("elementui", option.elementui);
ctx.put("iView", option.iView);
freeMarkerManager.outputTemp(new File(app, "package.json"), "Vue/package.json", ctx);
// freeMarkerManager.outputTemp(new File(app, "package-lock.json"), "Vue/package-lock.json", ctx);
freeMarkerManager.outputTemp(new File(app, "README.md"), "Vue/README.md", ctx);
Tool.outputResource("Vue/babel.config.js", new File(app, "babel.config.js"));
//public
Tool.outputResource("Vue/public/favicon.ico", new File(publics, "favicon.ico"));
freeMarkerManager.outputTemp(new File(publics, "index.html"), "Vue/public/index.html", ctx);
//src
freeMarkerManager.outputTemp(new File(src, "App.vue"), "Vue/src/App.vue", ctx);
freeMarkerManager.outputTemp(new File(src, "main.js"), "Vue/src/main.js", ctx);
Tool.outputResource("Vue/src/router.js", new File(src, "router.js"));
Tool.outputResource("Vue/src/assets/logo.png", new File(assets, "logo.png"));
Tool.outputResource("Vue/src/components/HelloWorld.vue", new File(components, "HelloWorld.vue"));
if (option.elementui) {
Tool.outputResource("Vue/src/plugins/element.js", new File(plugins, "element.js"));
}
if (option.iView) {
Tool.outputResource("Vue/src/plugins/iview.js", new File(plugins, "iview.js"));
}
}
return true; return true;
} }
} }

@ -2,6 +2,5 @@ package xyz.wbsite.dbtool.javafx.po;
public class VueOption { public class VueOption {
public String projectName; public String projectName;
public boolean elementui; public String type;
public boolean iView;
} }

@ -640,9 +640,9 @@ public class Dialog {
System.out.println("生成目录:" + file.getAbsolutePath()); System.out.println("生成目录:" + file.getAbsolutePath());
VueOption vueOption = new VueOption(); VueOption vueOption = new VueOption();
vueOption.projectName = controller.getName().getText(); vueOption.projectName = controller.getName().getText();
vueOption.elementui = controller.getElementUI().isSelected(); ToggleGroup type = controller.getType();
vueOption.iView = controller.getiView().isSelected(); RadioButton value = (RadioButton) type.selectedToggleProperty().getValue();
vueOption.type = value.textProperty().getValue();
dBmanger.generate(file.getAbsolutePath(), vueOption); dBmanger.generate(file.getAbsolutePath(), vueOption);
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
@Override @Override
@ -670,24 +670,6 @@ public class Dialog {
popup.show(); popup.show();
} }
public static void showVueAdmin() {
ProjectManager dBmanger = ManagerFactory.getdBManager();
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(dBmanger.getPath());
Stage stage = new Stage();
File file = directoryChooser.showDialog(stage);
if (file != null) {
System.out.println("生成目录:" + file.getAbsolutePath());
Platform.runLater(new Runnable() {
@Override
public void run() {
stage.close();
}
});
}
}
private static void check(OptionApiController controller, boolean check, String key) { private static void check(OptionApiController controller, boolean check, String key) {
for (Api api : controller.getData()) { for (Api api : controller.getData()) {
if (api.getMethod().endsWith(key) || (key.equals(".api.") && api.getMethod().contains(".api."))) { if (api.getMethod().endsWith(key) || (key.equals(".api.") && api.getMethod().contains(".api."))) {

@ -23,7 +23,6 @@
<Menu mnemonicParsing="false" text="其他模型"> <Menu mnemonicParsing="false" text="其他模型">
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#generateVue" text="生成Vue"/> <MenuItem mnemonicParsing="false" onAction="#generateVue" text="生成Vue"/>
<MenuItem mnemonicParsing="false" onAction="#generateVueAdmin" text="生成VueAdmin"/>
<MenuItem mnemonicParsing="false" onAction="#generateApi" text="生成Api"/> <MenuItem mnemonicParsing="false" onAction="#generateApi" text="生成Api"/>
<MenuItem mnemonicParsing="false" onAction="#generateAndroid" text="生成Android"/> <MenuItem mnemonicParsing="false" onAction="#generateAndroid" text="生成Android"/>
</items> </items>

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<BorderPane prefHeight="170.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" <BorderPane prefHeight="170.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="xyz.wbsite.dbtool.javafx.ctrl.OptionVueController"> fx:controller="xyz.wbsite.dbtool.javafx.ctrl.OptionVueController">
<center> <center>
<VBox prefHeight="120" prefWidth="300"> <VBox prefHeight="200" prefWidth="300">
<children> <children>
<GridPane prefHeight="50.0" prefWidth="300.0" BorderPane.alignment="CENTER"> <GridPane prefHeight="40.0" prefWidth="300.0" BorderPane.alignment="CENTER">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="80.0"/> <ColumnConstraints hgrow="SOMETIMES" prefWidth="80.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="200.0"/> <ColumnConstraints hgrow="SOMETIMES" prefWidth="200.0"/>
@ -29,17 +30,31 @@
</VBox.margin> </VBox.margin>
</GridPane> </GridPane>
<HBox prefHeight="50.0" prefWidth="300.0"> <VBox prefHeight="100.0" prefWidth="300.0">
<children> <children>
<CheckBox fx:id="elementUI" mnemonicParsing="false" selected="true" text="ElementUI"> <RadioButton mnemonicParsing="false" text="vue" id="1">
</CheckBox> <toggleGroup>
<CheckBox fx:id="iView" mnemonicParsing="false" selected="false" text="iView"> <ToggleGroup fx:id="type"/>
</CheckBox> </toggleGroup>
<padding>
<Insets bottom="5.0"/>
</padding>
</RadioButton>
<RadioButton mnemonicParsing="false" text="vue-element-admin" id="2" toggleGroup="$type">
<padding>
<Insets bottom="5.0"/>
</padding>
</RadioButton>
<RadioButton mnemonicParsing="false" text="vue-admin-template" toggleGroup="$type">
<padding>
<Insets bottom="5.0"/>
</padding>
</RadioButton>
</children> </children>
<padding> <padding>
<Insets bottom="3.0" left="30.0" right="10.0" top="10.0"/> <Insets bottom="3.0" left="30.0" right="10.0" top="10.0"/>
</padding> </padding>
</HBox> </VBox>
</children> </children>
</VBox> </VBox>
</center> </center>

@ -1,29 +0,0 @@
# ${appName}
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

@ -1,5 +0,0 @@
module.exports = {
presets: [
'@vue/app'
]
}

File diff suppressed because it is too large Load Diff

@ -1,54 +0,0 @@
{
"name": "${appName}",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^2.6.5",
<#if elementui>
"element-ui": "^2.4.5",
</#if>
<#if iView>
"iview": "^3.4.1",
</#if>
"vue": "^2.6.10",
"vue-router": "^3.0.6"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.7.0",
"@vue/cli-plugin-eslint": "^3.7.0",
"@vue/cli-service": "^3.7.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.5.21"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>${appName}</title>
</head>
<body>
<noscript>
<strong>We're sorry but my-app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

@ -1,33 +0,0 @@
<template>
<div id="app">
<img src="./assets/logo.png">
<div>
<p>
If Element is successfully added to this project, you'll see an
<code v-text="'<el-button>'"></code>
below
</p>
<el-button>el-button</el-button>
</div>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'app'
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

@ -1,66 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank"
rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank"
rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank"
rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

@ -1,17 +0,0 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
<#if elementui>
import './plugins/element.js'
</#if>
<#if iView>
import './plugins/iview.js'
</#if>
Vue.config.productionTip = false
new Vue({
router,
render: h => h(App),
}).$mount('#app')

@ -1,5 +0,0 @@
import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Element)

@ -1,5 +0,0 @@
import Vue from 'vue'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
Vue.use(iView)

@ -1,15 +0,0 @@
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from './components/HelloWorld'//首页
Vue.use(Router)
export default new Router({
routes: [
{//首页
path: '/',
name: 'HelloWorld',
component: HelloWorld
}
]
})
Loading…
Cancel
Save

Powered by TurnKey Linux.