From 52fc68b64212289b1ec7483e9fbcc7f5d14965ba Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 25 四月 2024 16:34:06 +0800
Subject: [PATCH] 配置生丝标准的前端开发+输入常量的前端开发+配置满勤奖的前端开发

---
 src/views/employeeSalary/salaryPlan/index.vue |  122 ++++++++++++++++++++++++++++++----------
 1 files changed, 91 insertions(+), 31 deletions(-)

diff --git a/src/views/employeeSalary/salaryPlan/index.vue b/src/views/employeeSalary/salaryPlan/index.vue
index 732c3c1..21c5787 100644
--- a/src/views/employeeSalary/salaryPlan/index.vue
+++ b/src/views/employeeSalary/salaryPlan/index.vue
@@ -12,15 +12,13 @@
         <TableCommonView
           :table-list="tableList"
           @selTableCol="selTableCol"
-          @handleShow="handleShow"
           @tableRowClick="tableRowClick"
         >
           <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="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>
@@ -28,7 +26,7 @@
         </TableCommonView>
       </div>
       <AddDialog 
-        :editDiaConfig="editConfig"
+      ref="add" :editRow="editRow"  @refresh="refresh" 
       />
       <div class="btn-pager">
         <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -40,6 +38,7 @@
 <script>
 import AddDialog from "@/views/employeeSalary/salaryPlan/components/addDialog.vue"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import { getSalaryPlanList, deleteSalaryPlanInfo } from  "@/api/employeeSalary/salaryPlan.js"
 export default {
   name: "salaryPlan",
   props: {},
@@ -51,29 +50,21 @@
       tableList: {},
       showCol: ["鏂规鍚嶇О", "宸ョ", "钖祫绫诲瀷", "璁¤垂鍛ㄦ湡", "璁¤垂鍏紡瀹氫箟", "娣诲姞鏃堕棿", "娣诲姞浜�"],
       tableColumn: [
-        // { label: "杞﹂棿", prop: "workshopNumber",iconRight:"el-icon-setting"},
-        { label: "鏂规鍚嶇О", prop: "workshopNumber",},
-        { label: "宸ョ", prop: "groupNumber", },
-        { label: "钖祫绫诲瀷", prop: "startCarNumber" },
-        { label: "璁¤垂鍛ㄦ湡", prop: "endCarNumber" },
-        { label: "璁¤垂鍏紡瀹氫箟", prop: "carFlag", },
-        { label: "娣诲姞鏃堕棿", prop: "notes", },
-        { label: "娣诲姞浜�", prop: "notes", },
+        { label: "鏂规鍚嶇О", prop: "name",min:110},
+        { label: "宸ョ", prop: "workTypeNames",min:100 },
+        { label: "钖祫绫诲瀷", prop: "salaryType",min:110 },
+        { label: "璁¤垂鍛ㄦ湡", prop: "cycle",min:110 },
+        { label: "璁¤垂鍏紡瀹氫箟", prop: "salaryFormula",min:140  },
+        { label: "娣诲姞鏃堕棿", prop: "createTime",min:130 },
+        { label: "娣诲姞浜�", prop: "addPeople",min:110 },
       ],
-      editConfig:{
-        visible:false,
-        infomitton:{
-          TabsIndex:0,
-          workshopId:null,
-        }
-      },
-      getDataParams: {
-        keyWord: '',
-      },
+      keyword: '',
+      editRow:{},
     }
   },
   created() {
     this.setTable()
+    this.getData(this.keyword)
   },
   methods: {
     setTable() {
@@ -108,25 +99,94 @@
       this.showcol = val
       this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
     },
+    // 璇锋眰鏁版嵁
+    async getData() {
+      this.loading = true
+      await getSalaryPlanList({
+        keyword: this.keyword,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      })
+        .then((res) => {
+          if (res.code === 200) {
+            if (res.data) {
+              const list = res.data.map(item=>{
+                let workTypeNames=''
+                if(item.workTypes){
+                  for(let i in item.workTypes){
+                    workTypeNames=workTypeNames+','+item.workTypeNames[i].name
+                  }
+                }
+                return {
+                  ...item,
+                  workTypeNames:workTypeNames
+                }
+              })
+              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.keyword= searchText,
+      this.pagerOptions.currPage = 1
+      this.getData()
     },
-    // 缁勫埆
-    handleShow() {
-
+    refresh(){
+      this.getData()
     },
     // 琛ㄦ牸琛岀偣鍑�
     tableRowClick(row) {
       console.log(row, "row")
     },
+    // 缂栬緫
+    handleClick(row) {
+      let config=JSON.parse(JSON.stringify(row));
+      this.editRow = { ...config, 
+        title:'缂栬緫',
+        type:'edit',
+        workTypeObj:{
+          value:config.workTypeId,
+          label:config.workType,
+        } 
+      }
+      this.$refs.add.islook = true;
+    },
+    // 鍒犻櫎
+    delClick(row) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          deleteSalaryPlanInfo({ id: row.id }).then((response) => {
+            if (response.code === 200) {
+              this.$message.success("鍒犻櫎鎴愬姛")
+              this.getData()
+            }
+          })
+        })
+        .catch(() => {})
+    },
+
   }
 }
 </script>

--
Gitblit v1.8.0