浏览代码

feat: 职位管理中增加在职人员信息

喵你个旺呀 1 年之前
父节点
当前提交
4b4253ba72

+ 6 - 0
Admin.NET/Admin.NET.Core/Entity/SysPos.cs

@@ -47,4 +47,10 @@ public partial class SysPos : EntityTenant
     /// </summary>
     [SugarColumn(ColumnDescription = "状态")]
     public StatusEnum Status { get; set; } = StatusEnum.Enable;
+    
+    /// <summary>
+    /// 在职人数
+    /// </summary>
+    [SugarColumn(IsIgnore = true)]
+    public List<SysUser> UserList { get; set; }
 }

+ 9 - 1
Admin.NET/Admin.NET.Core/Service/Pos/SysPosService.cs

@@ -36,7 +36,15 @@ public class SysPosService : IDynamicApiController, ITransient
         return await _sysPosRep.AsQueryable()
             .WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
             .WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code))
-            .OrderBy(u => new { u.OrderNo, u.Id }).ToListAsync();
+            .OrderBy(u => new { u.OrderNo, u.Id })
+            .Mapper(u =>
+            {
+                u.UserList = _sysPosRep.Context.Queryable<SysUser>()
+                    .Where(a => a.PosId == u.Id || SqlFunc.Subqueryable<SysUserExtOrg>()
+                        .Where(t => a.Id == t.UserId && t.PosId == u.Id).Any())
+                    .ToList();
+            })
+            .ToListAsync();
     }
 
     /// <summary>

+ 19 - 0
Web/src/views/system/pos/index.vue

@@ -25,6 +25,25 @@
 				<el-table-column type="index" label="序号" width="55" align="center" />
 				<el-table-column prop="name" label="职位名称" align="center" show-overflow-tooltip />
 				<el-table-column prop="code" label="职位编码" align="center" show-overflow-tooltip />
+        <el-table-column prop="userList" label="在职人数" width="70" align="center" show-overflow-tooltip >
+          <template #default="scope">{{ scope.row.userList?.length}}</template>
+        </el-table-column>
+        <el-table-column prop="userList" label="人员明细" width="120" align="center" show-overflow-tooltip >
+          <template #default="scope">
+            <el-popover placement="bottom" width="280" trigger="hover" v-if="scope.row.userList?.length">
+              <template #reference>
+                <el-text type="primary" class="cursor-default">
+                  <el-icon><ele-InfoFilled /></el-icon>人员明细
+                </el-text>
+              </template>
+              <el-table :data="scope.row.userList" stripe border>
+                <el-table-column type="index" label="序号" width="55" align="center" />
+                <el-table-column prop="account" label="账号" />
+                <el-table-column prop="realName" label="姓名" />
+              </el-table>
+            </el-popover>
+          </template>
+        </el-table-column>
 				<el-table-column prop="orderNo" label="排序" width="70" align="center" show-overflow-tooltip />
 				<el-table-column label="状态" width="70" align="center" show-overflow-tooltip>
 					<template #default="scope">