From 5e9b4920000a4d02eef3b207218e3ce8d68935be Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期四, 11 七月 2024 17:47:05 +0800
Subject: [PATCH] feat:纤度登记表重构

---
 src/views/employeeManage/workKindManage/index.vue |  248 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 238 insertions(+), 10 deletions(-)

diff --git a/src/views/employeeManage/workKindManage/index.vue b/src/views/employeeManage/workKindManage/index.vue
index 6e028e7..b6a63bf 100644
--- a/src/views/employeeManage/workKindManage/index.vue
+++ b/src/views/employeeManage/workKindManage/index.vue
@@ -1,21 +1,249 @@
 <template>
-  <div class="container"></div>
+  <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"
+        >
+          <template slot="leftButton">
+            <el-button size="small" type="primary" @click="addBtnClick">鏂板</el-button>
+          </template>
+        </CommonSearch>
+      </div>
+    </div>
+
+    <div class="body">
+      <div class="body-card">
+        <div class="list-view">
+          <TableCommonView
+            ref="tableListRef"
+            v-loading="loading"
+            :table-list="tableList"
+            @selTableCol="selTableCol"
+          >
+            <template slot="tableButton">
+              <el-table-column label="鎿嶄綔" width="90" fixed="right">
+                <template slot-scope="scope">
+                  <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button>
+                  <el-button @click="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
+                </template>
+              </el-table-column>
+            </template>
+          </TableCommonView>
+        </div>
+        <div class="btn-pager">
+          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+        </div>
+      </div>
+    </div>
+    <AddWorkKind ref="addWorkKind" :editRow="editRow"  @refresh="shutdown" />
+  </div>
 </template>
 
 <script>
+import { getWorkTypeList, deleteWorkTypeInfo } from "@/api/employeeManage/employeeInfo.js"
+import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import AddWorkKind from  "@/views/employeeManage/workKindManage/components/AddWorkKind"
 export default {
   name: "workKindManage",
-  props: {},
-  components: {},
-  mixins: [],
-  computed: {},
-  data() {
-    return {}
+  props: {
   },
-  created() {},
-  methods: {}
+  mixins: [pageMixin],
+  components: {
+    AddWorkKind,
+  },
+  data() {
+    return {
+      tableList: {},
+      loading: false,
+      searchOptions: [],
+      editRow: {
+        title: "鏂板缓",
+      },
+      keyWord: '',
+      tableColumn: [
+        { label: "宸ョ鍚嶇О", prop: "workName", min: 120, default: true }, // 涓婚
+        { label: "淇濆簳宸ヨ祫(鍏�/澶�)", prop: "guaranteedWages", min: 180, }, // 瀹㈡埛鍚嶇О
+        { label: "钖祫鏂规", prop: "salaryPlansName", min: 130, }, // 鑱旂郴浜哄鍚�
+        { label: "娣诲姞鏃堕棿", prop: "createTime", width: 130 }, // 瀹㈡埛鐘舵��
+        { label: "娣诲姞浜�", prop: "addPeople", min: 100 }, // 鑱旂郴鏂瑰紡
+      ],
+      showCol: [
+        "宸ョ鍚嶇О",
+        "淇濆簳宸ヨ祫(鍏�/澶�)",
+        "钖祫鏂规",
+        "娣诲姞鏃堕棿",
+        "娣诲姞浜�",
+      ]
+    }
+  },
+  created() {
+    this.setTable()
+    this.getData(this.keyWord)
+  },
+  computed: {
+  },
+  methods: {
+    setTable() {
+      this.tableList = {
+        selectIndex: true,
+        tableInfomation: [],
+        allcol: [],
+        showcol: this.showCol,
+        tableColumn: this.setColumnVisible(this.showCol)
+      }
+      this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
+      this.searchOptions = []
+      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
+        const label = this.tableList.tableColumn[i].label
+        const value = this.tableList.tableColumn[i].prop
+        this.searchOptions.push({ value: value, label: label })
+      }
+    },
+    setColumnVisible(showCol) {
+      return this.tableColumn.map((ele) => {
+        return {
+          ...ele,
+          isShowColumn: showCol.includes(ele.label)
+        }
+      })
+    },
+    selTableCol(val) {
+      this.showcol = val
+      this.tableList.tableColumn = this.setColumnVisible(val)
+    },
+    // 璇锋眰鏁版嵁
+    async getData() {
+      this.loading = true
+      await getWorkTypeList({
+        keyWord: this.keyWord,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      })
+        .then((res) => {
+          if (res.code === 200) {
+            if (res.data && res.data.length > 0) {
+              const list = res.data.map((item) => {
+                let salaryPlansName=''
+                if(item.salaryPlans&&item.salaryPlans.length>0){
+                  for(let i in item.salaryPlans){
+                    if(item.salaryPlans[i].name){
+                      salaryPlansName=salaryPlansName+(salaryPlansName?'+':'')+item.salaryPlans[i].name
+                    }
+                  }
+                }
+                return {
+                  ...item,
+                  salaryPlansName:salaryPlansName,
+                }
+              })
+              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) {
+      this.keyWord = searchText ?? ""
+      this.pagerOptions.currPage = 1
+      this.getData()
+    },
+    shutdown() {
+      this.getData();
+    },
+    // 鏂板缓
+    addBtnClick() {
+      this.editRow = { title:'鏂板缓',type:'add' }
+      this.$refs.addWorkKind.islook = true;
+    },
+    // 缂栬緫
+    handleClick(row) {
+      let config=JSON.parse(JSON.stringify(row));
+      this.editRow = { ...config, title:'缂栬緫',type:'edit',id:row.ID, }
+      this.$refs.addWorkKind.islook = true;
+    },
+    // 鍒犻櫎
+    delClick(row) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          deleteWorkTypeInfo({ id: row.ID }).then((response) => {
+            if (response.code === 200) {
+              this.$message.success("鍒犻櫎鎴愬姛")
+              this.getData()
+            } else {
+              this.$message.warning("鍒犻櫎澶辫触")
+            }
+          })
+        })
+        .catch(() => {})
+    },
+  }
 }
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.silkRegister-form {
+  height: 100%;
+  overflow: hidden;
+  .filter {
+    height: 80px;
+    display: flex;
+    align-items: center;
+    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 {
+    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% - 60px);
+      overflow: hidden;
+    }
+    .btn-pager {
+      display: flex;
+      margin-top: 10px;
+      .page {
+        margin-left: auto;
+      }
+    }
+  }
+}
+</style>

--
Gitblit v1.8.0