From 4e77a057819df8bcd8eb4218e6d1fcd8ccc8abf6 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期五, 26 四月 2024 18:21:56 +0800
Subject: [PATCH] 应发工资报表的前端开发

---
 src/views/reportManage/payableSalaryReport/index.vue |  264 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 178 insertions(+), 86 deletions(-)

diff --git a/src/views/reportManage/payableSalaryReport/index.vue b/src/views/reportManage/payableSalaryReport/index.vue
index cf609d3..d5641ab 100644
--- a/src/views/reportManage/payableSalaryReport/index.vue
+++ b/src/views/reportManage/payableSalaryReport/index.vue
@@ -1,100 +1,101 @@
 <template>
-  <div class="payableSalaryReport-container">
-    <div class="filter-card">
-      <CommonSearch :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch">
-        <template slot="leftButton">
-          <el-button size="small" type="primary" @click="exportBtnClick">瀵煎嚭</el-button>
-          <el-button size="small" type="primary" @click="refreshBtnClick">鍒锋柊</el-button>
-        </template>
-      </CommonSearch>
-    </div>
-    <div class="body-card">
-      <div class="list-view">
-        <TableCommonView
-          ref="tableListRef"
-          v-loading="loading"
-          :colOpenShow="false"
-          :table-list="tableList"
-          @selTableCol="selTableCol"
+  <div class="silkRegister-form">
+    <div class="filter">
+      <div class="filter-card">
+        <CommonSearch
+          :show-add="false"
+          :show-download="false"
+          :amount-view="false"
+          :show-action-btn="false"
+          placeholder="璇疯緭鍏ュ叧閿瘝"
+          @searchClick="onFilterSearch"
         >
-        </TableCommonView>
+          <template slot="leftButton">
+            <div class="margin_right_20px" style="width:200px;">
+              <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>
+          </template>
+        </CommonSearch>
       </div>
-      <!-- <div class="btn-pager">
-        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
-      </div> -->
     </div>
+
+    <div class="body">
+      <div class="body-card">
+        <div class="list-view">
+          <TableCommonView
+            ref="tableListRef"
+            v-loading="loading"
+            :table-list="tableList"
+            @selTableCol="selTableCol"
+            @inputContent="inputContent"
+          >
+          </TableCommonView>
+        </div>
+        <!-- <div class="btn-pager">
+          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+        </div> -->
+      </div>
+    </div> 
   </div>
 </template>
 
 <script>
+import { getAttendanceStatistic } from  "@/api/employeeSalary/attendanceManage.js"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import NewDate from "@/api/date";
+const { getCurrentMonth } = NewDate;
 export default {
-  name: "payableSalaryReport",
-  props: {},
-  components: {},
+  name: "attendanceStatistics",
+  props: {
+  },
   mixins: [pageMixin],
-  computed: {},
+  components: {
+  },
   data() {
     return {
-      loading: false,
       tableList: {},
+      loading: false,
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() > new Date().getTime() - 86400000;
+        },
+      },
+      object:{
+        date:getCurrentMonth()
+      },
+      searchOptions: [],
+      keyword: "",
       tableColumn: [
-        { label: "濮撳悕", prop: "name", default: true, fixed: true },
-        { label: "浜哄憳id", prop: "member_name" },
+        { label: "濮撳悕", prop: "workerName", min: 120, default: true }, 
+        { label: "浜哄憳id", prop: "workerId", min: 190,default: true}, 
         { label: "鎵嬫満鍙�", prop: "client_level" },
-        { label: "宸ョ", prop: "next_visit_time" },
-        { label: "鐢熶骇宸ヨ祫", prop: "detail_address" },
-        { label: "婊″嫟", prop: "client_status" },
-        { label: "瓒呮椂宸ヨ祫", prop: "contact_name" },
-        { label: "鍔犵彮宸ヨ祫", prop: "contact_phone" },
-        { label: "浜ら�氳ˉ璐�", prop: "client_level" },
-        { label: "甯﹀緬琛ヨ创", prop: "next_visit_time" },
-        { label: "宀椾綅琛ヨ创", prop: "detail_address" },
-        { label: "绀句繚琛ヨ创", prop: "client_status" },
-        { label: "宸ラ緞琛ヨ创", prop: "contact_name" },
-        { label: "涓嶈揪淇濆簳", prop: "contact_phone" },
-        { label: "璐ㄩ噺濂�", prop: "contact_phone" },
-        { label: "濂栫綒1", prop: "client_level" },
-        { label: "濂栫綒2/娓呭噳琛�", prop: "next_visit_time", width: "110" },
-        { label: "鏃ュ父妫�鏌�/濂栫綒3", prop: "detail_address", width: "110" },
-        { label: "鍋滄満琛ヨ创", prop: "client_status" },
-        { label: "搴斿彂宸ヨ祫", prop: "contact_name" },
-        { label: "澶囨敞", prop: "contact_phone", width: "140" }
+        { label: "宸ョ", prop: "workType", min: 100, },
+        { label: "澶囨敞", prop: "actualAttendanceDays", min: 110 }, 
       ],
       showCol: [
-        "濮撳悕",
-        "浜哄憳id",
         "鎵嬫満鍙�",
         "宸ョ",
-        "鐢熶骇宸ヨ祫",
-        "婊″嫟",
-        "瓒呮椂宸ヨ祫",
-        "鍔犵彮宸ヨ祫",
-        "浜ら�氳ˉ璐�",
-        "甯﹀緬琛ヨ创",
-        "宀椾綅琛ヨ创",
-        "绀句繚琛ヨ创",
-        "宸ラ緞琛ヨ创",
-        "涓嶈揪淇濆簳",
-        "璐ㄩ噺濂�",
-        "濂栫綒1",
-        "濂栫綒2/娓呭噳琛�",
-        "鏃ュ父妫�鏌�/濂栫綒3",
-        "鍋滄満琛ヨ创",
-        "搴斿彂宸ヨ祫",
-        "澶囨敞"
+        "澶囨敞",
       ]
     }
   },
   created() {
     this.setTable()
+    this.getData(this.keyword)
+  },
+  computed: {
   },
   methods: {
     setTable() {
       this.tableList = {
         selectIndex: true,
-        isFixed: true,
-        tableInfomation: [{ name: "寮犱笁" }, { name: "lisi" }, { name: "鐜嬩簲" }],
+        isFixed:true,
+        tableInfomation: [],
         allcol: [],
         showcol: this.showCol,
         tableColumn: this.setColumnVisible(this.showCol)
@@ -111,44 +112,135 @@
       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 getAttendanceStatistic({
+        keyword: this.keyword,
+        month:this.object.date,
+        // page: this.pagerOptions.currPage,
+        // pageSize: this.pagerOptions.pageSize
+      })
+        .then((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: "client_level" },
+                { label: "宸ョ", prop: "workType", min: 100,fixed:'left' },
+              ];
+              let tableColumn3=[
+               { label: "澶囨敞", prop: "actualAttendanceDays", min: 110 }, 
+              ]
+              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:150,
+                      default:true,
+                      isEditTd: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,
+                  ...headerItem,
+                }
+              })
+              this.tableList.tableInfomation = list || []
+              this.pagerOptions.totalCount = res.total
+            } else {
+              this.tableList.tableInfomation = []
+            }
+          } else {
+            this.tableList.tableInfomation = []
+          }
+          this.loading = false
+        })
+        .catch((err) => {
+          console.log(err)
+          this.tableList.tableInfomation = []
+          this.loading = false
+        })
     },
     // 鎼滅储
     onFilterSearch(searchText) {
-      console.log(searchText)
+      this.keyword = searchText ?? ""
+      this.pagerOptions.currPage = 1
+      this.getData()
     },
-    // 瀵煎嚭
-    exportBtnClick() {},
-    // 鍒锋柊
-    refreshBtnClick() {}
+    inputContent( prop, row, scope){
+      console.log(prop,'---',row,'---',scope)
+    },
   }
 }
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style lang="scss" scoped>
-.payableSalaryReport-container {
+.silkRegister-form {
   height: 100%;
-  .filter-card {
-    margin: 20px 30px;
+  overflow: hidden;
+  .filter {
     height: 80px;
     display: flex;
     align-items: center;
-    padding: 0 20px 0 20px;
-    border-radius: 12px;
-    background-color: #fff;
+    padding: 12px 20px 0 20px;
+    &-card {
+      height: 80px;
+      display: flex;
+      align-items: center;
+      box-sizing: border-box;
+      padding: 10px 20px;
+      flex: 1;
+      border-radius: 12px;
+      background-color: #fff;
+    }
   }
-  .body-card {
-    margin: 0 30px;
-    background-color: #fff;
-    padding: 10px 15px;
-    height: calc(100% - 180px);
+  .body {
+    box-sizing: border-box;
+    padding: 10px 20px;
+    border-radius: 12px;
+    height: calc(100% - 92px);
+    .body-card {
+      background-color: #fff;
+      border-radius: 12px;
+      height: 100%;
+      overflow: hidden;
+    }
+    .list-view {
+      height: calc(100% - 10px);
+      overflow: hidden;
+    }
+    .btn-pager {
+      display: flex;
+      margin-top: 10px;
+      .page {
+        margin-left: auto;
+      }
+    }
   }
 }
 </style>

--
Gitblit v1.8.0