瀏覽代碼

no message

linwenxin 5 月之前
父節點
當前提交
05a42617f5

+ 66 - 10
src/views/partsManagement/accessoryCenterIdentity/components/center-parts-shop-in-stock-from.vue

@@ -19,7 +19,16 @@
         </el-table-column>
         <el-table-column label="配件编码" width="180">
           <template slot-scope="scope">
-            <el-select v-model="scope.row.partsNumber" placeholder="请选择" @change="update(scope.$index)">
+            <el-select
+              v-model="scope.row.partsNumber"
+              filterable
+              remote
+              reserve-keyword
+              placeholder="请输入关键词"
+              :remote-method="remoteMethod"
+              :loading="loading"
+              @change="update(scope.$index)"
+            >
               <el-option
                 v-for="item in partsList"
                 :key="item.goodsCode"
@@ -32,7 +41,16 @@
         </el-table-column>
         <el-table-column label="配件名称" width="180">
           <template slot-scope="scope">
-            <el-select v-model="scope.row.partsNumber" placeholder="请选择" @change="update(scope.$index)">
+            <el-select
+              v-model="scope.row.partsNumber"
+              filterable
+              remote
+              reserve-keyword
+              placeholder="请输入关键词"
+              :remote-method="remoteMethod2"
+              :loading="loading2"
+              @change="update(scope.$index)"
+            >
               <el-option
                 v-for="item in partsList"
                 :key="item.goodsCode"
@@ -96,7 +114,9 @@ export default {
     return {
       tableData: [{ remark: '' }],
       partsList: [],
-      records: []
+      records: [],
+      loading: false,
+      loading2: false
     }
   },
   mounted() {
@@ -104,15 +124,51 @@ export default {
       this.records = res.data
       console.log(this.records)
     })
-    listPageV2({
-      pageNum: 1,
-      pageSize: -1,
-      params: [{ param: 'a.status', compare: '=', value: 'ON' }]
-    }).then(res => {
-      this.partsList = res.data.records
-    })
+    // listPageV2({
+    //   pageNum: 1,
+    //   pageSize: -1,
+    //   params: [{ param: 'a.status', compare: '=', value: 'ON' }]
+    // }).then(res => {
+    //   this.partsList = res.data.records
+    // })
   },
   methods: {
+    remoteMethod(query) {
+      if (query !== '') {
+        this.loading = true
+        listPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.goods_code', compare: 'like', value: query }
+          ]
+        }).then(res => {
+          this.loading = false
+          this.partsList = res.data.records
+        })
+      } else {
+        this.partsList = []
+      }
+    },
+    remoteMethod2(query) {
+      if (query !== '') {
+        this.loading2 = true
+        listPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.goods_name', compare: 'like', value: query }
+          ]
+        }).then(res => {
+          this.loading2 = false
+          this.partsList = res.data.records
+        })
+      } else {
+        this.partsList = []
+      }
+    },
     add() {
       this.tableData.push({ remark: '' })
     },