Browse Source

添加过滤员工 区域按钮

胡佳骏 1 year ago
parent
commit
741298d96d

+ 60 - 2
Assets/FrameWork/ProjectManager/Scripts/Project/XunJian/XunJianDataManager.cs

@@ -16,9 +16,31 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
     public void GetXunJianList(Action<List<XunJianListData>> callback)
     {
        WindowsManager.Instance.StartCoroutine(testBack(callback));
-     
+
     }
 
+    public void GetAreaList(string area, Action<List<XunJianListData>> callback)
+    {
+        if (areaList.ContainsKey(area))
+        {
+            callback.Invoke(areaList[area]);
+        }
+        else
+        {
+            callback.Invoke(xjDataList);
+        }
+    }
+
+    public void GetPeopleList(string people, Action<List<XunJianListData>> callback)
+    {
+        if(peopleList.ContainsKey(people))
+        {
+            callback.Invoke( peopleList[people]);
+        }else
+        {
+            callback.Invoke(xjDataList);
+        }
+    }
     XunJianListData testData()
     {
         XunJianListData xj = new XunJianListData();
@@ -32,7 +54,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         xj.projectTime = "2023/11/23 10:53 ";
         xj.renwuModelType = RenWuModelType.SaoTu;
         xj.itemList = getRenwuData();
-
+        xj.people = "员工A";
         return xj;
     }
     XunJianListData testData2()
@@ -48,6 +70,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         xj.projectTime = "2023/11/23 10:53 ";
         xj.renwuModelType = RenWuModelType.DianYun;
         xj.itemList = getRenwuData();
+        xj.people = "员工B";
 
         return xj;
     }
@@ -64,6 +87,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         xj.projectTime = "2023/11/23 10:53 ";
         xj.renwuModelType = RenWuModelType.None;
         xj.itemList = getRenwuData();
+        xj.people = "员工C";
 
         return xj;
     }
@@ -242,6 +266,9 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         }
         return itemlist;
     }
+
+    public Dictionary<string, List<XunJianListData>> areaList = new Dictionary<string, List<XunJianListData>>();
+    public Dictionary<string, List<XunJianListData>> peopleList = new Dictionary<string, List<XunJianListData>>();
     IEnumerator testBack(Action<List<XunJianListData>> callback)
     {
         yield return WindowsManager.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpEdustryAction.InspectionList, "", (string msg) =>
@@ -258,6 +285,35 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
                     xjDataList.Add(testData2());
                 }
                 xjDataList.AddRange(XunJianDataParetListData(data));
+
+
+                peopleList = new Dictionary<string, List<XunJianListData>>();
+                areaList = new Dictionary<string, List<XunJianListData>>();
+                for (int i = 0; i < xjDataList.Count; i++)
+                {
+                    if (areaList.ContainsKey(xjDataList[i].inarea))
+                    {
+                        areaList[xjDataList[i].inarea].Add(xjDataList[i]);
+                    }
+                    else
+                    {
+                        areaList.Add(xjDataList[i].inarea, new List<XunJianListData>());
+                        areaList[xjDataList[i].inarea].Add(xjDataList[i]);
+                    }
+
+
+
+                    if (peopleList.ContainsKey(xjDataList[i].people))
+                    {
+                        peopleList[xjDataList[i].people].Add(xjDataList[i]);
+                    }
+                    else
+                    {
+                        peopleList.Add(xjDataList[i].people, new List<XunJianListData>());
+                        peopleList[xjDataList[i].people].Add(xjDataList[i]);
+                    }
+                }
+
                 callback(xjDataList);
             }
             else
@@ -275,6 +331,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         }));
     }
 
+
     List<XunJianListData> XunJianDataParetListData(List<XunJianData> data)
     {
         List<XunJianListData> listData = new List<XunJianListData>();
@@ -308,6 +365,7 @@ public class XunJianDataManager : Singleton<XunJianDataManager>
         public List<RenWuItem> itemList;
         public RenWuModelType renwuModelType;
         public string url;
+        public string people = "未知员工";
     }
 
     public class XunJianData

+ 66 - 0
Assets/FrameWork/ProjectManager/Scripts/Project/XunJianLieBiaoWindow.cs

@@ -1,15 +1,21 @@
 using System.Collections;
 using System.Collections.Generic;
+using TMPro;
 using UnityEngine;
+using UnityEngine.UI;
 using static XunJianDataManager;
 
 public class XunJianLieBiaoWindow : WindowSingleton<XunJianLieBiaoWindow>
 {
+
+    public TMP_Dropdown chooseArea;
+    public TMP_Dropdown choosePeople;
     public GameObject parentGo;
     public List<GameObject> itemList;
     protected override void OnStart()
     {
         base.OnStart();
+        RemoveAll();
         GameObject liebiao = WindowsManager.Instance.GetPrefab(WindowConfig.windowType.XunJian, "liebiao");
         XunJianDataManager.Instance.GetXunJianList((List<XunJianListData> data) => {
             for (int i = 0; i < data.Count; i++)
@@ -19,6 +25,66 @@ public class XunJianLieBiaoWindow : WindowSingleton<XunJianLieBiaoWindow>
                 item.updateData(data[i]);
                 itemList.Add(itemGo);
             }
+            chooseArea.options = new List<TMP_Dropdown.OptionData>();
+            foreach (var it in XunJianDataManager.Instance.areaList.Keys)
+            {
+                TMP_Dropdown.OptionData Ddata = new TMP_Dropdown.OptionData();
+                Ddata.text = it;
+                chooseArea.options.Add(Ddata);
+            }
+            choosePeople.options = new List<TMP_Dropdown.OptionData>();
+            foreach (var it in XunJianDataManager.Instance.peopleList.Keys)
+            {
+                TMP_Dropdown.OptionData Ddata = new TMP_Dropdown.OptionData();
+                Ddata.text = it;
+                choosePeople.options.Add(Ddata);
+            }
+            TMP_Dropdown.OptionData Ddata2 = new TMP_Dropdown.OptionData();
+            Ddata2.text = "È«²¿µØÇø";
+            chooseArea.options.Add(Ddata2);
+            chooseArea.value = chooseArea.options.Count - 1;
+            TMP_Dropdown.OptionData Ddata3 = new TMP_Dropdown.OptionData();
+            Ddata3.text = "È«²¿ÈËÔ±";
+            choosePeople.options.Add(Ddata3);
+            choosePeople.value = choosePeople.options.Count - 1;
+
+            chooseArea.onValueChanged.AddListener(areaChange);
+            choosePeople.onValueChanged.AddListener(peopleChange);
+        });
+    }
+
+    private void peopleChange(int arg0)
+    {
+        RemoveAll();
+        GameObject liebiao = WindowsManager.Instance.GetPrefab(WindowConfig.windowType.XunJian, "liebiao");
+        XunJianDataManager.Instance.GetPeopleList(choosePeople.options[arg0].text, (List<XunJianListData> data) => {
+            
+            for (int i = 0; i < data.Count; i++)
+            {
+                GameObject itemGo = GameObject.Instantiate(liebiao, parentGo.transform);
+                XunJianLieBiaoItem item = itemGo.GetComponent<XunJianLieBiaoItem>();
+                item.updateData(data[i]);
+                itemList.Add(itemGo);
+            }
+
+
+        });
+    }
+
+    private void areaChange(int arg0)
+    {
+        RemoveAll();
+        GameObject liebiao = WindowsManager.Instance.GetPrefab(WindowConfig.windowType.XunJian, "liebiao");
+        XunJianDataManager.Instance.GetAreaList(chooseArea.options[arg0].text, (List<XunJianListData> data) => {
+            for (int i = 0; i < data.Count; i++)
+            {
+                GameObject itemGo = GameObject.Instantiate(liebiao, parentGo.transform);
+                XunJianLieBiaoItem item = itemGo.GetComponent<XunJianLieBiaoItem>();
+                item.updateData(data[i]);
+                itemList.Add(itemGo);
+            }
+
+
         });
     }
 

File diff suppressed because it is too large
+ 432 - 285
Assets/FrameWork/ProjectManager/XunJian/列表模块/列表模块.prefab


+ 8 - 8
Assets/FrameWork/ProjectManager/XunJian/进入任务/进入任务.prefab

@@ -7465,19 +7465,19 @@ PrefabInstance:
     m_Modifications:
     - target: {fileID: 1046681076883175317, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchorMax.y
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 1046681076883175317, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchorMin.y
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 1046681076883175317, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchoredPosition.x
-      value: 135
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 1046681076883175317, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchoredPosition.y
-      value: -50
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 2663175551128001469, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_Name
@@ -7493,19 +7493,19 @@ PrefabInstance:
       objectReference: {fileID: 0}
     - target: {fileID: 6534303979265014755, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchorMax.y
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 6534303979265014755, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchorMin.y
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 6534303979265014755, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchoredPosition.x
-      value: 405
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 6534303979265014755, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: m_AnchoredPosition.y
-      value: -50
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 7708746070731989160, guid: cb61b52cc83342e489699f3476640957, type: 3}
       propertyPath: playImg

Some files were not shown because too many files changed in this diff