From 11d7990309ddace2fa600cbeae58e3ab5ac368f9 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期日, 20 九月 2026 19:25:45 +0800
Subject: [PATCH] 新疆-融邦 1. 委外管理:新增合作商档案、委外订单、往来台账三个页面及接口;合作商附件弹框支持直接上传/删除并即时保存。   2. 信托基金与代储台账:客户档案加「信托基金 / 代储金额」并对超限标红提示;销售台账拆「卖油 / 代储」页签,代储走油库+储罐+合同金额,卖油保留产品明细;台账列表加审批状态与超限红字;审批中心显示销售合同号并能下钻台账明细。   3. 储罐号带入库存:储罐信息表单加「是否启用 / 用途 / 租客信息」联动与校验;库存管理、批号明细、入库/出库表单与列表补齐储罐号、油品、物流、过磅等字段展示。   4. 出库即发货与往来备件:出库台账区分「发货单 / 油品出库」两类来源并分别处理详情;新增备件出入库流水页面。   5. 车辆管理与残油联动:新增车辆管理页面;油品出入库表单物流信息顺序调整,车牌/车挂牌号联动只读。   6. 油品出库联动发货台账:发货台账加「发货单号 / 销售合同号」筛选,修复油品出库行批号列取错字段。   7. 采购申请模块:新增采购申请页面及接口。   8. 付款流水组件:抽出公共「付款流水」弹框组件,采购付款分栏、收付款台账与委外往来台账复用。   9. 列调整:收付款台账删除「付款金额 / 退货金额」;委外往来台账删除「回款金额」,并去掉金额列右对齐。

---
 src/views/inventoryManagement/stockManagement/Record.vue |  201 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 160 insertions(+), 41 deletions(-)

diff --git a/src/views/inventoryManagement/stockManagement/Record.vue b/src/views/inventoryManagement/stockManagement/Record.vue
index bdd00b4..7799ce1 100644
--- a/src/views/inventoryManagement/stockManagement/Record.vue
+++ b/src/views/inventoryManagement/stockManagement/Record.vue
@@ -3,37 +3,34 @@
     <div class="search_form mb10">
       <el-form ref="searchFormRef"
                :model="searchForm"
-               class="demo-form-inline">
+               class="demo-form-inline"
+               style="width: 100%">
         <el-row :gutter="20">
-          <el-col :span="4">
+          <el-col :span="6">
             <el-form-item label="浜у搧澶х被"
                           prop="productName">
               <el-input v-model="searchForm.productName"
-                        style="width: 240px"
                         placeholder="璇疯緭鍏�"
                         clearable />
             </el-form-item>
           </el-col>
-          <el-col :span="4">
+          <el-col :span="6">
             <el-form-item label="瑙勬牸鍨嬪彿"
                           prop="model">
               <el-input v-model="searchForm.model"
-                        style="width: 240px"
                         placeholder="璇疯緭鍏�"
                         clearable />
             </el-form-item>
           </el-col>
-          <el-col :span="4">
+          <el-col :span="6">
             <el-form-item label="鎵瑰彿"
                           prop="batchNo">
               <el-input v-model="searchForm.batchNo"
-                        style="width: 240px"
                         placeholder="璇疯緭鍏�"
                         clearable />
             </el-form-item>
           </el-col>
-          <!-- 鎸夐挳 -->
-          <el-col :span="4">
+          <el-col :span="6">
             <el-form-item>
               <el-button type="primary"
                          @click="getList">
@@ -46,23 +43,26 @@
           </el-col>
         </el-row>
       </el-form>
-      <div style="display: flex; gap: 10px; flex-wrap: nowrap;">
-        <el-button type="primary"
-                   @click="isShowNewModal = true">鏂板搴撳瓨</el-button>
-        <el-button type="primary"
-                   @click="isShowOilInModal = true">鏂板娌瑰搧鍏ュ簱</el-button>
-        <el-button type="primary"
-                   @click="isShowOilOutModal = true">鏂板娌瑰搧鍑哄簱</el-button>
-        <el-button type="info"
-                   plain
-                   icon="Upload"
-                   @click="isShowImportModal = true">
-          瀵煎叆搴撳瓨
-        </el-button>
-        <el-button @click="handleOut">瀵煎嚭</el-button>
-      </div>
     </div>
     <div class="table_list">
+      <div class="actions">
+        <div></div>
+        <div>
+          <el-button type="primary"
+                     @click="isShowNewModal = true">鏂板搴撳瓨</el-button>
+          <el-button type="primary"
+                     @click="isShowOilInModal = true">鏂板娌瑰搧鍏ュ簱</el-button>
+          <el-button type="primary"
+                     @click="isShowOilOutModal = true">鏂板娌瑰搧鍑哄簱</el-button>
+          <el-button type="info"
+                     plain
+                     icon="Upload"
+                     @click="isShowImportModal = true">
+            瀵煎叆搴撳瓨
+          </el-button>
+          <el-button @click="handleOut">瀵煎嚭</el-button>
+        </div>
+      </div>
       <el-table :data="tableData"
                 border
                 v-loading="tableLoading"
@@ -71,18 +71,30 @@
                 :row-key="(row, index) => index"
                 style="width: 100%"
                 :row-class-name="tableRowClassName"
-                height="calc(100vh - 18.5em)">
+                :span-method="spanMethod"
+                height="calc(100vh - 21em)">
         <el-table-column align="center"
                          type="selection"
+                         :selectable="isRowSelectable"
                          width="55" />
         <el-table-column align="center"
                          label="搴忓彿"
                          type="index"
+                         :index="indexMethod"
                          width="60" />
         <el-table-column label="浜у搧鍚嶇О"
                          prop="productName"
-                         min-width="120"
-                         show-overflow-tooltip />
+                         min-width="120">
+          <template #default="scope">
+            <div v-if="scope.row.__isGroup"
+                 class="tank-group-band">
+              <span class="tank-group-band__name">鍌ㄧ綈鍙� {{ scope.row.tankNo || "鏈垎閰�" }}</span>
+              <span class="tank-group-band__stat">鍚堟牸 {{ scope.row.qualifiedQuantity }}</span>
+              <span class="tank-group-band__stat">鍐荤粨 {{ scope.row.qualifiedLockedQuantity }}</span>
+            </div>
+            <span v-else>{{ scope.row.productName }}</span>
+          </template>
+        </el-table-column>
         <el-table-column label="瑙勬牸鍨嬪彿"
                          prop="model"
                          min-width="120"
@@ -95,30 +107,26 @@
                          prop="batchNo"
                          min-width="150"
                          show-overflow-tooltip />
+        <el-table-column label="鍌ㄧ綈鍙�"
+                         prop="tankNo"
+                         min-width="100"
+                         show-overflow-tooltip />
         <el-table-column label="鍚堟牸搴撳瓨鏁伴噺"
                          prop="qualifiedQuantity"
                          min-width="110"
-                         show-overflow-tooltip />
-        <el-table-column label="涓嶅悎鏍煎簱瀛樻暟閲�"
-                         prop="unQualifiedQuantity"
-                         min-width="120"
                          show-overflow-tooltip />
         <el-table-column label="鍚堟牸鍐荤粨鏁伴噺"
                          prop="qualifiedLockedQuantity"
                          min-width="110"
                          show-overflow-tooltip />
-        <el-table-column label="涓嶅悎鏍煎喕缁撴暟閲�"
-                         prop="unQualifiedLockedQuantity"
-                         min-width="120"
-                         show-overflow-tooltip />
         <el-table-column label="搴撳瓨棰勮鏁伴噺"
                          prop="warnNum"
                          min-width="110"
                          show-overflow-tooltip />
-        <el-table-column label="澶囨敞"
-                         prop="remark"
-                         min-width="150"
-                         show-overflow-tooltip />
+<!--        <el-table-column label="澶囨敞"-->
+<!--                         prop="remark"-->
+<!--                         min-width="150"-->
+<!--                         show-overflow-tooltip />-->
         <el-table-column label="鏈�杩戞洿鏂版椂闂�"
                          prop="updateTime"
                          min-width="160"
@@ -179,7 +187,7 @@
 
 <script setup>
   import pagination from "@/components/PIMTable/Pagination.vue";
-  import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
+  import { ref, reactive, toRefs, computed, onMounted, getCurrentInstance } from "vue";
   import { ElMessage, ElMessageBox } from "element-plus";
   import { getStockInventoryListPageCombined } from "@/api/inventoryManagement/stockInventory.js";
   const props = defineProps({
@@ -187,6 +195,10 @@
       type: Number,
       required: true,
       default: 0,
+    },
+    productName: {
+      type: String,
+      default: "",
     },
   });
 
@@ -221,6 +233,72 @@
     size: 100,
   });
   const total = ref(0);
+  // 鍌ㄧ綈鍙峰垎绫昏鍗犳弧鏁磋锛屾槑缁嗚姝e父娓叉煋
+  const TABLE_COLUMN_COUNT = 13;
+  const GROUP_ROW_LEAD_COLUMNS = 2; // 閫夋嫨鍒� + 搴忓彿鍒�
+  const isRowSelectable = row => !row?.__isGroup;
+  // 鍙湁鎴愬搧銆佸師鏂欎袱绫讳細鎸夊偍缃愬垎缃愬瓨鏀撅紝鍏朵綑澶х被涓嶅仛鍌ㄧ綈鍙峰垎缁�
+  const TANK_GROUP_CATEGORIES = ["鎴愬搧", "鍘熸枡"];
+  const shouldGroupByTank = computed(() =>
+    TANK_GROUP_CATEGORIES.includes(props.productName)
+  );
+  const sumBy = (rows, key) =>
+    rows.reduce((acc, row) => acc + Number(row[key] || 0), 0);
+  const buildGroupedRows = rows => {
+    const groups = new Map();
+    rows.forEach(row => {
+      const tankNo = row.tankNo || "";
+      if (!groups.has(tankNo)) {
+        groups.set(tankNo, []);
+      }
+      groups.get(tankNo).push(row);
+    });
+    const sortedTankNos = [...groups.keys()].sort((a, b) => {
+      if (!a) return 1;
+      if (!b) return -1;
+      return a.localeCompare(b, "zh-CN", { numeric: true });
+    });
+    return sortedTankNos.flatMap(tankNo => {
+      const groupRows = groups.get(tankNo);
+      return [
+        {
+          __isGroup: true,
+          tankNo,
+          qualifiedQuantity: sumBy(groupRows, "qualifiedQuantity"),
+          qualifiedLockedQuantity: sumBy(groupRows, "qualifiedLockedQuantity"),
+        },
+        ...groupRows,
+      ];
+    });
+  };
+  const spanMethod = ({ row, columnIndex }) => {
+    if (!row?.__isGroup) {
+      return { rowspan: 1, colspan: 1 };
+    }
+    if (columnIndex === 0) {
+      return { rowspan: 1, colspan: GROUP_ROW_LEAD_COLUMNS };
+    }
+    if (columnIndex === GROUP_ROW_LEAD_COLUMNS) {
+      return {
+        rowspan: 1,
+        colspan: TABLE_COLUMN_COUNT - GROUP_ROW_LEAD_COLUMNS,
+      };
+    }
+    return { rowspan: 0, colspan: 0 };
+  };
+  // 搴忓彿鍙鏄庣粏琛岃繛缁紪鍙凤紝鍒嗙被琛岀暀绌�
+  const indexMethod = index => {
+    if (tableData.value[index]?.__isGroup) {
+      return "";
+    }
+    let count = 0;
+    for (let i = 0; i <= index; i++) {
+      if (!tableData.value[i]?.__isGroup) {
+        count += 1;
+      }
+    }
+    return count;
+  };
   // 鏄惁鏄剧ず鏂板寮规
   const isShowNewModal = ref(false);
   // 鏄惁鏄剧ず娌瑰搧鍏ュ簱寮规
@@ -270,7 +348,9 @@
     getStockInventoryListPageCombined({ ...searchForm.value, ...page })
       .then(res => {
         tableLoading.value = false;
-        tableData.value = res.data.records;
+        tableData.value = shouldGroupByTank.value
+          ? buildGroupedRows(res.data.records)
+          : res.data.records;
         total.value = res.data.total;
         // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
         // checkStockAndCreatePurchase();
@@ -346,6 +426,9 @@
 
   // 琛ㄦ牸琛岀被鍚�
   const tableRowClassName = ({ row }) => {
+    if (row?.__isGroup) {
+      return "row-tank-group";
+    }
     const stock = Number(row?.qualifiedUnLockedQuantity ?? 0);
     const warn = Number(row?.warnNum ?? 0);
     if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
@@ -379,6 +462,12 @@
 </script>
 
 <style scoped lang="scss">
+  .actions {
+    display: flex;
+    justify-content: space-between;
+    margin-bottom: 12px;
+  }
+
   :deep(.row-low-stock td) {
     background-color: #fde2e2;
     color: #c45656;
@@ -387,4 +476,34 @@
   :deep(.row-low-stock:hover > td) {
     background-color: #fcd4d4;
   }
+
+  :deep(.row-tank-group > td) {
+    background-color: #eef5ff;
+  }
+
+  :deep(.row-tank-group:hover > td) {
+    background-color: #e4eefc;
+  }
+
+  :deep(.tank-group-band) {
+    display: flex;
+    align-items: center;
+    width: 100%;
+    font-size: 13px;
+    line-height: 20px;
+  }
+
+  :deep(.tank-group-band__name) {
+    margin-right: auto;
+    padding-left: 8px;
+    border-left: 3px solid #1d6fd8;
+    font-weight: 700;
+    color: #1d6fd8;
+  }
+
+  :deep(.tank-group-band__stat) {
+    margin-left: 24px;
+    font-weight: 600;
+    color: #3a7bd5;
+  }
 </style>

--
Gitblit v1.9.3