From 9ad048e36bef6d735bf0ef0c12698696e7d5100b Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期二, 23 四月 2024 18:36:35 +0800
Subject: [PATCH] 考勤统计的列表联调+表头动态数据重组的逻辑处理+详情数据的重组问题+更新考勤的接口联调

---
 src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue |  166 ++++++++++++++++++++++++++++++-------------------------
 1 files changed, 90 insertions(+), 76 deletions(-)

diff --git a/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue b/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue
index 306b58a..31643ee 100644
--- a/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue
+++ b/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue
@@ -4,75 +4,80 @@
     <div slot="title" class="tac drawerHeader">璇︽儏</div>
     <div class="dialog-content-box">
       <el-form class="form-box" ref="form" :rules="rules" :model="form" label-width="140px" label-position="right">
-        <el-form-item label="鍛樺伐濮撳悕锛�" prop="id">
-          {{ form.name }}
+        <el-form-item label="鍛樺伐濮撳悕锛�" prop="workerName">
+          {{ form.workerName ||'--'}}
         </el-form-item>
-        <el-form-item label="鍛樺伐ID锛�" prop="isCore">
-          {{ form.name }}
+        <el-form-item label="鍛樺伐ID锛�" prop="workerId">
+          {{ form.workerId||'--' }}
         </el-form-item>
-        <el-form-item label="宸ョ锛�" prop="id">
-          {{ form.name }}
+        <el-form-item label="宸ョ锛�" prop="workType">
+          {{ form.workType||'--' }}
         </el-form-item>
-        <el-form-item label="鑰冨嫟鏃ユ湡锛�" prop="isCore">
-          {{ form.name }}
+        <el-form-item label="鑰冨嫟鏃ユ湡锛�" prop="month">
+          {{ form.month||'--' }}
         </el-form-item>
-        <el-form-item label="鐘舵�侊細" prop="id">
+        <el-form-item label="鐘舵�侊細" prop="status">
           <template v-if="!isEditOne">
-            <i  class="el-icon-circle-check cursor_pointer font_size_20 color_67c23a"></i>
-           {{ form.name }}
+            <i  v-if='form.status==1' class="el-icon-circle-check cursor_pointer font_size_20 color_67c23a"></i>
+           <span :class="getClassName(form.status)">
+            {{ getAttendanceStatus(form.status) }}
+            </span>
            <i @click="editOneClick" class="el-icon-edit-outline cursor_pointer font_size_20"></i>
           </template>
           <template v-else>
-            <el-select v-model="form.phoneNum" filterable placeholder="璇烽�夋嫨"  class="margin_right_15px" style="width: calc(100% - 80px)">
-            <el-option v-for="item in DeviceList" :key="item.id" :label="item.name" :value="item.id">
+            <el-select v-model="form.status" filterable placeholder="璇烽�夋嫨"  class="margin_right_15px" style="width: calc(100% - 120px)">
+            <el-option v-for="item in attendanceStatusList" :key="item.id" :label="item.value" :value="item.id">
             </el-option>
           </el-select>
               <el-button type="text" @click="submitEditOneClick('form')">纭畾</el-button>
+              <el-button type="text" @click="cancelEditClick('isEditOne')">鍙栨秷</el-button>
           </template>
         </el-form-item>
-        <el-form-item label="涓婄彮鎵撳崱鏃堕棿锛�" prop="isCore">
-          {{ form.name }}
+        <el-form-item label="涓婄彮鎵撳崱鏃堕棿锛�" prop="startWorkTime">
+          {{ form.startWorkTime||'--' }}
         </el-form-item>
-        <el-form-item label="涓嬬彮鎵撳崱鏃堕棿锛�" prop="id">
-          {{ form.name }}
+        <el-form-item label="涓嬬彮鎵撳崱鏃堕棿锛�" prop="endWorkTime">
+          {{ form.endWorkTime||'--' }}
         </el-form-item>
-        <el-form-item label="鐝锛�" prop="isCore">
-          {{ form.name }}
+        <el-form-item label="鐝锛�" prop="classes">
+          {{ form.classes ||'--'}}
         </el-form-item>
-        <el-form-item label="鐝寮�濮嬫椂闂达細" prop="id">
-          {{ form.name }}
+        <el-form-item label="鐝寮�濮嬫椂闂达細" prop="classesStartTime">
+          {{ form.classesStartTime ||'--'}}
         </el-form-item>
-        <el-form-item label="鐝缁撴潫鏃堕棿锛�" prop="isCore">
-          {{ form.name }}
+        <el-form-item label="鐝缁撴潫鏃堕棿锛�" prop="classesEndTime">
+          {{ form.classesEndTime||'--' }}
         </el-form-item>
-        <el-form-item label="宸ヤ綔鏃ュ姞鐝椂闀匡細" prop="id">
+        <el-form-item label="宸ヤ綔鏃ュ姞鐝椂闀匡細" prop="weekdayOverTime">
           <template v-if="!isEditTwo">
-           {{ form.name }}
+           {{ form.weekdayOverTime }}
            <i @click="editTwoClick" class="el-icon-edit-outline cursor_pointer font_size_20"></i>
           </template>
           <template v-else>
             <el-input
-                v-model.number="form.produceAheadDay"
+                v-model.number="form.weekdayOverTime"
                 maxlength="20"
-                style="width: calc(100% - 80px)"
+                style="width: calc(100% - 120px)"
                 clearable
                 placeholder="璇疯緭鍏�"
                 class="margin_right_15px"
               ></el-input>
               <el-button type="text" @click="submitEditTwoClick('form')">纭畾</el-button>
+              <el-button type="text" @click="cancelEditClick('isEditTwo')">鍙栨秷</el-button>
           </template>
         </el-form-item>
       </el-form>
     </div>
     <div slot="footer" class="dialog-footer tac">
-      <el-button type="cancel" @click="cancelMethod()">鍙栨秷</el-button>
-      <el-button type="primary" @click="submitForm('form')">纭畾</el-button>
+      <el-button type="cancel" @click="cancelMethod()">鍏抽棴</el-button>
+      <!-- <el-button type="primary" @click="submitForm('form')">纭畾</el-button> -->
     </div>
   </el-dialog>
 </template>
 
 <script>
-import { getDeleteFollowRecord } from "@/api/employeeManage/employeeInfo.js"
+import { updateAttendance } from "@/api/employeeSalary/attendanceManage.js"
+import { getDataByType } from "@/api/data"
 export default {
   props: {
     editRow: {
@@ -89,23 +94,9 @@
       },
       isEditOne:false,
       isEditTwo:false,
-      DeviceList:[],
+      attendanceStatusList: getDataByType("attendanceStatus"),
       rules: {
-        id: [
-          {
-            required: true,
-            message: "璇疯緭鍏ヤ汉鍛樺鍚�",
-            trigger: ["blur", "change"],
-          },
-        ],
-        name: [
-          {
-            required: true,
-            message: "璇疯緭鍏ュ憳宸ョ紪鐮�",
-            trigger: ["blur", "change"],
-          },
-        ],
-        produceAheadDay: [
+        weekdayOverTime: [
           {
             required: false,
             message: "璇疯緭鍏�",
@@ -132,38 +123,64 @@
     },
   },
   methods: {
+    getAttendanceStatus(val){
+      let string = "";
+      if (val) {
+        for (let i in this.attendanceStatusList) {
+          if (this.attendanceStatusList[i].id == val) {
+            string = this.attendanceStatusList[i].value;
+          }
+        }
+      }
+      return string;
+    },
+    getClassName(val){
+      let classname=''
+       // 1==姝e父 2===鍔犵彮 3==浼戝亣 4===寮傚父
+      if(val==1){
+        classname = "color_67c23a";
+      }else if(val==2){
+        classname = "color_FF9900 ";
+      }else if(val==3){
+        classname = "color_333";
+      }else if(val==4){
+        classname = "color_red";
+      }
+      return classname
+    },
     editOneClick(){
       this.isEditOne=true
     },
     submitEditOneClick(){
-      this.isEditOne=false
+      this.submitForm('form','isEditOne')
     },
     editTwoClick(){
       this.isEditTwo=true
     },
     submitEditTwoClick(){
-      this.isEditTwo=false
+      this.submitForm('form','isEditTwo')
     },
     formInfo() {
       if (this.islook) {
-        this.form = {
-          isCore: "",
-          id: "",
-        };
+        this.form = {};
         this.$nextTick(()=>{
           this.$refs["form"].resetFields();
-          if (this.editRow.id) {
+          if (this.editRow.workerId) {
             this.form = JSON.parse(JSON.stringify(this.editRow));
           }
         })
       }
     },
+    cancelEditClick(name){
+      this[name]=false
+      this.formInfo()
+    },
     validatorNum(rule, value, callback) {
-      if (value) {
+      if (value&&this.isEditTwo) {
         if (value == undefined || value == null) {
           callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
         } else {
-          var reg = /^\+?[0-9]\d*$/;
+          var reg = /^\+?[1-9]\d*$/;
           if (!reg.test(value)) {
             callback(new Error("璇峰~鍐欎笉灏忎簬0鐨勬暟瀛�"));
           } else {
@@ -178,31 +195,28 @@
       this.$refs["form"].resetFields();
       this.islook = false;
     },
-    submitForm(formName) {
+    submitForm(formName,name) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           let form = JSON.parse(JSON.stringify(this.form));
-          if (this.editRow.type == "add") {
-            getDeleteFollowRecord(form).then((res) => {
-              if (res.code == 200) {
-                this.$message({
-                  message: "娣诲姞鎴愬姛锛�",
-                  type: "success",
-                });
-                this.cancelMethod();
-              }
-            });
-          } else {
-            getDeleteFollowRecord(form).then((res) => {
-              if (res.code == 200) {
-                this.$message({
-                  message: "缂栬緫鎴愬姛锛�",
-                  type: "success",
-                });
-                this.cancelMethod();
-              }
-            });
+          let day=(Number(form.dateDay)<10)?'0'+form.dateDay:form.dateDay
+          let params={
+            date:form.month+'-'+day,
+            overTimeDuration:Number(form.weekdayOverTime),
+            status:form.status,
+            workerId:form.workerId
           }
+            updateAttendance(params).then((res) => {
+              if (res.code == 200) {
+                this.$message({
+                  message: "鎿嶄綔鎴愬姛锛�",
+                  type: "success",
+                });
+                this[name]=false
+                this.$emit('shutdown')
+                this.cancelMethod();
+              }
+            });
         } else {
           console.log('error submit!!');
           return false;

--
Gitblit v1.8.0