From 49bd184f8a9c5bb636cb7225647003044c617752 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 11 四月 2024 18:11:57 +0800
Subject: [PATCH] 新增产量登记表的接口联调,大概80个左右的字段调试+重组表格数据回数的一个一条数据对3条数据

---
 src/views/productManage/silkInspectForm/index.vue |  266 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 255 insertions(+), 11 deletions(-)

diff --git a/src/views/productManage/silkInspectForm/index.vue b/src/views/productManage/silkInspectForm/index.vue
index 085bcf8..42c3c14 100644
--- a/src/views/productManage/silkInspectForm/index.vue
+++ b/src/views/productManage/silkInspectForm/index.vue
@@ -1,21 +1,265 @@
 <template>
-  <div class="container"></div>
+  <div class="silkInspect-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> -->
+            <el-button size="small" type="primary" @click="printClick">鎵撳嵃</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.ID)" 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>
+  </div>
 </template>
 
 <script>
+import { getInspectCheckList, getInspectCheckDelete } from "@/api/productManage/silkInspectForm.js"
+import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+
 export default {
-  name: "silkInspectForm",
-  props: {},
-  components: {},
-  mixins: [],
-  computed: {},
-  data() {
-    return {}
+  name: "SilkInspectForm",
+  props: {
   },
-  created() {},
-  methods: {}
+  mixins: [pageMixin],
+  components: {
+  },
+  data() {
+    return {
+      tableList: {},
+      loading: false,
+      searchOptions: [],
+      keyword: '',
+      tableColumn: [
+        { label: "缂栧彿", prop: "number", min: 120, default: true }, 
+        { label: "杞﹂棿", prop: "name", min: 190, }, 
+        { label: "杞︾粍", prop: "workshopGroup", min: 100, },
+        { label: "鏃ユ湡", prop: "finishDate", min: 100 }, 
+        { label: "骞冲潎绾ゅ害", prop: "averageFineness", min: 100 }, 
+        { label: "鍏噺绾ゅ害", prop: "measureFineness", min: 130 }, 
+        { label: "鍋忓樊", prop: "deviation", min: 130 }, 
+        { label: "鎬诲樊", prop: "totalDeviation", min: 110 }, 
+        { label: "杞︾粍绛夌骇", prop: "finenessGrade", min: 110 }, 
+        { label: "娓呮磥", prop: "cleanliness", min: 110 },
+        { label: "娲佸噣", prop: "purity", min: 110 }, 
+        { label: "瑙勬牸", prop: "spec", min: 110 }, 
+      ],
+      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 getInspectCheckList({
+        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,
+                  number: item.finenessRegister.number,
+                  name: item.finenessRegister.name,
+                  workshopGroup: item.finenessRegister.workshopGroup,
+                  finishDate: item.finenessRegister.finishDate,
+                  spec:item.finenessRegister.spec,
+                }
+              })
+              this.tableList.tableInfomation = list || []
+              this.pagerOptions.totalCount = res.data.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({
+        path:"/productManage/silkRegisterForm/addPage?activeName=second",
+      });
+    },
+     // 鎵撳嵃
+     printClick(){
+
+    },
+    // 缂栬緫
+    handleClick(row) {
+      this.$router.push({
+                path:"/productManage/silkRegisterForm/addPage",
+                query:{
+                  activeName:'second',
+                  inspectID:row.ID,
+                  id:row.finenessRegisterID,
+                  number:row.number,
+                }
+              });
+    },
+    // 鍒犻櫎
+    delClick(id) {
+      debugger
+      this.$confirm("璇风‘璁ゆ槸鍚﹀垹闄わ紝鍒犻櫎鎿嶄綔涓嶅彲鎾ら攢??", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          getInspectCheckDelete({ id: 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>
+.silkInspect-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