Browse Source

pms sap库存列表功能优化

zhangcl 2 months ago
parent
commit
4a7581a0c8
4 changed files with 69 additions and 3 deletions
  1. 3 1
      src/locales/en.ts
  2. 3 1
      src/locales/ru.ts
  3. 3 1
      src/locales/zh-CN.ts
  4. 60 0
      src/views/pms/iotsapstock/index.vue

+ 3 - 1
src/locales/en.ts

@@ -996,7 +996,9 @@ export default {
     requQuantity: 'requisitionQuantity',
     DelayMaintenance:'DelayMaintenance',
     DelayReason:'DelayReason',
-    MaterialMaster:'MaterialMaster'
+    MaterialMaster:'MaterialMaster',
+    totalQuantity: 'TotalQuantity',
+    totalAmount: 'TotalAmount(Yuan/CNY)'
   },
   process:{
     processName:'ProcessName',

+ 3 - 1
src/locales/ru.ts

@@ -983,7 +983,9 @@ export default {
     storageTime:'入库时间',
     selectMaterial:'选择物料',
     quantity: '库存数量',
-    requQuantity: '领用数量'
+    requQuantity: '领用数量',
+    totalQuantity: '总数量',
+    totalAmount: '总金额(元/人民币)'
   },
 
   'OAuth 2.0': 'OAuth 2.0' // 避免菜单名是 OAuth 2.0 时,一直 warn 报错

+ 3 - 1
src/locales/zh-CN.ts

@@ -990,7 +990,9 @@ export default {
     requQuantity: '领用数量',
     DelayMaintenance:'推迟保养',
     DelayReason:'推迟原因',
-    MaterialMaster:'物料主数据'
+    MaterialMaster:'物料主数据',
+    totalQuantity: '总数量',
+    totalAmount: '总金额(元/人民币)'
   },
   process:{
     processName:'流程名称',

+ 60 - 0
src/views/pms/iotsapstock/index.vue

@@ -97,6 +97,22 @@
     </el-form>
   </ContentWrap>
 
+  <!-- ========== 统计信息卡片 ========== -->
+  <ContentWrap style="margin-bottom: 16px">
+    <el-card shadow="never" class="stat-card">
+      <div class="stat-container">
+        <div class="stat-item">
+          <span class="stat-label">{{ t('stock.totalQuantity') }}:</span>
+          <span class="stat-value">{{ totalQuantity.toLocaleString() }}</span>
+        </div>
+        <div class="stat-item">
+          <span class="stat-label">{{ t('stock.totalAmount') }}:</span>
+          <span class="stat-value">¥ {{ totalAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) }}</span>
+        </div>
+      </div>
+    </el-card>
+  </ContentWrap>
+
   <!-- 列表 -->
   <ContentWrap>
     <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
@@ -158,6 +174,9 @@ const { t } = useI18n() // 国际化
 
 const factoryList = ref([] as SapOrgApi.SapOrgVO[])   // 工厂列表
 const storageLocationList = ref([] as SapOrgApi.SapOrgVO[]) // 库存地点列表
+// 新增统计变量
+const totalQuantity = ref(0)   // 总数量
+const totalAmount = ref(0)     // 总金额
 
 const loading = ref(true) // 列表的加载中
 const list = ref<IotSapStockVO[]>([]) // 列表的数据
@@ -200,6 +219,16 @@ const getList = async () => {
     const data = await IotSapStockApi.getIotSapStockPage(queryParams)
     list.value = data.list
     total.value = data.total
+    // 从第一条记录中提取统计值
+    if (data.list && data.list.length > 0) {
+      // 确保取到有效的数值(第一条记录中的统计值代表整个查询结果)
+      totalQuantity.value = Number(data.list[0].totalQuantity) || 0
+      totalAmount.value = Number(data.list[0].totalAmount) || 0
+    } else {
+      // 没有数据时重置为0
+      totalQuantity.value = 0
+      totalAmount.value = 0
+    }
   } finally {
     loading.value = false
   }
@@ -297,3 +326,34 @@ onMounted(() => {
   getList()
 })
 </script>
+
+<style scoped>
+/* 统计卡片样式 */
+.stat-card {
+  border-radius: 4px;
+  border: 1px solid #ebeef5;
+}
+
+.stat-container {
+  display: flex;
+  padding: 8px;
+}
+
+.stat-item {
+  display: flex;
+  align-items: center;
+  margin-right: 40px; /* 控制项间距 */
+}
+
+.stat-label {
+  font-weight: bold;
+  color: #606266;
+  margin-right: 8px;
+}
+
+.stat-value {
+  font-size: 18px;
+  font-weight: bold;
+  color: #409EFF;
+}
+</style>