Просмотр исходного кода

点击全部显示所有仓库
搜索条件优化

DuGuYang 3 лет назад
Родитель
Сommit
0a0e241a4c

+ 24 - 22
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -77,22 +77,23 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 DataTable dt = OtherMySqlConn.dtable("SELECT Id FROM Users WHERE RealName like '%" + UserIdRealName + "%'");
                 var Count = dt.Rows.Count;
-                int times = 0;
+                // int times = 0;
                 string UserIds = "";
                 foreach (DataRow item in dt.Rows)
                 {
-                    times++;
-                    if (times == Count)
-                    {
-                        UserIds += item["Id"].ToString();
-                    }
-                    else
-                    {
-                        UserIds += item["Id"].ToString() + ",";
-                    }
+                    // times++;
+                    // if (times == Count)
+                    // {
+                    //     UserIds += item["Id"].ToString();
+                    // }
+                    // else
+                    // {
+                    //     UserIds += item["Id"].ToString() + ",";
+                    // }
+                    UserIds += item["Id"].ToString() + ",";
                 }
                 // condition += " and UserId in (select UserId from UserForRealName where RealName='" + UserIdRealName + "')";
-                condition += " and UserId in (" + UserIds + ")";
+                condition += " and UserId in (" + UserIds.TrimEnd(',') + ")";
             }
             //仓库管理员真实姓名
 
@@ -100,22 +101,23 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 DataTable dts = OtherMySqlConn.dtable("SELECT Id FROM Users WHERE RealName like '%" + ManageUserIdRealName + "%'");
                 var Counts = dts.Rows.Count;
-                int time = 1;
+                // int time = 1;
                 string UserIdss = "";
                 foreach (DataRow items in dts.Rows)
                 {
-                    time++;
-                    if (time == Counts)
-                    {
-                        UserIdss += items["Id"].ToString();
-                    }
-                    else
-                    {
-                        UserIdss += items["Id"].ToString() + ",";
-                    }
+                    // time++;
+                    // if (time == Counts)
+                    // {
+                    //     UserIdss += items["Id"].ToString();
+                    // }
+                    // else
+                    // {
+                    //     UserIdss += items["Id"].ToString() + ",";
+                    // }
+                    UserIdss += items["Id"].ToString() + ",";
                 }
                 // condition += " and ManageUserId in (select ManageUserId from UserForRealName where RealName='" + ManageUserIdRealName + "')";
-                condition += " and UserId in (" + UserIdss + ")";
+                condition += " and UserId in (" + UserIdss.TrimEnd(',') + ")";
             }
             //仓库管理员手机号
             if (!string.IsNullOrEmpty(ManageUserIdMobile))

+ 2 - 1
wwwroot/layuiadmin/modules_main/StoreHouse_Admin.js

@@ -498,9 +498,10 @@ layui.config({
         }
     });
     form.on('submit(LAY-list-front-searchall)', function (data) {
+        var field = data.field;
         field.ShowFlag = 1;
         table.reload('LAY-list-manage', {
-            where: null,
+            where: field,
             page: {
                 curr: 1
             }