From e8b239efa63361a8984810bf9b4047981b98050c Mon Sep 17 00:00:00 2001
From: yuyu <1981343953@qq.com>
Date: 星期三, 16 八月 2023 17:17:18 +0800
Subject: [PATCH] 8.16提交 原材料报检 角色管理

---
 src/views/inspectionManagement/reportForInspection/index.vue |  175 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 98 insertions(+), 77 deletions(-)

diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index 84cdfb4..3ff10a1 100644
--- a/src/views/inspectionManagement/reportForInspection/index.vue
+++ b/src/views/inspectionManagement/reportForInspection/index.vue
@@ -37,18 +37,16 @@
               </el-input>
             </el-form-item>
             <el-form-item>
-              <el-button type="primary">鏌ヨ</el-button>
-              <el-button type="primary" plain>閲嶇疆</el-button>
+              <el-button type="primary" @click="search">鏌ヨ</el-button>
+              <el-button type="primary" plain @click="reset">閲嶇疆</el-button>
             </el-form-item>
             </el-form>
         </div>
         <div class="library-table">
           <div class="table-header">
             <div class="search-bar">
-              <el-radio-group v-model="radioValue">
-                <el-radio-button label="鍏ㄩ儴" />
-                <el-radio-button label="寰呮楠�" />
-                <el-radio-button label="宸叉楠�" />
+              <el-radio-group v-model="radioValue" @change="radioclick">
+                <el-radio-button v-for="option in radioOptions" :key="option.value" :label="option.value">{{ option.label }}</el-radio-button>
               </el-radio-group>
             </div>
             <div class="generateInsp">
@@ -66,7 +64,6 @@
             >
               <el-table-column
                 type="selection"
-                label=""
                 min-width="10%"
               /> 
               <el-table-column
@@ -75,27 +72,27 @@
                 min-width="8%"
               />
               <el-table-column
-                prop="date"
+                prop="createTime"
                 label="鏉ユ枡鏃ユ湡"
                 min-width="8%"
               />
               <el-table-column
-                prop="providerName"
+                prop="supplierName"
                 label="渚涘簲鍟嗗悕绉�"
                 min-width="12%"
               />
               <el-table-column
-                prop="code"
+                prop="materialCoding"
                 label="鏉愭枡缂栫爜"
                 min-width="8%"
               />
               <el-table-column
-                prop="name"
+                prop="materialName"
                 label="鏉愭枡鍚嶇О"
                 min-width="8%"
               />
               <el-table-column
-                prop="modelandspecification"
+                prop="specificationsModels"
                 label="瑙勬牸鍨嬪彿"
                 min-width="12%"
               />
@@ -105,33 +102,33 @@
                 min-width="5%"
               />
               <el-table-column
-                prop="amount"
+                prop="quantity"
                 label="鏁伴噺"
                 min-width="5%"
               />
               <el-table-column
-                prop="commisiondate"
+                prop="inspectionDate"
                 label="鎶ユ鏃ユ湡"
                 min-width="8%"
               />
               <el-table-column
-                prop="person"
+                prop="surveyor"
                 label="妫�楠屼汉"
                 min-width="8%"
               />
               <el-table-column
-                prop="checkdate"
+                prop="dateSurvey"
                 label="妫�楠屾棩鏈�"
                 min-width="8%"
               />
               <el-table-column
-                prop="state"
+                prop="condition"
                 label="鐘舵��"
                 min-width="8%"
               >
               <template slot-scope="scope">
-                <span :style="{ color: scope.row.state === '宸叉娴�' ? 'green' : 'red' }">
-                  {{ scope.row.state }}
+                <span :style="{ color: scope.row.condition === 1 ? 'green' : 'red' }">
+                  {{ scope.row.condition === 1 ? '宸叉娴�':'鏈娴�' }}
                 </span>
               </template>
               </el-table-column>
@@ -142,10 +139,10 @@
                 @size-change="handleSizeChange"
                 @current-change="handleCurrentChange"
                 :current-page="currentPage"
-                :page-sizes="[100, 200, 300, 400]"
-                :page-size="100"
+                :page-sizes="[5, 10, 15, 20]"
+                :page-size="pageSize"
                 layout="total, sizes, prev, pager, next, jumper"
-                :total="400">
+                :total="total">
               </el-pagination>
             </div>
           </div>
@@ -154,6 +151,7 @@
 </template>
 
 <script>
+import {getRawMaterialList } from '@/api/inspection/rawmaterial'
 export default {
   data() {
     return {
@@ -165,79 +163,102 @@
         date: ''
       },
       options: [{
-        value: '1',
-        label: '閮ㄩ棬1'
+        value: 0,
+        label: '鍏ㄩ儴'
       }, {
-        value: '2',
-        label: '閮ㄩ棬2'
+        value: 1,
+        label: '宸叉楠�'
       }, {
-        value: '3',
-        label: '閮ㄩ棬3'
+        value: 2,
+        label: '鏈楠�'
       }],
-      radioValue: '',
+      radioOptions:[{
+        label: '鍏ㄩ儴',
+        value: 0
+      },{
+        value: 1,
+        label: '宸叉楠�'
+      },{
+        value: 2,
+        label: '寰呮楠�'
+      }],
+      radioValue: 0,
       inspectionTable: [{
-        date: '2023-07-28',
-        providerName: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-        code: 'BP214274',
-        name: '閾濆寘閽㈢粸绾�',
-        modelandspecification: 'JLHA/G1A-185/30-26/7',
+        createTime: '2023-07-28',
+        supplier_name: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
+        materialCoding: 'BP214274',
+        materialName: '閾濆寘閽㈢粸绾�',
+        specificationsModels: 'JLHA/G1A-185/30-26/7',
         unit: '鍚�',
-        amount: '21',
-        commisiondate: '2023-08-02',
-        person: '榛勫皬鏄�',
-        checkdate: '2023-12-09',
-        state: '宸叉娴�'
-      }, {
-        date: '2023-07-28',
-        providerName: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-        code: 'BP214274',
-        name: '閾濆寘閽㈢粸绾�',
-        modelandspecification: 'JLHA/G1A-185/30-26/7',
-        unit: '鍚�',
-        amount: '21',
-        commisiondate: '2023-08-02',
-        person: '榛勫皬鏄�',
-        checkdate: '2023-12-09',
-        state: '寰呮娴�'
-      }, {
-        date: '2023-07-28',
-        providerName: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-        code: 'BP214274',
-        name: '閾濆寘閽㈢粸绾�',
-        modelandspecification: 'JLHA/G1A-185/30-26/7',
-        unit: '鍚�',
-        amount: '21',
-        commisiondate: '2023-08-02',
-        person: '榛勫皬鏄�',
-        checkdate: '2023-12-09',
-        state: '宸叉娴�'
-      }, {
-        date: '2023-07-28',
-        providerName: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-        code: 'BP214274',
-        name: '閾濆寘閽㈢粸绾�',
-        modelandspecification: 'JLHA/G1A-185/30-26/7',
-        unit: '鍚�',
-        amount: '21',
-        commisiondate: '2023-08-02',
-        person: '榛勫皬鏄�',
-        checkdate: '2023-12-09',
-        state: '寰呮娴�'
+        quantity: 21,
+        dateSurvey: '2023-08-02',
+        surveyor: '榛勫皬鏄�',
+        inspectionDate: '2023-12-09',
+        condition: 1
       }],
-      currentPage: 0
+      currentPage: 1,
+      pageSize: 5,
+      total:20,
+      data: ''
     }
   },
+  created(){
+    this.getRawMaterialList()
+  },
   methods: {
+    // 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁
+    async getRawMaterialList(){
+      const res = await getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize})
+      // console.log(res)
+      this.inspectionTable = res.data.row
+      this.data = res.data.row
+      this.total = res.data.total
+    },
+    async search(){
+      this.radioValue = this.searchData.state
+      const res = await getRawMaterialList({condition: this.searchData.state,
+        createTime:this.searchData.date,
+        materialCoding:this.searchData.code,
+        materialName: this.searchData.name,
+        pageNo: this.currentPage,
+        pageSize: this.pageSize
+      })
+      // console.log(res)
+      this.inspectionTable = res.data.row
+      this.data = res.data.row
+      this.total = res.data.total
+    },
+    reset(){
+      this.searchData = {
+        code: '',
+        name: '',
+        state: '',
+        date: ''
+      }
+      this.getRawMaterialList()
+    },
+    radioclick(){
+      this.searchData.state = this.radioValue
+      // console.log(this.radioValue)
+      this.inspectionTable = this.data.filter((item)=>{
+        return item.condition === this.radioValue
+      })
+      if(this.radioValue === 0){
+        this.inspectionTable = this.data
+      }
+      this.total = this.inspectionTable.length
+    },
     // 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣
     handleSizeChange(val) {
       console.log(`姣忛〉 ${val} 鏉)
-      this.currentPage = 1
       this.pageSize = val
+      this.getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize})
     },
     // 褰撳墠椤垫敼鍙樻椂瑙﹀彂 璺宠浆鍏朵粬椤�
     handleCurrentChange(val) {
       console.log(`褰撳墠椤�: ${val}`)
       this.currentPage = val
+      this.getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize})
     }
   }
 }

--
Gitblit v1.9.3