Skip to content

Commit 27bc85d

Browse files
authored
Merge branch 'flipped-aurora:main' into main
2 parents b8392a7 + 2c7809b commit 27bc85d

File tree

7 files changed

+34
-40
lines changed

7 files changed

+34
-40
lines changed

server/resource/package/server/service/service.go.tpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ type {{.StructName}}Service struct {}
2222

2323
{{- if not .OnlyTemplate }}
2424
// Create{{.StructName}} 创建{{.Description}}记录
25-
// Author [piexlmax](https://github.com/piexlmax)
25+
// Author [yourname](https://github.com/yourname)
2626
func ({{.Abbreviation}}Service *{{.StructName}}Service) Create{{.StructName}}({{.Abbreviation}} *{{.Package}}.{{.StructName}}) (err error) {
2727
err = {{$db}}.Create({{.Abbreviation}}).Error
2828
return err
2929
}
3030

3131
// Delete{{.StructName}} 删除{{.Description}}记录
32-
// Author [piexlmax](https://github.com/piexlmax)
32+
// Author [yourname](https://github.com/yourname)
3333
func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}({{.PrimaryField.FieldJson}} string{{- if .AutoCreateResource -}},userID uint{{- end -}}) (err error) {
3434
{{- if .AutoCreateResource }}
3535
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
@@ -48,7 +48,7 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}({{.
4848
}
4949

5050
// Delete{{.StructName}}ByIds 批量删除{{.Description}}记录
51-
// Author [piexlmax](https://github.com/piexlmax)
51+
// Author [yourname](https://github.com/yourname)
5252
func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}ByIds({{.PrimaryField.FieldJson}}s []string {{- if .AutoCreateResource }},deleted_by uint{{- end}}) (err error) {
5353
{{- if .AutoCreateResource }}
5454
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
@@ -67,21 +67,21 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}ById
6767
}
6868

6969
// Update{{.StructName}} 更新{{.Description}}记录
70-
// Author [piexlmax](https://github.com/piexlmax)
70+
// Author [yourname](https://github.com/yourname)
7171
func ({{.Abbreviation}}Service *{{.StructName}}Service)Update{{.StructName}}({{.Abbreviation}} {{.Package}}.{{.StructName}}) (err error) {
7272
err = {{$db}}.Model(&{{.Package}}.{{.StructName}}{}).Where("{{.PrimaryField.ColumnName}} = ?",{{.Abbreviation}}.{{.PrimaryField.FieldName}}).Updates(&{{.Abbreviation}}).Error
7373
return err
7474
}
7575

7676
// Get{{.StructName}} 根据{{.PrimaryField.FieldJson}}获取{{.Description}}记录
77-
// Author [piexlmax](https://github.com/piexlmax)
77+
// Author [yourname](https://github.com/yourname)
7878
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}({{.PrimaryField.FieldJson}} string) ({{.Abbreviation}} {{.Package}}.{{.StructName}}, err error) {
7979
err = {{$db}}.Where("{{.PrimaryField.ColumnName}} = ?", {{.PrimaryField.FieldJson}}).First(&{{.Abbreviation}}).Error
8080
return
8181
}
8282

8383
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录
84-
// Author [piexlmax](https://github.com/piexlmax)
84+
// Author [yourname](https://github.com/yourname)
8585
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoList(info {{.Package}}Req.{{.StructName}}Search) (list []{{.Package}}.{{.StructName}}, total int64, err error) {
8686
limit := info.PageSize
8787
offset := info.PageSize * (info.Page - 1)
@@ -139,7 +139,7 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoLis
139139
if limit != 0 {
140140
db = db.Limit(limit).Offset(offset)
141141
}
142-
142+
143143
err = db.Find(&{{.Abbreviation}}s).Error
144144
return {{.Abbreviation}}s, total, err
145145
}

server/resource/plugin/server/service/service.go.template

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ type {{.Abbreviation}} struct {}
2323
{{- end}}
2424
{{- if not .OnlyTemplate }}
2525
// Create{{.StructName}} 创建{{.Description}}记录
26-
// Author [piexlmax](https://github.com/piexlmax)
26+
// Author [yourname](https://github.com/yourname)
2727
func (s *{{.Abbreviation}}) Create{{.StructName}}({{.Abbreviation}} *model.{{.StructName}}) (err error) {
2828
err = {{$db}}.Create({{.Abbreviation}}).Error
2929
return err
3030
}
3131

3232
// Delete{{.StructName}} 删除{{.Description}}记录
33-
// Author [piexlmax](https://github.com/piexlmax)
33+
// Author [yourname](https://github.com/yourname)
3434
func (s *{{.Abbreviation}}) Delete{{.StructName}}({{.PrimaryField.FieldJson}} string{{- if .AutoCreateResource -}},userID uint{{- end -}}) (err error) {
3535
{{- if .AutoCreateResource }}
3636
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
@@ -49,7 +49,7 @@ func (s *{{.Abbreviation}}) Delete{{.StructName}}({{.PrimaryField.FieldJson}} st
4949
}
5050

5151
// Delete{{.StructName}}ByIds 批量删除{{.Description}}记录
52-
// Author [piexlmax](https://github.com/piexlmax)
52+
// Author [yourname](https://github.com/yourname)
5353
func (s *{{.Abbreviation}}) Delete{{.StructName}}ByIds({{.PrimaryField.FieldJson}}s []string {{- if .AutoCreateResource }},deleted_by uint{{- end}}) (err error) {
5454
{{- if .AutoCreateResource }}
5555
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
@@ -68,21 +68,21 @@ func (s *{{.Abbreviation}}) Delete{{.StructName}}ByIds({{.PrimaryField.FieldJson
6868
}
6969

7070
// Update{{.StructName}} 更新{{.Description}}记录
71-
// Author [piexlmax](https://github.com/piexlmax)
71+
// Author [yourname](https://github.com/yourname)
7272
func (s *{{.Abbreviation}}) Update{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
7373
err = {{$db}}.Model(&model.{{.StructName}}{}).Where("{{.PrimaryField.ColumnName}} = ?",{{.Abbreviation}}.{{.PrimaryField.FieldName}}).Updates(&{{.Abbreviation}}).Error
7474
return err
7575
}
7676

7777
// Get{{.StructName}} 根据{{.PrimaryField.FieldJson}}获取{{.Description}}记录
78-
// Author [piexlmax](https://github.com/piexlmax)
78+
// Author [yourname](https://github.com/yourname)
7979
func (s *{{.Abbreviation}}) Get{{.StructName}}({{.PrimaryField.FieldJson}} string) ({{.Abbreviation}} model.{{.StructName}}, err error) {
8080
err = {{$db}}.Where("{{.PrimaryField.ColumnName}} = ?", {{.PrimaryField.FieldJson}}).First(&{{.Abbreviation}}).Error
8181
return
8282
}
8383

8484
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录
85-
// Author [piexlmax](https://github.com/piexlmax)
85+
// Author [yourname](https://github.com/yourname)
8686
func (s *{{.Abbreviation}}) Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (list []model.{{.StructName}}, total int64, err error) {
8787
limit := info.PageSize
8888
offset := info.PageSize * (info.Page - 1)

web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"sortablejs": "^1.15.3",
3737
"spark-md5": "^3.0.2",
3838
"tailwindcss": "^3.4.10",
39-
"vite-auto-import-svg": "^1.0.0",
40-
"vue": "^3.5.1",
39+
"vite-auto-import-svg": "^1.1.0",
40+
"vue": "^3.5.7",
4141
"vue-echarts": "^7.0.3",
4242
"vue-router": "^4.4.3",
4343
"vuedraggable": "^4.1.0"

web/src/core/global.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,27 @@ const createIconComponent = (name) => ({
1616
})
1717

1818
const registerIcons = async(app) => {
19-
const iconModules = import.meta.glob('@/assets/icons/**/*.svg')
20-
for (const path in iconModules) {
19+
const iconModules = import.meta.glob('@/assets/icons/**/*.svg') // 系统目录 svg 图标
20+
const pluginIconModules = import.meta.glob('@/plugin/**/assets/icons/**/*.svg') // 插件目录 svg 图标
21+
const mergedIconModules = Object.assign({}, iconModules, pluginIconModules); // 合并所有 svg 图标
22+
for (const path in mergedIconModules) {
23+
let pluginName = ""
24+
if (path.startsWith("/src/plugin/")) {
25+
pluginName = `${path.split('/')[3]}-`
26+
}
2127
const iconName = path.split('/').pop().replace(/\.svg$/, '')
2228
// 如果iconName带空格则不加入到图标库中并且提示名称不合法
2329
if (iconName.indexOf(' ') !== -1) {
24-
console.error(`icon ${iconName}.svg includes whitespace`)
30+
console.error(`icon ${iconName}.svg includes whitespace in ${path}`)
2531
continue
2632
}
33+
const key = `${pluginName}${iconName}`
2734
const iconComponent = createIconComponent(iconName)
2835
config.logs.push({
29-
'key': iconName,
36+
'key': key,
3037
'label': iconName,
3138
})
32-
app.component(iconName, iconComponent)
39+
app.component(key, iconComponent)
3340
}
3441
}
3542

web/src/view/layout/header/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
!-->
55

66
<template>
7-
<div class="flex justify-between fixed top-0 left-0 right-0 z-10 h-16 bg-white text-slate-700 dark:text-slate-300 dark:bg-slate-900 shadow dark:shadow-gray-700 flex items-center px-2">
7+
<div class="flex justify-between fixed top-0 left-0 right-0 z-10 h-16 bg-white text-slate-700 dark:text-slate-300 dark:bg-slate-900 shadow dark:shadow-gray-700 items-center px-2">
88
<div
99
class="flex items-center cursor-pointer flex-1"
1010
>

web/src/view/superAdmin/menu/icon.vue

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div class="w-full">
33
<el-select
4-
v-model="metaData.icon"
4+
v-model="value"
55
clearable
66
filterable
77
placeholder="请选择"
88
class="w-full"
99
>
1010
<template #prefix>
1111
<el-icon>
12-
<component :is="metaData.icon" />
12+
<component :is="value" />
1313
</el-icon>
1414
</template>
1515
<el-option
@@ -42,14 +42,7 @@ defineOptions({
4242
name: 'Icon',
4343
})
4444
45-
const props = defineProps({
46-
meta: {
47-
default: function() {
48-
return {}
49-
},
50-
type: Object,
51-
},
52-
})
45+
const value = defineModel()
5346
5447
const options = reactive([
5548
{
@@ -1171,15 +1164,9 @@ const options = reactive([
11711164
{
11721165
'key': 'wind-power',
11731166
'label': 'wind-power',
1174-
},
1175-
...config.logs
1167+
}
11761168
])
1177-
const metaData = ref(props.meta)
1178-
if (!metaData.value.icon) {
1179-
// metaData.value.icon = options[0].label
1180-
// 传参无icon则显示空即可,否则默认会加一个aim的icon
1181-
metaData.value.icon = ''
1182-
}
1169+
11831170
11841171
</script>
11851172

web/src/view/superAdmin/menu/menu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
prop="meta.icon"
288288
>
289289
<icon
290-
:meta="form.meta"
290+
v-model="form.meta.icon"
291291
/>
292292
</el-form-item>
293293
</el-col>

0 commit comments

Comments
 (0)