瀏覽代碼

出入库管理

chrislee 1 年之前
父節點
當前提交
23ee7282f5

+ 13 - 2
src/views/modules/common/material-component.vue

@@ -30,6 +30,10 @@
         type: String,
         default: ''
       },
+      materialType: {
+        type: String,
+        default: ''
+      },
       bizType: {
         type: String,
         default: ''
@@ -57,6 +61,10 @@
     watch: {
       materialId (value) {
         this.value = value
+      },
+      materialType (value) {
+        this.options = []
+        this.getList()
       }
     },
     mounted () {
@@ -79,7 +87,8 @@
           params: this.$http.adornParams({
             'current': this.current,
             'size': this.size,
-            'materialName': this.name
+            'materialName': this.name,
+            'materialTypeId': this.materialType
           })
         }).then(({data}) => {
           if (data && data.code === '200') {
@@ -133,7 +142,9 @@
           this.value = null
         }
         let selectedItem = this.options.find(item1 => item1.value === item)
-        selectedItem.buttonType = '0'
+        if (selectedItem) {
+          selectedItem.buttonType = '0'
+        }
         // console.log(JSON.stringify(selectedItem))
         this.$emit('materialSelected', selectedItem)
       },

+ 9 - 7
src/views/modules/warehouse/stock-order-inbound.vue

@@ -23,24 +23,26 @@
               </el-col>
             </el-row>
             <el-row class="my-row">
+              <el-col :span="8" style="padding-left: 20px">
+                <el-form-item label="类别" prop="materialTypeId" :rules="{required: false, message: '类别不能为空', trigger: 'blur'}">
+                  <!--                  <el-input v-if="!item.buttonType || item.buttonType === '0'" v-model="item.categoryName" :disabled="true" style="width: 200px"></el-input>-->
+                  <material-type-component v-model="item.materialTypeId" :type-id.sync="item.materialTypeId"></material-type-component>
+                </el-form-item>
+              </el-col>
               <el-col :span="8">
                 <el-form-item label="名称" prop="materialId" :rules="{required: false, message: '名称不能为空', trigger: 'blur'}">
                   <el-input v-if="item.buttonType === '1'" placeholder="请输入" v-model="item.materialName"
                             :disabled="display" @blur="blurMaterialName(item)" style="width: 200px; margin-right: 10px"/>
                   <material-component v-else
                                       v-model="dataList[index]"
-                                      :material-id="item.materialId" biz-type="in">
+                                      :material-id="item.materialId"
+                                      :material-type="item.materialTypeId"
+                                      biz-type="in">
                   </material-component>
                   <el-button v-show="item.buttonType && item.buttonType === '1'" @click="changeButtonType(item, 0)" type="danger">选择</el-button>
                   <el-button v-show="!item.buttonType || item.buttonType === '0'" @click="changeButtonType(item, 1)" type="danger">输入</el-button>
                 </el-form-item>
               </el-col>
-              <el-col :span="8" style="padding-left: 20px">
-                <el-form-item label="类别" prop="materialTypeId" :rules="{required: false, message: '类别不能为空', trigger: 'blur'}">
-<!--                  <el-input v-if="!item.buttonType || item.buttonType === '0'" v-model="item.categoryName" :disabled="true" style="width: 200px"></el-input>-->
-                  <material-type-component v-model="item.materialTypeId" :type-id.sync="item.materialTypeId"></material-type-component>
-                </el-form-item>
-              </el-col>
               <el-col :span="8" style="padding-left: 20px">
                 <el-form-item label="入库依据类别" prop="sourceCategory" :rules="{required: false, message: '类别不能为空', trigger: 'blur'}">
                   <el-select v-model="item.sourceCategory" placeholder="请选择" :disabled="true">

+ 10 - 7
src/views/modules/warehouse/stock-order-outbound.vue

@@ -13,20 +13,22 @@
         <template v-for="(item, index) in dataList">
           <div :key="index" class="my-line">
             <el-row class="my-row">
+              <el-col :span="8" style="padding-left: 20px">
+                <el-form-item label="类别" prop="cateId">
+<!--                  <el-input v-model="item.categoryName" :disabled="true" placeholder="类别"></el-input>-->
+                  <material-type-component v-model="item.materialTypeId" :type-id.sync="item.materialTypeId"></material-type-component>
+                </el-form-item>
+              </el-col>
               <el-col :span="8">
                 <el-form-item label="名称" prop="materialName">
                   <el-input v-if="id"  v-model="item.materialName" :disabled="true" style="width: 200px; margin-right: 10px"/>
                   <material-component v-else
                                       v-model="dataList[index]"
-                                      :material-id.sync="item.materialId">
+                                      :material-id.sync="item.materialId"
+                                      :material-type.sync="item.materialTypeId">
                   </material-component>
                 </el-form-item>
               </el-col>
-              <el-col :span="8" style="padding-left: 20px">
-                <el-form-item label="类别" prop="cateId">
-                  <el-input v-model="item.categoryName" :disabled="true" placeholder="类别"></el-input>
-                </el-form-item>
-              </el-col>
               <el-col :span="8" style="text-align: right;">
                 <el-button @click="removeOne(index)" type="danger" icon="el-icon-delete" circle style="padding: 6px"></el-button>
               </el-col>
@@ -74,9 +76,10 @@
   import {getBoundDetails, outboundBatch, updateBatch} from '@/api/warehouse'
   import {getUUID} from '../../../utils'
   import MaterialComponent from '../common/material-component'
+  import MaterialTypeComponent from "@/views/modules/common/material-type-component.vue";
   export default {
     name: 'stock-order-inbound',
-    components: {MaterialComponent, DictSelect, UserComponent},
+    components: {MaterialTypeComponent, MaterialComponent, DictSelect, UserComponent},
     data () {
       return {
         visible: false,