ysy hai 1 ano
pai
achega
790eac0bf4
Modificáronse 1 ficheiros con 33 adicións e 5 borrados
  1. 33 5
      src/views/produce/components/picking/pickingList.vue

+ 33 - 5
src/views/produce/components/picking/pickingList.vue

@@ -39,10 +39,27 @@
             :key="tableKey"
             :cache-key="tableKey"
             :row-style="rowStyle"
-            rowClickChecked
-            :rowClickCheckedIntelligent="false"
+            :row-click-checked="true"
+            :row-click-checked-intelligent="false"
             @update:selection="handleSelectionChange"
+            @done="onDone"
           >
+            <template v-slot:toolbar>
+              <el-alert type="info" :closable="false" class="ele-alert-border" style="width: 300px;">
+                <i class="el-icon-info ele-text-info"></i>
+                <span class="ele-text">
+                  <span>
+                    已选择
+                    <b class="ele-text-info">{{ allSelection.length }}</b>
+                    项数据<em></em>
+                  </span>
+                </span>
+                <el-link type="primary" :underline="false" @click="clearChoose">
+                  清空
+                </el-link>
+              </el-alert>
+            </template>
+
             <template v-slot:code="{ row }">
               {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
             </template>
@@ -133,9 +150,6 @@
             width: 45,
             type: 'selection',
             columnKey: 'selection',
-            selectable: (row, index) => {
-              return !this.allSelection.some((it) => it.id == row.id);
-            },
             align: 'center',
             reserveSelection: true
           },
@@ -299,9 +313,23 @@
         }
       },
       handleSelectionChange(data) {
+        this.allSelection = this.allSelection.filter(
+          (f) => f.rootCategoryLevelId != this.rootCategoryLevelId
+        );
         this.allSelection = [...this.allSelection, ...data];
       },
 
+      onDone() {
+        this.$nextTick(() => {
+          const ids = this.allSelection.map((item) => item.id);
+          this.$refs.table.setSelectedRowKeys(ids);
+        });
+      },
+
+            /* 清空选择 */
+            clearChoose() {
+        this.$refs.table.clearSelection();
+      },
       rowStyle({ row }) {
         return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
       },