Prechádzať zdrojové kódy

fix: 工单领料库存数量显示问题

liujt 5 dní pred
rodič
commit
71ff76a318

+ 50 - 4
src/views/produce/components/picking/newPickingList.vue

@@ -1,13 +1,18 @@
 <template>
-  <el-dialog
+  <ele-modal
     :title="title"
     :visible.sync="visible"
     v-if="visible"
     :before-close="handleClose"
     :close-on-click-modal="false"
+    :maxable="true"
     :close-on-press-escape="false"
+    id="formId"
     append-to-body
     width="75%"
+    @update:fullscreen="fullscreen"
+    :fullscreen="isFullscreen"
+    :height="dialogDynamicHeight"
   >
     <el-card shadow="never">
       <pickingListSearch
@@ -41,7 +46,7 @@
             :datasource="datasource"
             :selection.sync="selection"
             row-key="id"
-            height="calc(100vh - 350px)"
+            :height="tableHeight"
             class="dict-table"
             :cache-key="tableKey"
             :row-style="rowStyle"
@@ -97,7 +102,7 @@
             </template>
 
             <template v-slot:measureQuantity="{ row }">
-              {{ row.measureQuantity }} {{ row.measureUnit }}
+              {{ row.stockCountBase }} {{ row.measureUnit }}
             </template>
 
             <template v-slot:weight="{ row }">
@@ -144,7 +149,7 @@
       <el-button type="primary" size="small" @click="selected">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
     </div>
-  </el-dialog>
+  </ele-modal>
 </template>
 
 <script>
@@ -174,6 +179,7 @@
     data() {
       return {
         visible: false,
+        isFullscreen: false,
 
         id: null,
         treeIds: null,
@@ -465,6 +471,26 @@
             width: 130,
             align: 'center'
           },
+          {
+            prop: 'lockQuantity',
+            label: '锁定数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'availableQuantity',
+            label: '可用数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              // 入库计量数量不会随出库变化,可用数量必须使用当前批次库存余额计算
+              const inventoryBalance = Number(row.availableCountBase) || 0;
+              const lock = Number(row.lockQuantity) || 0;
+              const result =
+                (inventoryBalance * 100 - lock * 100) / 100;
+              return Math.round(result * 100) / 100;
+            }
+          },
 
           ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
             ? [
@@ -808,6 +834,23 @@
         //       ]
         //     : [])
         // ];
+      },
+
+      // 弹窗高度
+      dialogDynamicHeight() {
+        if (this.isFullscreen) {
+          // 全屏时,高度为窗口高度
+          return window.innerHeight + 'px';
+        }
+        return '600px';
+      },
+
+      // 表格高度
+      tableHeight() {
+        if (this.isFullscreen) {
+          return 'calc(100vh - 120px)';
+        }
+        return 'calc(100vh - 350px)';
       }
     },
     watch: {},
@@ -1043,6 +1086,9 @@
         this.allSelection = [];
         this.visible = false;
       },
+      fullscreen() {
+        this.isFullscreen = !this.isFullscreen;
+      },
       selected() {
         if (this.allSelection.length == 0) {
           this.$message.warning('请选择物料');