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

---
 src/views/employeeSalary/apprenticeshipManage/index.vue |  119 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 85 insertions(+), 34 deletions(-)

diff --git a/src/views/employeeSalary/apprenticeshipManage/index.vue b/src/views/employeeSalary/apprenticeshipManage/index.vue
index 395aae8..ef15e92 100644
--- a/src/views/employeeSalary/apprenticeshipManage/index.vue
+++ b/src/views/employeeSalary/apprenticeshipManage/index.vue
@@ -4,8 +4,7 @@
       <CommonSearch ref="searchRef" :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch">
         <template slot="leftButton">
           <el-button size="small" type="primary" @click="addBtnClick" >鏂板</el-button>
-          <el-button size="small" type="primary" @click="refreshClick">鍒锋柊</el-button>
-          <el-button size="small" type="primary" @click="printClick">鎵撳嵃</el-button>
+          <!-- <el-button size="small" type="primary" @click="exportClick">瀵煎叆</el-button> -->
         </template>
       </CommonSearch>
     </div>
@@ -14,15 +13,14 @@
         <TableCommonView
           :table-list="tableList"
           @selTableCol="selTableCol"
-          @handleShow="handleShow"
           @tableRowClick="tableRowClick"
+          v-loading="loading"
         >
           <template slot="tableButton">
             <el-table-column label="鎿嶄綔" width="180">
               <template slot-scope="scope">
-                <el-button @click.stop="handleClick(scope.row, '鏌ョ湅')" type="text" size="small">鏌ョ湅</el-button>
                 <el-button @click.stop="handleClick(scope.row, '淇敼')" type="text" size="small">淇敼</el-button>
-                <el-button @click.stop="handleClick(scope.row, '鍒犻櫎')" type="text" size="small">鍒犻櫎</el-button>
+                <el-button @click.stop="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
                 
               </template>
             </el-table-column>
@@ -30,7 +28,8 @@
         </TableCommonView>
       </div>
       <AddDialog 
-        :editDiaConfig="editConfig"
+       ref="add"
+        :editRow="editRow"  @refresh="refreshClick"
       />
       <div class="btn-pager">
         <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -40,8 +39,11 @@
 </template>
 
 <script>
+import { getMentorList, deleteMentorInfo } from "@/api/employeeSalary/apprenticeshipManage.js"
 import AddDialog from "@/views/employeeSalary/apprenticeshipManage/components/addDialog.vue"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import Date from "@/api/date";
+const { formatDate2 } = Date;
 export default {
   name: "apprenticeshipManage",
   props: {},
@@ -51,23 +53,17 @@
   data() {
     return {
       tableList: {},
-      showCol: ["杞﹂棿", "缁勫埆", "寮�濮嬭溅鍙�", "缁撴潫杞﹀彿", "鍗婅溅鏍囧織", "澶囨敞"],
+      showCol: ["鏈堜唤", "鍛樺伐缂栫爜", "鍛樺伐濮撳悕", "甯﹀緬澶╂暟", "娣诲姞鏃堕棿", "娣诲姞浜�"],
       tableColumn: [
-        // { label: "杞﹂棿", prop: "workshopNumber",iconRight:"el-icon-setting"},
-        { label: "杞﹂棿", prop: "workshopNumber",},
-        { label: "缁勫埆", prop: "groupNumber", },
-        { label: "寮�濮嬭溅鍙�", prop: "startCarNumber" },
-        { label: "缁撴潫杞﹀彿", prop: "endCarNumber" },
-        { label: "鍗婅溅鏍囧織", prop: "carFlag",isCallMethod: true, getCallMethod: this.getStatusCarFlag },
-        { label: "澶囨敞", prop: "notes", },
+        { label: "鏈堜唤", prop: "month",min:90,},
+        { label: "鍛樺伐缂栫爜", prop: "workerId", min:120,},
+        { label: "鍛樺伐濮撳悕", prop: "name" },
+        { label: "甯﹀緬澶╂暟", prop: "days" , min:110,},
+        { label: "娣诲姞鏃堕棿", prop: "created_at", min:140, },
+        { label: "娣诲姞浜�", prop: "creator", },
       ],
-      editConfig:{
-        visible:false,
-        infomitton:{
-          TabsIndex:0,
-          workshopId:null,
-        }
-      },
+      editRow:{},
+      loading: false,
       getDataParams: {
         keyWord: '',
       },
@@ -75,6 +71,7 @@
   },
   created() {
     this.setTable()
+    this.getData(this.getDataParams.keyWord)
   },
   methods: {
     setTable() {
@@ -109,35 +106,89 @@
       this.showcol = val
       this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
     },
+    // 璇锋眰鏁版嵁
+    async getData() {
+      this.loading = true
+      await getMentorList({
+        keyWord:this.getDataParams.keyWord,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      })
+        .then((res) => {
+          if (res.code === 200) {
+            if (res.data) {
+              const list = res.data.map(item=>{
+                return {
+                  ...item,
+                  name:item.worker?item.worker.name:'',
+                  created_at:item.CreatedAt?formatDate2(item.CreatedAt).split(' ')[0]:''
+                }
+              })
+              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
+        })
+    },
     // 鏂板
     addBtnClick() {
-      this.editConfig.infomitton={}
-      this.editConfig.dialogTitle="鏂板"
-      this.editConfig.visible=true
+      this.editRow = { title:'鏂板缓',type:'add' }
+      this.$refs.add.islook = true;
     },
     // 鎼滅储
     onFilterSearch(searchText) {
       this.getDataParams.keyWord = searchText,
-        this.getData()
+      this.pagerOptions.currPage = 1
+      this.getData()
     },
     // 鍒锋柊
     refreshClick() {
-      this.getDataParams.keyWord = ""
-      this.pagerOptions.currPage = 1
-      this.pagerOptions.pageSize = 15
-      // this.$refs.searchRef.searchInput = ""
       this.getData()
     },
     // 鎵撳嵃
-    printClick() { },
-    // 缁勫埆
-    handleShow() {
-
-    },
+    exportClick() { },
     // 琛ㄦ牸琛岀偣鍑�
     tableRowClick(row) {
       console.log(row, "row")
     },
+     // 缂栬緫
+     handleClick(row) {
+      let config=JSON.parse(JSON.stringify(row));
+      this.editRow = { 
+        ...config, 
+        title:'缂栬緫',
+        type:'edit',
+        id:config.ID
+      }
+      this.$refs.add.islook = true;
+    },
+    // 鍒犻櫎
+    delClick(row) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          deleteMentorInfo({ id: row.ID }).then((response) => {
+            if (response.code === 200) {
+              this.$message.success("鍒犻櫎鎴愬姛")
+              this.getData()
+            }
+          })
+        })
+        .catch(() => {})
+    },
   }
 }
 </script>

--
Gitblit v1.8.0