From 12808fdd0d17f2fdf423e9e2db202e514977cee1 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 29 四月 2026 16:52:41 +0800
Subject: [PATCH] 新增去掉id

---
 src/views/financialManagement/revenueManagement/index.vue |  120 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 103 insertions(+), 17 deletions(-)

diff --git a/src/views/financialManagement/revenueManagement/index.vue b/src/views/financialManagement/revenueManagement/index.vue
index 47961e5..70b58df 100644
--- a/src/views/financialManagement/revenueManagement/index.vue
+++ b/src/views/financialManagement/revenueManagement/index.vue
@@ -7,13 +7,13 @@
       </el-form-item>
       <el-form-item label="鏀舵鏂瑰紡:">
         <el-select
-                v-model="filters.incomeMethod"
+                v-model="filters.incomeMethodLabel"
                 placeholder="璇烽�夋嫨"
                 clearable
                 style="width: 200px;"
               >
                 <el-option
-                  v-for="item in payment_methods"
+                  v-for="item in incomeMethodOptions"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value"
@@ -34,8 +34,8 @@
           <el-button
             type="danger"
             icon="Delete"
-            :disabled="multipleList.length <= 0"
-            @click="deleteRow(multipleList.map((item) => item.id))"
+            :disabled="multipleList.length <= 0 || hasBusinessIdInSelection"
+            @click="handleBatchDelete"
           >
             鎵归噺鍒犻櫎
           </el-button>
@@ -51,11 +51,23 @@
           size: pagination.pageSize,
           total: pagination.total,
         }"
+        :isShowSummary="true"
+        :summaryMethod="summarizeMainTable"
         @selection-change="handleSelectionChange"
         @pagination="changePage"
       >
+        <template #incomeMethodSlot="{ row }">
+          <el-tag>
+            {{ getIncomeMethodLabel(row) }}
+          </el-tag>
+        </template>
         <template #operation="{ row }">
-          <el-button type="primary" link @click="edit(row.id)">
+          <el-button 
+            type="primary" 
+            link 
+            :disabled="!!row.businessId"
+            @click="edit(row.id)"
+          >
             缂栬緫
           </el-button>
           <el-button
@@ -83,7 +95,7 @@
 <script setup>
 import { usePaginationApi } from "@/hooks/usePaginationApi";
 import { listPage, delAccountIncome, fileListPage, fileAdd, fileDel } from "@/api/financialManagement/revenueManagement";
-import { onMounted, getCurrentInstance } from "vue";
+import { onMounted, getCurrentInstance, ref, computed } from "vue";
 import Modal from "./Modal.vue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import dayjs from "dayjs";
@@ -100,11 +112,25 @@
 const { proxy } = getCurrentInstance();
 const modalRef = ref();
 const { payment_methods } = proxy.useDict("payment_methods");
+const { receipt_payment_type } = proxy.useDict("receipt_payment_type");
 const { income_types } = proxy.useDict("income_types");
 const fileListRef = ref(null);
 const fileListDialogVisible = ref(false);
 const currentFileRow = ref(null);
 const accountType = ref('鏀跺叆');
+
+const incomeMethodOptions = computed(() => {
+  const merged = [...(payment_methods.value || []), ...(receipt_payment_type.value || [])];
+  const uniqueMap = new Map();
+  merged.forEach((item) => {
+    const label = item?.label;
+    if (!label) return;
+    if (!uniqueMap.has(label)) {
+      uniqueMap.set(label, { label, value: label });
+    }
+  });
+  return Array.from(uniqueMap.values());
+});
 
 const {
   filters,
@@ -117,7 +143,7 @@
 } = usePaginationApi(
   listPage,
   {
-    incomeMethod: undefined,
+    incomeMethodLabel: undefined,
     entryDate: undefined,
   },
   [
@@ -155,17 +181,11 @@
     },
     {
       label: "鏀舵鏂瑰紡",
-      prop: "incomeMethod",
+      prop: "incomeMethodLabel",
 			align: 'center',
 			width: '100',
-      dataType: "tag",
-      formatData: (params) => {
-        if (payment_methods.value.find((m) => m.value == params)) {
-          return payment_methods.value.find((m) => m.value == params).label;
-        } else {
-          return null
-        }
-      },
+      dataType: "slot",
+      slot: "incomeMethodSlot",
     },
     {
       label: "鍙戠エ鍙风爜",
@@ -194,18 +214,48 @@
       align: "center",
       width: "160px",
     },
-  ]
+  ],
+  undefined,
+  {
+    incomeMethodLabel: (value) => ({
+      incomeMethodLabel: value || undefined,
+    }),
+  }
 );
+
+// 琛ㄦ牸鍚堣锛氭敹鍏ラ噾棰�
+const summarizeMainTable = (param) => {
+  return proxy.summarizeTable(param, ["incomeMoney"]);
+};
+
+const getIncomeMethodLabel = (row) => {
+  const methodValue = row?.incomeMethod;
+  const dictList = String(row?.businessType) === "1"
+    ? receipt_payment_type.value
+    : payment_methods.value;
+  return dictList.find((item) => item.value == methodValue)?.label || "--";
+};
 
 // 澶氶�夊悗鍋氫粈涔�
 const handleSelectionChange = (selectionList) => {
   multipleList.value = selectionList;
 };
 
+// 鍒ゆ柇閫変腑鐨勯」涓槸鍚︽湁 businessId
+const hasBusinessIdInSelection = computed(() => {
+  return multipleList.value.some(item => item.businessId);
+});
+
 const add = () => {
   modalRef.value.openModal();
 };
 const edit = (id) => {
+  // 妫�鏌ュ綋鍓嶈鏄惁鏈� businessId
+  const row = dataList.value.find(item => item.id === id);
+  if (row && row.businessId) {
+    proxy.$modal.msgWarning("璇ヨ褰曞凡鍏宠仈涓氬姟锛屼笉鑳界紪杈�");
+    return;
+  }
   modalRef.value.loadForm(id);
 };
 const changePage = ({ page, limit }) => {
@@ -214,6 +264,25 @@
   onCurrentChange(page);
 };
 const deleteRow = (id) => {
+  // 濡傛灉鏄暟缁勶紝妫�鏌ユ槸鍚︽湁 businessId
+  if (Array.isArray(id)) {
+    const hasBusinessId = id.some(itemId => {
+      const row = dataList.value.find(item => item.id === itemId);
+      return row && row.businessId;
+    });
+    if (hasBusinessId) {
+      proxy.$modal.msgWarning("閫変腑鐨勮褰曚腑鍖呭惈宸插叧鑱斾笟鍔$殑璁板綍锛屼笉鑳藉垹闄�");
+      return;
+    }
+  } else {
+    // 鍗曚釜鍒犻櫎锛屾鏌ユ槸鍚︽湁 businessId
+    const row = dataList.value.find(item => item.id === id);
+    if (row && row.businessId) {
+      proxy.$modal.msgWarning("璇ヨ褰曞凡鍏宠仈涓氬姟锛屼笉鑳藉垹闄�");
+      return;
+    }
+  }
+  
   ElMessageBox.confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", {
     confirmButtonText: "纭畾",
     cancelButtonText: "鍙栨秷",
@@ -230,6 +299,23 @@
   });
 };
 
+// 鎵归噺鍒犻櫎
+const handleBatchDelete = () => {
+  if (multipleList.value.length === 0) {
+    proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+    return;
+  }
+  
+  // 妫�鏌ユ槸鍚︽湁 businessId
+  if (hasBusinessIdInSelection.value) {
+    proxy.$modal.msgWarning("閫変腑鐨勮褰曚腑鍖呭惈宸插叧鑱斾笟鍔$殑璁板綍锛屼笉鑳藉垹闄�");
+    return;
+  }
+  
+  const ids = multipleList.value.map((item) => item.id);
+  deleteRow(ids);
+};
+
 const changeDaterange = (value) => {
   if (value) {
     filters.entryDate = value;

--
Gitblit v1.9.3