Pārlūkot izejas kodu

前后:分页;角色人员查询;

dubch 5 gadi atpakaļ
vecāks
revīzija
88baddf959

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

@@ -557,6 +557,8 @@ func (this *RoleController) GetUsersForRole() {
 
 	page := this.GetPageInfoForm()
 	keyword := this.GetString("keyword")
+	userName := this.GetString("userName")
+	unitName := this.GetString("unitName")
 	roleid := this.Ctx.Input.Param(":rid")
 	svc := permission.GetPermissionService(utils.DBE)
 	var users []userRole.Base_User
@@ -565,11 +567,18 @@ func (this *RoleController) GetUsersForRole() {
 	if keyword != "" {
 		where = where + " and Realname like '%" + keyword + "%'"
 	}
+	if userName != "" {
+		where = where + " and Realname like '%" + userName + "%'"
+	}
 	//判断超级管理员和有查看所有数据权限的用户
 	svcPerm := permission.GetPermissionService(utils.DBE)
 	isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
 	if !svcPerm.IsAdmin(this.User.Id) && !isauth {
 		where += " and Unit = '" + this.User.Unit + "'"
+	} else {
+		if unitName != "" {
+			where = where + " and Unit like '%" + unitName + "%'"
+		}
 	}
 	total, users := svc.GetUserListForRole(page.CurrentPage, page.Size, roleid, "Id", where)
 

+ 24 - 5
src/dashoo.cn/backend/api/controllers/oilsupplier/goodsaptitude.go

@@ -1198,11 +1198,21 @@ func (this *OilGoodsAptitudeController) Changelist() {
 func (this *OilGoodsAptitudeController) GoodsParentList() {
 	Name := this.Ctx.Input.Param(":name")
 	Level := this.GetString("level")
+	SupplierId := this.GetString("SupplierId")
+	if SupplierId != "" {
+		svc :=supplier.GetOilSupplierService(utils.DBE)
+		var supplier supplier.OilSupplier
+		svc.GetEntityByWhere(OilSupplierName, "Id = " + SupplierId, &supplier)
+		Level = supplier.Grade
+	}
 	if Name != "" {
 		svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
-		where1 := " (goods.GoodsLevel is null or goods.GoodsLevel = " + Level + ") AND (Name LIKE '%" + Name + "%' OR Code LIKE '" + Name + "%') "
+		where1 := " (Name LIKE '%" + Name + "%' OR Code LIKE '" + Name + "%') "
+		if Level != "" {
+			where1 += " and (goods.GoodsLevel is null or goods.GoodsLevel = " + Level + ") "
+		}
 
-		sqlStr := "SELECT class.Id, Code, Name, concat(Code, '  ', Name) as CodeName, ParentId,goods.GoodsLevel FROM OilGoodsAptitudeClass class left join OilGoodsAptitude goods on goods.ClassId = class.Id " +
+			sqlStr := "SELECT class.Id, Code, Name, concat(Code, '  ', Name) as CodeName, ParentId,goods.GoodsLevel FROM OilGoodsAptitudeClass class left join OilGoodsAptitude goods on goods.ClassId = class.Id " +
 			"WHERE " + where1 + " AND class.Edition='1' AND class.DeletionStateCode = 0 ORDER BY Code"
 		list, _ := svc.DBE.QueryString(sqlStr)
 		/*
@@ -1237,13 +1247,22 @@ func (this *OilGoodsAptitudeController) GoodsChildList() {
 // @router /goodschildlistbypid/:parentid [get]
 func (this *OilGoodsAptitudeController) GoodsChildLisByParentId() {
 	ParentId := this.Ctx.Input.Param(":parentid")
+	SupplierId := this.GetString("SupplierId")
 	GoodsLevel := this.GetString("GoodsLevel")
+	svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
+	if SupplierId != "" {
+		var supplier supplier.OilSupplier
+		svc.GetEntityByWhere(OilSupplierName, "Id = " + SupplierId, &supplier)
+		GoodsLevel = supplier.Grade
+	}
+	where := ""
+	if GoodsLevel == "2" {
+		where = "IF(LENGTH(CODE)=8 , g.GoodsLevel = '2', 1=1) and "
+	}
 	sqlStr := "SELECT o.Id, o.`Code`, o.`Name`, concat(o.Code, '  ', o.Name) as CodeName, o.ParentId, g.GoodsLevel," +
 		" (CASE WHEN length(Code)>=8 THEN '1' ELSE '0' END) as Leaf FROM OilGoodsAptitudeClass o " +
 		" LEFT JOIN `OilGoodsAptitude` g ON (g.ClassId = o.Id)" +
-		" WHERE IF ((LENGTH(CODE)=8 and '" + GoodsLevel + "' = 2 ) , g.GoodsLevel = '2', 1=1 ) and o.ParentId = " + ParentId + " AND o.Edition='1' AND o.DeletionStateCode = 0 order by o.Code"
-
-	svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
+		" WHERE " + where + "o.ParentId = " + ParentId + " AND o.Edition='1' AND o.DeletionStateCode = 0 order by o.Code"
 	list, _ := svc.DBE.QueryString(sqlStr)
 	var datainfo DataInfo
 	datainfo.Items = list

+ 5 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist2.vue

@@ -683,12 +683,16 @@
       getsectreelist () {
         let _this = this
         let name = _this.searchText
+        console.log(this.Grade,_this.Grade, '_this.Grade')
         let params = {
+          SupplierId: this.SupplierId,
           level : _this.Grade
         }
         api.goodsParentlist(params, name, this.$axios).then(res => {
           console.log(res.data.items, 'res.data.items')
-          _this.sectreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Code,Name,CodeName,GoodsLevel')
+          if (res.data.items) {
+            _this.sectreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Code,Name,CodeName,GoodsLevel')
+          }
         }).catch(err => {
           console.error(err)
         })

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/basisedit.vue

@@ -8,7 +8,7 @@
     <el-card class="box-card">
       <div slot="header">
         <span>
-          <i class="icon icon-table2"></i> 信息
+          <i class="icon icon-table2"></i> {{ formData.SupplierName}}
         </span>
         <span style="float: right;">
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="editIsRestrict('0')" v-if="formData.IsRestrict == '1' && showBtn ">增项限制已开启</el-button>

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/goodsedit.vue

@@ -8,7 +8,7 @@
     <el-card class="box-card">
       <div slot="header">
         <span>
-          <i class="icon icon-table2"></i> 信息
+          <i class="icon icon-table2"></i>  {{ formData.SupplierName}}
         </span>
         <span style="float: right;">
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="editIsRestrict('0')" v-if="formData.IsRestrict == '1' && showBtn ">增项限制已开启</el-button>

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/_opera/techedit.vue

@@ -8,7 +8,7 @@
     <el-card class="box-card">
       <div slot="header">
         <span>
-          <i class="icon icon-table2"></i> 信息
+          <i class="icon icon-table2"></i> {{ formData.SupplierName}}
         </span>
         <span style="float: right;">
           <el-button type="primary" size="mini" style="margin-right: 5px" @click="editIsRestrict('0')" v-if="formData.IsRestrict == '1' && showBtn ">增项限制已开启</el-button>

+ 34 - 6
src/dashoo.cn/frontend_web/src/pages/system/userrole.vue

@@ -85,11 +85,25 @@
     </el-dialog>
     <!-- 用户列表 -->
     <el-dialog title="包含用户列表" :visible.sync="userDialogVisible">
-      <el-button type="primary" size="mini" style="float: right; margin-top: -10px;margin-left :5px"
-        @click="deleteuserdata()">删除</el-button>
-      <el-button type="primary" size="mini" style="float: right; margin-top: -10px" @click="roleadduseradmin()">添加
-      </el-button>
-      <br />
+      <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="userName" placeholder="请输入用户名"></el-input>
+        </el-form-item>
+        <el-form-item label="所属单位">
+          <el-input size="mini" style="width: 165px;" v-model="unitName" placeholder="请输入所属单位"></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" type="primary" style="margin-left:10px; margin-top: -4px;"
+                     @click="selectUser(selectRoleId)">查询
+          </el-button>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
+                     @click="deleteuserdata()">删除</el-button>
+          <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px" @click="roleadduseradmin()">添加
+          </el-button>
+        </el-form-item>
+      </el-form>
       <el-table :data="userList" @selection-change="handleUserSelecChange" border>
         <!-- <el-table-column label="操作" align="center">
           <template slot-scope="scope">
@@ -330,6 +344,8 @@
         currentUserPage: 1,
         userSize: 10,
         userList: [],
+        userName: '',
+        unitName: '',
         selectRoleId: '',
         formLabelWidth: '120px',
         dialogtitle: '', // 添加编辑对话框
@@ -390,6 +406,9 @@
       this.getadminpermission()
       this.getroleData()
     },
+    activated() {
+      this.currentUserPage = 1
+    },
     methods: {
       initData () {
         let _this = this
@@ -679,13 +698,19 @@
             console.error(err)
           })
       },
+      selectUser () {
+        this.currentUserPage = 1
+        this.initUserList(this.selectRoleId)
+      },
       initUserList (rid) {
         let _this = this
         _this.userList = []
         // paginate
         const params = {
           _currentPage: this.currentUserPage,
-          _size: this.userSize
+          _size: this.userSize,
+          userName: this.userName,
+          unitName: this.unitName
         }
         // request
         this.$axios.get('role/getusersforrole/' + rid, {
@@ -722,8 +747,11 @@
         this.dialogVisible = true
       },
       showUserList (val) {
+        this.userName = ''
+        this.unitName = ''
         this.userDialogVisible = true
         this.selectRoleId = val.Id
+        this.currentUserPage = 1
         this.initUserList(val.Id)
       },
       setpower (val) {