From 7d6ddbd2750a46b389e4e1c28b94204df895b6fd Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 07 五月 2026 17:44:13 +0800
Subject: [PATCH] 财务管理总账科目模块接口对接

---
 src/api/financialManagement/accountSubject.js         |   46 +++
 src/views/financialManagement/generalLedger/index.vue |  527 +++++++++++++++++++++----------------
 src/router/index.js                                   |  224 ++++++++--------
 3 files changed, 458 insertions(+), 339 deletions(-)

diff --git a/src/api/financialManagement/accountSubject.js b/src/api/financialManagement/accountSubject.js
new file mode 100644
index 0000000..e54de63
--- /dev/null
+++ b/src/api/financialManagement/accountSubject.js
@@ -0,0 +1,46 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鎬诲笎绉戠洰鍒楄〃
+export function listAccountSubject(query) {
+  return request({
+    url: "/accountSubject/list",
+    method: "get",
+    params: query,
+  });
+}
+
+// 鏂板鎬诲笎绉戠洰
+export function addAccountSubject(data) {
+  return request({
+    url: "/accountSubject/add",
+    method: "post",
+    data: data,
+  });
+}
+
+// 淇敼鎬诲笎绉戠洰
+export function updateAccountSubject(data) {
+  return request({
+    url: "/accountSubject/edit",
+    method: "put",
+    data: data,
+  });
+}
+
+// 鍒犻櫎鎬诲笎绉戠洰
+export function delAccountSubject(ids) {
+  return request({
+    url: "/accountSubject/remove/" + ids,
+    method: "delete",
+  });
+}
+
+// 瀵煎嚭鎬诲笎绉戠洰
+export function exportAccountSubject(data) {
+  return request({
+    url: "/accountSubject/export",
+    method: "post",
+    data: data,
+    responseType: "blob",
+  });
+}
diff --git a/src/router/index.js b/src/router/index.js
index 2bb5586..e08b668 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -134,118 +134,118 @@
     ],
   },
   // 璐㈠姟绠$悊妯″潡璺敱
-  // {
-  //   path: "/financial",
-  //   component: Layout,
-  //   hidden: false,
-  //   redirect: "/financial/general-ledger",
-  //   alwaysShow: true,
-  //   meta: { title: "璐㈠姟绠$悊", icon: "money" },
-  //   children: [
-  //     {
-  //       path: "general-ledger",
-  //       component: () => import("@/views/financialManagement/generalLedger/index.vue"),
-  //       name: "GeneralLedger",
-  //       meta: { title: "鎬诲笎绉戠洰" },
-  //     },
-  //     {
-  //       path: "sales-out",
-  //       component: () => import("@/views/financialManagement/receivable/salesOut.vue"),
-  //       name: "SalesOut",
-  //       meta: { title: "閿�鍞嚭搴�" },
-  //     },
-  //     {
-  //       path: "sales-return",
-  //       component: () => import("@/views/financialManagement/receivable/salesReturn.vue"),
-  //       name: "SalesReturn",
-  //       meta: { title: "閿�鍞��璐�" },
-  //     },
-  //     {
-  //       path: "receivable-reconciliation",
-  //       component: () => import("@/views/financialManagement/receivable/reconciliation.vue"),
-  //       name: "ReceivableReconciliation",
-  //       meta: { title: "搴旀敹瀵硅处" },
-  //     },
-  //     {
-  //       path: "invoice-apply",
-  //       component: () => import("@/views/financialManagement/receivable/invoiceApply.vue"),
-  //       name: "InvoiceApply",
-  //       meta: { title: "寮�绁ㄧ敵璇�" },
-  //     },
-  //     {
-  //       path: "output-invoice",
-  //       component: () => import("@/views/financialManagement/receivable/outputInvoice.vue"),
-  //       name: "OutputInvoice",
-  //       meta: { title: "閿�椤瑰彂绁�" },
-  //     },
-  //     {
-  //       path: "receipt",
-  //       component: () => import("@/views/financialManagement/receivable/receipt.vue"),
-  //       name: "Receipt",
-  //       meta: { title: "鏀舵鍗�" },
-  //     },
-  //     {
-  //       path: "purchase-in",
-  //       component: () => import("@/views/financialManagement/payable/purchaseIn.vue"),
-  //       name: "PurchaseIn",
-  //       meta: { title: "閲囪喘鍏ュ簱" },
-  //     },
-  //     {
-  //       path: "payable-reconciliation",
-  //       component: () => import("@/views/financialManagement/payable/reconciliation.vue"),
-  //       name: "PayableReconciliation",
-  //       meta: { title: "搴斾粯瀵硅处" },
-  //     },
-  //     {
-  //       path: "input-invoice",
-  //       component: () => import("@/views/financialManagement/payable/input-invoice.vue"),
-  //       name: "InputInvoice",
-  //       meta: { title: "杩涢」鍙戠エ" },
-  //     },
-  //     {
-  //       path: "payment-apply",
-  //       component: () => import("@/views/financialManagement/payable/paymentApply.vue"),
-  //       name: "PaymentApply",
-  //       meta: { title: "浠樻鐢宠" },
-  //     },
-  //     {
-  //       path: "payment",
-  //       component: () => import("@/views/financialManagement/payable/payment.vue"),
-  //       name: "Payment",
-  //       meta: { title: "浠樻鍗�" },
-  //     },
-  //     {
-  //       path: "fixed-assets",
-  //       component: () => import("@/views/financialManagement/assets/fixedAssets.vue"),
-  //       name: "FixedAssets",
-  //       meta: { title: "鍥哄畾璧勪骇" },
-  //     },
-  //     {
-  //       path: "intangible-assets",
-  //       component: () => import("@/views/financialManagement/assets/intangibleAssets.vue"),
-  //       name: "IntangibleAssets",
-  //       meta: { title: "鏃犲舰璧勪骇" },
-  //     },
-  //     {
-  //       path: "voucher",
-  //       component: () => import("@/views/financialManagement/voucher/index.vue"),
-  //       name: "Voucher",
-  //       meta: { title: "鍑瘉" },
-  //     },
-  //     {
-  //       path: "voucher-general-ledger",
-  //       component: () => import("@/views/financialManagement/voucher/generalLedger.vue"),
-  //       name: "VoucherGeneralLedger",
-  //       meta: { title: "绉戠洰鎬诲笎" },
-  //     },
-  //     {
-  //       path: "voucher-detail-ledger",
-  //       component: () => import("@/views/financialManagement/voucher/detailLedger.vue"),
-  //       name: "VoucherDetailLedger",
-  //       meta: { title: "绉戠洰鏄庣粏甯�" },
-  //     },
-  //   ],
-  // },
+  {
+    path: "/financial",
+    component: Layout,
+    hidden: false,
+    redirect: "/financial/general-ledger",
+    alwaysShow: true,
+    meta: { title: "璐㈠姟绠$悊", icon: "money" },
+    children: [
+      {
+        path: "general-ledger",
+        component: () => import("@/views/financialManagement/generalLedger/index.vue"),
+        name: "GeneralLedger",
+        meta: { title: "鎬诲笎绉戠洰" },
+      },
+      {
+        path: "sales-out",
+        component: () => import("@/views/financialManagement/receivable/salesOut.vue"),
+        name: "SalesOut",
+        meta: { title: "閿�鍞嚭搴�" },
+      },
+      {
+        path: "sales-return",
+        component: () => import("@/views/financialManagement/receivable/salesReturn.vue"),
+        name: "SalesReturn",
+        meta: { title: "閿�鍞��璐�" },
+      },
+      {
+        path: "receivable-reconciliation",
+        component: () => import("@/views/financialManagement/receivable/reconciliation.vue"),
+        name: "ReceivableReconciliation",
+        meta: { title: "搴旀敹瀵硅处" },
+      },
+      {
+        path: "invoice-apply",
+        component: () => import("@/views/financialManagement/receivable/invoiceApply.vue"),
+        name: "InvoiceApply",
+        meta: { title: "寮�绁ㄧ敵璇�" },
+      },
+      {
+        path: "output-invoice",
+        component: () => import("@/views/financialManagement/receivable/outputInvoice.vue"),
+        name: "OutputInvoice",
+        meta: { title: "閿�椤瑰彂绁�" },
+      },
+      {
+        path: "receipt",
+        component: () => import("@/views/financialManagement/receivable/receipt.vue"),
+        name: "Receipt",
+        meta: { title: "鏀舵鍗�" },
+      },
+      {
+        path: "purchase-in",
+        component: () => import("@/views/financialManagement/payable/purchaseIn.vue"),
+        name: "PurchaseIn",
+        meta: { title: "閲囪喘鍏ュ簱" },
+      },
+      {
+        path: "payable-reconciliation",
+        component: () => import("@/views/financialManagement/payable/reconciliation.vue"),
+        name: "PayableReconciliation",
+        meta: { title: "搴斾粯瀵硅处" },
+      },
+      {
+        path: "input-invoice",
+        component: () => import("@/views/financialManagement/payable/input-invoice.vue"),
+        name: "InputInvoice",
+        meta: { title: "杩涢」鍙戠エ" },
+      },
+      {
+        path: "payment-apply",
+        component: () => import("@/views/financialManagement/payable/paymentApply.vue"),
+        name: "PaymentApply",
+        meta: { title: "浠樻鐢宠" },
+      },
+      {
+        path: "payment",
+        component: () => import("@/views/financialManagement/payable/payment.vue"),
+        name: "Payment",
+        meta: { title: "浠樻鍗�" },
+      },
+      {
+        path: "fixed-assets",
+        component: () => import("@/views/financialManagement/assets/fixedAssets.vue"),
+        name: "FixedAssets",
+        meta: { title: "鍥哄畾璧勪骇" },
+      },
+      {
+        path: "intangible-assets",
+        component: () => import("@/views/financialManagement/assets/intangibleAssets.vue"),
+        name: "IntangibleAssets",
+        meta: { title: "鏃犲舰璧勪骇" },
+      },
+      {
+        path: "voucher",
+        component: () => import("@/views/financialManagement/voucher/index.vue"),
+        name: "Voucher",
+        meta: { title: "鍑瘉" },
+      },
+      {
+        path: "voucher-general-ledger",
+        component: () => import("@/views/financialManagement/voucher/generalLedger.vue"),
+        name: "VoucherGeneralLedger",
+        meta: { title: "绉戠洰鎬诲笎" },
+      },
+      {
+        path: "voucher-detail-ledger",
+        component: () => import("@/views/financialManagement/voucher/detailLedger.vue"),
+        name: "VoucherDetailLedger",
+        meta: { title: "绉戠洰鏄庣粏甯�" },
+      },
+    ],
+  },
 ];
 
 // 鍔ㄦ�佽矾鐢憋紝鍩轰簬鐢ㄦ埛鏉冮檺鍔ㄦ�佸幓鍔犺浇
diff --git a/src/views/financialManagement/generalLedger/index.vue b/src/views/financialManagement/generalLedger/index.vue
index 0570627..fbe2210 100644
--- a/src/views/financialManagement/generalLedger/index.vue
+++ b/src/views/financialManagement/generalLedger/index.vue
@@ -1,23 +1,39 @@
 <template>
   <div class="app-container">
-    <el-form :model="filters" :inline="true">
+    <el-form :model="filters"
+             :inline="true">
       <el-form-item label="绉戠洰缂栫爜:">
-        <el-input v-model="filters.subjectCode" placeholder="璇疯緭鍏ョ鐩紪鐮�" clearable style="width: 200px;" />
+        <el-input v-model="filters.subjectCode"
+                  placeholder="璇疯緭鍏ョ鐩紪鐮�"
+                  clearable
+                  style="width: 200px;" />
       </el-form-item>
       <el-form-item label="绉戠洰鍚嶇О:">
-        <el-input v-model="filters.subjectName" placeholder="璇疯緭鍏ョ鐩悕绉�" clearable style="width: 200px;" />
+        <el-input v-model="filters.subjectName"
+                  placeholder="璇疯緭鍏ョ鐩悕绉�"
+                  clearable
+                  style="width: 200px;" />
       </el-form-item>
       <el-form-item label="绉戠洰绫诲瀷:">
-        <el-select v-model="filters.subjectType" placeholder="璇烽�夋嫨" clearable style="width: 200px;">
-          <el-option label="璧勪骇绫�" value="asset" />
-          <el-option label="璐熷�虹被" value="liability" />
-          <el-option label="鏉冪泭绫�" value="equity" />
-          <el-option label="鎴愭湰绫�" value="cost" />
-          <el-option label="鎹熺泭绫�" value="profit_loss" />
+        <el-select v-model="filters.subjectType"
+                   placeholder="璇烽�夋嫨"
+                   clearable
+                   style="width: 200px;">
+          <el-option label="璧勪骇绫�"
+                     value="璧勪骇绫�" />
+          <el-option label="璐熷�虹被"
+                     value="璐熷�虹被" />
+          <el-option label="鏉冪泭绫�"
+                     value="鏉冪泭绫�" />
+          <el-option label="鎴愭湰绫�"
+                     value="鎴愭湰绫�" />
+          <el-option label="鎹熺泭绫�"
+                     value="鎹熺泭绫�" />
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" @click="getTableData">鎼滅储</el-button>
+        <el-button type="primary"
+                   @click="getTableData">鎼滅储</el-button>
         <el-button @click="resetFilters">閲嶇疆</el-button>
       </el-form-item>
     </el-form>
@@ -25,76 +41,85 @@
       <div class="actions">
         <div></div>
         <div>
-          <el-button type="primary" @click="add" icon="Plus">鏂板</el-button>
-          <el-button @click="handleOut" icon="Download">瀵煎嚭</el-button>
+          <el-button type="primary"
+                     @click="add"
+                     icon="Plus">鏂板</el-button>
+          <el-button @click="handleOut"
+                     icon="Download">瀵煎嚭</el-button>
         </div>
       </div>
-      <PIMTable
-        rowKey="id"
-        :column="columns"
-        :tableData="dataList"
-        :page="{
+      <PIMTable rowKey="id"
+                :column="columns"
+                :tableData="dataList"
+                :page="{
           current: pagination.currentPage,
           size: pagination.pageSize,
           total: pagination.total,
         }"
-        @pagination="changePage"
-      >
-        <template #subjectType="{ row }">
-          <el-tag :type="getSubjectTypeType(row.subjectType)">{{ getSubjectTypeLabel(row.subjectType) }}</el-tag>
-        </template>
-        <template #balanceDirection="{ row }">
-          <el-tag :type="row.balanceDirection === 'debit' ? 'success' : 'danger'">
-            {{ row.balanceDirection === 'debit' ? '鍊熸柟' : '璐锋柟' }}
-          </el-tag>
-        </template>
-        <template #status="{ row }">
-          <el-tag :type="row.status === 'active' ? 'success' : 'info'">
-            {{ row.status === 'active' ? '鍚敤' : '绂佺敤' }}
-          </el-tag>
-        </template>
-        <template #operation="{ row }">
-          <el-button type="primary" link @click="edit(row)">缂栬緫</el-button>
-          <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button>
-        </template>
+                @pagination="changePage">
       </PIMTable>
     </div>
-
-    <FormDialog :title="dialogTitle" v-model="dialogVisible" width="600px" @confirm="submitForm" @cancel="dialogVisible = false">
-      <el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
-        <el-form-item label="绉戠洰缂栫爜" prop="subjectCode">
-          <el-input v-model="form.subjectCode" placeholder="璇疯緭鍏ョ鐩紪鐮�" />
+    <FormDialog :title="dialogTitle"
+                v-model="dialogVisible"
+                width="600px"
+                @confirm="submitForm"
+                @cancel="dialogVisible = false">
+      <el-form :model="form"
+               :rules="rules"
+               ref="formRef"
+               label-width="100px">
+        <el-form-item label="绉戠洰缂栫爜"
+                      prop="subjectCode">
+          <el-input v-model="form.subjectCode"
+                    placeholder="璇疯緭鍏ョ鐩紪鐮�" />
         </el-form-item>
-        <el-form-item label="绉戠洰鍚嶇О" prop="subjectName">
-          <el-input v-model="form.subjectName" placeholder="璇疯緭鍏ョ鐩悕绉�" />
+        <el-form-item label="绉戠洰鍚嶇О"
+                      prop="subjectName">
+          <el-input v-model="form.subjectName"
+                    placeholder="璇疯緭鍏ョ鐩悕绉�" />
         </el-form-item>
-        <el-form-item label="绉戠洰绫诲瀷" prop="subjectType">
-          <el-select v-model="form.subjectType" placeholder="璇烽�夋嫨绉戠洰绫诲瀷" style="width: 100%;">
-            <el-option label="璧勪骇绫�" value="asset" />
-            <el-option label="璐熷�虹被" value="liability" />
-            <el-option label="鏉冪泭绫�" value="equity" />
-            <el-option label="鎴愭湰绫�" value="cost" />
-            <el-option label="鎹熺泭绫�" value="profit_loss" />
+        <el-form-item label="绉戠洰绫诲瀷"
+                      prop="subjectType">
+          <el-select v-model="form.subjectType"
+                     placeholder="璇烽�夋嫨绉戠洰绫诲瀷"
+                     style="width: 100%;">
+            <el-option label="璧勪骇绫�"
+                       value="璧勪骇绫�" />
+            <el-option label="璐熷�虹被"
+                       value="璐熷�虹被" />
+            <el-option label="鏉冪泭绫�"
+                       value="鏉冪泭绫�" />
+            <el-option label="鎴愭湰绫�"
+                       value="鎴愭湰绫�" />
+            <el-option label="鎹熺泭绫�"
+                       value="鎹熺泭绫�" />
           </el-select>
         </el-form-item>
-        <el-form-item label="浣欓鏂瑰悜" prop="balanceDirection">
+        <el-form-item label="浣欓鏂瑰悜"
+                      prop="balanceDirection">
           <el-radio-group v-model="form.balanceDirection">
-            <el-radio label="debit">鍊熸柟</el-radio>
-            <el-radio label="credit">璐锋柟</el-radio>
+            <el-radio label="鍊熸柟">鍊熸柟</el-radio>
+            <el-radio label="璐锋柟">璐锋柟</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="鐘舵��" prop="status">
+        <el-form-item label="鐘舵��"
+                      prop="status">
           <el-radio-group v-model="form.status">
-            <el-radio label="active">鍚敤</el-radio>
-            <el-radio label="inactive">绂佺敤</el-radio>
+            <el-radio :label="0">鍚敤</el-radio>
+            <el-radio :label="1">绂佺敤</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="澶囨敞" prop="remark">
-          <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉�" />
+        <el-form-item label="澶囨敞"
+                      prop="remark">
+          <el-input v-model="form.remark"
+                    type="textarea"
+                    :rows="3"
+                    placeholder="璇疯緭鍏ュ娉�" />
         </el-form-item>
       </el-form>
       <template #footer>
-        <el-button type="primary" @click="submitForm">纭畾</el-button>
+        <el-button type="primary"
+                   @click="submitForm">纭畾</el-button>
         <el-button @click="dialogVisible = false">鍙栨秷</el-button>
       </template>
     </FormDialog>
@@ -102,190 +127,238 @@
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from "vue";
-import { ElMessage, ElMessageBox } from "element-plus";
-import FormDialog from "@/components/Dialog/FormDialog.vue";
+  import { ref, reactive, onMounted, getCurrentInstance } from "vue";
+  import { ElMessage, ElMessageBox } from "element-plus";
+  import FormDialog from "@/components/Dialog/FormDialog.vue";
+  import {
+    listAccountSubject,
+    addAccountSubject,
+    updateAccountSubject,
+    delAccountSubject,
+    exportAccountSubject,
+  } from "@/api/financialManagement/accountSubject";
 
-defineOptions({
-  name: "鎬诲笎绉戠洰",
-});
+  defineOptions({
+    name: "鎬诲笎绉戠洰",
+  });
 
-const filters = reactive({
-  subjectCode: "",
-  subjectName: "",
-  subjectType: "",
-});
+  const { proxy } = getCurrentInstance();
 
-const pagination = reactive({
-  currentPage: 1,
-  pageSize: 10,
-  total: 0,
-});
-
-const columns = [
-  { label: "绉戠洰缂栫爜", prop: "subjectCode", width: "120" },
-  { label: "绉戠洰鍚嶇О", prop: "subjectName", width: "150" },
-  { label: "绉戠洰绫诲瀷", prop: "subjectType", slot: "subjectType" },
-  { label: "浣欓鏂瑰悜", prop: "balanceDirection", slot: "balanceDirection" },
-  { label: "鐘舵��", prop: "status", slot: "status" },
-  { label: "澶囨敞", prop: "remark", showOverflowTooltip: true },
-  { label: "鎿嶄綔", prop: "operation", slot: "operation", width: "150", fixed: "right" },
-];
-
-const dataList = ref([]);
-const dialogVisible = ref(false);
-const dialogTitle = ref("");
-const formRef = ref(null);
-const isEdit = ref(false);
-const currentId = ref(null);
-
-const form = reactive({
-  subjectCode: "",
-  subjectName: "",
-  subjectType: "",
-  balanceDirection: "debit",
-  status: "active",
-  remark: "",
-});
-
-const rules = {
-  subjectCode: [{ required: true, message: "璇疯緭鍏ョ鐩紪鐮�", trigger: "blur" }],
-  subjectName: [{ required: true, message: "璇疯緭鍏ョ鐩悕绉�", trigger: "blur" }],
-  subjectType: [{ required: true, message: "璇烽�夋嫨绉戠洰绫诲瀷", trigger: "change" }],
-};
-
-const mockData = [
-  { id: 1, subjectCode: "1001", subjectName: "搴撳瓨鐜伴噾", subjectType: "asset", balanceDirection: "debit", status: "active", remark: "" },
-  { id: 2, subjectCode: "1002", subjectName: "閾惰瀛樻", subjectType: "asset", balanceDirection: "debit", status: "active", remark: "" },
-  { id: 3, subjectCode: "1122", subjectName: "搴旀敹璐︽", subjectType: "asset", balanceDirection: "debit", status: "active", remark: "" },
-  { id: 4, subjectCode: "2202", subjectName: "搴斾粯璐︽", subjectType: "liability", balanceDirection: "credit", status: "active", remark: "" },
-  { id: 5, subjectCode: "4001", subjectName: "瀹炴敹璧勬湰", subjectType: "equity", balanceDirection: "credit", status: "active", remark: "" },
-  { id: 6, subjectCode: "5001", subjectName: "鐢熶骇鎴愭湰", subjectType: "cost", balanceDirection: "debit", status: "active", remark: "" },
-  { id: 7, subjectCode: "6001", subjectName: "涓昏惀涓氬姟鏀跺叆", subjectType: "profit_loss", balanceDirection: "credit", status: "active", remark: "" },
-  { id: 8, subjectCode: "6401", subjectName: "涓昏惀涓氬姟鎴愭湰", subjectType: "profit_loss", balanceDirection: "debit", status: "active", remark: "" },
-];
-
-const getSubjectTypeLabel = (type) => {
-  const map = {
-    asset: "璧勪骇绫�",
-    liability: "璐熷�虹被",
-    equity: "鏉冪泭绫�",
-    cost: "鎴愭湰绫�",
-    profit_loss: "鎹熺泭绫�",
-  };
-  return map[type] || type;
-};
-
-const getSubjectTypeType = (type) => {
-  const map = {
-    asset: "success",
-    liability: "danger",
-    equity: "warning",
-    cost: "info",
-    profit_loss: "primary",
-  };
-  return map[type] || "";
-};
-
-const getTableData = () => {
-  let result = [...mockData];
-  if (filters.subjectCode) {
-    result = result.filter(item => item.subjectCode.includes(filters.subjectCode));
-  }
-  if (filters.subjectName) {
-    result = result.filter(item => item.subjectName.includes(filters.subjectName));
-  }
-  if (filters.subjectType) {
-    result = result.filter(item => item.subjectType === filters.subjectType);
-  }
-  pagination.total = result.length;
-  dataList.value = result.slice((pagination.currentPage - 1) * pagination.pageSize, pagination.currentPage * pagination.pageSize);
-};
-
-const resetFilters = () => {
-  filters.subjectCode = "";
-  filters.subjectName = "";
-  filters.subjectType = "";
-  pagination.currentPage = 1;
-  getTableData();
-};
-
-const changePage = ({ current, size }) => {
-  pagination.currentPage = current;
-  pagination.pageSize = size;
-  getTableData();
-};
-
-const add = () => {
-  isEdit.value = false;
-  dialogTitle.value = "鏂板绉戠洰";
-  Object.assign(form, {
+  const filters = reactive({
     subjectCode: "",
     subjectName: "",
     subjectType: "",
-    balanceDirection: "debit",
-    status: "active",
+  });
+
+  const pagination = reactive({
+    currentPage: 1,
+    pageSize: 10,
+    total: 0,
+  });
+
+  const columns = [
+    { label: "绉戠洰缂栫爜", prop: "subjectCode", width: "120" },
+    { label: "绉戠洰鍚嶇О", prop: "subjectName", width: "150" },
+    { label: "绉戠洰绫诲瀷", prop: "subjectType" },
+    {
+      label: "浣欓鏂瑰悜",
+      prop: "balanceDirection",
+      dataType: "tag",
+      formatData: value => {
+        if (value === "鍊熸柟") {
+          return "鍊熸柟";
+        }
+        return "璐锋柟";
+      },
+      formatType: value => {
+        if (value === "鍊熸柟") {
+          return "primary";
+        }
+        return "danger";
+      },
+    },
+    {
+      label: "鐘舵��",
+      prop: "status",
+      dataType: "tag",
+      formatData: value => {
+        if (value === 0 || value === "0") {
+          return "鍚敤";
+        }
+        return "绂佺敤";
+      },
+      formatType: value => {
+        if (value === 0 || value === "0") {
+          return "success";
+        }
+        return "info";
+      },
+    },
+
+    { label: "澶囨敞", prop: "remark", showOverflowTooltip: true },
+    {
+      dataType: "action",
+      label: "鎿嶄綔",
+      align: "center",
+      fixed: "right",
+      width: "150",
+      operation: [
+        {
+          name: "缂栬緫",
+          type: "primary",
+          clickFun: row => {
+            edit(row);
+          },
+        },
+        {
+          name: "鍒犻櫎",
+          type: "danger",
+          clickFun: row => {
+            handleDelete(row);
+          },
+        },
+      ],
+    },
+  ];
+
+  const dataList = ref([]);
+  const dialogVisible = ref(false);
+  const dialogTitle = ref("");
+  const formRef = ref(null);
+  const isEdit = ref(false);
+
+  const form = reactive({
+    id: undefined,
+    subjectCode: "",
+    subjectName: "",
+    subjectType: "",
+    balanceDirection: "鍊熸柟",
+    status: 0,
     remark: "",
   });
-  dialogVisible.value = true;
-};
 
-const edit = (row) => {
-  isEdit.value = true;
-  currentId.value = row.id;
-  dialogTitle.value = "缂栬緫绉戠洰";
-  Object.assign(form, row);
-  dialogVisible.value = true;
-};
+  const rules = {
+    subjectCode: [{ required: true, message: "璇疯緭鍏ョ鐩紪鐮�", trigger: "blur" }],
+    subjectName: [{ required: true, message: "璇疯緭鍏ョ鐩悕绉�", trigger: "blur" }],
+    subjectType: [
+      { required: true, message: "璇烽�夋嫨绉戠洰绫诲瀷", trigger: "change" },
+    ],
+  };
 
-const submitForm = () => {
-  formRef.value.validate((valid) => {
-    if (valid) {
-      if (isEdit.value) {
-        const index = mockData.findIndex(item => item.id === currentId.value);
-        if (index !== -1) {
-          mockData[index] = { ...mockData[index], ...form };
+  const getSubjectTypeType = type => {
+    const map = {
+      璧勪骇绫�: "success",
+      璐熷�虹被: "danger",
+      鏉冪泭绫�: "warning",
+      鎴愭湰绫�: "info",
+      鎹熺泭绫�: "primary",
+    };
+    return map[type] || "";
+  };
+
+  const getTableData = () => {
+    const query = {
+      pageNum: pagination.currentPage,
+      pageSize: pagination.pageSize,
+      ...filters,
+    };
+    listAccountSubject(query).then(response => {
+      dataList.value = response.data.records;
+      pagination.total = response.data.total;
+    });
+  };
+
+  const resetFilters = () => {
+    filters.subjectCode = "";
+    filters.subjectName = "";
+    filters.subjectType = "";
+    pagination.currentPage = 1;
+    getTableData();
+  };
+
+  const changePage = obj => {
+    pagination.currentPage = obj.page;
+    pagination.pageSize = obj.limit;
+    getTableData();
+  };
+
+  const add = () => {
+    isEdit.value = false;
+    dialogTitle.value = "鏂板绉戠洰";
+    Object.assign(form, {
+      id: undefined,
+      subjectCode: "",
+      subjectName: "",
+      subjectType: "",
+      balanceDirection: "鍊熸柟",
+      status: 0,
+      remark: "",
+    });
+    dialogVisible.value = true;
+  };
+
+  const edit = row => {
+    isEdit.value = true;
+    dialogTitle.value = "缂栬緫绉戠洰";
+    Object.assign(form, row);
+    dialogVisible.value = true;
+  };
+
+  const submitForm = () => {
+    formRef.value.validate(valid => {
+      if (valid) {
+        if (isEdit.value) {
+          updateAccountSubject(form).then(() => {
+            ElMessage.success("缂栬緫鎴愬姛");
+            dialogVisible.value = false;
+            getTableData();
+          });
+        } else {
+          addAccountSubject(form).then(() => {
+            ElMessage.success("鏂板鎴愬姛");
+            dialogVisible.value = false;
+            getTableData();
+          });
         }
-        ElMessage.success("缂栬緫鎴愬姛");
-      } else {
-        const newId = mockData.length > 0 ? Math.max(...mockData.map(item => item.id)) + 1 : 1;
-        mockData.push({ id: newId, ...form });
-        ElMessage.success("鏂板鎴愬姛");
       }
-      dialogVisible.value = false;
-      getTableData();
-    }
-  });
-};
+    });
+  };
 
-const handleDelete = (row) => {
-  ElMessageBox.confirm("纭鍒犻櫎璇ョ鐩悧锛�", "鎻愮ず", {
-    confirmButtonText: "纭畾",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  }).then(() => {
-    const index = mockData.findIndex(item => item.id === row.id);
-    if (index !== -1) {
-      mockData.splice(index, 1);
-    }
-    ElMessage.success("鍒犻櫎鎴愬姛");
+  const handleDelete = row => {
+    const ids = row.id;
+    ElMessageBox.confirm("纭鍒犻櫎璇ョ鐩悧锛�", "鎻愮ず", {
+      confirmButtonText: "纭畾",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
+      .then(() => {
+        return delAccountSubject(ids);
+      })
+      .then(() => {
+        ElMessage.success("鍒犻櫎鎴愬姛");
+        getTableData();
+      });
+  };
+
+  const handleOut = () => {
+    proxy.download(
+      "accountSubject/export",
+      {
+        ...filters,
+      },
+      `account_subject_${new Date().getTime()}.xlsx`
+    );
+  };
+
+  onMounted(() => {
     getTableData();
   });
-};
-
-const handleOut = () => {
-  ElMessage.success("瀵煎嚭鎴愬姛");
-};
-
-onMounted(() => {
-  getTableData();
-});
 </script>
 
 <style lang="scss" scoped>
-.actions {
-  display: flex;
-  justify-content: space-between;
-  margin-bottom: 15px;
-}
+  .actions {
+    display: flex;
+    justify-content: space-between;
+    margin-bottom: 15px;
+  }
 </style>

--
Gitblit v1.9.3