Ver Fonte

提交景昱系统基础设置的考勤同步

Lijy há 3 meses atrás
pai
commit
e3da3340ee

+ 65 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -335,6 +335,21 @@
             </div>
         </el-col>
         </el-row>
+        <div class="yanjiu" v-if="user.companyId == 5978">
+            <p style="margin-left:10px;color:#666;">考勤同步</p>
+            <el-date-picker
+                v-model="attendanceSynchronizationDate"
+                type="daterange"
+                range-separator="至"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                value-format="yyyy-MM-dd" 
+                size="small"
+                :picker-options="pickerOptions"
+                style="margin: 0 20px;">
+            </el-date-picker>
+            <el-button type="primary" :loading="attendanceSynchronizationLoading" @click="startSynchronizing()" size="small" :disabled="!attendanceSynchronizationDate.length">开始同步</el-button>
+        </div>
         <div class="yanjiu">
             <p style="margin-left:10px;color:#666;">{{ $t('riBaoShenHeMoShi') }}</p><el-tag style="margin-left:10px;" type="plain">{{reportAuditTypeArray[timeType.reportAuditType]}}
                 <el-tooltip effect="dark" :content="$t('ruXuXiuGaiWeiQiTaShenHeMoShiQingLianXiKeFu')" placement="top-start">
@@ -915,7 +930,27 @@
                 specialHolidaysUser: {
                     values: [],
                     labels: []
-                }
+                },
+                attendanceSynchronizationDate: [],
+                attendanceSynchronizationLoading: false,
+                day31: 30 * 24 * 3600 * 1000,
+                pickerMinDate: null,
+                pickerMaxDate: null,
+                pickerOptions: {
+                    onPick: ({ maxDate, minDate }) => {
+                        if (minDate && this.pickerMinDate) {
+                            this.pickerMinDate = null;
+                        } else if (minDate) {
+                            this.pickerMinDate = minDate.getTime();
+                        }
+                    },
+                    disabledDate: (time) => {
+                        if (this.pickerMinDate) {
+                            return (time.getTime() > (this.pickerMinDate + this.day31)) || (time.getTime() < (this.pickerMinDate - this.day31));
+                        }
+                        return false;
+                    }
+                },
             };
         },
         watch: {
@@ -955,6 +990,35 @@
             }, 1000)
         },
          methods: {
+            startSynchronizing() {
+                this.attendanceSynchronizationLoading = true;
+                this.http.post('/user-with-beisen/syncAttendanceFromBeisen',{
+                    startDate: this.attendanceSynchronizationDate[0],
+                    endDate: this.attendanceSynchronizationDate[1],
+                },
+                res => {
+                    this.attendanceSynchronizationLoading = false;
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: '同步成功',
+                            type: "success"
+                        });
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.attendanceSynchronizationLoading = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                    }
+                );
+            },
             showMultiTimeOption() {
                 this.multiTimeOptionVisible = true;
                 this.listLoading = true;