From 544f30e28a3d8ea41e5ea8c0add2ce77c1b6fb1a Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期二, 07 五月 2024 17:48:31 +0800
Subject: [PATCH] 工种管理模块 编辑工种接口400的问题修改+增加如果启用不达标保底,则必须输入保底工资的逻辑

---
 src/views/productManage/productRegisterForm/index.vue |  173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 168 insertions(+), 5 deletions(-)

diff --git a/src/views/productManage/productRegisterForm/index.vue b/src/views/productManage/productRegisterForm/index.vue
index db864a0..d92f382 100644
--- a/src/views/productManage/productRegisterForm/index.vue
+++ b/src/views/productManage/productRegisterForm/index.vue
@@ -3,31 +3,176 @@
     <div class="filter-card">
       <CommonSearch :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="addBtnClick">鏂板</el-button>
         </template>
       </CommonSearch>
+    </div>
+    <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="180">
+              <template slot-scope="scope">
+                <el-button @click="editClick(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>
 </template>
 
 <script>
+import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import { getYieldRegisterList,deleteYieldRegister } from "@/api/productManage/productRegisterForm.js"
 export default {
   name: "productRegisterForm",
   props: {},
   components: {},
-  mixins: [],
+  mixins: [pageMixin],
   computed: {},
   data() {
-    return {}
+    return {
+      loading: false,
+      tableList: {},
+      keyword: '',
+      tableColumn: [
+        { label: "缂栧彿", prop: "number", min: 100, default: true },
+        { label: "鐢熶骇鏃堕棿", prop: "createTime", min: 110, },
+        { label: "杞︾粍", prop: "groupNumber" },
+        { label: "瑙勬牸", prop: "spec", min: 90 },
+        { label: "杞﹂棿", prop: "workshopName", min: 200 },
+        { label: "搴勫彛", prop: "marketName" },
+        { label: "鍥炴暟", prop: "circle",},
+        { label: "杞︾粍鎬讳骇閲�", prop: "total" }
+      ],
+      showCol: ["缂栧彿", "鐢熶骇鏃堕棿", "杞︾粍", "瑙勬牸", "杞﹂棿", "搴勫彛", "鍥炴暟", "杞︾粍鎬讳骇閲�"]
+    }
   },
-  created() {},
-  methods: {}
+  created() {
+    this.setTable()
+    this.getData(this.keyword)
+  },
+  methods: {
+    setTable() {
+      this.tableList = {
+        selectIndex: false,
+        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 getYieldRegisterList({
+        keyword: this.keyword,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      })
+        .then((res) => {
+          console.log(res)
+          if (res.code === 200) {
+            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 =  res.data || []
+              this.pagerOptions.totalCount = res.count
+            } 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()
+    },
+    // 鏂板
+    addBtnClick() {
+      this.$router.push({ name: "addProductRegisterPage" })
+    },
+    // 缂栬緫
+    editClick(row) {
+      this.$router.push({
+         name:'addProductRegisterPage',
+         query:{
+            id:row.ID,
+            number:row.number,
+          }
+        });
+    },
+    // 鍒犻櫎
+    delClick(row) {
+      this.$confirm("璇风‘璁ゆ槸鍚﹀垹闄わ紝鍒犻櫎鎿嶄綔涓嶅彲鎾ら攢?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          deleteYieldRegister({ number: row.number }).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>
 .productRegisterForm-container {
+  height: 100%;
   .filter-card {
     margin: 20px 30px;
     height: 80px;
@@ -37,5 +182,23 @@
     border-radius: 12px;
     background-color: #fff;
   }
+  .body-card {
+    margin: 0 30px;
+    background-color: #fff;
+    padding: 10px 15px;
+    height: calc(100% - 160px);
+    border-radius: 12px;
+  }
+    .list-view {
+      height: calc(100% - 60px);
+      overflow: hidden;
+    }
+    .btn-pager {
+      display: flex;
+      margin-top: 10px;
+      .page {
+        margin-left: auto;
+      }
+    }
 }
 </style>

--
Gitblit v1.8.0