Просмотр исходного кода

产线和车间新增线边仓的选择

695593266@qq.com 5 месяцев назад
Родитель
Сommit
8a5fe1526b

+ 18 - 3
src/api/factoryModel/index.js

@@ -219,7 +219,10 @@ export async function codeExists(code) {
 }
 // 获取工厂下的所有产线
 export async function listFactoryLineByFactoryId(params) {
-  const res = await request.post(`/main/factoryarea/listFactoryLineByFactoryId`, params);
+  const res = await request.post(
+    `/main/factoryarea/listFactoryLineByFactoryId`,
+    params
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -227,9 +230,21 @@ export async function listFactoryLineByFactoryId(params) {
 }
 // 获取产线下的所有工位
 export async function listByProductionLineId(productionLineId) {
-  const res = await request.get(`/main/factoryworkstation/listByProductionLineId/${productionLineId}`);
+  const res = await request.get(
+    `/main/factoryworkstation/listByProductionLineId/${productionLineId}`
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+//获取所有线边仓
+
+export async function getAllListWarehouse() {
+  const res = await request.get(`/wms/warehouse/listWarehouseByField`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 38 - 3
src/views/factoryModel/productionLine/components/edit.vue

@@ -141,6 +141,23 @@
               </el-select>
             </el-form-item>
           </el-col>
+          <el-col :span="8" style="margin-bottom: 12px">
+            <el-form-item label="线边仓:" prop="warehouseList">
+              <el-select
+                v-model="warehouseId"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <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 :span="8" style="margin-bottom: 12px">
             <el-form-item label="联系方式:" prop="extInfo.phone">
               <el-input
@@ -343,7 +360,11 @@
 </template>
 
 <script>
-  import { saveOrUpdate, listWorkshopByParentId } from '@/api/factoryModel';
+  import {
+    saveOrUpdate,
+    listWorkshopByParentId,
+    getAllListWarehouse
+  } from '@/api/factoryModel';
   import { getUserPage } from '@/api/system/organization';
   import { deepClone } from '@/components/FormGenerator/utils';
   import { cityDataLabel } from 'ele-admin/packages/utils/regions';
@@ -392,7 +413,8 @@
           workMeter: '', // 工作节拍
           workingAbility: '', // 加工能力
           locationDetail: '', // 详细地址
-          location: [] // 省市区
+          location: [], // 省市区
+          warehouseList: []
         },
         groupId: '',
         enabled: 1,
@@ -449,7 +471,9 @@
         areaTreeList: [],
 
         factoryList: [],
-        workshopPlanList: []
+        workshopPlanList: [],
+        warehouseList: [],
+        warehouseId: ''
       };
     },
     computed: {
@@ -469,6 +493,7 @@
     created() {
       this.getBasicAreaList();
       this.getFactoryList();
+      this.getListWarehouse();
     },
     methods: {
       getTime() {
@@ -529,6 +554,8 @@
           if (this.form.extInfo.principalDep) {
             this.getUserPage();
           }
+
+          this.warehouseId = this.form.extInfo.warehouseList.join(',');
         } else {
           this.form = { ...this.defaultForm };
           const info = {
@@ -540,6 +567,7 @@
             locationDetail: '', // 详细地址
             location: [] // 省市区
           };
+          this.warehouseId = '';
           this.$set(this.form, 'extInfo', info);
           this.$nextTick(() => {
             this.$refs.form.resetFields();
@@ -577,6 +605,7 @@
             delete this.form.id;
           }
           let params = deepClone(this.form);
+          params.extInfo.warehouseList = this.warehouseId.split(',');
           params.mainFactoryCapacityList =
             params.mainFactoryCapacityList.concat(this.delList);
           saveOrUpdate(params)
@@ -620,6 +649,12 @@
         this.factoryList = list || [];
       },
 
+      async getListWarehouse() {
+        const res = await getAllListWarehouse();
+
+        this.warehouseList = res;
+      },
+
       change_factoryId() {
         this.form.workshopPlanId = '';
         this.workshopPlanList = [];

+ 36 - 5
src/views/factoryModel/workshop/components/edit.vue

@@ -126,7 +126,25 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <el-col :span="12" style="margin-bottom: 22px">
+          <el-form-item label="线边仓:" prop="warehouseList">
+            <el-select
+              v-model="form.extInfo.warehouseList"
+              placeholder="请选择"
+              style="width: 100%"
+              multiple
+            >
+              <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 :span="12" style="margin-bottom: 22px">
           <el-form-item label="所属区域:">
             <area-select
               v-model="form.areaId"
@@ -162,13 +180,17 @@
 </template>
 
 <script>
-  import { saveOrUpdate } from '@/api/factoryModel';
+  import {
+    saveOrUpdate,
+    getFactoryarea,
+    getAllListWarehouse
+  } from '@/api/factoryModel';
   import { getUserPage } from '@/api/system/organization';
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
   import personSelect from '@/components/CommomSelect/person-select.vue';
   import AreaSelect from '@/views/enterpriseModel/regionalManage/components/area-cascader.vue';
   import { basicAreaPageAPI } from '@/api/regionalManage';
-  import { getFactoryarea } from '@/api/factoryModel';
+
   export default {
     props: {
       options_groupId: {
@@ -191,6 +213,7 @@
     created() {
       this.getFactoryList();
       this.getBasicAreaList();
+      this.getListWarehouse();
     },
     data() {
       const defaultForm = function () {
@@ -202,7 +225,8 @@
           areaName: '',
           extInfo: {
             location: '',
-            principalDep: '' // 负责人部门
+            principalDep: '', // 负责人部门
+            warehouseList: []
           },
           leaderId: '', // 负责人
           groupId: '',
@@ -249,7 +273,8 @@
           leaderId: []
         },
         factoryList: [],
-        workshopPlanList: []
+        workshopPlanList: [],
+        warehouseList: []
       };
     },
     computed: {
@@ -304,6 +329,12 @@
         this.factoryList = list || [];
       },
 
+      async getListWarehouse() {
+        const res = await getAllListWarehouse();
+
+        this.warehouseList = res;
+      },
+
       change_factoryId(e) {
         this.form.workshopPlanId = '';
         this.workshopPlanList = [];