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/data.ts | 297 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 297 insertions(+), 0 deletions(-)
diff --git a/src/views/erp/finance/voucher/data.ts b/src/views/erp/finance/voucher/data.ts
new file mode 100644
index 0000000..3953605
--- /dev/null
+++ b/src/views/erp/finance/voucher/data.ts
@@ -0,0 +1,297 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { FinVoucherApi } from '#/api/erp/finance/voucher';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import { z } from '#/adapter/form';
+import { getRangePickerDefaultProps } from '#/utils';
+
+import dayjs from 'dayjs';
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'edit';
+
+/** 鏂板/淇敼鐨勮〃鍗曪紙鍒嗗綍鐢� entry-table 鍗曠嫭缁存姢锛� */
+export function useFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ component: 'Input',
+ fieldName: 'id',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'voucherNo',
+ label: '鍑瘉瀛楀彿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '鐣欑┖鑷姩鐢熸垚',
+ allowClear: true,
+ },
+ help: '鐣欑┖鏃剁敱绯荤粺鎸夈�愯 + 骞存湀 + 4 浣嶆祦姘淬�戣嚜鍔ㄧ敓鎴�',
+ },
+ {
+ fieldName: 'voucherDate',
+ label: '鍑瘉鏃ユ湡',
+ component: 'DatePicker',
+ componentProps: {
+ placeholder: '璇烽�夋嫨鍑瘉鏃ユ湡',
+ showTime: false,
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ class: 'w-full',
+ },
+ rules: 'required',
+ defaultValue: dayjs().format('YYYY-MM-DD'),
+ },
+ {
+ // 涓庡嚟璇佸瓧鍙枫�佸嚟璇佹棩鏈熷苟鎺掍竴琛岋紝閬垮厤涓夊垪鏍呮牸閲岀┖鍑轰竴鏍�
+ fieldName: 'attachmentCount',
+ label: '闄勪欢寮犳暟',
+ component: 'InputNumber',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇疯緭鍏ラ檮浠跺紶鏁�',
+ min: 0,
+ precision: 0,
+ },
+ defaultValue: 0,
+ rules: z.number().min(0).default(0),
+ },
+ {
+ fieldName: 'summary',
+ label: '鍑瘉鎽樿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ嚟璇佹憳瑕侊紝濡傦細鏀粯 10 鏈堝姙鍏垂',
+ allowClear: true,
+ maxLength: 200,
+ },
+ formItemClass: 'col-span-3',
+ },
+ {
+ fieldName: 'entries',
+ label: '鍑瘉鍒嗗綍',
+ component: 'Input',
+ formItemClass: 'col-span-3',
+ },
+ {
+ fieldName: 'blobIds',
+ label: '鍑瘉闄勪欢',
+ component: 'FileUpload',
+ componentProps: {
+ valueKey: 'id',
+ maxNumber: 10,
+ multiple: true,
+ helpText: '鏀寔鍥剧墖銆丳DF銆丒xcel 绛夋牸寮忥紝鍗曚釜鏂囦欢涓嶈秴杩� 50MB',
+ },
+ formItemClass: 'col-span-3',
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ娉�',
+ rows: 3,
+ },
+ formItemClass: 'col-span-3',
+ },
+ ];
+}
+
+/** 鍒嗗綍琛ㄦ牸鐨勫瓧娈� */
+export function useEntryColumns(
+ disabled: boolean,
+): VxeTableGridOptions['columns'] {
+ return [
+ { type: 'seq', title: '搴忓彿', width: 55, fixed: 'left' },
+ {
+ field: 'summary',
+ title: '鎽樿',
+ minWidth: 140,
+ slots: { default: 'summary' },
+ },
+ {
+ field: 'subjectCode',
+ title: '浼氳绉戠洰',
+ minWidth: 180,
+ slots: { default: 'subject' },
+ },
+ {
+ field: 'debit',
+ title: '鍊熸柟閲戦',
+ minWidth: 130,
+ align: 'center',
+ slots: { default: 'debit' },
+ },
+ {
+ field: 'credit',
+ title: '璐锋柟閲戦',
+ minWidth: 130,
+ align: 'center',
+ slots: { default: 'credit' },
+ },
+ {
+ field: 'auxiliaryType',
+ title: '杈呭姪鏍哥畻',
+ minWidth: 120,
+ slots: { default: 'auxiliaryType' },
+ },
+ {
+ field: 'auxiliaryName',
+ title: '杈呭姪鏍哥畻瀵硅薄',
+ minWidth: 150,
+ slots: { default: 'auxiliaryName' },
+ },
+ {
+ title: '鎿嶄綔',
+ width: 70,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ visible: !disabled,
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'voucherNo',
+ label: '鍑瘉瀛楀彿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ嚟璇佸瓧鍙�',
+ allowClear: true,
+ },
+ },
+ {
+ fieldName: 'summary',
+ label: '鍑瘉鎽樿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ嚟璇佹憳瑕�',
+ allowClear: true,
+ },
+ },
+ {
+ fieldName: 'voucherDate',
+ label: '鍑瘉鏃ユ湡',
+ component: 'RangePicker',
+ componentProps: {
+ ...getRangePickerDefaultProps(),
+ showTime: false,
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ allowClear: true,
+ },
+ },
+ {
+ fieldName: 'creator',
+ label: '鍒跺崟浜�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ埗鍗曚汉璐﹀彿',
+ allowClear: true,
+ },
+ },
+ {
+ fieldName: 'status',
+ label: '鍑瘉鐘舵��',
+ component: 'Select',
+ componentProps: {
+ options: getDictOptions(DICT_TYPE.FINANCE_VOUCHER_STATUS, 'number'),
+ placeholder: '璇烽�夋嫨鍑瘉鐘舵��',
+ allowClear: true,
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<FinVoucherApi.Voucher>['columns'] {
+ return [
+ {
+ type: 'expand',
+ width: 45,
+ slots: { content: 'expand_content' },
+ },
+ { type: 'checkbox', width: 40 },
+ {
+ field: 'voucherNo',
+ title: '鍑瘉瀛楀彿',
+ minWidth: 150,
+ fixed: 'left',
+ },
+ {
+ field: 'voucherDate',
+ title: '鍑瘉鏃ユ湡',
+ minWidth: 120,
+ formatter: 'formatDate',
+ },
+ {
+ field: 'summary',
+ title: '鎽樿',
+ minWidth: 200,
+ showOverflow: 'tooltip',
+ },
+ {
+ field: 'debit',
+ title: '鍊熸柟鍚堣',
+ minWidth: 130,
+ align: 'right',
+ formatter: 'formatAmount2',
+ },
+ {
+ field: 'credit',
+ title: '璐锋柟鍚堣',
+ minWidth: 130,
+ align: 'right',
+ formatter: 'formatAmount2',
+ },
+ {
+ field: 'status',
+ title: '鍑瘉鐘舵��',
+ minWidth: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.FINANCE_VOUCHER_STATUS },
+ },
+ },
+ {
+ // 鍚庣 creator 瀛樼殑鏄敤鎴� ID锛岀洿鎺ュ睍绀烘槸鏁板瓧锛屽垪閲岃窡瀵煎嚭閮芥敼鐢� creatorName锛堟樀绉帮級锛�
+ // 鎼滅储妗嗕粛鎸� creator 浼犲弬锛岃涔変笉鍙�
+ field: 'creatorName',
+ title: '鍒跺崟浜�',
+ minWidth: 120,
+ },
+ {
+ field: 'attachmentCount',
+ title: '闄勪欢寮犳暟',
+ minWidth: 100,
+ },
+ {
+ title: '闄勪欢',
+ field: 'attachmentList',
+ minWidth: 100,
+ slots: { default: 'attachment' },
+ },
+ {
+ field: 'createTime',
+ title: '鍒涘缓鏃堕棿',
+ minWidth: 180,
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '鎿嶄綔',
+ width: 260,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3