From 534533425b15b183cea60fa162d9884e5d3c6243 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 13 十月 2026 17:55:50 +0800
Subject: [PATCH] Merge branch 'dev_海西州_北京同仁堂' into dev_海西州_惠牧

---
 src/views/erp/finance/voucher/modules/account-select.vue |  150 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 150 insertions(+), 0 deletions(-)

diff --git a/src/views/erp/finance/voucher/modules/account-select.vue b/src/views/erp/finance/voucher/modules/account-select.vue
new file mode 100644
index 0000000..4b6b093
--- /dev/null
+++ b/src/views/erp/finance/voucher/modules/account-select.vue
@@ -0,0 +1,150 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { FinAccountSubjectApi } from '#/api/erp/finance/subject';
+
+import { nextTick, ref } from 'vue';
+
+import { message, Modal } from 'ant-design-vue';
+
+import { useVbenVxeGrid } from '#/adapter/vxe-table';
+import { getAccountSubjectPage } from '#/api/erp/finance/subject';
+
+defineOptions({ name: 'FinAccountSelect' });
+
+const emit = defineEmits<{
+  selected: [subject: FinAccountSubjectApi.AccountSubject];
+}>();
+
+const open = ref(false); // 寮圭獥鏄惁鎵撳紑
+const selectedRow = ref<FinAccountSubjectApi.AccountSubject>(); // 閫変腑鐨勭鐩�
+
+/** 琛ㄦ牸閰嶇疆 */
+const [Grid, gridApi] = useVbenVxeGrid({
+  formOptions: {
+    schema: [
+      {
+        fieldName: 'subjectCode',
+        label: '绉戠洰缂栫爜',
+        component: 'Input',
+        componentProps: { placeholder: '璇疯緭鍏ョ鐩紪鐮�', allowClear: true },
+      },
+      {
+        fieldName: 'subjectName',
+        label: '绉戠洰鍚嶇О',
+        component: 'Input',
+        componentProps: { placeholder: '璇疯緭鍏ョ鐩悕绉�', allowClear: true },
+      },
+    ],
+  },
+  gridOptions: {
+    columns: [
+      { type: 'radio', width: 50 },
+      {
+        field: 'subjectCode',
+        title: '绉戠洰缂栫爜',
+        minWidth: 140,
+        treeNode: true,
+      },
+      { field: 'subjectName', title: '绉戠洰鍚嶇О', minWidth: 200 },
+      {
+        field: 'subjectType',
+        title: '绉戠洰绫诲瀷',
+        minWidth: 120,
+        cellRender: {
+          name: 'CellDict',
+          props: { type: 'finance_subject_type' },
+        },
+      },
+      {
+        field: 'balanceDirection',
+        title: '浣欓鏂瑰悜',
+        minWidth: 100,
+        cellRender: {
+          name: 'CellDict',
+          props: { type: 'finance_balance_direction' },
+        },
+      },
+    ],
+    height: 480,
+    keepSource: true,
+    radioConfig: {
+      highlight: true,
+      trigger: 'row',
+    },
+    proxyConfig: {
+      ajax: {
+        query: async (_params, formValues) => {
+          // 鏍戝舰灞曠ず涓嶉�傜敤鍒嗛〉锛屼竴娆℃�ф媺鍙栧叏閮ㄥ懡涓鐩�
+          const page = await getAccountSubjectPage({
+            pageNo: 1,
+            pageSize: -1,
+            status: 0,
+            ...formValues,
+          });
+          return {
+            list: page.list,
+            total: page.list.length,
+          };
+        },
+      },
+    },
+    rowConfig: {
+      keyField: 'id',
+      isHover: true,
+    },
+    toolbarConfig: {
+      refresh: true,
+      search: true,
+    },
+    treeConfig: {
+      parentField: 'parentId',
+      rowField: 'id',
+      transform: true,
+      expandAll: true,
+      reserve: true,
+    },
+  } as VxeTableGridOptions<FinAccountSubjectApi.AccountSubject>,
+  gridEvents: {
+    radioChange: ({ row }: { row: FinAccountSubjectApi.AccountSubject }) => {
+      selectedRow.value = row;
+    },
+  },
+});
+
+/** 鎵撳紑寮圭獥 */
+async function openModal() {
+  open.value = true;
+  selectedRow.value = undefined;
+  // 鐗规畩锛氬脊绐楁槸 destroy-on-close锛岄噷闈� Grid 闅忓脊绐楅噸寤猴紝蹇呴』绛夋寕杞藉畬鎴愬悗 gridApi 鎵嶆湁鐪熷疄渚�
+  // 锛坴ben 鐨� gridApi.grid 鍒濆鏄┖瀵硅薄锛宮ount 鏃舵墠璧嬪�硷級锛屽惁鍒� clearRadioRow 浼氭姤 is not a function
+  await nextTick();
+  await gridApi.grid.clearRadioRow();
+  await gridApi.formApi.resetForm();
+  await gridApi.query();
+}
+
+/** 纭閫夋嫨 */
+function handleConfirm() {
+  if (!selectedRow.value) {
+    message.warning('璇烽�夋嫨涓�鏉′細璁$鐩�');
+    return;
+  }
+  emit('selected', selectedRow.value);
+  open.value = false;
+}
+
+defineExpose({ open: openModal });
+</script>
+
+<template>
+  <Modal
+    v-model:open="open"
+    title="閫夋嫨浼氳绉戠洰"
+    width="70%"
+    :destroy-on-close="true"
+    @ok="handleConfirm"
+    @cancel="open = false"
+  >
+    <Grid table-title="浼氳绉戠洰鍒楄〃锛堜粎鍚敤鐘舵�佺殑绉戠洰鍙鍑瘉寮曠敤锛�" />
+  </Modal>
+</template>

--
Gitblit v1.9.3