From 14363b1ae7cb0d730158ec8dfbee55a85b2fc09f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 12 五月 2026 15:23:17 +0800
Subject: [PATCH] feat(financial): 实现财务模块数据接口联调

---
 src/views/financialManagement/generalLedger/index.vue |   74 ++++++++++++++++++++++++++++++++++---
 1 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/src/views/financialManagement/generalLedger/index.vue b/src/views/financialManagement/generalLedger/index.vue
index fbe2210..2d370f4 100644
--- a/src/views/financialManagement/generalLedger/index.vue
+++ b/src/views/financialManagement/generalLedger/index.vue
@@ -68,6 +68,10 @@
                :rules="rules"
                ref="formRef"
                label-width="100px">
+        <el-form-item label="鐖剁骇绉戠洰">
+          <el-input :model-value="parentSubjectLabel"
+                    disabled />
+        </el-form-item>
         <el-form-item label="绉戠洰缂栫爜"
                       prop="subjectCode">
           <el-input v-model="form.subjectCode"
@@ -201,8 +205,15 @@
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: "150",
+      width: "220",
       operation: [
+        {
+          name: "鏂板",
+          type: "primary",
+          clickFun: row => {
+            addChild(row);
+          },
+        },
         {
           name: "缂栬緫",
           type: "primary",
@@ -224,11 +235,13 @@
   const dataList = ref([]);
   const dialogVisible = ref(false);
   const dialogTitle = ref("");
+  const parentSubjectLabel = ref("椤剁骇绉戠洰");
   const formRef = ref(null);
   const isEdit = ref(false);
 
   const form = reactive({
     id: undefined,
+    parentId: null,
     subjectCode: "",
     subjectName: "",
     subjectType: "",
@@ -258,8 +271,8 @@
 
   const getTableData = () => {
     const query = {
-      pageNum: pagination.currentPage,
-      pageSize: pagination.pageSize,
+      current: pagination.currentPage,
+      size: pagination.pageSize,
       ...filters,
     };
     listAccountSubject(query).then(response => {
@@ -282,11 +295,19 @@
     getTableData();
   };
 
-  const add = () => {
-    isEdit.value = false;
-    dialogTitle.value = "鏂板绉戠洰";
+  const buildParentSubjectLabel = parentRow => {
+    if (!parentRow) {
+      return "椤剁骇绉戠洰";
+    }
+    const code = parentRow.subjectCode || "";
+    const name = parentRow.subjectName || "";
+    return `${code} ${name}`.trim();
+  };
+
+  const resetForm = ({ parentId = null, parentRow = null } = {}) => {
     Object.assign(form, {
       id: undefined,
+      parentId,
       subjectCode: "",
       subjectName: "",
       subjectType: "",
@@ -294,13 +315,54 @@
       status: 0,
       remark: "",
     });
+    parentSubjectLabel.value = buildParentSubjectLabel(parentRow);
+  };
+
+  const add = () => {
+    isEdit.value = false;
+    dialogTitle.value = "鏂板绉戠洰";
+    resetForm({ parentId: null, parentRow: null });
     dialogVisible.value = true;
+  };
+
+  const addChild = row => {
+    isEdit.value = false;
+    dialogTitle.value = "鏂板瀛愮鐩�";
+    resetForm({ parentId: row.id, parentRow: row });
+    form.subjectType = row.subjectType || "";
+    form.balanceDirection = row.balanceDirection || "鍊熸柟";
+    dialogVisible.value = true;
+  };
+
+  const findSubjectById = (nodes, id) => {
+    for (const item of nodes || []) {
+      if (item.id === id) {
+        return item;
+      }
+      if (item.children && item.children.length > 0) {
+        const found = findSubjectById(item.children, id);
+        if (found) {
+          return found;
+        }
+      }
+    }
+    return null;
   };
 
   const edit = row => {
     isEdit.value = true;
     dialogTitle.value = "缂栬緫绉戠洰";
     Object.assign(form, row);
+    form.parentId = row.parentId ?? null;
+    const parentRow =
+      row.parentId === null || row.parentId === undefined
+        ? null
+        : findSubjectById(dataList.value, row.parentId);
+    parentSubjectLabel.value = parentRow
+      ? buildParentSubjectLabel(parentRow)
+      : row.parentId
+      ? `涓婄骇ID: ${row.parentId}`
+      : buildParentSubjectLabel(null);
     dialogVisible.value = true;
   };
 

--
Gitblit v1.9.3