瀏覽代碼

bug fix: 171

chris 1 年之前
父節點
當前提交
bc18fb653a
共有 1 個文件被更改,包括 9 次插入18 次删除
  1. 9 18
      src/views/modules/tech/program-add-or-update.vue

+ 9 - 18
src/views/modules/tech/program-add-or-update.vue

@@ -10,21 +10,7 @@
       <el-row>
         <el-col :span="6">
           <el-form-item label="物料名称" prop="productId">
-            <el-select
-              v-model="dataForm.productId"
-              filterable
-              remote
-              clearable
-              placeholder="请选择"
-            >
-              <el-option
-                v-for="item in materialList"
-                :key="item.materialId"
-                :label="item.materialName"
-                :value="item.materialId"
-              >
-              </el-option>
-            </el-select>
+            <product-component v-model="dataForm.productId" :product-id="dataForm.productId" @productSelected="prodSelected"/>
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -118,9 +104,10 @@
 <script>
 import { getMaterialList } from '@/api/material'
 import uploadComponent from '../common/upload-component-v2'
+import ProductComponent from '@/views/modules/common/product-component'
 export default {
   name: 'program-add-or-update',
-  components: {uploadComponent},
+  components: {ProductComponent, uploadComponent},
   data () {
     return {
       id: 0,
@@ -196,10 +183,14 @@ export default {
         }
       })
     },
-    uploadSuccess () {}
+    uploadSuccess () {},
+    prodSelected (item) {
+      this.dataForm.productId = item.value
+      this.dataForm.materialName = item.label
+    }
   }
 }
 </script>
 
 <style>
-</style>
+</style>