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

---
 src/components/makepager/TableCommonView.vue                                             |    6 
 src/api/employeeSalary/attendanceManage.js                                               |   58 ++++++
 src/assets/style/index.scss                                                              |    4 
 src/views/employeeSalary/attendanceStatistics/index.vue                                  |  203 ++++++++++++++--------
 src/api/data.js                                                                          |    9 
 src/views/employeeSalary/attendanceManage/index.vue                                      |   74 ++++----
 src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue |  166 ++++++++++--------
 7 files changed, 327 insertions(+), 193 deletions(-)

diff --git a/src/api/data.js b/src/api/data.js
index deb21f5..815656d 100644
--- a/src/api/data.js
+++ b/src/api/data.js
@@ -6,9 +6,16 @@
   { id: 4, value: "娲佸噣鍒�" },
   { id: 5, value: "鏈�澶у亸宸�" }
 ]
-
+const attendanceStatus = [
+  { id: 1, value: "姝e父" },
+  { id: 2, value: "鍔犵彮" },
+  { id: 3, value: "浼戝亣" },
+  { id: 4, value: "寮傚父" },
+]
 export const getDataByType = (type) => {
   if (type == "projectOptions") {
     return projectOptions
+  }else if(type=='attendanceStatus'){
+    return attendanceStatus
   }
 }
diff --git a/src/api/employeeSalary/attendanceManage.js b/src/api/employeeSalary/attendanceManage.js
new file mode 100644
index 0000000..4cd1c33
--- /dev/null
+++ b/src/api/employeeSalary/attendanceManage.js
@@ -0,0 +1,58 @@
+import request from "@/common/untils/request.js"
+
+// 鑰冨嫟绠$悊鍒楄〃
+export function getAttendanceList(data) {
+  return request({
+    url: "/api-jl/v1/attendance/getAttendanceList",
+    method: "post",
+    data
+  })
+}
+// 鍒犻櫎鑰冨嫟绠$悊
+export function deleteAttendanceInfo(data) {
+  return request({
+    url: "/api-jl/v1/attendance/deleteAttendanceInfo",
+    method: "delete",
+    data
+  })
+}
+// 鑰冨嫟绠$悊 瀵煎叆
+export function attendanceInput(data) {
+  return request({
+    url: "/api-jl/v1/attendance/attendanceInput",
+    method: "post",
+    data
+  })
+}
+// 鑰冨嫟绠$悊 鑾峰彇鍔犵彮瑙勫垯
+export function getAttendanceRule(data) {
+  return request({
+    url: "/api-jl/v1/attendance/getAttendanceRule",
+    method: "get",
+    data
+  })
+}
+// 鑰冨嫟绠$悊 淇濆瓨鍔犵彮瑙勫垯
+export function saveAttendanceRule(data) {
+  return request({
+    url: "/api-jl/v1/attendance/saveAttendanceRule",
+    method: "post",
+    data
+  })
+}
+//鑰冨嫟缁熻鑾峰彇
+export function getAttendanceStatistic(data) {
+  return request({
+    url: "/api-jl/v1/attendance/getAttendanceStatistic",
+    method: "post",
+    data
+  })
+}
+//鑰冨嫟缁熻鏇存柊
+export function updateAttendance(data) {
+  return request({
+    url: "/api-jl/v1/attendance/updateAttendance",
+    method: "post",
+    data
+  })
+}
diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss
index 4648954..0286b0c 100644
--- a/src/assets/style/index.scss
+++ b/src/assets/style/index.scss
@@ -147,7 +147,9 @@
 .cursor_pointer {
   cursor: pointer;
 }
-
+.font_weight_700{
+  font-weight: 700;
+}
 .btn-pager {
   display: flex;
   margin-top: 10px;
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index bc0f088..9562caa 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -95,7 +95,7 @@
           <span
             v-else-if="item.isCommonClick && scope.row[item.prop]"
             class="sel-name"
-            @click="selCommonClick(scope.row)"
+            @click="selCommonClick(scope.row,item.prop,item)"
             >
             <div v-if="item.isCallMethod">
               <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">
@@ -409,8 +409,8 @@
       this.$emit("selServiceOrderClick", row)
     },
     // 鍏叡锛堥攢鍞満浼氥�佹姤浠峰崟銆侀攢鍞�诲崟銆侀攢鍞瓙鍗曘�傘�傘�傦級
-    selCommonClick(row) {
-      this.$emit("selCommonClick", row)
+    selCommonClick(row,prop,item) {
+      this.$emit("selCommonClick", row,prop,item)
     },
     // 琛岀偣鍑�
     tableRowClick(row, column, event) {
diff --git a/src/views/employeeSalary/attendanceManage/index.vue b/src/views/employeeSalary/attendanceManage/index.vue
index 1b5873a..bc9c870 100644
--- a/src/views/employeeSalary/attendanceManage/index.vue
+++ b/src/views/employeeSalary/attendanceManage/index.vue
@@ -13,6 +13,7 @@
           <template slot="leftButton">
             <el-button size="small" type="primary" @click="exportClick">瀵煎叆</el-button>
             <el-button size="small" type="primary" @click="synchClick">鍚屾</el-button>
+            <el-button size="small" type="primary" @click="ruleSettingClick">瑙勫垯璁剧疆</el-button>
           </template>
         </CommonSearch>
       </div>
@@ -30,7 +31,7 @@
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="90" fixed="right">
                 <template slot-scope="scope">
-                  <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
+                  <el-button @click="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
                 </template>
               </el-table-column>
             </template>
@@ -41,19 +42,22 @@
         </div>
       </div>
     </div>
+    <!-- 瑙勫垯璁剧疆 -->
+    <RuleSettingDialog ref="RuleSettingDialog" :editRow="editRow"  @closeClick="getData" />
   </div>
 </template>
 
 <script>
-import { getFollowRecordList, getDeleteFollowRecord } from "@/api/productManage/silkRegisterForm.js"
+import { getAttendanceList, deleteAttendanceInfo } from "@/api/employeeSalary/attendanceManage.js"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-
+import RuleSettingDialog from  "@/views/employeeSalary/attendanceManage/components/RuleSettingDialog"
 export default {
   name: "attendanceManage",
   props: {
   },
   mixins: [pageMixin],
   components: {
+    RuleSettingDialog
   },
   data() {
     return {
@@ -65,22 +69,20 @@
         title: "鏂板缓",
         infomation: {}
       },
-      search_map: {},
+      keyword: '',
       tableColumn: [
-        { label: "鏃ユ湡", prop: "topic", min: 120, default: true }, 
-        { label: "鍛樺伐缂栧彿", prop: "client_name", min: 190,default: true}, 
-        { label: "鍛樺伐濮撳悕", prop: "contact_name", min: 100, },
-        { label: "涓婄彮鎵撳崱鏃堕棿", prop: "client_status", min: 100 },
-        { label: "涓嬬彮鎵撳崱鏃堕棿", prop: "contact_information_name", min: 100 }, 
-        { label: "鐝", prop: "follow_time", min: 100 },
-        { label: "鐝涓婄彮鏃堕棿", prop: "next_follow_time", min: 110 },
-        { label: "鐝涓嬬彮鏃堕棿", prop: "member_name", min: 110 }, 
-        { label: "娣诲姞鏃堕棿", prop: "next_follow_time", min: 130 },
-        { label: "娣诲姞浜�", prop: "member_name", min: 110 }, 
+        { label: "鏃ユ湡", prop: "date", min: 120, default: true }, 
+        { label: "鍛樺伐缂栧彿", prop: "workerId", min: 190,default: true}, 
+        { label: "鍛樺伐濮撳悕", prop: "workerName", min: 100, },
+        { label: "涓婄彮鎵撳崱鏃堕棿", prop: "startWorkTime", min: 100 },
+        { label: "涓嬬彮鎵撳崱鏃堕棿", prop: "endWorkTime", min: 100 }, 
+        { label: "鐝", prop: "classes", min: 100 },
+        { label: "鐝涓婄彮鏃堕棿", prop: "classesStartTime", min: 110 },
+        { label: "鐝涓嬬彮鏃堕棿", prop: "classesEndTime", min: 110 }, 
+        { label: "娣诲姞鏃堕棿", prop: "createTime", min: 130 },
+        { label: "娣诲姞浜�", prop: "addPeople", min: 110 }, 
       ],
       showCol: [
-        "鏃ユ湡",
-        "鍛樺伐缂栧彿",
         "鍛樺伐濮撳悕",
         "涓婄彮鎵撳崱鏃堕棿",
         "涓嬬彮鎵撳崱鏃堕棿",
@@ -89,12 +91,13 @@
         "鐝涓嬬彮鏃堕棿",
         "娣诲姞鏃堕棿",
         "娣诲姞浜�",
-      ]
+      ],
+      editRow:{},
     }
   },
   created() {
     this.setTable()
-    this.getData(this.search_map)
+    this.getData(this.keyword)
   },
   computed: {
   },
@@ -117,9 +120,10 @@
     },
     setColumnVisible(showCol) {
       return this.tableColumn.map((ele) => {
+       
         return {
           ...ele,
-          isShowColumn: showCol.includes(ele.label)
+          isShowColumn: ele.default?true:showCol.includes(ele.label)
         }
       })
     },
@@ -130,28 +134,22 @@
     // 璇锋眰鏁版嵁
     async getData() {
       this.loading = true
-      await getFollowRecordList({
-        search_map: this.search_map,
+      await getAttendanceList({
+        keyword: this.keyword,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       })
         .then((res) => {
           console.log(res)
           if (res.code === 200) {
-            if (res.data.list && res.data.list.length > 0) {
-              const list = res.data.list.map((item) => {
+            if (res.data && res.data.length > 0) {
+              const list = res.data.map((item) => {
                 return {
                   ...item,
-                  client_name: item.client.name,
-                  contact_name: item.contact.name,
-                  client_status: item.client_status.name,
-                  phone: item.contact.phone,
-                  member_name: item.member.username,
-                  contact_information_name: item.contact_information.name
                 }
               })
               this.tableList.tableInfomation = list || []
-              this.pagerOptions.totalCount = res.data.count
+              this.pagerOptions.totalCount = res.total
             } else {
               this.tableList.tableInfomation = []
             }
@@ -168,30 +166,34 @@
     },
     // 鎼滅储
     onFilterSearch(searchText) {
-      this.search_map.client_name = searchText ?? ""
+      this.keyword = searchText ?? ""
       this.pagerOptions.currPage = 1
       this.getData()
     },
-    // 鏂板缓
+    // 瀵煎叆
     exportClick() {
       
     },
-     // 鎵撳嵃
+     // 鍚屾
      synchClick(){
 
     },
-    
+     // 鎵撳嵃
+     ruleSettingClick(){
+      this.$refs.RuleSettingDialog.islook = true;
+    },
     // 鍒犻櫎
-    delClick(id) {
+    delClick(row) {
       this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
         type: "warning"
       })
         .then(() => {
-          getDeleteFollowRecord({ ids: [id] }).then((response) => {
+          deleteAttendanceInfo({ ids: [row.ID] }).then((response) => {
             if (response.code === 200) {
               this.$message.success("鍒犻櫎鎴愬姛")
+              this.pagerOptions.currPage = 1
               this.getData()
             } else {
               this.$message.warning("鍒犻櫎澶辫触")
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;
diff --git a/src/views/employeeSalary/attendanceStatistics/index.vue b/src/views/employeeSalary/attendanceStatistics/index.vue
index 97b3de6..836dfb2 100644
--- a/src/views/employeeSalary/attendanceStatistics/index.vue
+++ b/src/views/employeeSalary/attendanceStatistics/index.vue
@@ -12,11 +12,13 @@
         >
           <template slot="leftButton">
             <div class="margin_right_20px" style="width:200px;">
-              <el-date-picker v-model="object.date" style="width:100%" type="month" placeholder="閫夋嫨鏃ユ湡"
+              <el-date-picker v-model="object.date" style="width:100%"
+              @change="onFilterSearch"
+              :clearable="false" type="month" placeholder="閫夋嫨鏃ユ湡"
+              :picker-options="pickerOptions"
                 value-format="yyyy-MM">
               </el-date-picker>
             </div>
-            <el-button size="small" type="primary" @click="ruleSettingClick">瑙勫垯璁剧疆</el-button>
           </template>
         </CommonSearch>
       </div>
@@ -30,34 +32,25 @@
             v-loading="loading"
             :table-list="tableList"
             @selTableCol="selTableCol"
+            @selCommonClick="(row,prop,item) => selCommonClick(row,prop,item)"
           >
-            <template slot="tableButton">
-              <el-table-column label="鎿嶄綔" width="90" fixed="right">
-                <template slot-scope="scope">
-                  <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
-                </template>
-              </el-table-column>
-            </template>
           </TableCommonView>
         </div>
-        <div class="btn-pager">
+        <!-- <div class="btn-pager">
           <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
-        </div>
+        </div> -->
       </div>
     </div>
-    <AttendanceStatisticsDetails ref="attendanceStatisticsDetails" :editRow="editRow"  @shutdown="getData" />
-     <!-- 瑙勫垯璁剧疆 -->
-     <RuleSettingDialog ref="RuleSettingDialog" :editRow="editRow"  @closeClick="getData" />
+    <AttendanceStatisticsDetails ref="attendanceStatisticsDetails" :editRow="editRow"  @shutdown="getData" />  
   </div>
 </template>
 
 <script>
-import { getFollowRecordList, getDeleteFollowRecord } from "@/api/employeeSalary/attendanceStatistics.js"
+import { getAttendanceStatistic } from  "@/api/employeeSalary/attendanceManage.js"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
 import AttendanceStatisticsDetails from  "@/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails"
-import RuleSettingDialog from  "@/views/employeeSalary/attendanceStatistics/components/RuleSettingDialog"
-import Date from "@/api/date";
-const { getCurrentMonth } = Date;
+import NewDate from "@/api/date";
+const { getCurrentMonth } = NewDate;
 export default {
   name: "attendanceStatistics",
   props: {
@@ -65,12 +58,16 @@
   mixins: [pageMixin],
   components: {
     AttendanceStatisticsDetails,
-    RuleSettingDialog
   },
   data() {
     return {
       tableList: {},
       loading: false,
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() > new Date().getTime() - 86400000;
+        },
+      },
       object:{
         date:getCurrentMonth()
       },
@@ -83,21 +80,18 @@
         title: "鏂板缓",
         infomation: {}
       },
-      search_map: {},
+      keyword: "",
       tableColumn: [
-        { label: "濮撳悕", prop: "topic", min: 120, default: true }, 
-        { label: "浜哄憳ID", prop: "client_name", min: 190,default: true}, 
-        { label: "宸ョ", prop: "contact_name", min: 100, },
-        { label: "鏈堜唤", prop: "client_status", min: 100 },
-        { label: "1/鍛ㄤ竴", prop: "client_status", min: 100 },
-        { label: "宸ヤ綔鏃ュ姞鐝椂闀�(灏忔椂)", prop: "contact_information_name", min: 180 }, 
-        { label: "浼戞伅鏃ュ姞鐝椂闀�(灏忔椂)", prop: "follow_time", min: 180 },
-        { label: "搴斿嚭鍕ゅぉ鏁�", prop: "next_follow_time", min: 110 },
-        { label: "瀹為檯鍑哄嫟澶╂暟", prop: "member_name", min: 110 }, 
+        { label: "濮撳悕", prop: "workerName", min: 120, default: true }, 
+        { label: "浜哄憳ID", prop: "workerId", min: 190,default: true}, 
+        { label: "宸ョ", prop: "workType", min: 100, },
+        { label: "鏈堜唤", prop: "month", min: 100 },
+        { label: "宸ヤ綔鏃ュ姞鐝椂闀�(灏忔椂)", prop: "weekdayOverTime", min: 180 }, 
+        { label: "浼戞伅鏃ュ姞鐝椂闀�(灏忔椂)", prop: "restDayOverTime", min: 180 },
+        { label: "搴斿嚭鍕ゅぉ鏁�", prop: "requiredAttendanceDays", min: 110 },
+        { label: "瀹為檯鍑哄嫟澶╂暟", prop: "actualAttendanceDays", min: 110 }, 
       ],
       showCol: [
-        "濮撳悕",
-        "浜哄憳ID",
         "宸ョ",
         "鏈堜唤",
         "宸ヤ綔鏃ュ姞鐝椂闀�(灏忔椂)",
@@ -109,7 +103,7 @@
   },
   created() {
     this.setTable()
-    this.getData(this.search_map)
+    this.getData(this.keyword)
   },
   computed: {
   },
@@ -117,6 +111,7 @@
     setTable() {
       this.tableList = {
         selectIndex: true,
+        isFixed:true,
         tableInfomation: [],
         allcol: [],
         showcol: this.showCol,
@@ -134,39 +129,74 @@
       return this.tableColumn.map((ele) => {
         return {
           ...ele,
-          isShowColumn: showCol.includes(ele.label)
+          isShowColumn:ele.default?true:showCol.includes(ele.label)
         }
       })
     },
     selTableCol(val) {
-      this.showcol = val
-      this.tableList.tableColumn = this.setColumnVisible(val)
+      this.showcol = val;
+      this.tableList.tableColumn = this.setColumnVisible(val);
     },
     // 璇锋眰鏁版嵁
     async getData() {
       this.loading = true
-      await getFollowRecordList({
-        search_map: this.search_map,
-        page: this.pagerOptions.currPage,
-        pageSize: this.pagerOptions.pageSize
+      await getAttendanceStatistic({
+        keyword: this.keyword,
+        month:this.object.date,
+        // page: this.pagerOptions.currPage,
+        // pageSize: this.pagerOptions.pageSize
       })
         .then((res) => {
           console.log(res)
           if (res.code === 200) {
             if (res.data.list && res.data.list.length > 0) {
+              let tableColumn1= [
+                { label: "濮撳悕", prop: "workerName", min: 120,default: true,fixed:'left' }, 
+                { label: "浜哄憳ID", prop: "workerId", min: 120,default: true,fixed:'left'}, 
+                { label: "宸ョ", prop: "workType", min: 100,fixed:'left' },
+                { label: "鏈堜唤", prop: "month", min: 90 ,fixed:'left'},
+              ];
+              let tableColumn3=[
+                { label: "宸ヤ綔鏃ュ姞鐝椂闀�(灏忔椂)", prop: "weekdayOverTime", min: 140,fixed:'right'}, 
+                { label: "浼戞伅鏃ュ姞鐝椂闀�(灏忔椂)", prop: "restDayOverTime", min: 140,fixed:'right' },
+                { label: "搴斿嚭鍕ゅぉ鏁�", prop: "requiredAttendanceDays", min: 110 ,fixed:'right'},
+                { label: "瀹為檯鍑哄嫟澶╂暟", prop: "actualAttendanceDays", min: 110,fixed:'right'}, 
+              ]
+              let tableColumn2=[]
+              let headerList=res.data.list.length>0?res.data.list[0]:[]
+                if(headerList.details&&headerList.details.length>0){
+                  for(let i in headerList.details){
+                    tableColumn2.push({
+                      label:headerList.details[i].date+'',
+                      prop:'headerDate'+headerList.details[i].date,
+                      min:100,
+                      default:true,
+                      isCallMethod:true,
+                      isClass: true,
+                      getClassName:this.getHeaderClass,
+                      getCallMethod: this.getHeaderDate,
+                      isCommonClick:true,
+                      isIcon:true,
+                    })
+                  }
+                }
+               
+              let tableColumn=tableColumn1.concat(tableColumn2).concat(tableColumn3)
+              this.tableColumn=tableColumn;
+              this.setTable()
               const list = res.data.list.map((item) => {
+                let headerItem={}
+                let details=item.details?item.details:[]
+                for(let i in details){
+                  headerItem['headerDate'+details[i].date]=details[i].status
+                }
                 return {
                   ...item,
-                  client_name: item.client.name,
-                  contact_name: item.contact.name,
-                  client_status: item.client_status.name,
-                  phone: item.contact.phone,
-                  member_name: item.member.username,
-                  contact_information_name: item.contact_information.name
+                  ...headerItem,
                 }
               })
               this.tableList.tableInfomation = list || []
-              this.pagerOptions.totalCount = res.data.count
+              this.pagerOptions.totalCount = res.total
             } else {
               this.tableList.tableInfomation = []
             }
@@ -181,41 +211,62 @@
           this.loading = false
         })
     },
+    getHeaderDate(val){
+      let string=''
+       // 1==姝e父 2===鍔犵彮 3==浼戝亣 4===寮傚父
+      if(val==1){
+        string="<i class='el-icon-circle-check'></i>"
+      }else if(val==2){
+        string='鐝�'
+      }else if(val==3){
+        string='浼�'
+      }else if(val==4){
+        string='寮�'
+      }
+      return string
+    },
+    getHeaderClass(val){
+      let classname=''
+       // 1==姝e父 2===鍔犵彮 3==浼戝亣 4===寮傚父
+      if(val==1){
+        classname = "color_67c23a font_weight_700 font_size_20";
+      }else if(val==2){
+        classname = "color_FF9900  font_weight_700";
+      }else if(val==3){
+        classname = "color_333  font_weight_700";
+      }else if(val==4){
+        classname = "color_red  font_weight_700";
+      }
+      return classname
+    },
     // 鎼滅储
     onFilterSearch(searchText) {
-      this.search_map.client_name = searchText ?? ""
+      this.keyword = searchText ?? ""
       this.pagerOptions.currPage = 1
       this.getData()
     },
-    // 璇︽儏
-    detailsClick(row) {
+    selCommonClick(row,prop,item){
+      
       let config=JSON.parse(JSON.stringify(row));
-      this.editRow = { ...config, title:'缂栬緫',type:'add' }
-      this.$refs.addWorkKind.islook = true;
-    },
-     // 鎵撳嵃
-     ruleSettingClick(){
-      this.$refs.RuleSettingDialog.islook = true;
-    },
-    
-    // 鍒犻櫎
-    delClick(id) {
-      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning"
-      })
-        .then(() => {
-          getDeleteFollowRecord({ ids: [id] }).then((response) => {
-            if (response.code === 200) {
-              this.$message.success("鍒犻櫎鎴愬姛")
-              this.getData()
-            } else {
-              this.$message.warning("鍒犻櫎澶辫触")
-            }
-          })
-        })
-        .catch(() => {})
+      let details=config.details
+      let headerItem={}
+      for(let i in details){
+        if(details[i].date==item.label){
+          headerItem.classes=details[i].classes
+          headerItem.classesEndTime=details[i].classesEndTime
+          headerItem.classesStartTime=details[i].classesStartTime
+          headerItem.endWorkTime=details[i].endWorkTime
+          headerItem.startWorkTime=details[i].startWorkTime
+          headerItem.status=details[i].status
+          headerItem.dateDay=details[i].date
+          break;
+        }
+      }
+      this.editRow = { 
+        ...config, 
+        ...headerItem,
+      }
+      this.$refs.attendanceStatisticsDetails.islook = true;
     },
   }
 }
@@ -254,7 +305,7 @@
       overflow: hidden;
     }
     .list-view {
-      height: calc(100% - 60px);
+      height: calc(100% - 10px);
       overflow: hidden;
     }
     .btn-pager {

--
Gitblit v1.8.0