diff --git a/QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go b/QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go
index e2db5ff2..28d05846 100644
--- a/QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go
+++ b/QMPlusServer/model/dbModel/exa_fileUploadAndDownload.go
@@ -21,7 +21,7 @@ func (f *ExaFileUploadAndDownload) Upload() error {
}
func (f *ExaFileUploadAndDownload) DeleteFile() error {
- err := qmsql.DEFAULTDB.Where("id = ?", f.ID).Delete(f).Error
+ err := qmsql.DEFAULTDB.Where("id = ?", f.ID).Unscoped().Delete(f).Error
return err
}
diff --git a/QMPlusServer/model/sysModel/sys_base_menu.go b/QMPlusServer/model/sysModel/sys_base_menu.go
index 933d688c..df971442 100644
--- a/QMPlusServer/model/sysModel/sys_base_menu.go
+++ b/QMPlusServer/model/sysModel/sys_base_menu.go
@@ -17,6 +17,7 @@ type SysBaseMenu struct {
Name string `json:"name"`
Hidden bool `json:"hidden"`
Component string `json:"component"`
+ Sort string `json:"sort"`
Meta `json:"meta"`
NickName string `json:"nickName"`
Children []SysBaseMenu `json:"children"`
@@ -53,9 +54,10 @@ func (b *SysBaseMenu) UpdataBaseMenu() (err error) {
upDataMap["component"] = b.Component
upDataMap["title"] = b.Title
upDataMap["icon"] = b.Icon
+ upDataMap["sort"] = b.Sort
err = qmsql.DEFAULTDB.Where("id = ?", b.ID).Find(&SysBaseMenu{}).Updates(upDataMap).Error
err1 := qmsql.DEFAULTDB.Where("menu_id = ?", b.ID).Find(&[]SysMenu{}).Updates(upDataMap).Error
- fmt.Printf("菜单修改时候,关联菜单err:%v", err1)
+ fmt.Printf("菜单修改时候,关联菜单err1:%v,err:%v", err1, err)
return err
}
@@ -71,14 +73,17 @@ func (b *SysBaseMenu) GetInfoList(info modelInterface.PageInfo) (err error, list
return
} else {
var menuList []SysBaseMenu
- err = db.Find(&menuList).Error
+ err = db.Where("parent_id = 0").Order("sort", true).Find(&menuList).Error
+ for i := 0; i < len(menuList); i++ {
+ err = getBaseChildrenList(&menuList[i])
+ }
return err, menuList, total
}
}
//获取基础路由树
func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
- err = qmsql.DEFAULTDB.Where(" parent_id = ?", 0).Find(&menus).Error
+ err = qmsql.DEFAULTDB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error
for i := 0; i < len(menus); i++ {
err = getBaseChildrenList(&menus[i])
}
@@ -86,7 +91,7 @@ func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
}
func getBaseChildrenList(menu *SysBaseMenu) (err error) {
- err = qmsql.DEFAULTDB.Where("parent_id = ?", menu.ID).Find(&menu.Children).Error
+ err = qmsql.DEFAULTDB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
for i := 0; i < len(menu.Children); i++ {
err = getBaseChildrenList(&menu.Children[i])
}
diff --git a/QMPlusServer/model/sysModel/sys_menu_authority.go b/QMPlusServer/model/sysModel/sys_menu_authority.go
index 6a2e88e5..8b6300ad 100644
--- a/QMPlusServer/model/sysModel/sys_menu_authority.go
+++ b/QMPlusServer/model/sysModel/sys_menu_authority.go
@@ -43,7 +43,7 @@ func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysMe
//获取动态路由树
func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
- err = qmsql.DEFAULTDB.Where("authority_id = ? AND parent_id = ?", authorityId, 0).Find(&menus).Error
+ err = qmsql.DEFAULTDB.Where("authority_id = ? AND parent_id = ?", authorityId, 0).Order("sort", true).Find(&menus).Error
for i := 0; i < len(menus); i++ {
err = getChildrenList(&menus[i])
}
@@ -51,7 +51,7 @@ func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
}
func getChildrenList(menu *SysMenu) (err error) {
- err = qmsql.DEFAULTDB.Where("authority_id = ? AND parent_id = ?", menu.AuthorityId, menu.MenuId).Find(&menu.Children).Error
+ err = qmsql.DEFAULTDB.Where("authority_id = ? AND parent_id = ?", menu.AuthorityId, menu.MenuId).Order("sort", true).Find(&menu.Children).Error
for i := 0; i < len(menu.Children); i++ {
err = getChildrenList(&menu.Children[i])
}
diff --git a/QMPlusVuePage/src/App.vue b/QMPlusVuePage/src/App.vue
index 4347e36f..69f7532e 100644
--- a/QMPlusVuePage/src/App.vue
+++ b/QMPlusVuePage/src/App.vue
@@ -5,22 +5,18 @@
diff --git a/QMPlusVuePage/src/view/layout/index.vue b/QMPlusVuePage/src/view/layout/index.vue
index 362e5fcd..3661021d 100644
--- a/QMPlusVuePage/src/view/layout/index.vue
+++ b/QMPlusVuePage/src/view/layout/index.vue
@@ -2,15 +2,16 @@
-
-
- Gin-Vue-Admin
-
+
{{item.meta.title}}
-
+
@@ -52,9 +54,9 @@ import Aside from '@/view/layout/aside'
import { mapGetters, mapMutations } from 'vuex'
export default {
name: 'Layout',
- data(){
- return{
- isCollapse:false
+ data() {
+ return {
+ isCollapse: false
}
},
components: {
@@ -63,6 +65,7 @@ export default {
methods: {
...mapMutations('user', ['LoginOut']),
totalCollapse() {
+ this.isCollapse = !this.isCollapse
this.$bus.emit('totalCollapse')
},
toPerson() {
@@ -77,22 +80,13 @@ export default {
matched() {
return this.$route.matched
}
- },
- created(){
- this.$bus.on('totalCollapse', () => {
- this.isCollapse = !this.isCollapse
- console.log(this.isCollapse)
- })
- },
- beforeDestroy() {
- this.$bus.off('totalCollapse')
}
}