zxz 2 سال پیش
والد
کامیت
1f819a7d7a
1فایلهای تغییر یافته به همراه80 افزوده شده و 51 حذف شده
  1. 80 51
      src/views/personnelManagement/checkWorkList.vue

+ 80 - 51
src/views/personnelManagement/checkWorkList.vue

@@ -49,18 +49,24 @@
       label="上班打卡时间"
       width="180">
       <template slot-scope="scope">
-        <span v-if="scope.row.toClockDate" style="margin-left: 10px">{{ scope.row.toClockDate.split(" ")[1] }}</span>
+        <span v-if="scope.row.toClockDate" style="margin-left: 10px">
+          {{ scope.row.toClockDate.split(" ")[1] }}
+          <span v-if="scope.row.lateFlag == 1" style="color: brown;font-size: 14px;">迟</span>
+        </span>
         <span v-else-if="scope.row.status=='补卡成功'&&scope.row.supplementClockType=='1'" style="margin-left: 10px;">已补卡</span>
-        <span v-else-if="scope.row.leaveType" style="margin-left: 10px;">{{scope.row.leaveType}}</span>
+        <span v-else-if="!scope.row.toClockDate && scope.row.leaveType" style="margin-left: 10px;">{{scope.row.leaveType}}</span>
       </template>
     </el-table-column>
     <el-table-column
       prop="offClockDate"
       label="下班打卡时间">
       <template slot-scope="scope">
-        <span v-if="scope.row.offClockDate" style="margin-left: 10px">{{ scope.row.offClockDate.split(" ")[1] }}</span>
+        <span v-if="scope.row.offClockDate" style="margin-left: 10px">
+          {{ scope.row.offClockDate.split(" ")[1] }}
+          <span v-if="scope.row.leaveEarlyFlag == 1" style="color: brown;font-size: 14px;">早</span>
+        </span>
         <span v-else-if="scope.row.status=='补卡成功'&&scope.row.supplementClockType=='3'" style="margin-left: 10px;">已补卡</span>
-        <span v-else-if="scope.row.leaveType" style="margin-left: 10px;">{{scope.row.leaveType}}</span>
+        <span v-else-if="!scope.row.offClockDate && scope.row.leaveType" style="margin-left: 10px;">{{scope.row.leaveType}}</span>
       </template>
     </el-table-column>
   </el-table>
@@ -171,15 +177,30 @@
     },
     mounted() {
       let date = new Date()
-            // 通过时间戳计算
-            let defalutStartTime = date.getTime() - 7 * 24 * 3600 * 1000 // 转化为时间戳
-            let defalutEndTime = date.getTime()
-            let startDateNs = new Date(defalutStartTime) 
-            let endDateNs = new Date(defalutEndTime)
-            // 月,日 不够10补0
-            defalutStartTime = startDateNs.getFullYear() + '-' + ((startDateNs.getMonth() + 1) >= 10 ? (startDateNs.getMonth() + 1) : '0' + (startDateNs.getMonth() + 1)) + '-' + (startDateNs.getDate() >= 10 ? startDateNs.getDate() : '0' + startDateNs.getDate())
-            defalutEndTime = endDateNs.getFullYear() + '-' + ((endDateNs.getMonth() + 1) >= 10 ? (endDateNs.getMonth() + 1) : '0' + (endDateNs.getMonth() + 1)) + '-' + (endDateNs.getDate() >= 10 ? endDateNs.getDate() : '0' + endDateNs.getDate())
-            this.value2= [defalutStartTime, defalutEndTime]
+			let new_year = date.getFullYear(); // 取当前的年份
+			let month = date.getMonth();
+			let new_month = month + 1; // 取当前的月份
+			let mon = '';
+			let day = '';
+			if (month > 12) {
+				new_month -= 12; // 月份减
+				new_year++; // 年份增
+			}
+			let firstDay = new Date(new_year, new_month, 1); // 取当年当月中的第一天
+			let lastDay = new Date(firstDay.getTime() - 1000 * 60 * 60 * 24).getDate(); // 获取当月最后一天日期
+			if (firstDay.getMonth() < 10) {
+				mon = '0' + firstDay.getMonth();
+			} else {
+				mon = firstDay.getMonth();
+			}
+			if (lastDay < 10) {
+				day = '0' + lastDay;
+			} else {
+				day = lastDay;
+			}
+			let startDate = firstDay.getFullYear() + '-' + mon + '-' + '0' + firstDay.getDate();
+			let endDate = firstDay.getFullYear() + '-' + mon + '-' + day;
+      this.value2 = [startDate,endDate]
     },
      
     methods: {
@@ -201,7 +222,15 @@
         }, 1000)
       },
       datechange() {
-        this.getList()
+        if (this.value2[0].split('-')[1] != this.value2[1].split('-')[1]) {
+          this.$message({
+            message: '请选择相同月份的起始日期',
+            type: 'warning',
+          })
+          return
+        } else {
+          this.getList()
+        }
       },
       deptChange(){
         this.getList()
@@ -215,28 +244,28 @@
           },
         })
       },
-      dateFormat(fmt, date) {
-        let ret
-        const opt = {
-          'Y+': date.getFullYear().toString(), // 年
-          'm+': (date.getMonth() + 1).toString(), // 月
-          'd+': date.getDate().toString(), // 日
-          'H+': date.getHours().toString(), // 时
-          // "M+": date.getMinutes().toString(),         // 分
-          // "S+": date.getSeconds().toString()          // 秒
-          // 有其他格式化字符需求可以继续添加,必须转化成字符串
-        }
-        for (let k in opt) {
-          ret = new RegExp('(' + k + ')').exec(fmt)
-          if (ret) {
-            fmt = fmt.replace(
-              ret[1],
-              ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
-            )
-          }
-        }
-        return fmt
-      },
+      // dateFormat(fmt, date) {
+      //   let ret
+      //   const opt = {
+      //     'Y+': date.getFullYear().toString(), // 年
+      //     'm+': (date.getMonth() + 1).toString(), // 月
+      //     'd+': date.getDate().toString(), // 日
+      //     'H+': date.getHours().toString(), // 时
+      //     // "M+": date.getMinutes().toString(),         // 分
+      //     // "S+": date.getSeconds().toString()          // 秒
+      //     // 有其他格式化字符需求可以继续添加,必须转化成字符串
+      //   }
+      //   for (let k in opt) {
+      //     ret = new RegExp('(' + k + ')').exec(fmt)
+      //     if (ret) {
+      //       fmt = fmt.replace(
+      //         ret[1],
+      //         ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
+      //       )
+      //     }
+      //   }
+      //   return fmt
+      // },
 
       handleClose() {
         this.accessoryTFs = false
@@ -266,27 +295,27 @@
           startDate = this.value2[0] ? this.value2[0] : ''
           endDate = this.value2[1] ? this.value2[1] : ''
         }
-        getList({
-          currentPage: this.currentPage,
+          getList({
+            currentPage: this.currentPage,
             pageSize: this.pageSize,
             startDate: startDate,
             endDate: endDate,
             searchKeyWord: this.searchKeyWord,
             compId: localStorage.getItem('ws-pf_compId'),
-            dept:this.deptId
-          })
-          .toPromise()
-          .then((response) => {
-            console.log(response.data)
-            this.tableData = response.records
-            // for (var i = 0; i < response.records.length; i++) {
-            //   response.records[i].identification = 'false'
-            // }
-            // this.customerList = response
-            // this.deptCircularPage.currentPage = response.current
-            // this.deptCircularPage.pageSize = response.size
-            // this.deptBudgetTotal = response.total
+            dept: this.deptId
           })
+            .toPromise()
+            .then((response) => {
+              console.log(response.data)
+              this.tableData = response.records
+              // for (var i = 0; i < response.records.length; i++) {
+              //   response.records[i].identification = 'false'
+              // }
+              // this.customerList = response
+              // this.deptCircularPage.currentPage = response.current
+              // this.deptCircularPage.pageSize = response.size
+              // this.deptBudgetTotal = response.total
+            })
       },
       //部门列表查询
       getDeptList() {