Browse Source

提交刷新考情的功能

Lijy 5 ngày trước cách đây
mục cha
commit
c365784e7b

+ 4 - 1
fhKeeper/formulahousekeeper/octopus/src/http.js

@@ -12,7 +12,10 @@ function handleResults (response) {
 }
 
 function handleUrl (url) {
-    url = BASE_URL + url;
+    if(url.indexOf('http') != 0) {
+        url = BASE_URL + url;
+    }
+    // url = BASE_URL + url;
     return url
 }
 

+ 63 - 1
fhKeeper/formulahousekeeper/octopus/src/views/customer/list.vue

@@ -83,6 +83,7 @@
                     <el-button size="mini"  @click="editClick('K', scope.row)">登录系统</el-button>
                     <el-button size="mini"  @click="editClick('I', scope.row)"  v-if="scope.row.canDelete">删除企业</el-button>
                     <el-button size="mini"  @click="editClick('E', scope.row)" v-loading="dingdingSync" v-if="scope.row.dingdingCorpid">同步钉钉人员</el-button>
+                    <el-button size="mini"  @click="editClick('M', scope.row)">刷新考勤</el-button>
                 </template>
             </el-table-column>
         </el-table>
@@ -316,6 +317,20 @@
                 <el-button type="primary" @click="addFeishuInfo('feishuInfo')">确 定</el-button>
             </span>
         </el-dialog>
+        <!-- 刷新考情 -->
+        <el-dialog v-if="editDialogM" :visible.sync="editDialogM" title="刷新考勤">
+            <el-form label-width="200px">
+                <el-form-item label="选择刷新考勤时间">
+                    <el-date-picker v-model="dialogData.attendanceTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="handleDateChange" value-format="yyyy-MM-dd"></el-date-picker>
+                </el-form-item>
+                 <span style="color: red;margin-left: 200px">考勤时间不能超过七天</span>
+
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="editDialogM = false">取 消</el-button>
+                <el-button type="primary" :disabled="!(dialogData.attendanceTime || []).length" @click="refreshExamSituation()" :loading="refreshExamSituationLoading">刷 新</el-button>
+            </span>
+        </el-dialog>
     </section>
 </template>
 <script>
@@ -334,6 +349,7 @@ import App from '../../App.vue';
                 editDialogF: false,
                 editDialogG: false,
                 editDialogH: false,
+                editDialogM: false,
 
                 user: JSON.parse(sessionStorage.user),
 
@@ -383,13 +399,24 @@ import App from '../../App.vue';
                     managerName: [
                         { required: true, message: '请输入管理员名称', trigger: 'blur' },
                     ],
-                }
+                },
+
+                refreshExamSituationLoading: false,
             };
         },
         // 过滤器
         filters: {
         },
         methods: {
+            handleDateChange(val) {
+                if (!val || val.length !== 2) return;
+                const [start, end] = val;
+                const diffDays = (new Date(end) - new Date(start)) / (1000 * 60 * 60 * 24);
+                if (diffDays > 7) {
+                this.$message.warning('时间范围不能超过7天');
+                this.dialogData.attendanceTime = [];
+                }
+            },
             // 名称搜索
             searchList() {
                 this.page = 1;
@@ -565,6 +592,9 @@ import App from '../../App.vue';
                                 type: "error"
                             });
                         });
+                } else if (i == 'M') {
+                    this.$set(this.dialogData,'attendanceTime',[])
+                    this.editDialogM = true
                 }
                 
             },
@@ -1001,6 +1031,38 @@ import App from '../../App.vue';
                     });
                 });
             },
+
+            // 刷新考勤
+            refreshExamSituation() {
+                const { id, attendanceTime } = this.dialogData;
+                const url = `http://worktime.ttkuaiban.com/api/dingding/syncCardTime`
+                const params = {
+                    id,
+                    startDate: attendanceTime[0],
+                    endDate: attendanceTime[1],
+                }
+                const queryString = new URLSearchParams(params).toString();
+                const finalUrl = `${url}?${queryString}`;
+
+                this.refreshExamSituationLoading = true
+                this.http.get(finalUrl, res => {
+                    this.refreshExamSituationLoading = false
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: "刷新成功",
+                            type: "success"
+                        });
+                        this.editDialogM = false
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                }, error => {
+                    this.refreshExamSituationLoading = false
+                })
+            }
         },
         created() {
             let height = window.innerHeight;