Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
front-backend
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
front-backend
Commits
8e60664e
Commit
8e60664e
authored
Nov 13, 2019
by
dqjdda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
8c4c2808
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
178 additions
and
4 deletions
+178
-4
src/router/routers.js
+15
-1
src/views/generator/config.vue
+155
-0
src/views/generator/generator.vue
+1
-2
src/views/generator/index.vue
+7
-1
No files found.
src/router/routers.js
View file @
8e60664e
...
...
@@ -69,7 +69,21 @@ export const constantRouterMap = [
path
:
'center'
,
component
:
()
=>
import
(
'@/views/system/user/center'
),
name
:
'个人中心'
,
meta
:
{
title
:
'个人中心'
,
icon
:
'user'
}
meta
:
{
title
:
'个人中心'
}
}
]
},
{
path
:
'/generator'
,
component
:
Layout
,
hidden
:
true
,
redirect
:
'noredirect'
,
children
:
[
{
path
:
'config/:tableName'
,
component
:
()
=>
import
(
'@/views/generator/config'
),
name
:
'GeneratorIndex'
,
meta
:
{
title
:
'生成配置'
}
}
]
}
...
...
src/views/generator/config.vue
0 → 100644
View file @
8e60664e
<
template
>
<el-tabs
v-model=
"activeName"
style=
"padding-left: 5px;"
>
<el-tab-pane
label=
"基本配置"
name=
"first"
>
<el-form
ref=
"form"
:inline=
"true"
:model=
"form"
:rules=
"rules"
size=
"small"
label-width=
"90px"
>
<el-form-item
label=
"模块名称"
prop=
"moduleName"
>
<el-input
v-model=
"form.moduleName"
/>
</el-form-item>
<el-form-item
label=
"至于包下"
prop=
"pack"
>
<el-input
v-model=
"form.pack"
/>
</el-form-item>
<el-form-item
label=
"前端路径"
prop=
"path"
>
<el-input
v-model=
"form.path"
/>
</el-form-item>
<el-form-item
label=
"作者名称"
prop=
"author"
>
<el-input
v-model=
"form.author"
/>
</el-form-item>
<el-form-item
label=
"去表前缀"
prop=
"prefix"
>
<el-input
v-model=
"form.prefix"
placeholder=
"默认不去除表前缀"
/>
</el-form-item>
<!--
<el-form-item
label=
"Api路径"
>
-->
<!--
<el-input
v-model=
"form.apiPath"
/>
-->
<!--
</el-form-item>
-->
<el-form-item
label=
"是否覆盖"
prop=
"cover"
>
<el-radio-group
v-model=
"form.cover"
size=
"mini"
>
<el-radio-button
label=
"true"
>
是
</el-radio-button>
<el-radio-button
label=
"false"
>
否
</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane
label=
"字段配置"
name=
"second"
>
<el-form
size=
"small"
label-width=
"90px"
>
<el-table
v-loading=
"loading"
:data=
"data"
size=
"small"
style=
"width: 100%;margin-bottom: 15px"
>
<el-table-column
label=
"序号"
width=
"80"
align=
"center"
>
<template
slot-scope=
"scope"
>
<div>
{{
scope
.
$index
+
1
}}
</div>
</
template
>
</el-table-column>
<el-table-column
prop=
"columnName"
label=
"字段名称"
/>
<el-table-column
prop=
"columnType"
label=
"字段类型"
/>
<el-table-column
prop=
"columnComment"
label=
"字段标题"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"data[scope.$index].columnComment"
class=
"edit-input"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"查询方式"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"data[scope.$index].columnQuery"
class=
"edit-input"
clearable
placeholder=
"请选择"
>
<el-option
label=
"模糊查询"
value=
"1"
/>
<el-option
label=
"精确查询"
value=
"2"
/>
</el-select>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
prop=
"columnShow"
label=
"列表显示"
>
<
template
slot-scope=
"scope"
>
<el-tooltip
:content=
"scope.row.columnShow === 'true' ?'显示':'不显示'"
placement=
"top"
>
<el-switch
v-model=
"data[scope.$index].columnShow"
active-color=
"#13ce66"
inactive-color=
"#ff4949"
active-value=
"true"
inactive-value=
"false"
/>
</el-tooltip>
</
template
>
</el-table-column>
</el-table>
</el-form>
</el-tab-pane>
</el-tabs>
</template>
<
script
>
import
initData
from
'@/mixins/initData'
import
{
update
,
get
}
from
'@/api/genConfig'
export
default
{
name
:
'GeneratorConfig'
,
components
:
{},
mixins
:
[
initData
],
data
()
{
return
{
activeName
:
'second'
,
tableName
:
''
,
form
:
{
author
:
''
,
pack
:
''
,
path
:
''
,
moduleName
:
''
,
cover
:
'false'
,
apiPath
:
''
,
prefix
:
''
},
rules
:
{
author
:
[
{
required
:
true
,
message
:
'作者不能为空'
,
trigger
:
'blur'
}
],
pack
:
[
{
required
:
true
,
message
:
'包路径不能为空'
,
trigger
:
'blur'
}
],
moduleName
:
[
{
required
:
true
,
message
:
'包路径不能为空'
,
trigger
:
'blur'
}
],
path
:
[
{
required
:
true
,
message
:
'前端代码生成路径不能为空'
,
trigger
:
'blur'
}
],
cover
:
[
{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'blur'
}
]
}
}
},
created
()
{
this
.
tableName
=
this
.
$route
.
params
.
tableName
this
.
$nextTick
(()
=>
{
this
.
init
()
get
().
then
(
data
=>
{
this
.
form
=
data
this
.
form
.
cover
=
this
.
form
.
cover
.
toString
()
})
})
},
methods
:
{
beforeInit
()
{
this
.
url
=
'api/generator/columns'
const
tableName
=
this
.
tableName
this
.
params
=
{
tableName
}
return
true
},
cancel
()
{
this
.
$refs
[
'form'
].
resetFields
()
},
doSubmit
()
{
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
update
(
this
.
form
).
then
(
res
=>
{
}).
catch
(
err
=>
{
this
.
cancel
()
console
.
log
(
err
.
response
.
data
.
message
)
})
}
else
{
return
false
}
})
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
>
.edit-input
{
.el-input__inner
{
border
:
none
;
}
}
</
style
>
<
style
scoped
>
/
deep
/
.input-with-select
.el-input-group__prepend
{
background-color
:
#fff
;
}
</
style
>
src/views/generator/generator.vue
View file @
8e60664e
<
template
>
<div>
<el-button
type=
"primary"
size=
"mini"
@
click=
"toGen"
>
生成代码
</el-button
>
<el-button
type=
"primary"
icon=
"el-icon-position"
size=
"mini"
@
click=
"toGen"
/
>
<el-dialog
:visible
.
sync=
"dialog"
:close-on-click-modal=
"false"
:before-close=
"cancel"
title=
"代码生成配置"
append-to-body
width=
"880px"
>
<el-form
ref=
"form"
:inline=
"true"
:model=
"form"
:rules=
"rules"
size=
"small"
label-width=
"90px"
>
<el-form-item
label=
"模块名称"
prop=
"moduleName"
>
...
...
@@ -114,7 +114,6 @@ export default {
methods
:
{
toGen
()
{
this
.
dialog
=
true
this
.
time
=
130
this
.
$nextTick
(()
=>
{
this
.
init
()
get
().
then
(
data
=>
{
...
...
src/views/generator/index.vue
View file @
8e60664e
...
...
@@ -23,7 +23,13 @@
</el-table-column>
<el-table-column
label=
"操作"
width=
"140px"
align=
"center"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<Generator
:name=
"scope.row.tableName"
/>
<el-button
size=
"mini"
style=
"margin-right: 2px"
type=
"text"
>
预览
</el-button>
<el-button
size=
"mini"
style=
"margin-left: -1px;margin-right: 2px"
type=
"text"
>
<router-link
:to=
"'/generator/config/' + scope.row.tableName"
>
编辑
</router-link>
</el-button>
<el-button
type=
"text"
style=
"margin-left: -1px"
size=
"mini"
>
生成
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
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