Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
0c61b945
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
337
Star
18155
Fork
5506
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c61b945
编写于
12月 31, 2021
作者:
P
piexlmax
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
自动化代码修改完成
上级
2b3d36b5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
207 addition
and
162 deletion
+207
-162
server/resource/template/web/form.vue.tpl
server/resource/template/web/form.vue.tpl
+51
-45
server/resource/template/web/table.vue.tpl
server/resource/template/web/table.vue.tpl
+148
-113
web/src/view/systemTools/autoCode/index.vue
web/src/view/systemTools/autoCode/index.vue
+2
-2
web/src/view/systemTools/system/system.vue
web/src/view/systemTools/system/system.vue
+6
-2
未找到文件。
server/resource/template/web/form.vue.tpl
浏览文件 @
0c61b945
...
...
@@ -37,83 +37,89 @@
</template>
<script>
export
default
{
name
:
'
{{.StructName}}
'
}
</script>
<script
setup
>
import
{
create
{{.
StructName
}},
update
{{.
StructName
}},
find
{{.
StructName
}}
}
from
'
@/api/{{.PackageName}}
'
// 此处请自行替换地址
import
infoList
from
'
@/mixins/infoList
'
export
default
{
name
:
'
{{.StructName}}
'
,
mixins
:
[
infoList
],
data
()
{
return
{
type
:
''
,
{{
-
range
$index
,
$element
:
=
.
DictTypes
}}
{{
$element
}}
Options
:
[],
{{
-
end
}}
formData
:
{
}
from
'
@/api/{{.PackageName}}
'
import
{
getDictFunc
}
from
'
@/utils/format
'
import
{
useRoute
,
useRouter
}
from
"
vue-router
"
import
{
ElMessage
}
from
'
element-plus
'
import
{
ref
}
from
'
vue
'
const
route
=
useRoute
()
const
router
=
useRouter
()
const
type
=
ref
(
''
)
{{
-
range
$index
,
$element
:
=
.
DictTypes
}}
const
{{
$element
}}
Options
=
ref
([])
{{
-
end
}}
const
formData
=
ref
({
{{
-
range
.
Fields
}}
{{
-
if
eq
.
FieldType
"
bool
"
}}
{{
-
if
eq
.
FieldType
"
bool
"
}}
{{.
FieldJson
}}:
false
,
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
string
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
string
"
}}
{{.
FieldJson
}}:
''
,
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
int
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
int
"
}}
{{.
FieldJson
}}:
{{
-
if
.
DictType
}}
undefined
{{
else
}}
0
{{
-
end
}},
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
time.Time
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
time.Time
"
}}
{{.
FieldJson
}}:
new
Date
(),
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
float64
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
float64
"
}}
{{.
FieldJson
}}:
0
,
{{
-
end
}}
{{
-
end
}}
}
}
},
async
created
()
{
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
if
(
this
.
$route
.
query
.
id
)
{
const
res
=
await
find
{{.
StructName
}}({
ID
:
this
.
$route
.
query
.
id
})
{{
-
end
}}
})
const
init
=
async
()
=>
{
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
if
(
route
.
query
.
id
)
{
const
res
=
await
find
{{.
StructName
}}({
ID
:
route
.
query
.
id
})
if
(
res
.
code
===
0
)
{
this
.
formData
=
res
.
data
.
re
{{.
Abbreviation
}}
t
his
.
typ
e
=
'
update
'
formData
.
value
=
res
.
data
.
re
{{.
Abbreviation
}}
t
ype
.
valu
e
=
'
update
'
}
}
else
{
t
his
.
typ
e
=
'
create
'
t
ype
.
valu
e
=
'
create
'
}
{{
-
range
$index
,
$element
:
=
.
DictTypes
}}
await
this
.
getDict
(
'
{
{
$element
}
}
'
)
{{
$element
}}
Options
.
value
=
await
getDictFunc
(
'
{
{
$element
}
}
'
)
{{
-
end
}}
},
methods
:
{
async
save
()
{
}
init
()
const
save
=
async
()
=>
{
let
res
switch
(
t
his
.
typ
e
)
{
switch
(
t
ype
.
valu
e
)
{
case
'
create
'
:
res
=
await
create
{{.
StructName
}}(
this
.
formData
)
res
=
await
create
{{.
StructName
}}(
formData
.
value
)
break
case
'
update
'
:
res
=
await
update
{{.
StructName
}}(
this
.
formData
)
res
=
await
update
{{.
StructName
}}(
formData
.
value
)
break
default
:
res
=
await
create
{{.
StructName
}}(
this
.
formData
)
res
=
await
create
{{.
StructName
}}(
formData
.
value
)
break
}
if
(
res
.
code
===
0
)
{
this
.
$m
essage
({
ElM
essage
({
type
:
'
success
'
,
message
:
'
创建/更改成功
'
})
}
},
back
()
{
this
.
$router
.
go
(
-
1
)
}
}
const
back
=
()
=>
{
router
.
go
(
-
1
)
}
</script>
<style>
...
...
server/resource/template/web/table.vue.tpl
浏览文件 @
0c61b945
...
...
@@ -57,7 +57,7 @@
{{- if .DictType}}
<el-table-column
align=
"left"
label=
"{{.FieldDesc}}"
prop=
"{{.FieldJson}}"
width=
"120"
>
<template
#default
="
scope
"
>
{
{
"{{"
}
} filterDict(scope.row.{{.FieldJson}},
"{{.DictType}}"
) {
{
"}}"
}
}
{
{
"{{"
}
} filterDict(scope.row.{{.FieldJson}},
{{.DictType}}Options
) {
{
"}}"
}
}
</template>
</el-table-column>
{{- else if eq .FieldType "bool" }}
...
...
@@ -69,7 +69,7 @@
{{- end }}
<el-table-column
align=
"left"
label=
"按钮组"
>
<template
#default
="
scope
"
>
<el-button
type=
"text"
icon=
"edit"
size=
"small"
class=
"table-button"
@
click=
"update{{.StructName}}(scope.row)"
>
变更
</el-button>
<el-button
type=
"text"
icon=
"edit"
size=
"small"
class=
"table-button"
@
click=
"update{{.StructName}}
Func
(scope.row)"
>
变更
</el-button>
<el-button
type=
"text"
icon=
"delete"
size=
"mini"
@
click=
"deleteRow(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
...
...
@@ -125,6 +125,12 @@
</template>
<script>
export
default
{
name
:
'
{{.StructName}}
'
}
</script>
<script
setup
>
import
{
create
{{.
StructName
}},
delete
{{.
StructName
}},
...
...
@@ -132,112 +138,143 @@ import {
update
{{.
StructName
}},
find
{{.
StructName
}},
get
{{.
StructName
}}
List
}
from
'
@/api/{{.PackageName}}
'
// 此处请自行替换地址
import
infoList
from
'
@/mixins/infoList
'
export
default
{
name
:
'
{{.StructName}}
'
,
mixins
:
[
infoList
],
data
()
{
return
{
listApi
:
get
{{
.
StructName
}}
List
,
dialogFormVisible
:
false
,
type
:
''
,
deleteVisible
:
false
,
multipleSelection
:
[],
{{
-
range
$index
,
$element
:
=
.
DictTypes
}}
{{
$element
}}
Options
:
[],
{{
-
end
}}
formData
:
{
{{
-
range
.
Fields
}}
{{
-
if
eq
.
FieldType
"
bool
"
}}
}
from
'
@/api/{{.PackageName}}
'
import
{
getDictFunc
,
formatDate
,
formatBoolean
,
filterDict
}
from
'
@/utils/format
'
import
{
ElMessage
,
ElMessageBox
}
from
'
element-plus
'
import
{
ref
}
from
'
vue
'
const
dialogFormVisible
=
ref
(
false
)
const
type
=
ref
(
''
)
const
deleteVisible
=
ref
(
false
)
const
multipleSelection
=
ref
([])
{{
-
range
$index
,
$element
:
=
.
DictTypes
}}
const
{{
$element
}}
Options
=
ref
([])
{{
-
end
}}
const
formData
=
ref
({
{{
-
range
.
Fields
}}
{{
-
if
eq
.
FieldType
"
bool
"
}}
{{.
FieldJson
}}:
false
,
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
string
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
string
"
}}
{{.
FieldJson
}}:
''
,
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
int
"
}}
{{.
FieldJson
}}:
{{
-
if
.
DictType
}}
undefined
{{
else
}}
0
{{
-
end
}},
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
time.Time
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
int
"
}}
{{.
FieldJson
}}:
{{
-
if
.
DictType
}}
undefined
{{
else
}}
0
{{
-
end
}},
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
time.Time
"
}}
{{.
FieldJson
}}:
new
Date
(),
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
float64
"
}}
{{
-
end
}}
{{
-
if
eq
.
FieldType
"
float64
"
}}
{{.
FieldJson
}}:
0
,
{{
-
end
}}
{{
-
end
}}
}
}
},
async
created
()
{
await
this
.
getTableData
()
{{
-
end
}}
{{
-
end
}}
})
const
page
=
ref
(
1
)
const
total
=
ref
(
0
)
const
pageSize
=
ref
(
10
)
const
tableData
=
ref
([])
const
searchInfo
=
ref
({})
const
onReset
=
()
=>
{
searchInfo
.
value
=
{}
}
// 搜索
const
onSubmit
=
()
=>
{
page
.
value
=
1
pageSize
.
value
=
10
{{
-
range
.
Fields
}}{{
-
if
eq
.
FieldType
"
bool
"
}}
if
(
searchInfo
.
value
.{{.
FieldJson
}}
===
""
){
searchInfo
.
value
.{{.
FieldJson
}}
=
null
}{{
end
}}{{
end
}}
getTableData
()
}
// 分页
const
handleSizeChange
=
(
val
)
=>
{
pageSize
.
value
=
val
getTableData
()
}
const
handleCurrentChange
=
(
val
)
=>
{
page
.
value
=
val
getTableData
()
}
// 查询
const
getTableData
=
async
()
=>
{
const
table
=
await
get
{{.
StructName
}}
List
({
page
:
page
.
value
,
pageSize
:
pageSize
.
value
,
...
searchInfo
.
value
})
if
(
table
.
code
===
0
)
{
tableData
.
value
=
table
.
data
.
list
total
.
value
=
table
.
data
.
total
page
.
value
=
table
.
data
.
page
pageSize
.
value
=
table
.
data
.
pageSize
}
}
getTableData
()
const
setOptions
=
async
()
=>
{
{{
-
range
$index
,
$element
:
=
.
DictTypes
}}
await
this
.
getDict
(
'
{
{
$element
}
}
'
)
{{
$element
}}
Options
.
value
=
await
getDictFunc
(
'
{
{
$element
}
}
'
)
{{
-
end
}}
},
methods
:
{
onReset
()
{
this
.
searchInfo
=
{}
},
// 条件搜索前端看此方法
onSubmit
()
{
this
.
page
=
1
this
.
pageSize
=
10
{{
-
range
.
Fields
}}{{
-
if
eq
.
FieldType
"
bool
"
}}
if
(
this
.
searchInfo
.{{.
FieldJson
}}
===
""
){
this
.
searchInfo
.{{.
FieldJson
}}
=
null
}{{
end
}}{{
end
}}
this
.
getTableData
()
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
},
deleteRow
(
row
)
{
this
.
$confirm
(
'
确定要删除吗?
'
,
'
提示
'
,
{
}
setOptions
()
const
handleSelectionChange
=
(
val
)
=>
{
multipleSelection
.
value
=
val
}
const
deleteRow
=
(
row
)
=>
{
ElMessageBox
.
confirm
(
'
确定要删除吗?
'
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}).
then
(()
=>
{
this
.
delete
{{.
StructName
}}
(
row
)
})
}
,
async
onDelete
()
{
}).
then
(()
=>
{
delete
{{.
StructName
}}
Func
(
row
)
})
}
const
onDelete
=
async
()
=>
{
const
ids
=
[]
if
(
this
.
multipleSelection
.
length
===
0
)
{
this
.
$m
essage
({
if
(
multipleSelection
.
value
.
length
===
0
)
{
ElM
essage
({
type
:
'
warning
'
,
message
:
'
请选择要删除的数据
'
})
return
}
this
.
multipleSelection
&&
this
.
multipleSelection
.
map
(
item
=>
{
multipleSelection
.
value
&&
multipleSelection
.
value
.
map
(
item
=>
{
ids
.
push
(
item
.
ID
)
})
const
res
=
await
delete
{{.
StructName
}}
ByIds
({
ids
})
if
(
res
.
code
===
0
)
{
this
.
$m
essage
({
ElM
essage
({
type
:
'
success
'
,
message
:
'
删除成功
'
})
if
(
t
his
.
tableData
.
length
===
ids
.
length
&&
this
.
pag
e
>
1
)
{
this
.
pag
e
--
if
(
t
ableData
.
value
.
length
===
ids
.
length
&&
page
.
valu
e
>
1
)
{
page
.
valu
e
--
}
this
.
deleteVisible
=
false
this
.
getTableData
()
}
},
async
update
{{.
StructName
}}(
row
)
{
const
res
=
await
find
{{.
StructName
}}({
ID
:
row
.
ID
})
this
.
type
=
'
update
'
if
(
res
.
code
===
0
)
{
this
.
formData
=
res
.
data
.
re
{{.
Abbreviation
}}
this
.
dialogFormVisible
=
true
deleteVisible
.
value
=
false
getTableData
()
}
},
closeDialog
()
{
this
.
dialogFormVisible
=
false
this
.
formData
=
{
{{
-
range
.
Fields
}}
}
const
update
{{.
StructName
}}
Func
=
async
(
row
)
=>
{
const
res
=
await
find
{{.
StructName
}}({
ID
:
row
.
ID
})
type
.
value
=
'
update
'
if
(
res
.
code
===
0
)
{
formData
.
value
=
res
.
data
.
re
{{.
Abbreviation
}}
dialogFormVisible
.
value
=
true
}
}
const
closeDialog
=
()
=>
{
dialogFormVisible
.
value
=
false
formData
.
value
=
{
{{
-
range
.
Fields
}}
{{
-
if
eq
.
FieldType
"
bool
"
}}
{{.
FieldJson
}}:
false
,
{{
-
end
}}
...
...
@@ -253,49 +290,47 @@ export default {
{{
-
if
eq
.
FieldType
"
float64
"
}}
{{.
FieldJson
}}:
0
,
{{
-
end
}}
{{
-
end
}}
}
},
async
delete
{{.
StructName
}}(
row
)
{
const
res
=
await
delete
{{.
StructName
}}({
ID
:
row
.
ID
})
if
(
res
.
code
===
0
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
删除成功
'
})
if
(
this
.
tableData
.
length
===
1
&&
this
.
page
>
1
)
{
this
.
page
--
{{
-
end
}}
}
this
.
getTableData
()
}
},
async
enterDialog
()
{
}
const
delete
{{.
StructName
}}
Func
=
async
(
row
)
=>
{
const
res
=
await
delete
{{.
StructName
}}({
ID
:
row
.
ID
})
if
(
res
.
code
===
0
)
{
ElMessage
({
type
:
'
success
'
,
message
:
'
删除成功
'
})
if
(
tableData
.
value
.
length
===
1
&&
page
.
value
>
1
)
{
page
.
value
--
}
getTableData
()
}
}
const
enterDialog
=
async
()
=>
{
let
res
switch
(
t
his
.
typ
e
)
{
switch
(
t
ype
.
valu
e
)
{
case
'
create
'
:
res
=
await
create
{{.
StructName
}}(
this
.
formData
)
res
=
await
create
{{.
StructName
}}(
formData
.
value
)
break
case
'
update
'
:
res
=
await
update
{{.
StructName
}}(
this
.
formData
)
res
=
await
update
{{.
StructName
}}(
formData
.
value
)
break
default
:
res
=
await
create
{{.
StructName
}}(
this
.
formData
)
res
=
await
create
{{.
StructName
}}(
formData
.
value
)
break
}
if
(
res
.
code
===
0
)
{
this
.
$m
essage
({
ElM
essage
({
type
:
'
success
'
,
message
:
'
创建/更改成功
'
})
this
.
closeDialog
()
this
.
getTableData
()
closeDialog
()
getTableData
()
}
},
openDialog
()
{
this
.
type
=
'
create
'
this
.
dialogFormVisible
=
true
}
},
}
const
openDialog
=
()
=>
{
type
.
value
=
'
create
'
dialogFormVisible
.
value
=
true
}
</script>
...
...
web/src/view/systemTools/autoCode/index.vue
浏览文件 @
0c61b945
...
...
@@ -185,12 +185,12 @@ import PreviewCodeDialog from '@/view/systemTools/autoCode/component/previewCode
import
{
toUpperCase
,
toHump
,
toSQLLine
,
toLowerCase
}
from
'
@/utils/stringFun
'
import
{
createTemp
,
getDB
,
getTable
,
getColumn
,
preview
,
getMeta
}
from
'
@/api/autoCode
'
import
{
getDict
}
from
'
@/utils/dictionary
'
import
{
ref
,
getCurrentInstance
}
from
'
vue
'
import
{
ref
,
getCurrentInstance
,
reactive
}
from
'
vue
'
import
{
useRoute
}
from
'
vue-router
'
import
{
ElMessage
}
from
'
element-plus
'
const
route
=
useRoute
()
const
activeNames
=
re
f
([
''
])
const
activeNames
=
re
active
([
])
const
preViewCode
=
ref
({})
const
dbform
=
ref
({
dbName
:
''
,
...
...
web/src/view/systemTools/system/system.vue
浏览文件 @
0c61b945
...
...
@@ -347,11 +347,15 @@ export default {
<
script
setup
>
import
{
getSystemConfig
,
setSystemConfig
}
from
'
@/api/system
'
import
{
emailTest
}
from
'
@/api/email
'
import
{
ref
}
from
'
vue
'
import
{
ref
,
reactive
}
from
'
vue
'
import
{
ElMessage
}
from
'
element-plus
'
const
activeNames
=
reactive
([])
const
config
=
ref
({
system
:
{},
system
:
{
iplimitCount
:
0
,
iplimitTime
:
0
},
jwt
:
{},
casbin
:
{},
mysql
:
{},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录