ysy 1 жил өмнө
parent
commit
30a7dbd4db

+ 1 - 1
src/views/produce/components/picking/index.vue

@@ -34,7 +34,7 @@
       </div>
     </div>
 
-    <pickingList ref="pickingListRef"></pickingList>
+    <pickingList isType="pick" ref="pickingListRef"></pickingList>
   </el-dialog>
 </template>
 

+ 45 - 19
src/views/produce/components/picking/pickingList.vue

@@ -38,6 +38,10 @@
             class="dict-table"
             :key="tableKey"
             :cache-key="tableKey"
+            :row-style="rowStyle"
+            rowClickChecked
+            :rowClickCheckedIntelligent="false"
+            @update:selection="handleSelectionChange"
           >
             <template v-slot:code="{ row }">
               {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
@@ -56,19 +60,17 @@
               <span :style="{ color: row.status == 0 ? '#157A2C' : '#FFA929' }"
                 >状态{{
                   row.status == 0 ? '空闲' : row.status == 1 ? '占用' : ''
-                }}</span>
+                }}</span
+              >
             </template>
 
             <template v-slot:packingCountBase="{ row }">
-              {{ row.packingCountBase }} {{row.minUnit}}
+              {{ row.packingCountBase }} {{ row.minUnit }}
             </template>
 
             <template v-slot:availableCountBase="{ row }">
-              {{ row.availableCountBase }} {{row.measuringUnit}}
+              {{ row.availableCountBase }} {{ row.measuringUnit }}
             </template>
-            
-
-
           </ele-pro-table>
         </template>
       </ele-split-layout>
@@ -87,12 +89,18 @@
 
   export default {
     components: { AssetTree, pickingListSearch },
-    props: {},
+    props: {
+      isType: {
+        type: String,
+        default: '',
+        required: true
+      }
+    },
     data() {
       return {
         visible: false,
 
-        treeIds: '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28',
+        treeIds: null,
         categoryLevelId: null,
         rootCategoryLevelId: null,
         isCategory: true,
@@ -108,7 +116,8 @@
           '占用'
         ],
 
-        selection: []
+        selection: [],
+        allSelection: []
       };
     },
 
@@ -124,15 +133,18 @@
             width: 45,
             type: 'selection',
             columnKey: 'selection',
-            align: 'center'
+            selectable: (row, index) => {
+              return !this.allSelection.some((it) => it.id == row.id);
+            },
+            align: 'center',
+            reserveSelection: true
           },
           {
             columnKey: 'index',
             label: '序号',
             type: 'index',
             width: 50,
-            align: 'center',
-            reserveSelection: true
+            align: 'center'
           },
           {
             prop: 'code',
@@ -238,7 +250,7 @@
               ]
             : []),
 
-            ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
+          ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
             ? [
                 {
                   prop: 'packingCountBase',
@@ -249,8 +261,7 @@
               ]
             : []),
 
-
-            ...([1, 23].includes(Number(this.rootCategoryLevelId))
+          ...([1, 23].includes(Number(this.rootCategoryLevelId))
             ? [
                 {
                   prop: 'availableCountBase',
@@ -260,7 +271,6 @@
                 }
               ]
             : [])
-
         ];
       }
     },
@@ -288,12 +298,20 @@
           });
         }
       },
+      handleSelectionChange(data) {
+        this.allSelection = [...this.allSelection, ...data];
+      },
+
+      rowStyle({ row }) {
+        return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
+      },
       handleNodeClick(data) {
         this.isCategory = true;
         this.categoryLevelId = data.id;
         this.rootCategoryLevelId = data.rootCategoryLevelId;
         this.reload();
       },
+
       setRootId(data) {
         this.categoryLevelId = data.id;
         this.rootCategoryLevelId = data.rootCategoryLevelId;
@@ -317,12 +335,16 @@
         this.visible = false;
       },
       selected() {
-        if (!this.current) {
-          return this.$message.warning('请选择');
-        }
+        console.log(this.selection);
 
         this.handleClose();
       }
+    },
+
+    created() {
+      if (this.isType == 'pick') {
+        this.treeIds = '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28';
+      }
     }
   };
 </script>
@@ -357,4 +379,8 @@
   .topsearch {
     margin-bottom: 15px;
   }
+
+  ::v-deep .is-checked {
+    background: #e6f7ff;
+  }
 </style>

+ 1 - 0
src/views/produceOrder/components/carDialog.vue

@@ -18,6 +18,7 @@
       cache-key="materialDialogtable"
       :datasource="datasource"
       :selection.sync="selection"
+  
       height="45vh"
     >
     </ele-pro-table>