Quellcode durchsuchen

提交请假管理请假天数都调用接口获取请假天数

Lijy vor 2 Jahren
Ursprung
Commit
35030c2199

+ 25 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

@@ -1811,7 +1811,6 @@ export default {
       return zong
     },
     submits(){
-      // console.log(this.addForm)
       // return
         this.$refs.addForm.validate(valid => {
           this.addForm.endDate = this.buling(this.addForm.endDate)
@@ -1907,12 +1906,37 @@ export default {
     // 计算日期
     datas() {
         // this.addForm.timeDays = this.DateDiff(this.addForm.startDate, this.addForm.endDate)
+
         if(this.addForm.startDate > this.addForm.endDate) {
           this.addForm.endDate = this.addForm.startDate
         }
         this.addForm.timeDays = this.countWorkDay(this.addForm.startDate, this.addForm.endDate)
         this.timeChoose = this.addForm.timeDays
         this.addForm.timeHours = this.addForm.timeDays * 8
+
+        // 调用接口获取请假天数
+        let startDateData = this.buling(this.addForm.startDate)
+        let endDateData = this.buling(this.addForm.endDate)
+        this.http.post('/leave-sheet/leaveDays', {
+          startDate: startDateData,
+          endDate: endDateData
+        },
+          res => {
+              if (res.code == "ok") {
+                  this.addForm.timeDays = res.data
+              } else {
+                  this.$message({
+                    message: res.msg,
+                    type: "error"
+                  });
+              }
+          },
+          error => {
+              this.$message({
+                  message: error,
+                  type: "error"
+              });
+          });
     },
     datasss() {
       // console.log(123)

+ 12 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/exaLeave/applyLeave.vue

@@ -342,6 +342,18 @@ export default {
             this.editForm.endDate = this.formatDate(value[1])
             this.formshowText.dateTitle = this.formatDate(value[0])+'\u3000至\u3000'+this.formatDate(value[1])
             this.editForm.timeDays = this.getDaysBetween(value[0],value[1])
+
+            this.$axios.post('/leave-sheet/leaveDays', {
+                startDate: this.editForm.startDate,
+                endDate: this.editForm.endDate
+            })
+            .then(res => {
+                if(res.code == "ok") {
+                    this.editForm.timeDays = res.data
+                } else {
+                    this.$toast.fail(res.msg);
+                }
+            }).catch(err=> {this.$toast.clear();console.log(err)});
         },
         date_hourChange(value){
             this.editForm.startDate = this.formatDate(value)