Explorar o código

2022.3.15列表排版

17613754660 %!s(int64=3) %!d(string=hai) anos
pai
achega
8ee7ee9a61

+ 38 - 8
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -2166,23 +2166,22 @@
             border
             :height="500"
             highlight-current-row
-            style="width: 100%"
+            style="width: 100%;"
           >
-            <el-table-column width="60" type="index" fixed="left" label="序号">
+            <el-table-column width="300" type="index" fixed="left" label="部门">
               <template slot-scope="scope">
                 {{ scope.$index + 1 }}
               </template>
             </el-table-column>
 
-            <el-table-column width="100" prop="name" fixed="left" label="姓名">
+            <el-table-column width="300" prop="name" fixed="left" label="姓名">
             </el-table-column>
             <el-table-column
-              width="90"
-              v-for="(item, index) in allDate"
-              :key="index"
-              :label="item.showDate + '/' + item.weekDay"
+              width="300"
+              label="未填日期"
               align="center"
             >
+            <!-- :label="item.showDate + '/' + item.weekDay" -->
               <template slot-scope="scope">
                 <div
                   style="color: red"
@@ -3275,6 +3274,8 @@ export default {
         let nowwd = [this.getAutoWeekDate(nowdate)[0],this.getAutoWeekDate(nowdate)[6]]
         this.WorktimeDatepickValue1 = nowwd
       }
+      console.log("change",this.WorktimeDatepickValue1);
+      this.allDate = this.alreadyAllDate(this.WorktimeDatepickValue1[0],this.WorktimeDatepickValue1[1])
       this.http.post(
         "/report/getUserDailyWorkTime",
         // "/report/getNoReportUserList",
@@ -3286,8 +3287,9 @@ export default {
         (res) => {
           if (res.code == "ok") {
             this.monthworkDate = res.data.list;
+            
             this.$forceUpdate();
-            console.log("monthworkdate", this.monthworkDate);
+            console.log("monthworkdate", this.allDate);
           }
         },
         (error) => {
@@ -3298,6 +3300,31 @@ export default {
         }
       );
     },
+    alreadyAllDate(stime,etime){
+    let diffdate = new Array();
+    let i=0;
+    while(stime<=etime){
+          let dateArray = stime.split("-");
+          let date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
+          let stimewk = "周" + "日一二三四五六".charAt(date.getDay());
+          let timedate = (stime.split("-")[1].charAt(0) == 0 ? stime.split("-")[1].charAt(1) : stime.split("-")[1]) + "月" + (stime.split("-")[2].charAt(0) == 0 ? stime.split("-")[2].charAt(1) : stime.split("-")[2]) + "日"
+          let timeshowdate = (stime.split("-")[1].charAt(0) == 0 ? stime.split("-")[1].charAt(1) : stime.split("-")[1]) + "." + (stime.split("-")[2].charAt(0) == 0 ? stime.split("-")[2].charAt(1) : stime.split("-")[2])
+
+        diffdate[i] = {date:timedate,showDate:timeshowdate,weekDay:stimewk};
+
+        let stime_ts = new Date(stime).getTime(); 
+        let next_date = stime_ts + (24*60*60*1000);
+        let next_dates_y = new Date(next_date).getFullYear()+'-';
+        let next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
+        let next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
+        stime = next_dates_y+next_dates_m+next_dates_d;
+        i++;
+      }
+      return diffdate
+    },
+      
+    
+
     showMonthNotWorkTime() {
       if(this.WorktimeDatepickValue2.length == 0){
         let newdate = new Date();
@@ -3538,9 +3565,11 @@ export default {
           if (res.code == "ok") {
             this.fillStatusList = res.data;
             this.allDate.forEach((d) => {
+              console.log("d1",d);
               var fillInfo = null;
               d.state = null;
               this.fillStatusList.forEach((s) => {
+                console.log("s1",s);
                 var d1 = s.createDate.split("-")[2];
                 var d2 = d.date.split("月")[1].split("日")[0];
                 if (d1.indexOf("0") == 0) {
@@ -4400,6 +4429,7 @@ export default {
         });
       }
       this.allDate = dayArry;
+      
       //不能超过最大日期
       if (this.choseDay > day - 1) {
         this.choseDay = day - 1;