@@ -912,4 +1253,5 @@ defineOptions({
-{{- end}}
\ No newline at end of file
+{{- end}}
+{{- end}}
diff --git a/server/router/system/enter.go b/server/router/system/enter.go
index ffd6508b..7127d9e9 100644
--- a/server/router/system/enter.go
+++ b/server/router/system/enter.go
@@ -18,6 +18,7 @@ type RouterGroup struct {
DictionaryDetailRouter
AuthorityBtnRouter
SysExportTemplateRouter
+ SysParamsRouter
}
var (
@@ -26,6 +27,7 @@ var (
baseApi = api.ApiGroupApp.SystemApiGroup.BaseApi
casbinApi = api.ApiGroupApp.SystemApiGroup.CasbinApi
systemApi = api.ApiGroupApp.SystemApiGroup.SystemApi
+ sysParamsApi = api.ApiGroupApp.SystemApiGroup.SysParamsApi
autoCodeApi = api.ApiGroupApp.SystemApiGroup.AutoCodeApi
authorityApi = api.ApiGroupApp.SystemApiGroup.AuthorityApi
apiRouterApi = api.ApiGroupApp.SystemApiGroup.SystemApiApi
diff --git a/server/router/system/sys_params.go b/server/router/system/sys_params.go
new file mode 100644
index 00000000..50dd2364
--- /dev/null
+++ b/server/router/system/sys_params.go
@@ -0,0 +1,25 @@
+package system
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/middleware"
+ "github.com/gin-gonic/gin"
+)
+
+type SysParamsRouter struct{}
+
+// InitSysParamsRouter 初始化 参数 路由信息
+func (s *SysParamsRouter) InitSysParamsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
+ sysParamsRouter := Router.Group("sysParams").Use(middleware.OperationRecord())
+ sysParamsRouterWithoutRecord := Router.Group("sysParams")
+ {
+ sysParamsRouter.POST("createSysParams", sysParamsApi.CreateSysParams) // 新建参数
+ sysParamsRouter.DELETE("deleteSysParams", sysParamsApi.DeleteSysParams) // 删除参数
+ sysParamsRouter.DELETE("deleteSysParamsByIds", sysParamsApi.DeleteSysParamsByIds) // 批量删除参数
+ sysParamsRouter.PUT("updateSysParams", sysParamsApi.UpdateSysParams) // 更新参数
+ }
+ {
+ sysParamsRouterWithoutRecord.GET("findSysParams", sysParamsApi.FindSysParams) // 根据ID获取参数
+ sysParamsRouterWithoutRecord.GET("getSysParamsList", sysParamsApi.GetSysParamsList) // 获取参数列表
+ sysParamsRouterWithoutRecord.GET("getSysParam", sysParamsApi.GetSysParam) // 根据Key获取参数
+ }
+}
diff --git a/server/service/system/auto_code_template.go b/server/service/system/auto_code_template.go
index 52822207..542072ec 100644
--- a/server/service/system/auto_code_template.go
+++ b/server/service/system/auto_code_template.go
@@ -308,7 +308,13 @@ func (s *autoCodeTemplate) getTemplateStr(t string, info request.AutoFunc) (stri
func (s *autoCodeTemplate) addTemplateToAst(t string, info request.AutoFunc) error {
tPath := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "router", info.Package, info.HumpPackageName+".go")
funcName := fmt.Sprintf("Init%sRouter", info.StructName)
- stmtStr := fmt.Sprintf("%sRouterWithoutAuth.%s(\"%s\", %sApi.%s)", info.Abbreviation, info.Method, info.Router, info.Abbreviation, info.FuncName)
+
+ routerStr := "RouterWithoutAuth"
+ if info.IsAuth {
+ routerStr = "Router"
+ }
+
+ stmtStr := fmt.Sprintf("%s%s.%s(\"%s\", %sApi.%s)", info.Abbreviation, routerStr, info.Method, info.Router, info.Abbreviation, info.FuncName)
if info.IsPlugin {
tPath = filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin", info.Package, "router", info.HumpPackageName+".go")
stmtStr = fmt.Sprintf("group.%s(\"%s\", api%s.%s)", info.Method, info.Router, info.StructName, info.FuncName)
@@ -324,13 +330,25 @@ func (s *autoCodeTemplate) addTemplateToAst(t string, info request.AutoFunc) err
funcDecl := utilsAst.FindFunction(astFile, funcName)
stmtNode := utilsAst.CreateStmt(stmtStr)
- for i := len(funcDecl.Body.List) - 1; i >= 0; i-- {
- st := funcDecl.Body.List[i]
- // 使用类型断言来检查stmt是否是一个块语句
- if blockStmt, ok := st.(*ast.BlockStmt); ok {
- // 如果是,插入代码 跳出
- blockStmt.List = append(blockStmt.List, stmtNode)
- break
+ if info.IsAuth {
+ for i := 0; i < len(funcDecl.Body.List); i++ {
+ st := funcDecl.Body.List[i]
+ // 使用类型断言来检查stmt是否是一个块语句
+ if blockStmt, ok := st.(*ast.BlockStmt); ok {
+ // 如果是,插入代码 跳出
+ blockStmt.List = append(blockStmt.List, stmtNode)
+ break
+ }
+ }
+ } else {
+ for i := len(funcDecl.Body.List) - 1; i >= 0; i-- {
+ st := funcDecl.Body.List[i]
+ // 使用类型断言来检查stmt是否是一个块语句
+ if blockStmt, ok := st.(*ast.BlockStmt); ok {
+ // 如果是,插入代码 跳出
+ blockStmt.List = append(blockStmt.List, stmtNode)
+ break
+ }
}
}
diff --git a/server/service/system/enter.go b/server/service/system/enter.go
index 272ee7b4..634cd001 100644
--- a/server/service/system/enter.go
+++ b/server/service/system/enter.go
@@ -16,7 +16,7 @@ type ServiceGroup struct {
DictionaryDetailService
AuthorityBtnService
SysExportTemplateService
-
+ SysParamsService
AutoCodePlugin autoCodePlugin
AutoCodePackage autoCodePackage
AutoCodeHistory autoCodeHistory
diff --git a/server/service/system/sys_params.go b/server/service/system/sys_params.go
new file mode 100644
index 00000000..7391ec01
--- /dev/null
+++ b/server/service/system/sys_params.go
@@ -0,0 +1,82 @@
+package system
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/system"
+ systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
+)
+
+type SysParamsService struct{}
+
+// CreateSysParams 创建参数记录
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) CreateSysParams(sysParams *system.SysParams) (err error) {
+ err = global.GVA_DB.Create(sysParams).Error
+ return err
+}
+
+// DeleteSysParams 删除参数记录
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) DeleteSysParams(ID string) (err error) {
+ err = global.GVA_DB.Delete(&system.SysParams{}, "id = ?", ID).Error
+ return err
+}
+
+// DeleteSysParamsByIds 批量删除参数记录
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) DeleteSysParamsByIds(IDs []string) (err error) {
+ err = global.GVA_DB.Delete(&[]system.SysParams{}, "id in ?", IDs).Error
+ return err
+}
+
+// UpdateSysParams 更新参数记录
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) UpdateSysParams(sysParams system.SysParams) (err error) {
+ err = global.GVA_DB.Model(&system.SysParams{}).Where("id = ?", sysParams.ID).Updates(&sysParams).Error
+ return err
+}
+
+// GetSysParams 根据ID获取参数记录
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) GetSysParams(ID string) (sysParams system.SysParams, err error) {
+ err = global.GVA_DB.Where("id = ?", ID).First(&sysParams).Error
+ return
+}
+
+// GetSysParamsInfoList 分页获取参数记录
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) GetSysParamsInfoList(info systemReq.SysParamsSearch) (list []system.SysParams, total int64, err error) {
+ limit := info.PageSize
+ offset := info.PageSize * (info.Page - 1)
+ // 创建db
+ db := global.GVA_DB.Model(&system.SysParams{})
+ var sysParamss []system.SysParams
+ // 如果有条件搜索 下方会自动创建搜索语句
+ if info.StartCreatedAt != nil && info.EndCreatedAt != nil {
+ db = db.Where("created_at BETWEEN ? AND ?", info.StartCreatedAt, info.EndCreatedAt)
+ }
+ if info.Name != "" {
+ db = db.Where("name LIKE ?", "%"+info.Name+"%")
+ }
+ if info.Key != "" {
+ db = db.Where("key LIKE ?", "%"+info.Key+"%")
+ }
+ err = db.Count(&total).Error
+ if err != nil {
+ return
+ }
+
+ if limit != 0 {
+ db = db.Limit(limit).Offset(offset)
+ }
+
+ err = db.Find(&sysParamss).Error
+ return sysParamss, total, err
+}
+
+// GetSysParam 根据key获取参数value
+// Author [Mr.奇淼](https://github.com/pixelmaxQm)
+func (sysParamsService *SysParamsService) GetSysParam(key string) (param system.SysParams, err error) {
+ err = global.GVA_DB.Where(system.SysParams{Key: key}).First(¶m).Error
+ return
+}
diff --git a/server/source/system/api.go b/server/source/system/api.go
index f3affb21..89c591d4 100644
--- a/server/source/system/api.go
+++ b/server/source/system/api.go
@@ -174,6 +174,14 @@ func (i *initApi) InitializeData(ctx context.Context) (context.Context, error) {
{ApiGroup: "公告", Method: "PUT", Path: "/info/updateInfo", Description: "更新公告"},
{ApiGroup: "公告", Method: "GET", Path: "/info/findInfo", Description: "根据ID获取公告"},
{ApiGroup: "公告", Method: "GET", Path: "/info/getInfoList", Description: "获取公告列表"},
+
+ {ApiGroup: "参数管理", Method: "POST", Path: "/sysParams/createSysParams", Description: "新建参数"},
+ {ApiGroup: "参数管理", Method: "DELETE", Path: "/sysParams/deleteSysParams", Description: "删除参数"},
+ {ApiGroup: "参数管理", Method: "DELETE", Path: "/sysParams/deleteSysParamsByIds", Description: "批量删除参数"},
+ {ApiGroup: "参数管理", Method: "PUT", Path: "/sysParams/updateSysParams", Description: "更新参数"},
+ {ApiGroup: "参数管理", Method: "GET", Path: "/sysParams/findSysParams", Description: "根据ID获取参数"},
+ {ApiGroup: "参数管理", Method: "GET", Path: "/sysParams/getSysParamsList", Description: "获取参数列表"},
+ {ApiGroup: "参数管理", Method: "GET", Path: "/sysParams/getSysParam", Description: "获取参数列表"},
}
if err := db.Create(&entities).Error; err != nil {
return ctx, errors.Wrap(err, sysModel.SysApi{}.TableName()+"表数据初始化失败!")
diff --git a/server/source/system/casbin.go b/server/source/system/casbin.go
index bafd9ec1..5a9cdbec 100644
--- a/server/source/system/casbin.go
+++ b/server/source/system/casbin.go
@@ -178,6 +178,14 @@ func (i *initCasbin) InitializeData(ctx context.Context) (context.Context, error
{Ptype: "p", V0: "888", V1: "/info/findInfo", V2: "GET"},
{Ptype: "p", V0: "888", V1: "/info/getInfoList", V2: "GET"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/createSysParams", V2: "POST"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/deleteSysParams", V2: "DELETE"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/deleteSysParamsByIds", V2: "DELETE"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/updateSysParams", V2: "PUT"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/findSysParams", V2: "GET"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/getSysParamsList", V2: "GET"},
+ {Ptype: "p", V0: "888", V1: "/sysParams/getSysParam", V2: "GET"},
+
{Ptype: "p", V0: "8881", V1: "/user/admin_register", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/createApi", V2: "POST"},
{Ptype: "p", V0: "8881", V1: "/api/getApiList", V2: "POST"},
diff --git a/server/source/system/menu.go b/server/source/system/menu.go
index 7bdd932d..fda6ab90 100644
--- a/server/source/system/menu.go
+++ b/server/source/system/menu.go
@@ -81,6 +81,7 @@ func (i *initMenu) InitializeData(ctx context.Context) (next context.Context, er
{MenuLevel: 0, Hidden: false, ParentId: 24, Path: "plugin-email", Name: "plugin-email", Component: "plugin/email/view/index.vue", Sort: 4, Meta: Meta{Title: "邮件插件", Icon: "message"}},
{MenuLevel: 0, Hidden: false, ParentId: 15, Path: "exportTemplate", Name: "exportTemplate", Component: "view/systemTools/exportTemplate/exportTemplate.vue", Sort: 5, Meta: Meta{Title: "表格模板", Icon: "reading"}},
{MenuLevel: 0, Hidden: false, ParentId: 24, Path: "anInfo", Name: "anInfo", Component: "plugin/announcement/view/info.vue", Sort: 5, Meta: Meta{Title: "公告管理[示例]", Icon: "scaleToOriginal"}},
+ {MenuLevel: 0, Hidden: false, ParentId: 3, Path: "sysParams", Name: "sysParams", Component: "view/superAdmin/params/sysParams.vue", Sort: 7, Meta: Meta{Title: "参数管理", Icon: "compass"}},
}
if err = db.Create(&entities).Error; err != nil {
return ctx, errors.Wrap(err, SysBaseMenu{}.TableName()+"表数据初始化失败!")
diff --git a/server/utils/upload/qiniu.go b/server/utils/upload/qiniu.go
index 87e91b68..f4287d59 100644
--- a/server/utils/upload/qiniu.go
+++ b/server/utils/upload/qiniu.go
@@ -8,8 +8,8 @@ import (
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
- "github.com/qiniu/api.v7/v7/auth/qbox"
- "github.com/qiniu/api.v7/v7/storage"
+ "github.com/qiniu/go-sdk/v7/auth/qbox"
+ "github.com/qiniu/go-sdk/v7/storage"
"go.uber.org/zap"
)
diff --git a/web/package.json b/web/package.json
index 3bcc7e30..bf2d07ab 100644
--- a/web/package.json
+++ b/web/package.json
@@ -1,6 +1,6 @@
{
"name": "gin-vue-admin",
- "version": "2.7.5",
+ "version": "2.7.6",
"private": true,
"scripts": {
"serve": "node openDocument.js && vite --host --mode development",
diff --git a/web/src/api/autoCode.js b/web/src/api/autoCode.js
index 616d462d..54433090 100644
--- a/web/src/api/autoCode.js
+++ b/web/src/api/autoCode.js
@@ -140,25 +140,30 @@ export const pubPlug = (params) => {
}
-export const llmAuto = (params) => {
- let modeName = {
- "xiaoqi": "小奇",
- "xiaomiao": "小淼",
- }
+export const llmAuto = (data) => {
return service({
url: '/autoCode/llmAuto',
method: 'post',
- params,
+ data:{...data,mode:'ai'},
timeout: 1000 * 60 * 10,
loadingOption:{
lock: true,
fullscreen:true,
- text: `${modeName[params.mode]}正在思考,请稍候...`,
+ text: `小淼正在思考,请稍候...`,
}
})
}
+export const butler = (data) => {
+ return service({
+ url: '/autoCode/llmAuto',
+ method: 'post',
+ data:{...data,mode:'butler'},
+ timeout: 1000 * 60 * 10,
+ })
+}
+
export const addFunc = (data) => {
return service({
url: '/autoCode/addFunc',
@@ -182,6 +187,3 @@ export const initAPI = (data) => {
data
})
}
-
-
-
diff --git a/web/src/api/sysParams.js b/web/src/api/sysParams.js
new file mode 100644
index 00000000..348f1b5e
--- /dev/null
+++ b/web/src/api/sysParams.js
@@ -0,0 +1,111 @@
+import service from '@/utils/request'
+// @Tags SysParams
+// @Summary 创建参数
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body model.SysParams true "创建参数"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
+// @Router /sysParams/createSysParams [post]
+export const createSysParams = (data) => {
+ return service({
+ url: '/sysParams/createSysParams',
+ method: 'post',
+ data
+ })
+}
+
+// @Tags SysParams
+// @Summary 删除参数
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body model.SysParams true "删除参数"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
+// @Router /sysParams/deleteSysParams [delete]
+export const deleteSysParams = (params) => {
+ return service({
+ url: '/sysParams/deleteSysParams',
+ method: 'delete',
+ params
+ })
+}
+
+// @Tags SysParams
+// @Summary 批量删除参数
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body request.IdsReq true "批量删除参数"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
+// @Router /sysParams/deleteSysParams [delete]
+export const deleteSysParamsByIds = (params) => {
+ return service({
+ url: '/sysParams/deleteSysParamsByIds',
+ method: 'delete',
+ params
+ })
+}
+
+// @Tags SysParams
+// @Summary 更新参数
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body model.SysParams true "更新参数"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
+// @Router /sysParams/updateSysParams [put]
+export const updateSysParams = (data) => {
+ return service({
+ url: '/sysParams/updateSysParams',
+ method: 'put',
+ data
+ })
+}
+
+// @Tags SysParams
+// @Summary 用id查询参数
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query model.SysParams true "用id查询参数"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
+// @Router /sysParams/findSysParams [get]
+export const findSysParams = (params) => {
+ return service({
+ url: '/sysParams/findSysParams',
+ method: 'get',
+ params
+ })
+}
+
+// @Tags SysParams
+// @Summary 分页获取参数列表
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query request.PageInfo true "分页获取参数列表"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
+// @Router /sysParams/getSysParamsList [get]
+export const getSysParamsList = (params) => {
+ return service({
+ url: '/sysParams/getSysParamsList',
+ method: 'get',
+ params
+ })
+}
+
+// @Tags SysParams
+// @Summary 不需要鉴权的参数接口
+// @accept application/json
+// @Produce application/json
+// @Param data query systemReq.SysParamsSearch true "分页获取参数列表"
+// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
+// @Router /sysParams/getSysParam [get]
+export const getSysParam = (params) => {
+ return service({
+ url: '/sysParams/getSysParam',
+ method: 'get',
+ params
+ })
+}
diff --git a/web/src/core/config.js b/web/src/core/config.js
index 429500fc..12463af9 100644
--- a/web/src/core/config.js
+++ b/web/src/core/config.js
@@ -13,7 +13,7 @@ const config = {
export const viteLogo = (env) => {
if (config.showViteLogo) {
console.log(greenText(`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`));
- console.log(greenText(`> 当前版本:v2.7.5`));
+ console.log(greenText(`> 当前版本:v2.7.6`));
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`));
console.log(greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`));
console.log(greenText(`> 插件市场:https://plugin.gin-vue-admin.com`));
diff --git a/web/src/core/gin-vue-admin.js b/web/src/core/gin-vue-admin.js
index 7e679428..08ed1250 100644
--- a/web/src/core/gin-vue-admin.js
+++ b/web/src/core/gin-vue-admin.js
@@ -10,7 +10,7 @@ export default {
register(app)
console.log(`
欢迎使用 Gin-Vue-Admin
- 当前版本:v2.7.5
+ 当前版本:v2.7.6
加群方式:微信:shouzi_1994 QQ群:622360840
项目地址:https://github.com/flipped-aurora/gin-vue-admin
插件市场:https://plugin.gin-vue-admin.com
diff --git a/web/src/pathInfo.json b/web/src/pathInfo.json
index 2f9e9991..45a341ca 100644
--- a/web/src/pathInfo.json
+++ b/web/src/pathInfo.json
@@ -1,5 +1,6 @@
{
"/src/view/about/index.vue": "About",
+ "/src/view/dashboard/index.vue": "Dashboard",
"/src/view/error/index.vue": "Error",
"/src/view/error/reload.vue": "Reload",
"/src/view/example/breakpoint/breakpoint.vue": "BreakPoint",
@@ -32,6 +33,7 @@
"/src/view/superAdmin/menu/icon.vue": "Icon",
"/src/view/superAdmin/menu/menu.vue": "Menus",
"/src/view/superAdmin/operation/sysOperationRecord.vue": "SysOperationRecord",
+ "/src/view/superAdmin/params/sysParams.vue": "SysParams",
"/src/view/superAdmin/user/user.vue": "User",
"/src/view/system/state.vue": "State",
"/src/view/systemTools/autoCode/component/fieldDialog.vue": "FieldDialog",
diff --git a/web/src/utils/dictionary.js b/web/src/utils/dictionary.js
index 70ea9ce8..440fe5e1 100644
--- a/web/src/utils/dictionary.js
+++ b/web/src/utils/dictionary.js
@@ -1,4 +1,5 @@
import { useDictionaryStore } from '@/pinia/modules/dictionary'
+import { getSysParam } from '@/api/sysParams'
// 获取字典方法 使用示例 getDict('sex').then(res) 或者 async函数下 const res = await getDict('sex')
export const getDict = async(type) => {
const dictionaryStore = useDictionaryStore()
@@ -24,3 +25,11 @@ export const showDictLabel = (
})
return Reflect.has(dictMap, code) ? dictMap[code] : ''
}
+
+
+export const getParams = async (key)=>{
+ const res = await getSysParam({key})
+ if(res.code === 0){
+ return res.data.value
+ }
+}
diff --git a/web/src/view/dashboard/componenst/banner.vue b/web/src/view/dashboard/components/banner.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/banner.vue
rename to web/src/view/dashboard/components/banner.vue
diff --git a/web/src/view/dashboard/componenst/card.vue b/web/src/view/dashboard/components/card.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/card.vue
rename to web/src/view/dashboard/components/card.vue
diff --git a/web/src/view/dashboard/componenst/charts-content-numbers.vue b/web/src/view/dashboard/components/charts-content-numbers.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/charts-content-numbers.vue
rename to web/src/view/dashboard/components/charts-content-numbers.vue
diff --git a/web/src/view/dashboard/componenst/charts-people-numbers.vue b/web/src/view/dashboard/components/charts-people-numbers.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/charts-people-numbers.vue
rename to web/src/view/dashboard/components/charts-people-numbers.vue
diff --git a/web/src/view/dashboard/componenst/charts.vue b/web/src/view/dashboard/components/charts.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/charts.vue
rename to web/src/view/dashboard/components/charts.vue
diff --git a/web/src/view/dashboard/componenst/index.js b/web/src/view/dashboard/components/index.js
similarity index 100%
rename from web/src/view/dashboard/componenst/index.js
rename to web/src/view/dashboard/components/index.js
diff --git a/web/src/view/dashboard/componenst/notice.vue b/web/src/view/dashboard/components/notice.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/notice.vue
rename to web/src/view/dashboard/components/notice.vue
diff --git a/web/src/view/dashboard/componenst/pluginTable.vue b/web/src/view/dashboard/components/pluginTable.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/pluginTable.vue
rename to web/src/view/dashboard/components/pluginTable.vue
diff --git a/web/src/view/dashboard/componenst/quickLinks.vue b/web/src/view/dashboard/components/quickLinks.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/quickLinks.vue
rename to web/src/view/dashboard/components/quickLinks.vue
diff --git a/web/src/view/dashboard/componenst/table.vue b/web/src/view/dashboard/components/table.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/table.vue
rename to web/src/view/dashboard/components/table.vue
diff --git a/web/src/view/dashboard/componenst/wiki.vue b/web/src/view/dashboard/components/wiki.vue
similarity index 100%
rename from web/src/view/dashboard/componenst/wiki.vue
rename to web/src/view/dashboard/components/wiki.vue
diff --git a/web/src/view/dashboard/index.vue b/web/src/view/dashboard/index.vue
index 13d0d26d..b5de35ee 100644
--- a/web/src/view/dashboard/index.vue
+++ b/web/src/view/dashboard/index.vue
@@ -37,7 +37,10 @@
diff --git a/web/src/view/superAdmin/menu/menu.vue b/web/src/view/superAdmin/menu/menu.vue
index 95247f30..1c2f2070 100644
--- a/web/src/view/superAdmin/menu/menu.vue
+++ b/web/src/view/superAdmin/menu/menu.vue
@@ -165,24 +165,9 @@
label="文件路径"
prop="component"
>
-
-
-
-
如果菜单包含子菜单,请创建router-view二级路由页面或者
+
如果菜单包含子菜单,请创建router-view二级路由页面或者
+
@@ -556,27 +541,19 @@ import {
import icon from '@/view/superAdmin/menu/icon.vue'
import WarningBar from '@/components/warningBar/warningBar.vue'
import { canRemoveAuthorityBtnApi } from '@/api/authorityBtn'
-import { reactive, ref, onMounted } from 'vue'
+import {reactive, ref} from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
-import pathInfo from '@/pathInfo.json'
-
import { toDoc } from '@/utils/doc'
-import { toLowerCase } from '@/utils/stringFun'
+import {toLowerCase} from "@/utils/stringFun";
+import ComponentsCascader from "@/view/superAdmin/menu/components/components-cascader.vue";
+
+import pathInfo from "@/pathInfo.json";
defineOptions({
name: 'Menus',
})
-const pathOptions = reactive({})
-
-onMounted(()=>{
- for (let pathInfoKey in pathInfo) {
- // 取消掉最前面的 /src/
- pathOptions[pathInfoKey.replace(/^\/src\//, '')] = pathInfo[pathInfoKey]
- }
-})
-
const rules = reactive({
path: [{ required: true, message: '请输入菜单name', trigger: 'blur' }],
component: [{ required: true, message: '请输入文件路径', trigger: 'blur' }],
@@ -608,9 +585,9 @@ const addParameter = (form) => {
})
}
-const fmtComponent = () => {
- form.value.component = form.value.component.replace(/\\/g, '/')
- form.value.name = toLowerCase(pathOptions[form.value.component])
+const fmtComponent = (component) => {
+ form.value.component = component.replace(/\\/g, '/')
+ form.value.name = toLowerCase(pathInfo["/src/"+component])
form.value.path = form.value.name
}
diff --git a/web/src/view/superAdmin/params/sysParams.vue b/web/src/view/superAdmin/params/sysParams.vue
new file mode 100644
index 00000000..5b1dfba3
--- /dev/null
+++ b/web/src/view/superAdmin/params/sysParams.vue
@@ -0,0 +1,453 @@
+
+
+
+
+
+
+
+
+ 创建日期
+
+
+
+
+
+
+ —
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 展开
+ 收起
+
+
+
+
+
+ 新增
+ 删除
+
+
+
+
+
+
+ {{ formatDate(scope.row.CreatedAt) }}
+
+
+
+
+
+
+
+
+ 查看详情
+ 变更
+ 删除
+
+
+
+
+
+
+
+
+
{{type==='create'?'添加':'修改'}}
+
+ 确 定
+ 取 消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
使用说明
+
+ 前端可以通过引入 import { getParams } from '@/utils/dictionary' 然后通过 await getParams(key) 来获取对应的参数。
+
+
+ 后端可以调用 new(system.SysParamsService).GetSysParam(key) 来获取对应的 value 值。
+
+
+ 后端需要提前 import "github.com/flipped-aurora/gin-vue-admin/server/service/system"
+
+
+
+
+
+
+
+
+ {{ detailFrom.name }}
+
+
+ {{ detailFrom.key }}
+
+
+ {{ detailFrom.value }}
+
+
+ {{ detailFrom.desc }}
+
+
+
+
+
+
+
+
+
+
diff --git a/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue b/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue
index 6d78672b..ed582332 100644
--- a/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue
+++ b/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue
@@ -1,7 +1,7 @@
{
const isDarkMode = appStore.config.darkMode === 'dark';
if (isDarkMode) {
@@ -39,6 +52,19 @@ const props = defineProps({
default() {
return {}
}
+ },
+ isAdd: {
+ type: Boolean,
+ default: false
+ }
+})
+
+watchEffect(() => {
+ for (const key in props.previewCode) {
+ if (props.isAdd && createKey.some(createKeyItem => key.includes(createKeyItem))) {
+ continue;
+ }
+ useCode.value[key] = props.previewCode[key]
}
})
@@ -48,7 +74,6 @@ onMounted(() => {
markedHighlight({
langPrefix: 'hljs language-',
highlight(code, lang, info) {
- console.log(code,lang,info)
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
if (lang === 'vue') {
return hljs.highlight(code, { language: 'html' }).value;
@@ -57,11 +82,11 @@ onMounted(() => {
}
})
);
- for (const key in props.previewCode) {
+ for (const key in useCode.value) {
if (activeName.value === '') {
activeName.value = key
}
- document.getElementById(key).innerHTML = marked.parse(props.previewCode[key])
+ document.getElementById(key).innerHTML = marked.parse(useCode.value[key])
}
})
diff --git a/web/src/view/systemTools/autoCode/index.vue b/web/src/view/systemTools/autoCode/index.vue
index 52d8a2c5..97d930ea 100644
--- a/web/src/view/systemTools/autoCode/index.vue
+++ b/web/src/view/systemTools/autoCode/index.vue
@@ -4,34 +4,35 @@
href="https://www.bilibili.com/video/BV1kv4y1g7nT?p=3"
title="此功能为开发环境使用,不建议发布到生产,具体使用效果请点我观看。"
/>
-
-
使用AI创建
+
+
-
+
-
+
+ 【完全免费】前往
插件市场个人中心申请AIPath,填入config.yaml的ai-path属性即可使用。
+
+
- 小奇
-
-
-
-
-
-
- 小淼
+ 生成
-
+
从数据库创建
自动化结构
+
@@ -420,6 +429,8 @@
row-key="fieldName"
>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -538,7 +554,7 @@
label="字段Json"
>
-
+
-
+
-
+
-
+
导出json
@@ -684,32 +704,35 @@
show-file-list="false"
accept=".json"
>
- 导入json
+ 导入json
清除暂存
暂存
- 预览代码
-
-
生成代码
+
+ {{isAdd?'查看代码':'预览代码'}}
+
@@ -771,6 +794,7 @@
@@ -791,6 +815,21 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import WarningBar from '@/components/warningBar/warningBar.vue'
import Sortable from 'sortablejs'
+const handleFocus = () => {
+ document.addEventListener('keydown', handleKeydown);
+};
+
+const handleBlur = () => {
+ document.removeEventListener('keydown', handleKeydown);
+};
+
+
+const handleKeydown = (event) => {
+ if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') {
+ llmAutoFunc();
+ }
+};
+
const getOnlyNumber = () => {
let randomNumber = '';
while (randomNumber.length < 16) {
@@ -801,55 +840,27 @@ const getOnlyNumber = () => {
const prompt = ref("")
-const llmAutoFunc = async (mode) =>{
- const res = await llmAuto({prompt:prompt.value,mode:mode})
+const llmAutoFunc = async (flag) =>{
+ if (flag&&!form.value.structName) {
+ ElMessage.error('请输入结构体名称')
+ return
+ }
+ if (!flag&&!prompt.value) {
+ ElMessage.error('请输入描述')
+ return
+ }
+ const res = await llmAuto({prompt:flag?'结构体名称为'+form.value.structName:prompt.value})
if (res.code === 0) {
form.value.fields = []
const json = JSON.parse(res.data)
for (let key in json){
- if(key === "fields"){
- json[key].forEach(item => {
- if (item.primaryKey) {
- form.value.gvaModel = false
- }
- form.value.fields.push({
- onlyNumber: getOnlyNumber(),
- fieldName: toUpperCase(item.fieldName),
- fieldDesc: item.fieldDesc,
- fieldType: item.fieldType,
- dataType: "",
- fieldJson: item.fieldJson||item.columnName,
- primaryKey: item.primaryKey,
- dataTypeLong: item.dataTypeLong,
- columnName: item.columnName,
- comment: item.comment || item.fieldDesc,
- require: false,
- errorText: '',
- clearable: true,
- fieldSearchType: '',
- fieldIndexType: '',
- dictType: '',
- form: true,
- desc: true,
- table: true,
- excel: false,
- dataSource: {
- association:1,
- table: '',
- label: '',
- value: ''
- }
- })
- })
- }else{
- if(mode === "xiaomiao"){
- form.value[key] = json[key]
- }
- }
+ form.value[key] = json[key]
}
}
}
+const isAdd = ref(false)
+
// 行拖拽
const rowDrop = () => {
// 要拖拽元素的父容器
@@ -1211,7 +1222,7 @@ const enterForm = async(isPreview) => {
form.value.humpPackageName = toSQLLine(form.value.packageName)
delete form.value.primaryField
if (isPreview) {
- const data = await preview(form.value)
+ const data = await preview({...form.value,isAdd:!!isAdd.value,fields:form.value.fields.filter(item => !item.disabled)})
preViewCode.value = data.data.autoCode
previewFlag.value = true
} else {
@@ -1327,7 +1338,14 @@ const setFdMap = async() => {
const getAutoCodeJson = async(id) => {
const res = await getMeta({ id: Number(id) })
if (res.code === 0) {
+ const add = route.query.isAdd
+ isAdd.value = add
form.value = JSON.parse(res.data.meta)
+ if (isAdd.value){
+ form.value.fields.forEach(item => {
+ item.disabled = true
+ })
+ }
}
}
diff --git a/web/src/view/systemTools/autoCodeAdmin/index.vue b/web/src/view/systemTools/autoCodeAdmin/index.vue
index bb4fbbec..6222479e 100644
--- a/web/src/view/systemTools/autoCodeAdmin/index.vue
+++ b/web/src/view/systemTools/autoCodeAdmin/index.vue
@@ -60,6 +60,9 @@
>
增加方法
+
+ 增加字段
+
+
+
+
-
+
API路径: [{{ autoFunc.method }}] /{{ autoFunc.abbreviation }}/{{ autoFunc.router }}
@@ -241,7 +247,8 @@ const autoFunc = ref({
humpPackageName:"",
businessDB:"",
method:"",
- funcDesc: ""
+ funcDesc: "",
+ isAuth:false,
})
const addFuncBtn = (row) => {
@@ -379,13 +386,16 @@ const enterDialog = async () => {
}
};
-const goAutoCode = (row) => {
+const goAutoCode = (row,isAdd) => {
if (row) {
router.push({
name: "autoCodeEdit",
params: {
id: row.ID,
},
+ query: {
+ isAdd: isAdd
+ },
});
} else {
router.push({ name: "autoCode" });
diff --git a/web/src/view/systemTools/exportTemplate/exportTemplate.vue b/web/src/view/systemTools/exportTemplate/exportTemplate.vue
index 60c2577a..c9a0c52a 100644
--- a/web/src/view/systemTools/exportTemplate/exportTemplate.vue
+++ b/web/src/view/systemTools/exportTemplate/exportTemplate.vue
@@ -211,6 +211,8 @@
label-position="right"
:rules="rule"
label-width="100px"
+ v-loading="aiLoading"
+ element-loading-text="小淼正在思考..."
>
-
+
+
-
@@ -283,11 +290,22 @@
:value="item.tableName"
/>
-
-
自动生成模板
+
自动补全
+
自动生成模板
-
+
+
+
+
+
{
+ aiLoading.value = true
+ const tables = tableOptions.value.map(item => item.tableName)
+ const aiRes = await butler({prompt:prompt.value,businessDB: formData.value.dbName||"",tables:tables,command:'autoExportTemplate'})
+ aiLoading.value = false
+ if (aiRes.code === 0) {
+ const aiData = JSON.parse(aiRes.data)
+ formData.value.name = aiData.name
+ formData.value.tableName = aiData.tableName
+ formData.value.templateID = aiData.templateID
+ formData.value.templateInfo = JSON.stringify(aiData.templateInfo, null, 2)
+ formData.value.joinTemplate = aiData.joinTemplate
+ }
+}
+
const getDbFunc = async() => {
const res = await getDB()
@@ -616,8 +654,7 @@ const getTableFunc = async() => {
formData.value.tableName = ''
}
getTableFunc()
-
-const getColumnFunc = async () => {
+const getColumnFunc = async (aiFLag) => {
if(!formData.value.tableName) {
ElMessage({
type: 'error',
@@ -626,11 +663,26 @@ const getColumnFunc = async () => {
return
}
formData.value.templateInfo = ""
+ aiLoading.value = true
const res = await getColumn({
businessDB: formData.value.dbName,
tableName: formData.value.tableName
})
if(res.code === 0) {
+ if(aiFLag){
+ const aiRes = await butler({data:res.data.columns,command:'exportCompletion'})
+ if (aiRes.code === 0) {
+ const aiData = JSON.parse(aiRes.data)
+ aiLoading.value = false
+ formData.value.templateInfo = JSON.stringify(aiData.templateInfo, null, 2)
+ formData.value.name = aiData.name
+ formData.value.templateID = aiData.templateID
+ return
+ }
+ ElMessage.warning('AI自动补全失败,已调整为逻辑填写')
+ }
+
+
// 把返回值的data.columns做尊换,制作一组JSON数据,columnName做key,columnComment做value
const templateInfo = {}
res.data.columns.forEach(item => {
@@ -638,6 +690,7 @@ const getColumnFunc = async () => {
})
formData.value.templateInfo = JSON.stringify(templateInfo, null, 2)
}
+ aiLoading.value = false
}