-
-
+
+
+
+
+
+
+
+
+
+
+ {{ systemInfo.name || '云泽管理系统' }}
+
+
+ {{ systemInfo.version || '1.0.0' }}
+
+
+ {{ systemInfo.environment || 'Production' }}
+
+
+ {{ currentTime }}
+
+
+ {{ systemInfo.uptime || '-' }}
+
+
+ {{ systemInfo.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone }}
+
+
+
+
+
+
+ {{ systemInfo.serverHost || '-' }}
+
+
+ {{ apiBaseUrl }}
+
+
+ {{ systemInfo.os || clientInfo.os }}
+
+
+ {{ systemInfo.cpuCores || clientInfo.cpuCores }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ systemInfo.dbType || 'MySQL' }}
+
+
+ {{ systemInfo.dbVersion || '-' }}
+
+
+
+ {{ systemInfo.dbStatus === 'connected' ? '已连接' : '未连接' }}
+
+
+
+ {{ systemInfo.dbConnections || '-' }}
+
+
+
+
+
+
+ {{ clientInfo.browser }}
+
+
+ {{ clientInfo.browserVersion }}
+
+
+ {{ clientInfo.os }}
+
+
+ {{ clientInfo.screenResolution }}
+
+
+
+ {{ clientInfo.isMobile ? '移动设备' : '桌面设备' }}
+
+
+
+ {{ clientInfo.userAgent }}
+
+
+
+
+
+
+ Vue 3
+
+
+ Element Plus
+
+
+ Vite
+
+
+ {{ clientInfo.nodeVersion || '-' }}
+
+
+
+
+
+
+
+ 刷新信息
+
+
+
+ 复制信息
+
+
+
+
-
+
+
+
-
diff --git a/pc/src/views/system/files/index.vue b/pc/src/views/system/files/index.vue
index 57315b4..4fd1fee 100644
--- a/pc/src/views/system/files/index.vue
+++ b/pc/src/views/system/files/index.vue
@@ -120,7 +120,7 @@
diff --git a/server/controllers/knowledge.go b/server/controllers/knowledge.go
index 3ed8d11..fa99877 100644
--- a/server/controllers/knowledge.go
+++ b/server/controllers/knowledge.go
@@ -290,12 +290,13 @@ func (c *KnowledgeController) GetTags() {
var result []map[string]interface{}
for _, tag := range tags {
result = append(result, map[string]interface{}{
- "tagId": tag.TagId,
- "tagName": tag.TagName,
- "tagColor": tag.TagColor,
- "usageCount": tag.UsageCount,
- "createTime": tag.CreateTime,
- "updateTime": tag.UpdateTime,
+ "tagId": tag.TagId,
+ "tagName": tag.TagName,
+ "tagColor": tag.TagColor,
+ "tagBackground": tag.TagBackground,
+ "usageCount": tag.UsageCount,
+ "createTime": tag.CreateTime,
+ "updateTime": tag.UpdateTime,
})
}
@@ -322,7 +323,8 @@ func (c *KnowledgeController) AddCategory() {
return
}
- id, err := models.AddCategory(&category)
+ // 不处理id,直接添加,表自动递增
+ _, err = models.AddCategory(&category)
if err != nil {
c.Data["json"] = map[string]interface{}{
"code": 1,
@@ -336,12 +338,12 @@ func (c *KnowledgeController) AddCategory() {
c.Data["json"] = map[string]interface{}{
"code": 0,
"message": "添加成功",
- "data": map[string]interface{}{"categoryId": id},
+ "data": nil,
}
c.ServeJSON()
}
-// AddTag 添加标签
+// AddTag 添加或更新标签
// @router /api/knowledge/tag/add [post]
func (c *KnowledgeController) AddTag() {
var tag models.KnowledgeTag
@@ -356,6 +358,31 @@ func (c *KnowledgeController) AddTag() {
return
}
+ // 判断是添加还是更新
+ if tag.TagId > 0 {
+ // 更新操作
+ err = models.UpdateTag(&tag)
+ if err != nil {
+ c.Data["json"] = map[string]interface{}{
+ "code": 1,
+ "message": "更新标签失败: " + err.Error(),
+ "data": nil,
+ }
+ c.ServeJSON()
+ return
+ }
+
+ c.Data["json"] = map[string]interface{}{
+ "code": 0,
+ "message": "更新成功",
+ "data": map[string]interface{}{"tagId": tag.TagId},
+ }
+ c.ServeJSON()
+ return
+ }
+
+ // 添加操作:确保 TagId 为 0,让数据库自动生成
+ tag.TagId = 0
id, err := models.AddTag(&tag)
if err != nil {
c.Data["json"] = map[string]interface{}{
diff --git a/server/database/add_knowledge_menus.sql b/server/database/add_knowledge_menus.sql
new file mode 100644
index 0000000..5011e1c
--- /dev/null
+++ b/server/database/add_knowledge_menus.sql
@@ -0,0 +1,65 @@
+-- 添加知识库管理相关的菜单项
+-- 注意:需要先查询知识库菜单的ID(parent_id),假设为 11
+
+-- 如果知识库菜单ID为11,添加分类管理和标签管理菜单
+-- 请根据实际数据库中的知识库菜单ID修改下面的 parent_id 值
+
+-- 查询知识库菜单ID(如果需要)
+-- SELECT id FROM yz_menus WHERE path = '/apps/knowledge';
+
+-- 添加分类管理菜单(如果不存在)
+INSERT INTO yz_menus (
+ name,
+ path,
+ parent_id,
+ icon,
+ `order`,
+ status,
+ component_path,
+ menu_type,
+ description
+)
+SELECT
+ '分类管理',
+ '/apps/knowledge/category',
+ id,
+ 'fa-solid fa-folder',
+ 2,
+ 1,
+ '@/views/apps/knowledge/category/index.vue',
+ 1,
+ '知识库分类管理'
+FROM yz_menus
+WHERE path = '/apps/knowledge'
+AND NOT EXISTS (
+ SELECT 1 FROM yz_menus WHERE path = '/apps/knowledge/category'
+);
+
+-- 添加标签管理菜单(如果不存在)
+INSERT INTO yz_menus (
+ name,
+ path,
+ parent_id,
+ icon,
+ `order`,
+ status,
+ component_path,
+ menu_type,
+ description
+)
+SELECT
+ '标签管理',
+ '/apps/knowledge/tag',
+ id,
+ 'fa-solid fa-tags',
+ 3,
+ 1,
+ '@/views/apps/knowledge/tag/index.vue',
+ 1,
+ '知识库标签管理'
+FROM yz_menus
+WHERE path = '/apps/knowledge'
+AND NOT EXISTS (
+ SELECT 1 FROM yz_menus WHERE path = '/apps/knowledge/tag'
+);
+
diff --git a/server/models/knowledge.go b/server/models/knowledge.go
index 38c24ff..813eb07 100644
--- a/server/models/knowledge.go
+++ b/server/models/knowledge.go
@@ -54,12 +54,13 @@ func (kc *KnowledgeCategory) TableName() string {
// KnowledgeTag 知识库标签模型
type KnowledgeTag struct {
- TagId int `orm:"column(tag_id);pk;auto" json:"tagId"`
- TagName string `orm:"column(tag_name);size(50);unique" json:"tagName"`
- TagColor string `orm:"column(tag_color);size(20);null" json:"tagColor"`
- UsageCount int `orm:"column(usage_count);default(0)" json:"usageCount"`
- CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"createTime"`
- UpdateTime time.Time `orm:"column(update_time);auto_now;type(datetime)" json:"updateTime"`
+ TagId int `orm:"column(tag_id);pk;auto" json:"tagId"`
+ TagName string `orm:"column(tag_name);size(50);unique" json:"tagName"`
+ TagColor string `orm:"column(tag_color);size(20);null" json:"tagColor"`
+ TagBackground string `orm:"column(tag_background);size(20);null" json:"tagBackground"`
+ UsageCount int `orm:"column(usage_count);default(0)" json:"usageCount"`
+ CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"createTime"`
+ UpdateTime time.Time `orm:"column(update_time);auto_now;type(datetime)" json:"updateTime"`
}
// TableName 设置表名
@@ -286,9 +287,23 @@ func AddCategory(category *KnowledgeCategory) (int64, error) {
return id, err
}
+// UpdateCategory 更新分类
+func UpdateCategory(category *KnowledgeCategory) error {
+ o := orm.NewOrm()
+ _, err := o.Update(category, "CategoryName", "CategoryDesc", "ParentId", "SortOrder")
+ return err
+}
+
// AddTag 添加标签
func AddTag(tag *KnowledgeTag) (int64, error) {
o := orm.NewOrm()
id, err := o.Insert(tag)
return id, err
}
+
+// UpdateTag 更新标签
+func UpdateTag(tag *KnowledgeTag) error {
+ o := orm.NewOrm()
+ _, err := o.Update(tag, "TagName", "TagColor", "TagBackground")
+ return err
+}