From 3bd8985e73fa326454ed8b8e1b1b60245caff89b Mon Sep 17 00:00:00 2001
From: YM <479443481@qq.com>
Date: 星期五, 28 三月 2025 16:32:04 +0800
Subject: [PATCH] 考勤组

---
 app/user/view/attendance/index.html |   89 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 78 insertions(+), 11 deletions(-)

diff --git a/app/user/view/attendance/index.html b/app/user/view/attendance/index.html
index 5bdd46c..b6726a7 100644
--- a/app/user/view/attendance/index.html
+++ b/app/user/view/attendance/index.html
@@ -5,11 +5,6 @@
   <table class="layui-hide" id="test" lay-filter="test"></table>
 </div>
 
-<script type="text/html" id="status">
-  <i
-    class="layui-icon {{#  if(d.status == 1){ }}green layui-icon-ok{{#  } else { }}yellow layui-icon-close{{#  } }}"
-  ></i>
-</script>
 <script type="text/html" id="toolbarDemo">
   <div class="layui-btn-container">
     <button class="layui-btn layui-btn-sm" lay-event="add">+ 娣诲姞鑰冨嫟缁�</button>
@@ -44,23 +39,91 @@
       cols: [
         [
           {
-            field: "title",
+            field: "name",
             title: "鍚嶇О",
-            align: "center"
+            align: "center",
+            width: 300
           },
           {
             field: "peopleNum",
             title: "浜烘暟",
-            width: 120
+            width: 120,
+            templet: function (d) {
+              var users = d.linkUserDate.filter((item) => item.type == "1");
+              return users.length;
+            }
           },
           {
             field: "type",
             title: "绫诲瀷",
-            width: 120
+            width: 120,
+            templet: function (d) {
+              if (d.type == "1") {
+                return "鍥哄畾鐝埗";
+              }
+              if (d.type == "2") {
+                return "鑷敱宸ユ椂";
+              }
+            }
           },
           {
             field: "time",
-            title: "鑰冨嫟鏃堕棿"
+            title: "鑰冨嫟鏃堕棿",
+            templet: function (d) {
+              // 鎸夌収鐝鍒嗙粍
+              var planMap = {};
+              Object.keys(d.work_plan).forEach((key) => {
+                var item = d.work_plan[key];
+                var showTxt = "";
+                if (key.indexOf("mon_") > -1) {
+                  showTxt = "鍛ㄤ竴";
+                }
+                if (key.indexOf("tue_") > -1) {
+                  showTxt = "鍛ㄤ簩";
+                }
+                if (key.indexOf("wed_") > -1) {
+                  showTxt = "鍛ㄤ笁";
+                }
+                if (key.indexOf("thur_") > -1) {
+                  showTxt = "鍛ㄥ洓";
+                }
+                if (key.indexOf("fri_") > -1) {
+                  showTxt = "鍛ㄤ簲";
+                }
+                if (key.indexOf("sat_") > -1) {
+                  showTxt = "鍛ㄥ叚";
+                }
+                if (key.indexOf("sun_") > -1) {
+                  showTxt = "鍛ㄦ棩";
+                }
+                if (item.id) {
+                  if (!planMap[item.id]) planMap[item.id] = { showTxt: [] };
+                  planMap[item.id].times = item.times;
+                  planMap[item.id].showTxt.push(showTxt);
+                } else {
+                  if (!planMap["null"]) planMap["null"] = { showTxt: [] };
+                  planMap.null.showTxt.push(showTxt);
+                }
+              });
+              console.log(planMap, "planMap");
+              // 鏍规嵁鐝鍒嗙被鏄剧ず鏃堕棿
+              var html_ = "";
+              Object.keys(planMap).forEach((key) => {
+                html_ +=
+                  "<p>" +
+                  planMap[key].showTxt.join("銆�") +
+                  "锛�" +
+                  (planMap[key].times && planMap[key].times.length > 0
+                    ? planMap[key].times.map(
+                        (item) => item.begin_time + " - " + item.end_time
+                      )
+                    : "浼戞伅") +
+                  "</p>";
+              });
+              console.log(html_);
+              
+              return html_;
+            }
           },
           {
             field: "right",
@@ -101,7 +164,11 @@
                 obj.del();
               }
             };
-            tool.delete("/user/attendance/delete", { id: obj.data.id }, callback);
+            tool.delete(
+              "/user/attendance/delete",
+              { id: obj.data.id },
+              callback
+            );
             layer.close(index);
           }
         );

--
Gitblit v1.9.1