Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
renren-generator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
renren-generator
Commits
d1e927f2
Commit
d1e927f2
authored
Jun 18, 2018
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持renren-fast-vue最新版
parent
116d0902
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
322 deletions
+35
-322
README.md
README.md
+0
-47
GenUtils.java
src/main/java/io/renren/utils/GenUtils.java
+6
-25
add-or-update.vue.vm
src/main/resources/template/add-or-update.vue.vm
+11
-6
list.html.vm
src/main/resources/template/adminlte/list.html.vm
+0
-59
list.js.vm
src/main/resources/template/adminlte/list.js.vm
+0
-124
index.js.vm
src/main/resources/template/elementui/index.js.vm
+0
-49
index.vue.vm
src/main/resources/template/index.vue.vm
+17
-11
menu.sql.vm
src/main/resources/template/menu.sql.vm
+1
-1
No files found.
README.md
View file @
d1e927f2
...
...
@@ -24,50 +24,3 @@
**演示效果图:**
![
输入图片说明
](
http://cdn.renren.io/img/82b99a1f0f884454ac3fff5e7f658ac8
"在这里输入图片标题"
)
**renren-fast-vue**
-
会生成elementui目录,把elementui目录下的src目录,直接覆盖原工程
-
修改原工程下的src/api/index.js,如:
```
javascript
import
*
as
common
from
'./modules/common'
import
*
as
user
from
'./modules/user'
import
*
as
role
from
'./modules/role'
import
*
as
menu
from
'./modules/menu'
import
*
as
log
from
'./modules/log'
import
*
as
config
from
'./modules/config'
import
*
as
oss
from
'./modules/oss'
import
*
as
goods
from
'./modules/goods'
import
*
as
schedule
from
'./modules/schedule'
export
default
{
common
,
// 公共
user
,
// 管理员管理
role
,
// 角色管理
menu
,
// 菜单管理
log
,
// 系统日志
config
,
// 参数管理
oss
,
// 文件服务
goods
,
// 商品管理
schedule
// 定时任务
}
```
-
修改原工程下的src/router/index.js,如:
```
javascript
children
:
[
// 通过isTab属性, 设定是否通过tab标签页展示内容
{
path
:
'/home'
,
component
:
_import
(
'home/index'
),
name
:
'home'
,
desc
:
'首页'
},
{
path
:
'/layout-setting'
,
component
:
_import
(
'layout/setting'
),
name
:
'setting'
,
desc
:
'布局设置'
},
{
path
:
'/user'
,
component
:
_import
(
'user/index'
),
name
:
'user'
,
desc
:
'管理员管理'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/role'
,
component
:
_import
(
'role/index'
),
name
:
'role'
,
desc
:
'角色管理'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/menu'
,
component
:
_import
(
'menu/index'
),
name
:
'menu'
,
desc
:
'菜单管理'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/sql'
,
component
:
_import
(
'sql/index'
),
name
:
'sql'
,
desc
:
'SQL监控'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/schedule'
,
component
:
_import
(
'schedule/index'
),
name
:
'schedule'
,
desc
:
'定时任务'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/config'
,
component
:
_import
(
'config/index'
),
name
:
'config'
,
desc
:
'参数管理'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/oss'
,
component
:
_import
(
'oss/index'
),
name
:
'oss'
,
desc
:
'文件上传'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/goods'
,
component
:
_import
(
'goods/index'
),
name
:
'goods'
,
desc
:
'商品管理'
,
meta
:
{
isTab
:
true
}
},
{
path
:
'/log'
,
component
:
_import
(
'log/index'
),
name
:
'log'
,
desc
:
'系统日志'
,
meta
:
{
isTab
:
true
}
}
]
```
src/main/java/io/renren/utils/GenUtils.java
View file @
d1e927f2
...
...
@@ -38,12 +38,8 @@ public class GenUtils {
templates
.
add
(
"template/Controller.java.vm"
);
templates
.
add
(
"template/menu.sql.vm"
);
templates
.
add
(
"template/adminlte/list.html.vm"
);
templates
.
add
(
"template/adminlte/list.js.vm"
);
templates
.
add
(
"template/elementui/index.vue.vm"
);
templates
.
add
(
"template/elementui/add-or-update.vue.vm"
);
templates
.
add
(
"template/elementui/index.js.vm"
);
templates
.
add
(
"template/index.vue.vm"
);
templates
.
add
(
"template/add-or-update.vue.vm"
);
return
templates
;
}
...
...
@@ -209,29 +205,14 @@ public class GenUtils {
return
className
.
toLowerCase
()
+
"_menu.sql"
;
}
if
(
template
.
contains
(
"list.html.vm"
))
{
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"adminlte"
+
File
.
separator
+
"modules"
+
File
.
separator
+
moduleName
+
File
.
separator
+
className
.
toLowerCase
()
+
".html"
;
}
if
(
template
.
contains
(
"list.js.vm"
))
{
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"adminlte"
+
File
.
separator
+
"js"
+
File
.
separator
+
"modules"
+
File
.
separator
+
moduleName
+
File
.
separator
+
className
.
toLowerCase
()
+
".js"
;
}
if
(
template
.
contains
(
"index.vue.vm"
))
{
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"
elementui"
+
File
.
separator
+
"src"
+
File
.
separator
+
"view
s"
+
File
.
separator
+
className
.
toLowerCase
()
+
File
.
separator
+
"index
.vue"
;
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"
src"
+
File
.
separator
+
"views"
+
File
.
separator
+
"module
s"
+
File
.
separator
+
moduleName
+
File
.
separator
+
className
.
toLowerCase
()
+
"
.vue"
;
}
if
(
template
.
contains
(
"add-or-update.vue.vm"
))
{
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"elementui"
+
File
.
separator
+
"src"
+
File
.
separator
+
"views"
+
File
.
separator
+
className
.
toLowerCase
()
+
File
.
separator
+
"add-or-update.vue"
;
}
if
(
template
.
contains
(
"index.js.vm"
))
{
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"elementui"
+
File
.
separator
+
"src"
+
File
.
separator
+
"api"
+
File
.
separator
+
"modules"
+
File
.
separator
+
className
.
toLowerCase
()
+
".js"
;
return
"main"
+
File
.
separator
+
"resources"
+
File
.
separator
+
"src"
+
File
.
separator
+
"views"
+
File
.
separator
+
"modules"
+
File
.
separator
+
moduleName
+
File
.
separator
+
className
.
toLowerCase
()
+
"-add-or-update.vue"
;
}
return
null
;
...
...
src/main/resources/template/
elementui/
add-or-update.vue.vm
→
src/main/resources/template/add-or-update.vue.vm
View file @
d1e927f2
...
...
@@ -20,7 +20,6 @@
</template>
<script>
import API from '@/api'
export default {
data () {
return {
...
...
@@ -54,7 +53,11 @@
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.${pk.attrname}) {
API.${pathName}.info(this.dataForm.${pk.attrname}).then(({data}) => {
this.$http({
url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/info/#[[$]]#{this.dataForm.${pk.attrname}}`),
method: 'get',
#[[params: this.$http.adornParams()]]#
}).then(({data}) => {
if (data && data.code === 0) {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
...
...
@@ -70,7 +73,10 @@
dataFormSubmit () {
#[[this.$refs['dataForm'].validate((valid) => {]]#
if (valid) {
var params = {
this.$http({
url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/${!this.dataForm.${pk.attrname} ? 'save' : 'update'}`),
method: 'post',
#[[data: this.$http.adornData({]]#
#foreach($column in $columns)
#if($column.columnName == $pk.columnName)
'${column.attrname}': this.dataForm.${column.attrname} || undefined,
...
...
@@ -79,9 +85,8 @@
#end
#end
}
var tick = !this.dataForm.${pk.attrname} ? API.${pathName}.add(params) : API.${pathName}.update(params)
tick.then(({data}) => {
})
}).then(({data}) => {
if (data && data.code === 0) {
#[[this.$message({]]#
message: '操作成功',
...
...
src/main/resources/template/adminlte/list.html.vm
deleted
100644 → 0
View file @
116d0902
<!DOCTYPE html>
<html>
<head>
<title>
${comments}
</title>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
name=
"viewport"
>
<link
rel=
"stylesheet"
href=
"../../css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"../../css/font-awesome.min.css"
>
<link
rel=
"stylesheet"
href=
"../../plugins/jqgrid/ui.jqgrid-bootstrap.css"
>
<link
rel=
"stylesheet"
href=
"../../plugins/ztree/css/metroStyle/metroStyle.css"
>
<link
rel=
"stylesheet"
href=
"../../css/main.css"
>
<script
src=
"../../libs/jquery.min.js"
></script>
<script
src=
"../../plugins/layer/layer.js"
></script>
<script
src=
"../../libs/bootstrap.min.js"
></script>
<script
src=
"../../libs/vue.min.js"
></script>
<script
src=
"../../plugins/jqgrid/grid.locale-cn.js"
></script>
<script
src=
"../../plugins/jqgrid/jquery.jqGrid.min.js"
></script>
<script
src=
"../../plugins/ztree/jquery.ztree.all.min.js"
></script>
<script
src=
"../../js/common.js"
></script>
</head>
<body>
<div
id=
"rrapp"
v-cloak
>
<div
v-show=
"showList"
>
<div
class=
"grid-btn"
>
<a
v-if=
"hasPermission('${moduleName}:${pathName}:save')"
class=
"btn btn-primary"
@
click=
"add"
><i
class=
"fa fa-plus"
></i>
新增
</a>
<a
v-if=
"hasPermission('${moduleName}:${pathName}:update')"
class=
"btn btn-primary"
@
click=
"update"
><i
class=
"fa fa-pencil-square-o"
></i>
修改
</a>
<a
v-if=
"hasPermission('${moduleName}:${pathName}:delete')"
class=
"btn btn-primary"
@
click=
"del"
><i
class=
"fa fa-trash-o"
></i>
删除
</a>
</div>
<table
id=
"jqGrid"
></table>
<div
id=
"jqGridPager"
></div>
</div>
<div
v-show=
"!showList"
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
{{title}}
</div>
<form
class=
"form-horizontal"
>
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<div
class=
"form-group"
>
<div
class=
"col-sm-2 control-label"
>
${column.comments}
</div>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
v-model=
"${classname}.${column.attrname}"
placeholder=
"${column.comments}"
/>
</div>
</div>
#end
#end
<div
class=
"form-group"
>
<div
class=
"col-sm-2 control-label"
></div>
<input
type=
"button"
class=
"btn btn-primary"
@
click=
"saveOrUpdate"
value=
"确定"
/>
<input
type=
"button"
class=
"btn btn-warning"
@
click=
"reload"
value=
"返回"
/>
</div>
</form>
</div>
</div>
<script
src=
"../../js/modules/${moduleName}/${pathName}.js"
></script>
</body>
</html>
\ No newline at end of file
src/main/resources/template/adminlte/list.js.vm
deleted
100644 → 0
View file @
116d0902
$(function () {
$("#jqGrid").jqGrid({
url: baseURL + '${moduleName}/${pathName}/list',
datatype: "json",
colModel: [
#foreach($column in $columns)
#if($column.columnName == $pk.columnName)
{ label: '${column.attrname}', name: '${column.attrname}', index: '${column.columnName}', width: 50, key: true },
#else
{ label: '${column.comments}', name: '${column.attrname}', index: '${column.columnName}', width: 80 }#if($velocityCount != $columns.size()), #end
#end
#end
],
viewrecords: true,
height: 385,
rowNum: 10,
rowList : [10,30,50],
rownumbers: true,
rownumWidth: 25,
autowidth:true,
multiselect: true,
pager: "#jqGridPager",
jsonReader : {
root: "page.list",
page: "page.currPage",
total: "page.totalPage",
records: "page.totalCount"
},
prmNames : {
page:"page",
rows:"limit",
order: "order"
},
gridComplete:function(){
//隐藏grid底部滚动条
$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
}
});
});
var vm = new Vue({
el:'#rrapp',
data:{
showList: true,
title: null,
${classname}: {}
},
methods: {
query: function () {
vm.reload();
},
add: function(){
vm.showList = false;
vm.title = "新增";
vm.${classname} = {};
},
update: function (event) {
var $pk.attrname = getSelectedRow();
if($pk.attrname == null){
return ;
}
vm.showList = false;
vm.title = "修改";
vm.getInfo(${pk.attrname})
},
saveOrUpdate: function (event) {
var url = vm.${classname}.${pk.attrname} == null ? "${moduleName}/${pathName}/save" : "${moduleName}/${pathName}/update";
$.ajax({
type: "POST",
url: baseURL + url,
contentType: "application/json",
data: JSON.stringify(vm.${classname}),
success: function(r){
if(r.code === 0){
alert('操作成功', function(index){
vm.reload();
});
}else{
alert(r.msg);
}
}
});
},
del: function (event) {
var ${pk.attrname}s = getSelectedRows();
if(${pk.attrname}s == null){
return ;
}
confirm('确定要删除选中的记录?', function(){
$.ajax({
type: "POST",
url: baseURL + "${moduleName}/${pathName}/delete",
contentType: "application/json",
data: JSON.stringify(${pk.attrname}s),
success: function(r){
if(r.code == 0){
alert('操作成功', function(index){
$("#jqGrid").trigger("reloadGrid");
});
}else{
alert(r.msg);
}
}
});
});
},
getInfo: function(${pk.attrname}){
$.get(baseURL + "${moduleName}/${pathName}/info/"+${pk.attrname}, function(r){
vm.${classname} = r.${classname};
});
},
reload: function (event) {
vm.showList = true;
var page = $("#jqGrid").jqGrid('getGridParam','page');
$("#jqGrid").jqGrid('setGridParam',{
page:page
}).trigger("reloadGrid");
}
}
});
\ No newline at end of file
src/main/resources/template/elementui/index.js.vm
deleted
100644 → 0
View file @
116d0902
import request from '../request'
import requestUrl from '../requestUrl'
import requestParam from '../requestParam'
import isInteger from 'lodash/isInteger'
// 获取列表
export function list (params) {
return request({
url: requestUrl('/${moduleName}/${pathName}/list'),
method: 'get',
params: requestParam(params, 'get')
})
}
// 获取信息
export function info (id) {
return request({
url: requestUrl('/${moduleName}/${pathName}/info' + (isInteger(id) ? `/${id}` : '')),
method: 'get',
params: requestParam({}, 'get')
})
}
// 添加
export function add (params) {
return request({
url: requestUrl('/${moduleName}/${pathName}/save'),
method: 'post',
data: requestParam(params)
})
}
// 修改
export function update (params) {
return request({
url: requestUrl('/${moduleName}/${pathName}/update'),
method: 'post',
data: requestParam(params)
})
}
// 删除
export function del (params) {
return request({
url: requestUrl('/${moduleName}/${pathName}/delete'),
method: 'post',
data: requestParam(params, 'post', false)
})
}
src/main/resources/template/
elementui/
index.vue.vm
→
src/main/resources/template/index.vue.vm
View file @
d1e927f2
...
...
@@ -57,8 +57,7 @@
</template>
<script>
import API from '@/api'
import AddOrUpdate from './add-or-update'
import AddOrUpdate from './${pathName}-add-or-update'
export default {
data () {
return {
...
...
@@ -84,12 +83,15 @@
// 获取数据列表
getDataList () {
this.dataListLoading = true
var params = {
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
}
API.${pathName}.list(params).then(({data}) => {
#[[this.$http({]]#
#[[url: this.$http.adornUrl]]#('/${moduleName}/${pathName}/list'),
method: 'get',
#[[params: this.$http.adornParams({]]#
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
...
...
@@ -118,7 +120,7 @@
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
#[[this.$nextTick(() => {]]#
this.$refs.addOrUpdate.init(id)
})
},
...
...
@@ -132,9 +134,13 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
API.${pathName}.del(ids).then(({data}) => {
#[[this.$http({]]#
url: #[[this.$http.adornUrl]]#('/${moduleName}/${pathName}/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
#[[this.$message({]]#
message: '操作成功',
type: 'success',
duration: 1500,
...
...
src/main/resources/template/menu.sql.vm
View file @
d1e927f2
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '${comments}', '
modules/${moduleName}/${pathName}.html', NULL, '1', 'fa fa-file-code-o
', '6');
VALUES ('1', '${comments}', '
${moduleName}/${pathName}', NULL, '1', 'config
', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment