Skip to content

Commit 78ddb9b

Browse files
authored
Merge pull request #11 from flipped-aurora/main
fork merge
2 parents eb89190 + 80c54ad commit 78ddb9b

File tree

153 files changed

+12578
-12629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+12578
-12629
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@
1212

1313
[English](./README-en.md) | 简体中文
1414

15+
## ✨一分钟生成前后端基础代码
16+
17+
<table>
18+
<tr>
19+
<td width="200">
20+
<p>📄 创建基础模板</p>
21+
<p>🤖 AI生成结构</p>
22+
<p>⏰ 生成代码</p>
23+
<p>🏷️ 分配权限</p>
24+
<p>🎉 基础CURD生成完成</p>
25+
</td>
26+
<td>
27+
<video src="https://private-user-images.githubusercontent.com/165128580/384700666-4d039215-af29-4f86-bb4f-60dbab38f58e.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzEyNTIxNDYsIm5iZiI6MTczMTI1MTg0NiwicGF0aCI6Ii8xNjUxMjg1ODAvMzg0NzAwNjY2LTRkMDM5MjE1LWFmMjktNGY4Ni1iYjRmLTYwZGJhYjM4ZjU4ZS5tcDQ_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTExMFQxNTE3MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NjJkMDcwZjJkMjAyMmU1N2I2MzQxY2RhODFlNzgzNGRiMDFhMmY2NTYyM2ZmODdhNDVmMWE1NzlhMDdlOTI5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ZJbswpLzF2RHjemcGirKOP0L1fvpl3FUqIiQ_-yjeUo" data-canonical-src="https://private-user-images.githubusercontent.com/165128580/384700666-4d039215-af29-4f86-bb4f-60dbab38f58e.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzEyNTIxNDYsIm5iZiI6MTczMTI1MTg0NiwicGF0aCI6Ii8xNjUxMjg1ODAvMzg0NzAwNjY2LTRkMDM5MjE1LWFmMjktNGY4Ni1iYjRmLTYwZGJhYjM4ZjU4ZS5tcDQ_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTExMFQxNTE3MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NjJkMDcwZjJkMjAyMmU1N2I2MzQxY2RhODFlNzgzNGRiMDFhMmY2NTYyM2ZmODdhNDVmMWE1NzlhMDdlOTI5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ZJbswpLzF2RHjemcGirKOP0L1fvpl3FUqIiQ_-yjeUo" controls="controls" muted="muted" class="d-block rounded-bottom-2 border-top width-fit" style="max-height:640px; min-height: 200px">
28+
</video>
29+
</td>
30+
</tr>
31+
</table>
32+
33+
1534
# 项目文档
1635
[在线文档](https://www.gin-vue-admin.com) : https://www.gin-vue-admin.com
1736

deploy/docker-compose/docker-compose-dev.yaml

Lines changed: 0 additions & 99 deletions
This file was deleted.

server/api/v1/system/auto_code_template.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func (a *AutoCodeTemplateApi) Preview(c *gin.Context) {
4040
info.PackageT = utils.FirstUpper(info.Package)
4141
autoCode, err := autoCodeTemplateService.Preview(c.Request.Context(), info)
4242
if err != nil {
43-
global.GVA_LOG.Error("预览失败!", zap.Error(err))
44-
response.FailWithMessage("预览失败", c)
43+
global.GVA_LOG.Error(err.Error(), zap.Error(err))
44+
response.FailWithMessage("预览失败:"+err.Error(), c)
4545
} else {
4646
response.OkWithDetailed(gin.H{"autoCode": autoCode}, "预览成功", c)
4747
}

server/model/system/request/sys_auto_history.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func (r *SysAutoHistoryCreate) Create() model.SysAutoCodeHistory {
2525
Request: r.Request,
2626
Table: r.Table,
2727
StructName: r.StructName,
28+
Abbreviation: r.StructName,
2829
BusinessDB: r.BusinessDB,
2930
Description: r.Description,
3031
Injections: r.Injections,

server/model/system/sys_auto_code_history.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type SysAutoCodeHistory struct {
1616
Package string `json:"package" gorm:"column:package;comment:模块名/插件名"`
1717
Request string `json:"request" gorm:"type:text;column:request;comment:前端传入的结构化信息"`
1818
StructName string `json:"structName" gorm:"column:struct_name;comment:结构体名称"`
19+
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;comment:结构体名称缩写"`
1920
BusinessDB string `json:"businessDb" gorm:"column:business_db;comment:业务库"`
2021
Description string `json:"description" gorm:"column:description;comment:Struct中文名称"`
2122
Templates map[string]string `json:"template" gorm:"serializer:json;type:text;column:templates;comment:模板信息"`

server/resource/package/web/view/form.vue.tpl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ getDataSourceFunc()
226226
{{- end }}
227227
{{- end }}
228228
<el-form-item>
229-
<el-button type="primary" @click="save">保存</el-button>
229+
<el-button :loading="btnLoading" type="primary" @click="save">保存</el-button>
230230
<el-button type="primary" @click="back">返回</el-button>
231231
</el-form-item>
232232
</el-form>
@@ -277,6 +277,9 @@ import ArrayCtrl from '@/components/arrayCtrl/arrayCtrl.vue'
277277
const route = useRoute()
278278
const router = useRouter()
279279
280+
// 提交按钮loading
281+
const btnLoading = ref(false)
282+
280283
const type = ref('')
281284
{{- range $index, $element := .DictTypes}}
282285
const {{ $element }}Options = ref([])
@@ -369,8 +372,9 @@ const init = async () => {
369372
init()
370373
// 保存按钮
371374
const save = async() => {
375+
btnLoading.value = true
372376
elFormRef.value?.validate( async (valid) => {
373-
if (!valid) return
377+
if (!valid) return btnLoading.value = false
374378
let res
375379
switch (type.value) {
376380
case 'create':
@@ -383,6 +387,7 @@ const save = async() => {
383387
res = await create{{.StructName}}(formData.value)
384388
break
385389
}
390+
btnLoading.value = false
386391
if (res.code === 0) {
387392
ElMessage({
388393
type: 'success',
@@ -410,4 +415,4 @@ const back = () => {
410415
<style>
411416
</style>
412417
{{- end }}
413-
{{- end }}
418+
{{- end }}

server/resource/package/web/view/table.vue.tpl

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@
7474
{{- if .CheckDataSource }}
7575
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
7676
<template #default="scope">
77-
{{if eq .DataSource.Association 2}}
77+
{{- if eq .DataSource.Association 2}}
7878
<el-tag v-for="(item,key) in filterDataSource(dataSource.{{.FieldJson}},scope.row.{{.FieldJson}})" :key="key">
7979
{{ "{{ item }}" }}
8080
</el-tag>
81-
{{ else }}
81+
{{- else }}
8282
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},scope.row.{{.FieldJson}}) {{"}}"}}</span>
83-
{{ end }}
83+
{{- end }}
8484
</template>
8585
</el-table-column>
8686
{{- else if .DictType}}
@@ -232,7 +232,17 @@
232232
{{- range .Fields}}
233233
{{- if .Desc }}
234234
<el-descriptions-item label="{{ .FieldDesc }}">
235-
{{- if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
235+
{{- if .CheckDataSource }}
236+
<template #default="scope">
237+
{{- if eq .DataSource.Association 2}}
238+
<el-tag v-for="(item,key) in filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}})" :key="key">
239+
{{ "{{ item }}" }}
240+
</el-tag>
241+
{{- else }}
242+
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}}) {{"}}"}}</span>
243+
{{- end }}
244+
</template>
245+
{{- else if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
236246
{{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}}
237247
{{- else }}
238248
{{- if eq .FieldType "picture" }}
@@ -338,7 +348,7 @@ const {{ $element }}Options = ref([])
338348
get{{.StructName}}DataSource,
339349

340350
// 获取数据源
341-
const dataSource = ref([])
351+
const dataSource = ref({})
342352
const getDataSourceFunc = async()=>{
343353
const res = await get{{.StructName}}DataSource()
344354
if (res.code === 0) {
@@ -537,13 +547,13 @@ getDataSourceFunc()
537547
{{- if .CheckDataSource }}
538548
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
539549
<template #default="scope">
540-
{{if eq .DataSource.Association 2}}
550+
{{- if eq .DataSource.Association 2}}
541551
<el-tag v-for="(item,key) in filterDataSource(dataSource.{{.FieldJson}},scope.row.{{.FieldJson}})" :key="key">
542552
{{ "{{ item }}" }}
543553
</el-tag>
544-
{{ else }}
554+
{{- else }}
545555
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},scope.row.{{.FieldJson}}) {{"}}"}}</span>
546-
{{ end }}
556+
{{- end }}
547557
</template>
548558
</el-table-column>
549559
{{- else if .DictType}}
@@ -642,7 +652,7 @@ getDataSourceFunc()
642652
<div class="flex justify-between items-center">
643653
<span class="text-lg">{{"{{"}}type==='create'?'新增':'编辑'{{"}}"}}</span>
644654
<div>
645-
<el-button type="primary" @click="enterDialog">确 定</el-button>
655+
<el-button :loading="btnLoading" type="primary" @click="enterDialog">确 定</el-button>
646656
<el-button @click="closeDialog">取 消</el-button>
647657
</div>
648658
</div>
@@ -727,7 +737,17 @@ getDataSourceFunc()
727737
{{- range .Fields}}
728738
{{- if .Desc }}
729739
<el-descriptions-item label="{{ .FieldDesc }}">
730-
{{- if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
740+
{{- if .CheckDataSource }}
741+
<template #default="scope">
742+
{{- if eq .DataSource.Association 2}}
743+
<el-tag v-for="(item,key) in filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}})" :key="key">
744+
{{ "{{ item }}" }}
745+
</el-tag>
746+
{{- else }}
747+
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}}) {{"}}"}}</span>
748+
{{- end }}
749+
</template>
750+
{{- else if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
731751
{{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}}
732752
{{- else }}
733753
{{- if eq .FieldType "picture" }}
@@ -821,6 +841,9 @@ defineOptions({
821841
const btnAuth = useBtnAuth()
822842
{{- end }}
823843
844+
// 提交按钮loading
845+
const btnLoading = ref(false)
846+
824847
// 控制更多查询条件显示/隐藏状态
825848
const showAllQuery = ref(false)
826849
@@ -987,7 +1010,6 @@ const onSubmit = () => {
9871010
elSearchFormRef.value?.validate(async(valid) => {
9881011
if (!valid) return
9891012
page.value = 1
990-
pageSize.value = 10
9911013
{{- range .Fields}}{{- if eq .FieldType "bool" }}
9921014
if (searchInfo.value.{{.FieldJson}} === ""){
9931015
searchInfo.value.{{.FieldJson}}=null
@@ -1171,8 +1193,9 @@ const closeDialog = () => {
11711193
}
11721194
// 弹窗确定
11731195
const enterDialog = async () => {
1196+
btnLoading.value = true
11741197
elFormRef.value?.validate( async (valid) => {
1175-
if (!valid) return
1198+
if (!valid) return btnLoading.value = false
11761199
let res
11771200
switch (type.value) {
11781201
case 'create':
@@ -1185,6 +1208,7 @@ const enterDialog = async () => {
11851208
res = await create{{.StructName}}(formData.value)
11861209
break
11871210
}
1211+
btnLoading.value = false
11881212
if (res.code === 0) {
11891213
ElMessage({
11901214
type: 'success',
@@ -1263,4 +1287,4 @@ defineOptions({
12631287
</style>
12641288
{{- end }}
12651289
1266-
{{- end }}
1290+
{{- end }}

0 commit comments

Comments
 (0)