lining hace 6 años
padre
commit
a0a45cf484

+ 18 - 16
src/dashoo.cn/backend/api/controllers/casbin/organize.go

@@ -375,23 +375,25 @@ func (this *OrganizesController) OrganizeParentList() {
 // @Success 200 {object} business.device.DeviceChannels
 // @router /listbydeptid [get]
 func (this *OrganizesController) ListByDeptId() {
-	ParentId := this.GetString("ParentId")
-	var user userRole.Base_User
+	//ParentId := this.GetString("ParentId")
+	//var user userRole.Base_User
 	svc := organize.GetOrganizeService(utils.DBE)
-	svc.GetEntityById(this.User.Id, &user)
-	companyids := strings.Split(user.Superior, ",")
-
-	ids := ""
-	if ParentId != "" {
-		ids = svc.GetAllChildById("100000180")
-	} else {
-		has := svc.UserInRoleById(this.User.Id, "10000203")
-		if has {
-			ids = svc.GetAllChildById("100000054")
-		} else {
-			ids = svc.GetAllChildById(companyids[len(companyids)-1])
-		}
-	}
+	unitId := svc.GetMyUnitDepartmentId(this.User.DepartmentId)
+
+	//svc.GetEntityById(this.User.Id, &user)
+	//companyids := strings.Split(user.Superior, ",")
+	ids := svc.GetAllChildById(unitId)
+	//ids := ""
+	//if ParentId != "" {
+	//	ids = svc.GetAllChildById("100000180")
+	//} else {
+	//	has := svc.UserInRoleById(this.User.Id, "10000203")
+	//	if has {
+	//		ids = svc.GetAllChildById("100000054")
+	//	} else {
+	//		ids = svc.GetAllChildById(companyids[len(companyids)-1])
+	//	}
+	//}
 	where := " Id in ( " + ids + " ) and AccCode='" + this.User.AccCode + "'"
 
 	list := make([]organize.Base_Organize, 0)

+ 11 - 3
src/dashoo.cn/backend/api/controllers/casbin/user.go

@@ -139,19 +139,27 @@ func (this *UserController) UserPowerCheckRole() {
 func (this *UserController) List() {
 	page := this.GetPageInfoForm()
 	keyword := this.GetString("keyword")
+	username := this.GetString("username")
+	departmentname := this.GetString("departmentname")
 	IsCompanyUser := this.GetString("IsCompanyUser")
 	svc := permission.GetPermissionService(utils.DBE)
 	organsvc := organize.GetOrganizeService(utils.DBE)
 	var users []userRole.Base_User
 	topid := organsvc.GetMyUnitDepartmentId(this.User.DepartmentId)
 	depids := organsvc.GetAllChildById(topid)
-	where := "IsVisible=1 and IsCompanyUser = 0 and DepartmentId in (" + depids + ") or Id = '" + utils.ToStr(this.User.Id) + "' "
+	where := "(IsVisible=1 and IsCompanyUser = 0 and DepartmentId in (" + depids + ") or Id = '" + utils.ToStr(this.User.Id) + "') "
 	//外部用户 IsCompanyUser == 1
 	if IsCompanyUser == "1" {
-		where = "IsVisible=1 and IsCompanyUser = 1 and CreateUserId='" + utils.ToStr(this.User.Id) + "' or Id = '" + utils.ToStr(this.User.Id) + "' "
+		where = "(IsVisible=1 and IsCompanyUser = 1 and CreateUserId='" + utils.ToStr(this.User.Id) + "' or Id = '" + utils.ToStr(this.User.Id) + "')"
 	}
 	if keyword != "" {
-		where = where + " and Realname like '%" + keyword + "%'"
+		where = where + " and UserName like '%" + keyword + "%'"
+	}
+	if username != "" {
+		where = where + " and  Realname like '%" + username + "%'"
+	}
+	if departmentname != "" {
+		where = where + " and DepartmentName like '%" + departmentname + "%'"
 	}
 	total := svc.GetPagingEntitiesWithOrder(page.CurrentPage, page.Size, "Id", false, &users, where)
 

+ 3 - 1
src/dashoo.cn/backend/api/controllers/system/auditsetting.go

@@ -414,7 +414,9 @@ func (this *OilAuditSettingController) GetAuditerByDept() {
 
 	var users []userRole.Base_RoleList
 	rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
-	where := "DepartmentId=" + Id
+	organsvc := organize.GetOrganizeService(utils.DBE)
+	depids := organsvc.GetAllChildById(Id)
+	where := "DepartmentId in (" + depids + ")"
 	rsvc.GetEntitysByWhere(BaseUserName, where, &users)
 
 	var datainfo ErrorDataInfo

+ 17 - 4
src/dashoo.cn/frontend_web/src/pages/system/users.vue

@@ -14,7 +14,13 @@
         </span>
         <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
           <el-form-item label="账号">
-            <el-input size="mini" style="width: 165px;" v-model="keyword" placeholder="请输入账号"></el-input>
+            <el-input size="mini" style="width: 165px;" v-model="searchForm.keyword" placeholder="请输入账号"></el-input>
+          </el-form-item>
+          <el-form-item label="用户名">
+            <el-input size="mini" style="width: 165px;" v-model="searchForm.UserName" placeholder="请输入账号"></el-input>
+          </el-form-item>
+          <el-form-item label="所属部门">
+            <el-input size="mini" style="width: 165px;" v-model="searchForm.DepartmentName" placeholder="请输入账号"></el-input>
           </el-form-item>
           <el-form-item>
             <el-dropdown split-button type="primary" size="mini" @click="seachdata" @command="searchCommand">
@@ -191,7 +197,6 @@
         list: [],
         rolelist: [],
         mustrolelist: [],
-        keyword: '',
         datadialogVisible: false,
         dialogtitle: '',
         disabledserial: false,
@@ -243,6 +248,11 @@
         selectedorg: [],
         userdepartment: [],
         ischeckbj: false, // 过滤字段勾选时触发的选中事件
+        searchForm: {
+          keyword: '',
+          UserName: '',
+          DepartmentName: ''
+        }
       }
     },
     computed: mapGetters({
@@ -264,7 +274,9 @@
         const params = {
           _currentPage: this.currentPage,
           _size: this.size,
-          keyword: this.keyword
+          keyword: this.searchForm.keyword,
+          username: this.searchForm.UserName,
+          departmentname: this.searchForm.DepartmentName
         }
         // request
         this.$axios.get('users/list', {
@@ -744,7 +756,8 @@
           })
       },
       clearSearch() {
-        this.keyword = ''
+        this.searchForm.keyword = ''
+        this.searchForm.UserName = ''
         this.list = []
         this.initData()
       }