From c4782840b8893dcc0bcf262153374237f40f6b9e Mon Sep 17 00:00:00 2001
From: YM <479443481@qq.com>
Date: 星期四, 10 四月 2025 15:33:33 +0800
Subject: [PATCH] 1

---
 app/user/view/attendance/index.html |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/app/user/view/attendance/index.html b/app/user/view/attendance/index.html
index b6726a7..62914e5 100644
--- a/app/user/view/attendance/index.html
+++ b/app/user/view/attendance/index.html
@@ -75,53 +75,76 @@
               Object.keys(d.work_plan).forEach((key) => {
                 var item = d.work_plan[key];
                 var showTxt = "";
+                var index = 0;
                 if (key.indexOf("mon_") > -1) {
                   showTxt = "鍛ㄤ竴";
+                  index = 1;
                 }
                 if (key.indexOf("tue_") > -1) {
                   showTxt = "鍛ㄤ簩";
+                  index = 2;
                 }
                 if (key.indexOf("wed_") > -1) {
                   showTxt = "鍛ㄤ笁";
+                  index = 3;
                 }
                 if (key.indexOf("thur_") > -1) {
                   showTxt = "鍛ㄥ洓";
+                  index = 4;
                 }
                 if (key.indexOf("fri_") > -1) {
                   showTxt = "鍛ㄤ簲";
+                  index = 5;
                 }
                 if (key.indexOf("sat_") > -1) {
                   showTxt = "鍛ㄥ叚";
+                  index = 6;
                 }
                 if (key.indexOf("sun_") > -1) {
                   showTxt = "鍛ㄦ棩";
+                  index = 7;
                 }
                 if (item.id) {
-                  if (!planMap[item.id]) planMap[item.id] = { showTxt: [] };
+                  if (!planMap[item.id])
+                    planMap[item.id] = { showTxt: [], index: null };
                   planMap[item.id].times = item.times;
                   planMap[item.id].showTxt.push(showTxt);
+                  if (planMap[item.id].index) {
+                    if (planMap[item.id].index > index)
+                      planMap[item.id].index = index;
+                  } else {
+                    planMap[item.id].index = index;
+                  }
                 } else {
-                  if (!planMap["null"]) planMap["null"] = { showTxt: [] };
+                  if (!planMap["null"]) planMap["null"] = { showTxt: [], index: 999 };
                   planMap.null.showTxt.push(showTxt);
                 }
               });
-              console.log(planMap, "planMap");
-              // 鏍规嵁鐝鍒嗙被鏄剧ず鏃堕棿
-              var html_ = "";
+              
+              // 鏍规嵁鐝鍒嗙被鏄剧ず鏃堕棿锛屽苟涓旀牴鎹懆涓�鍒板懆鏃ユ帓搴忥紝浼戞伅鏀惧湪鏈�鍚�
+              var infoList = [];
               Object.keys(planMap).forEach((key) => {
+                infoList.push(planMap[key])
+              });
+              infoList.sort((a, b) => a.index - b.index);
+              console.log(infoList, "infoList");
+              var html_ = "";
+              for (let i = 0; i < infoList.length; i++) {
+                const infoItem = infoList[i];
                 html_ +=
                   "<p>" +
-                  planMap[key].showTxt.join("銆�") +
+                    infoItem.showTxt.join("銆�") +
                   "锛�" +
-                  (planMap[key].times && planMap[key].times.length > 0
-                    ? planMap[key].times.map(
+                  (infoItem.times && infoItem.times.length > 0
+                    ? infoItem.times.map(
                         (item) => item.begin_time + " - " + item.end_time
                       )
                     : "浼戞伅") +
                   "</p>";
-              });
-              console.log(html_);
+              }
               
+              console.log(html_);
+
               return html_;
             }
           },

--
Gitblit v1.9.1