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

refactor(库存调拨): 优化搜索布局并调整表格列显示逻辑

liujt 7 месяцев назад
Родитель
Сommit
c6d3499cf6
1 измененных файлов с 72 добавлено и 182 удалено
  1. 72 182
      src/views/warehouseManagement/inventoryAllocation/add.vue

+ 72 - 182
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -196,24 +196,16 @@
                   </template>
                 </el-form-item>
               </el-col>
-              <el-col :span="10">
+              <el-col :span="7">
                 <el-input
                   placeholder="请输入名称/编码/批次号/型号/规格/客户代号/刻码"
                   v-model="query.keyWord"
                   class="input-with-select"
                   @keyup.enter.native="querySearch"
                 >
-                <!--  -->
-                  <el-button
-                    slot="append"
-                    icon="el-icon-search"
-                    type="primary"
-                    @click="querySearch"
-                    >搜索</el-button
-                  >
                 </el-input>
               </el-col>
-              <el-col :span="5">
+              <el-col :span="8">
                 <div
                   style="
                     display: flex;
@@ -221,6 +213,14 @@
                     margin-bottom: 10px;
                   "
                 >
+                  <el-button
+                    slot="append"
+                    icon="el-icon-search"
+                    type="primary"
+                    @click="querySearch"
+                    >搜索</el-button
+                  >
+
                   <el-button
                     @click="queryReset"
                     icon="el-icon-refresh-left"
@@ -233,168 +233,6 @@
               </el-col>
             </el-row>
           </el-form>
-          <!-- <el-table
-            ref="table"
-            :height="530"
-            :data="productList"
-            row-key="id"
-            @selection-change="selecctedRow"
-            tooltip-effect="dark"
-            border
-          >
-            <el-table-column
-              fixed="left"
-              align="center"
-              width="50"
-              :reserve-selection="true"
-              :selectable="checkSelectable"
-              type="selection"
-            ></el-table-column>
-            <el-table-column label="序号" type="index" width="50">
-            </el-table-column>
-            <el-table-column
-              label="物品编码"
-              prop="categoryCode"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="物品名称"
-              prop="categoryName"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="仓库"
-              prop="warehouseName"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="库区"
-              prop="areaName"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="货架"
-              prop="goodsShelfName"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="货位"
-              prop="goodsAllocationName"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="批次号"
-              prop="batchNo"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="牌号"
-              prop="brandNum"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="型号"
-              prop="categoryModel"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="规格"
-              prop="specification"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="包装编码"
-              prop="packageNo"
-              v-if="dimension == 3"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              v-if="dimension == 3"
-              label="包装数量"
-              prop="packingQuantity"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="包装单位"
-              v-if="dimension == 3"
-              prop="packingUnit"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="计量数量"
-              prop="measureQuantity"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="计量单位"
-              prop="measureUnit"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="重量"
-              prop="weight"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="重量单位"
-              prop="weightUnit"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-
-            <el-table-column
-              label="生产日期"
-              prop="productionDate"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="采购日期"
-              prop="purchaseDate"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="发货条码"
-              prop="barcodes"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="客户代号"
-              prop="clientCode"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="刻码"
-              prop="engrave"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="物料代号"
-              prop="materielDesignation"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-          </el-table> -->
-          <!-- <el-pagination
-            background
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="total"
-            :page-sizes="[10, 20, 50, 100]"
-            :page-size.sync="size"
-            :current-page.sync="page"
-            @current-change="getProductList"
-            @size-change="getProductList"
-          >
-          </el-pagination> -->
           <!-- 数据表格 -->
           <ele-pro-table
             ref="table"
@@ -416,6 +254,28 @@
             @submit.native.prevent
           >
             <el-row :gutter="15">
+              <el-col :span="12">
+                <el-form-item
+                  label-width="65px"
+                  label="调入工厂:"
+                  prop="targetFactoriesId"
+                >
+                  <el-select
+                    :disabled="allocateId == 1 || isEdit"
+                    style="width: 100%"
+                    @change="targetFactoryChange"
+                    v-model="params.targetFactoriesId"
+                    placeholder="请选择工厂"
+                  >
+                    <el-option
+                      v-for="item in factoryList"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
               <el-col :span="12">
                 <el-form-item
                   label-width="65px"
@@ -715,6 +575,7 @@
           outShelvesName: '',
           outFreightId: '', // 调出货位
           outFreightName: '',
+          targetFactoriesId: '', // 调入工厂
           inWarehouseId: '', // 调入仓库
           inWarehouseName: '',
           inCargoAreaId: '', // 调入库区
@@ -837,19 +698,19 @@
             align: 'center',
             minWidth: 130,
             showOverflowTooltip: true,
-          } : {},
+          } : '',
           this.dimension == 3 ? {
             prop: 'packingQuantity',
             label: '包装数量',
             align: 'center',
             showOverflowTooltip: true,
-          }:{},
+          }:'',
           this.dimension == 3 ? {
             prop: 'packingUnit',
             label: '包装单位',
             align: 'center',
             showOverflowTooltip: true,
-          } : {},
+          } : '',
           {
             prop: 'measureQuantity',
             label: '计量数量',
@@ -986,19 +847,19 @@
             align: 'center',
             minWidth: 130,
             showOverflowTooltip: true,
-          } : {},
+          } : '',
           this.dimension == 3 ? {
             prop: 'packingQuantity',
             label: '包装数量',
             align: 'center',
             showOverflowTooltip: true,
-          }:{},
+          }:'',
           this.dimension == 3 ? {
             prop: 'packingUnit',
             label: '包装单位',
             align: 'center',
             showOverflowTooltip: true,
-          } : {},
+          } : '',
           {
             prop: 'measureQuantity',
             label: '计量数量',
@@ -1069,16 +930,28 @@
           }
         ].filter(Boolean);
       },
+      userInfo() {
+        console.log('this.$store.state.user.info------', this.$store.state.user.info);
+        return this.$store.state.user.info
+      }
     },
     async created() {
       const code = await getCode('transfer_no');
       this.params.code = code;
       // this.getTreeData();
-      this.getFactoryList();
+      await this.getFactoryList();
       if (this.$route.query.isEdit) {
         console.log('this.$route.query.isEdit------', this.$route.query.isEdit);
         this.isEdit = true;
         this.getEditInfo();
+      } else {
+        if(this.factoryList.find(item => item.id == this.userInfo.factoryId)?.id) {
+          this.factoryId = this.userInfo.factoryId;
+          if(this.allocateId == 1) {
+            this.params.targetFactoriesId = this.factoryId
+          }
+         this.getTreeData(this.factoryId) 
+        }
       }
     },
     watch: {
@@ -1118,7 +991,7 @@
         let that = this;
         this.$nextTick(() => {
           console.log('操作了!!');
-          console.log('that.$refs.table------', that.$refs.table);
+          // console.log('that.$refs.table------', that.$refs.table);
           that.$refs.table.doLayout();
         });
       },
@@ -1143,6 +1016,7 @@
           outShelvesName: '',
           outFreightId: '', // 调出货位
           outFreightName: '',
+          targetFactoriesId: baseInfo.targetFactoriesId, // 调入工厂
           inWarehouseId: baseInfo.targetWarehouseId, // 调入仓库
           inWarehouseName: baseInfo.targetWarehouse,
           inCargoAreaId: '', // 调入库区
@@ -1235,6 +1109,13 @@
         console.log(baseInfo);
       },
       factoryChange() {
+        // this.params.inWarehouseName = this.params.outWarehouseName;
+        this.params.targetFactoriesId = this.factoryId;
+        console.log('this.params------', this.params);
+        this.reset();
+        this.getTreeData();
+      },
+      targetFactoryChange() {
         this.reset();
         this.getTreeData();
       },
@@ -1405,6 +1286,7 @@
         this.factoryList = res.list;
       },
       async outWarehouseChange(val) {
+        console.log('val------', val);
         this.outCargoAreaList = this.outTreeList.filter(
           (item) => item.id == val
         )[0]?.children;
@@ -1439,6 +1321,7 @@
             }
           });
         } else {
+          console.log(11111)
           this.inCargoAreaList = this.outCargoAreaList;
           this.params.inWarehouseName = this.params.outWarehouseName;
           this.params.inWarehouseId = this.params.outWarehouseId;
@@ -1451,6 +1334,7 @@
           this.inShelvesList = []; // 调入货架列表
           this.inFreightList = []; // 调入货位列表
         }
+        console.log('this.params------~~~', this.params);
         await this.getProductList();
         await this.reload();
       },
@@ -1573,6 +1457,7 @@
         this.getProductList();
         this.reload();
         this.selection=[]
+        this.selectionIds = []
         this.$refs.table.clearSelection()
         this.tableData=[]
       },
@@ -1659,7 +1544,8 @@
                   targetGoodsShelfId: item.targetGoodsShelfId,
                   targetGoodsShelfName: item.targetGoodsShelfName,
                   targetWarehouseId: item.targetWarehouseId,
-                  targetWarehouseName: item.targetWarehouseName
+                  targetWarehouseName: item.targetWarehouseName,
+                  targetFactoriesId: this.params.targetFactoriesId,
                 };
               }),
               allotCode: this.params.code,
@@ -1671,7 +1557,8 @@
               targetWarehouseId: this.params.inWarehouseId,
               status: status,
               type: this.allocateId,
-              inventoryDimension: this.dimension
+              inventoryDimension: this.dimension,
+              targetFactoriesId: this.params.targetFactoriesId,
             };
             console.log('params------------', params);
             storageApi.allotApplySave(params).then(() => {
@@ -1786,6 +1673,8 @@
           let boolen = this.selection.every((item) =>
             this.selectionIds.includes(item.id)
           );
+
+          console.log('boolen~~~~', boolen);
           if (this.selection.length > 0 && !boolen) {
             this.selection = this.selection.filter(
               (item) => !this.selectionIds.includes(item.id)
@@ -1910,6 +1799,7 @@
                   targetGoodsShelfName: this.params.inShelvesName,
                   targetWarehouseId: this.params.inWarehouseId,
                   targetWarehouseName: this.params.inWarehouseName,
+                  targetFactoriesId: this.params.targetFactoriesId,
                   outWarehouseArea:
                     this.params.outWarehouseName +
                     (this.params.outCargoAreaName