Bläddra i källkod

Merge branch 'master' of http://192.168.1.160:3000/zhaohanlin/rtk-web-wms-cloud

乐菲 1 månad sedan
förälder
incheckning
33a3990b2d

+ 60 - 6
src/views/rtkwms/inrequest/InRequestForm.vue

@@ -161,7 +161,7 @@
         size="mini"
         style="margin-bottom: 10px"
         @click="add()"
-        >新增明细</el-button
+        >新增明细111</el-button
       >
       <el-table :data="formData.list" border size="mini">
         <el-table-column
@@ -184,7 +184,27 @@
           prop="materialNo"
           width="160"
           show-overflow-tooltip
-        />
+        >
+          <template v-slot="scope">
+            <el-select
+              v-model="scope.row.materialNo"
+              filterable
+              remote
+              reserve-keyword
+              placeholder="请选择物料编码"
+              :remote-method="remoteMaterialNo"
+              :loading="loading"
+              @change="changeMaterialNo"
+            >
+              <el-option
+                v-for="(item, index) in materialNoList"
+                :key="item.code"
+                :label="item.code"
+                :value="index + '-' + scope.$index"
+              />
+            </el-select>
+          </template>
+        </el-table-column>
         <el-table-column
           label="物料名称"
           align="center"
@@ -204,10 +224,10 @@
               @change="changeMaterialName"
             >
               <el-option
-                v-for="item in materialNameList"
+                v-for="(item, index) in materialNameList"
                 :key="item.code"
                 :label="item.name"
-                :value="item.code + '-' + scope.$index"
+                :value="index + '-' + scope.$index"
               />
             </el-select>
           </template>
@@ -306,6 +326,7 @@ export default {
   },
   data() {
     return {
+      materialNoList: [],
       materialNameList: [],
       sourceOrderNoList: [],
       businessDescribeList: [],
@@ -399,6 +420,24 @@ export default {
       console.log(row);
       this.formData.list.splice(row.$index, 1);
     },
+    remoteMaterialNo(query) {
+      if (query !== "") {
+        const that = this;
+        this.loading = true;
+        setTimeout(async () => {
+          this.loading = false;
+          const {
+            data: { list },
+          } = await InRequestApi.getMaterialPage({
+            code: query,
+            pageSize: 999,
+          });
+          this.materialNoList = list || [];
+        }, 200);
+      } else {
+        this.materialNoList = [];
+      }
+    },
     remoteMaterialName(query) {
       if (query !== "") {
         const that = this;
@@ -467,13 +506,28 @@ export default {
         }
       });
     },
+    changeMaterialNo(value) {
+      const data = value.split("-");
+      this.materialNoList.map((v, i) => {
+        if (i == data[0]) {
+          v.materialNo = v.code;
+          v.materialName = v.name;
+          this.formData.list[data[1]] = v;
+
+          this.formData.list = [...this.formData.list];
+        }
+      });
+    },
     changeMaterialName(value) {
       const data = value.split("-");
-      this.materialNameList.map((v) => {
-        if (v.code == data[0]) {
+      this.materialNameList.map((v, i) => {
+        console.log(i == data[0]);
+        if (i == data[0]) {
           v.materialNo = v.code;
           v.materialName = v.name;
           this.formData.list[data[1]] = v;
+
+          this.formData.list = [...this.formData.list];
         }
       });
     },

+ 58 - 5
src/views/wms/output/inrequest/components/InRequestForm.vue

@@ -184,7 +184,27 @@
           prop="materialNo"
           width="160"
           show-overflow-tooltip
-        />
+        >
+          <template v-slot="scope">
+            <el-select
+              v-model="scope.row.materialNo"
+              filterable
+              remote
+              reserve-keyword
+              placeholder="请选择物料编码"
+              :remote-method="remoteMaterialNo"
+              :loading="loading"
+              @change="changeMaterialNo"
+            >
+              <el-option
+                v-for="(item, index) in materialNoList"
+                :key="item.code"
+                :label="item.code"
+                :value="index + '-' + scope.$index"
+              />
+            </el-select>
+          </template>
+        </el-table-column>
         <el-table-column
           label="物料名称"
           align="center"
@@ -204,10 +224,10 @@
               @change="changeMaterialName"
             >
               <el-option
-                v-for="item in materialNameList"
+                v-for="(item, index) in materialNameList"
                 :key="item.code"
                 :label="item.name"
-                :value="item.code + '-' + scope.$index"
+                :value="index + '-' + scope.$index"
               />
             </el-select>
           </template>
@@ -306,6 +326,7 @@ export default {
   },
   data() {
     return {
+      materialNoList: [],
       materialNameList: [],
       sourceOrderNoList: [],
       businessDescribeList: [],
@@ -399,6 +420,36 @@ export default {
       console.log(row);
       this.formData.list.splice(row.$index, 1);
     },
+    remoteMaterialNo(query) {
+      if (query !== "") {
+        const that = this;
+        this.loading = true;
+        setTimeout(async () => {
+          this.loading = false;
+          const {
+            data: { list },
+          } = await InRequestApi.getMaterialPage({
+            code: query,
+            pageSize: 999,
+          });
+          this.materialNoList = list || [];
+        }, 200);
+      } else {
+        this.materialNoList = [];
+      }
+    },
+    changeMaterialNo(value) {
+      const data = value.split("-");
+      this.materialNoList.map((v, i) => {
+        if (i == data[0]) {
+          v.materialNo = v.code;
+          v.materialName = v.name;
+          this.formData.list[data[1]] = v;
+
+          this.formData.list = [...this.formData.list];
+        }
+      });
+    },
     remoteMaterialName(query) {
       if (query !== "") {
         const that = this;
@@ -427,11 +478,13 @@ export default {
     },
     changeMaterialName(value) {
       const data = value.split("-");
-      this.materialNameList.map((v) => {
-        if (v.code == data[0]) {
+      this.materialNameList.map((v, i) => {
+        if (i == data[0]) {
           v.materialNo = v.code;
           v.materialName = v.name;
           this.formData.list[data[1]] = v;
+
+          this.formData.list = [...this.formData.list];
         }
       });
     },