Bläddra i källkod

角色管理修改

huahaiyan 6 år sedan
förälder
incheckning
80a638cdc4

+ 2 - 2
src/dashoo.cn/backend/api/controllers/casbin/role.go

@@ -63,7 +63,7 @@ func (this *RoleController) RoleList() {
 		roleofrole = strings.Trim(roleofrole, ",")
 		where = where + " and Id in (" + roleofrole + ")"
 	}
-	total := svc.GetRoleList(page.CurrentPage, page.Size, "CreateOn", utils.ToStr(this.User.Id), &roles, where)
+	total := svc.GetRoleList(page.CurrentPage, page.Size, "SortCode", utils.ToStr(this.User.Id), &roles, where)
 	var datainfo DataInfo
 	datainfo.Items = roles
 	datainfo.CurrentItemCount = total
@@ -84,7 +84,7 @@ func (this *RoleController) RoleAllList() {
 	if searchkey != "" {
 		where = where + " and Realname like '%" + searchkey + "%'"
 	}
-	total := svc.GetRoleList(page.CurrentPage, page.Size, "CreateOn", utils.ToStr(this.User.Id), &roles, where)
+	total := svc.GetRoleList(page.CurrentPage, page.Size, "SortCode", utils.ToStr(this.User.Id), &roles, where)
 	var datainfo DataInfo
 	datainfo.Items = roles
 	datainfo.CurrentItemCount = total

+ 24 - 6
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappendsub.go

@@ -185,8 +185,14 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
 			entity.CreateBy = this.User.Realname
 			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 
-			if strings.Contains(hasField, needList[i].FileName+",") {
-				//已存在,不能重复添加
+			isRepeat := false
+			for j := 0; j < len(list); j++ {
+				if list[j].NeedFileType == needList[i].FileName{
+					isRepeat = true
+					break
+				}
+			}
+			if isRepeat == true {
 				continue
 			}
 			entity.SupType = 2
@@ -273,8 +279,14 @@ func (this *OilSupplierCertAppendSubController) AddTechBus() {
 				entity.CreateBy = this.User.Realname
 				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 
-				if strings.Contains(hasField, needList[i].FileName+",") {
-					//已存在,不能重复添加
+				isRepeat := false
+				for j := 0; j < len(list); j++ {
+					if list[j].NeedFileType == needList[i].FileName{
+						isRepeat = true
+						break
+					}
+				}
+				if isRepeat == true {
 					continue
 				}
 				svc.InsertEntityBytbl(OilSupplierFileName, &entity)
@@ -369,8 +381,14 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
 				entity.CreateBy = this.User.Realname
 				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 
-				if strings.Contains(hasField, needList[i].FileName+",") {
-					//已存在,不能重复添加
+				isRepeat := false
+				for j := 0; j < len(list); j++ {
+					if list[j].NeedFileType == needList[i].FileName{
+						isRepeat = true
+						break
+					}
+				}
+				if isRepeat == true {
 					continue
 				}
 				svc.InsertEntityBytbl(OilSupplierFileName, &entity)

+ 9 - 7
src/dashoo.cn/frontend_web/src/pages/system/userrole.vue

@@ -258,7 +258,6 @@
         userSize: 10,
         userList: [],
         selectRoleId: '',
-        mustrolelist: [],
         formLabelWidth: '120px',
         dialogtitle: '', // 添加编辑对话框
         dialogVisible: false,
@@ -369,14 +368,17 @@
       },
       managerolesave() {
         let _this = this
-        for (let mdx in this.mustrolelist) {
-          if (this.selectedrole.indexOf(this.mustrolelist[mdx]) == -1) {
-            this.selectedrole.push(parseInt(this.mustrolelist[mdx]))
-          }
-        }
+        // for (let mdx in this.mustrolelist) {
+        //   console.log(this.mustrolelist)
+        //   if (this.selectedrole.indexOf(this.mustrolelist[mdx]) == -1) {
+        //     this.selectedrole.push(parseInt(this.mustrolelist[mdx]))
+        //   }
+        // }
         let rolestring = this.selectedrole.join(',')
+        let roleidsstring = rolestring.toString()
+        console.log("--",rolestring,roleidsstring)
         // request
-        this.$axios.put('role/setmanrole/' + this.selectedroleid + '_' + rolestring, {})
+        this.$axios.put('role/setmanrole/' + this.selectedroleid + '_' + roleidsstring, {})
           .then(res => {
             // response
             if (res.data.code === 0) {