瀏覽代碼

【新增】预留单-预留仓库选择

莫绍宝 3 年之前
父節點
當前提交
10fd62cb3b

+ 9 - 0
src/api/supply/reserve.js

@@ -70,4 +70,13 @@ export function checkMaterialList(params) {
     method: 'get',
     params
   })
+}
+
+// 获取仓库列表
+export function getWarehouseList(params) {
+  return request({
+    url: '/stock/manager/listStock',
+    method: 'get',
+    params
+  })
 }

+ 1 - 0
src/views/supply/reserve/components/reserve_detail.vue

@@ -59,6 +59,7 @@
           <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="预留数量" prop="reservedNum" min-width="100" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="预留仓库" prop="correspondName" min-width="100" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="备注" prop="reservedRemark" min-width="160" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="修改人" prop="updateBy" min-width="100" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="修改时间" prop="updateTime" min-width="160" show-overflow-tooltip></el-table-column>

+ 32 - 2
src/views/supply/reserve/components/reserve_form.vue

@@ -123,6 +123,15 @@
           </template>
         </el-table-column>
         <el-table-column align="center" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+
+        <el-table-column align="center" label="预留仓库" prop="correspondId" min-width="160" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-select v-model="scope.row.correspondId" placeholder="选择预留仓库" size="small" clearable @change="changeWarehouse(scope.$index)">
+              <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
+            </el-select>
+          </template>
+        </el-table-column>
+
         <el-table-column align="center" label="备注" prop="reservedRemark" min-width="160" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="状态" prop="status" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -259,7 +268,7 @@
 </template>
 
 <script>
-import { getDetail, getGoodsList, addData, editData, checkDealerList, checkMaterialList } from "@/api/supply/reserve";
+import { getDetail, getGoodsList, addData, editData, checkDealerList, checkMaterialList, getWarehouseList } from "@/api/supply/reserve";
 import { getDictList } from '@/api/common'
 
 let that
@@ -323,6 +332,7 @@ export default {
 
       dealerList: [],
       materialList: [],
+      warehouseList: [],
     }
   },
 
@@ -330,7 +340,8 @@ export default {
     that = this;
   },
 
-  created() {
+  async created() {
+    await this.getWarehouseList();
     if(this.listItem) {
       this.getDetail();
     }else {
@@ -362,6 +373,15 @@ export default {
       })
     },
 
+    // 获取仓库列表
+    async getWarehouseList() {
+      const res = await getWarehouseList({
+        pageNum: 1,
+        pageSize: -1,
+      });
+      this.warehouseList = res.data.records;
+    },
+
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
@@ -571,6 +591,16 @@ export default {
       }
     },
 
+    // 修改仓库
+    changeWarehouse(index) {
+      if(this.goodsList[index].correspondId) {
+        let obj = this.warehouseList.find(o => o.id == this.goodsList[index].correspondId);
+        this.goodsList[index].correspondName = obj.name;
+      }else {
+        this.goodsList[index].correspondName = '';
+      }
+    },
+
     // 提交
     clickSubmitForm() {
       this.$refs.mainForm.validate((valid) => {