Explorar el Código

作息时间修正

luojun hace 1 año
padre
commit
1d7db338a5
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7 1
      src/views/system/workTimeSet/dialog.add.vue

+ 7 - 1
src/views/system/workTimeSet/dialog.add.vue

@@ -17,6 +17,7 @@
               <el-table-column label="日期" width="160">
                 <template slot-scope="r" >
                   <el-date-picker
+                  :default-timezone="'GMT+8'"
                     style="width: 100%"
                     v-model="r.row.ymdDate"
                     size="mini"
@@ -321,7 +322,9 @@ export default {
       if(this.workTimeList.length === 0)return  this.$message.warning('请添加日期');
       //判断是否有重复的日期
       let dateList = [];
-      let workTimeList = JSON.parse(JSON.stringify(this.workTimeList))
+      console.log(this.workTimeList,"this.workTimeList")
+      // let workTimeList = JSON.parse(JSON.stringify(this.workTimeList))
+      let workTimeList = this.workTimeList;
       for (let v of workTimeList) {
         if (v.ymdDate) {
           let date = this.formatTime(v.ymdDate,"YYYY-MM-DD");
@@ -334,6 +337,8 @@ export default {
       }
       // 校验
       for (let workTime of workTimeList) {
+        const adjustedDate = new Date(workTime.ymdDate.getTime() + 8 * 60 * 60 * 1000);
+        workTime.ymdDate=adjustedDate.toISOString().split("T")[0];
         if (!this.check(workTime)) {
           return;
         }
@@ -342,6 +347,7 @@ export default {
         orgIdList:this.orgIdList,
         workTimeList:workTimeList
       }
+      console.log(workTimeList,"workTimeList")
       addWorkTimeDay(data).then(res=>{
         this.$emit("ok");
         this.handleClose();