Forráskód Böngészése

refactor(库存调拨): 物品维度不显示批次号,删除问题

liujt 7 hónapja
szülő
commit
3545009bed
1 módosított fájl, 36 hozzáadás és 158 törlés
  1. 36 158
      src/views/warehouseManagement/inventoryAllocation/add.vue

+ 36 - 158
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -242,6 +242,7 @@
             :datasource="datasource"
             cache-key="wms-inventoryAllocation-add-table-left"
             :selection.sync="selection"
+            row-key="id"
             :initLoad="false"
           >
           </ele-pro-table>
@@ -376,128 +377,6 @@
               </el-col>
             </el-row>
           </el-form>
-          <!-- <el-table
-            ref="detailTable"
-            :data="tableData"
-            :height="575"
-            tooltip-effect="dark"
-            border
-          >
-            <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="调出区域"
-              width="200"
-              prop="outWarehouseArea"
-              :show-overflow-tooltip="true"
-            >
-            </el-table-column>
-            <el-table-column
-              label="调入区域"
-              width="200"
-              prop="inWarehouseArea"
-              :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="batchNo"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="包装编码"
-              v-if="dimension == 3"
-              prop="packageNo"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              label="包装数量"
-              v-if="dimension == 3"
-              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="quantity"
-              width="130"
-              :show-overflow-tooltip="true"
-            >
-              <template slot-scope="scope">
-                <el-input-number 
-                  v-model="scope.row.quantity" 
-                  controls-position="right" 
-                 :min="0" 
-                 :max="scope.row.measureQuantity"
-                 :precision="2"
-                 style="width: 100%"
-                ></el-input-number>
-              </template>
-            </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="操作" width="100" fixed="right">
-              <template slot-scope="{ row, $index }">
-                <el-button
-                  @click="deleted(row, $index)"
-                  type="text"
-                  size="small"
-                  >删除</el-button
-                >
-              </template>
-            </el-table-column>
-          </el-table> -->
           <ele-pro-table
             ref="detailTable"
             :columns="columnsRight"
@@ -517,9 +396,9 @@
                 style="width: 100%"
               ></el-input-number>
             </template>
-            <template v-slot:action="{ row }">
+            <template v-slot:action="scoped">
               <el-button
-                  @click="deleted(row, $index)"
+                  @click="deleted(scoped.row, scoped.$index)"
                   type="text"
                   size="small"
                   >删除</el-button
@@ -685,32 +564,34 @@
             minWidth: 130,
             showOverflowTooltip: true,
           },
-          {
+          ...(this.dimension != '1' ? [{
             prop: 'batchNo',
             label: '批次号',
             align: 'center',
             minWidth: 130,
             showOverflowTooltip: true,
-          },
-          this.dimension == 3 ? {
-            prop: 'packageNo',
-            label: '包装编码',
-            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,
-          } : '',
+          }] : []),
+          ...(this.dimension == '3' ? [
+            {
+              prop: 'packageNo',
+              label: '包装编码',
+              align: 'center',
+              minWidth: 130,
+              showOverflowTooltip: true,
+            },
+            {
+              prop: 'packingQuantity',
+              label: '包装数量',
+              align: 'center',
+              showOverflowTooltip: true,
+            },
+            {
+              prop: 'packingUnit',
+              label: '包装单位',
+              align: 'center',
+              showOverflowTooltip: true,
+            }
+          ] : []),
           {
             prop: 'measureQuantity',
             label: '计量数量',
@@ -916,17 +797,6 @@
             fixed: 'right',
             width: 100,
             slot: 'action'
-            // render: (h, { row, index }) => {
-            //   return h('el-button', {
-            //     props: {
-            //       type: 'text',
-            //       size: 'small'
-            //     },
-            //     on: {
-            //       click: () => this.deleted(row, index)
-            //     }
-            //   }, '删除');
-            // }
           }
         ].filter(Boolean);
       },
@@ -1496,9 +1366,17 @@
         this.treeLoading = false;
       },
       deleted(row, index) {
+        console.log('deleted~~~', row.id, index);
         this.tableData.splice(index, 1);
-        console.log(this.selectionIds);
-        this.selectionIds = this.selectionIds.filter((item) => item !== row.id);
+        this.selectionIds = this.selectionIds.filter((item) => item != row.id);
+        this.selection = this.selection.filter((item) => item.id != row.id);
+        this.$refs.table.setSelectedRowKeys(this.selectionIds);
+        console.log('this.$refs.table.getSelectedRowKeys()~~~~', this.$refs.table);
+        
+        
+        console.log('selectionIds~~~~', this.selectionIds);
+        console.log('selection~~~~', this.selection);
+        this.$forceUpdate()
       },
       config() {
         if (this.allocateId == 1) {