فهرست منبع

出库管理和库存管理新增仓库名称选择功能并关联工厂选择

yusheng 10 ماه پیش
والد
کامیت
2360695d29

+ 39 - 3
src/views/warehouseManagement/outgoingManagement/index.vue

@@ -95,6 +95,8 @@
                 v-model="formData.factoryId"
                 clearable
                 class="w100"
+                @change="getTreeData"
+
               >
                 <el-option
                   v-for="item in factoryList"
@@ -104,6 +106,24 @@
                 ></el-option>
               </el-select> </el-form-item
           ></el-col>
+          <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+            <el-form-item label="仓库名称" prop="warehouseId">
+              <el-select
+                filterable
+                placeholder="请选择"
+                v-model="formData.warehouseId"
+                clearable
+                class="w100"
+              >
+                <el-option
+                  v-for="item in warehouseList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
           <el-col
             style="
               display: flex;
@@ -299,9 +319,10 @@
         outputSceneState,
         codeList: [],
         factoryList: [],
+        warehouseList: [],
         tableData: [],
         fromUserList: [],
-        loading:false,
+        loading: false,
         formData: {
           deptIds: '',
           categoryCode: '',
@@ -311,7 +332,8 @@
           endTime: '',
           status: '',
           factoryId: '',
-          time: []
+          time: [],
+          warehouseId: ''
         },
         total: 0,
         status: [
@@ -402,7 +424,7 @@
             showOverflowTooltip: true,
             width: 200
           },
-            {
+          {
             prop: 'storageTime',
             label: '出库时间',
             align: 'center',
@@ -440,8 +462,22 @@
       this.getUser();
       this.getTypeList();
       this.getFactoryList();
+      this.getTreeData();
     },
     methods: {
+      async getTreeData() {
+        this.formData.warehouseId = '';
+        try {
+          let res = await storageApi.getWarehouseTrees({
+            factoryId: this.formData.factoryId
+          });
+          if (res?.code === '0') {
+            this.warehouseList = res.data;
+          }
+        } catch (error) {
+          console.log(error);
+        }
+      },
       //获取工厂列表
       async getFactoryList() {
         const res = await warehouseDefinition.getFactoryarea({

+ 37 - 14
src/views/warehouseManagement/stockManagement/index.vue

@@ -100,6 +100,7 @@
                 v-model="formData.factoryId"
                 clearable
                 class="w100"
+                @change="getTreeData"
               >
                 <el-option
                   v-for="item in factoryList"
@@ -110,19 +111,24 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <!-- <el-col :lg="6" :sm="8" :xs="8">
-          <el-form-item label="创建时间" prop="time">
-            <el-date-picker
-              class="w100"
-              size="small"
-              v-model="formData.time"
-              type="daterange"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              value-format="yyyy-MM-dd"
-            ></el-date-picker> </el-form-item
-        ></el-col> -->
+          <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+            <el-form-item label="仓库名称" prop="warehouseId">
+              <el-select
+                filterable
+                placeholder="请选择"
+                v-model="formData.warehouseId"
+                clearable
+                class="w100"
+              >
+                <el-option
+                  v-for="item in warehouseList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
           <el-col
             style="
               display: flex;
@@ -295,6 +301,7 @@
         sceneState,
         codeList: [],
         factoryList: [],
+        warehouseList:[],
         tableData: [],
         formData: {
           deptIds: '',
@@ -305,7 +312,8 @@
           endTime: '',
           status: '',
           factoryId: '',
-          time: []
+          time: [],
+          warehouseId: ''
           // type: 1
         },
         loading: false,
@@ -454,8 +462,22 @@
     mounted() {
       this.getTypeList();
       this.getFactoryList();
+      this.getTreeData()
     },
     methods: {
+      async getTreeData() {
+         this.formData.warehouseId=''
+        try {
+          let res = await storageApi.getWarehouseTrees({
+            factoryId: this.formData.factoryId
+          });
+          if (res?.code === '0') {
+            this.warehouseList = res.data;
+          }
+        } catch (error) {
+          console.log(error);
+        }
+      },
       //获取工厂列表
       async getFactoryList() {
         const res = await warehouseDefinition.getFactoryarea({
@@ -464,6 +486,7 @@
           type: 1
         });
         this.factoryList = res.list;
+       
       },
       // 单击获取id
       cellClick(row) {