From f3cac4aa2db56d6017c1d1dc035bcfeaec76c3e2 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 十一月 2026 18:31:13 +0800
Subject: [PATCH] feat(crm): 投标保证金迁移到销售管理并接入销售台账
---
src/views/crm/bidBond/data.ts | 290 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 290 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/bidBond/data.ts b/src/views/crm/bidBond/data.ts
new file mode 100644
index 0000000..48d362c
--- /dev/null
+++ b/src/views/crm/bidBond/data.ts
@@ -0,0 +1,290 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { getCustomerSimpleList } from '#/api/crm/customer';
+import { getSaleOrderOptions } from '#/api/crm/bidBond';
+
+export const BID_RESULT_OPTIONS = [
+ { label: '寰呭紑鏍�', value: 0, color: 'processing' },
+ { label: '宸蹭腑鏍�', value: 1, color: 'success' },
+ { label: '鏈腑鏍�', value: 2, color: 'default' },
+];
+
+export const REFUND_STATUS_OPTIONS = [
+ { label: '鏈��鍥�', value: 0, color: 'warning' },
+ { label: '閮ㄥ垎閫�鍥�', value: 1, color: 'processing' },
+ { label: '宸查��鍥�', value: 2, color: 'success' },
+ { label: '鏃犻渶閫�鍥�', value: 3, color: 'default' },
+];
+
+export function getBidResultLabel(result?: number) {
+ return BID_RESULT_OPTIONS.find((item) => item.value === result)?.label ?? '-';
+}
+
+export function getBidResultColor(result?: number) {
+ return BID_RESULT_OPTIONS.find((item) => item.value === result)?.color ?? 'default';
+}
+
+export function getRefundStatusLabel(status?: number) {
+ return REFUND_STATUS_OPTIONS.find((item) => item.value === status)?.label ?? '-';
+}
+
+export function getRefundStatusColor(status?: number) {
+ return REFUND_STATUS_OPTIONS.find((item) => item.value === status)?.color ?? 'default';
+}
+
+/** 鏂板/淇敼鎶曟爣淇濊瘉閲戠殑琛ㄥ崟 */
+export function useFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'customerId',
+ label: '瀹㈡埛锛堟嫑鏍囨柟锛�',
+ component: 'ApiSelect',
+ rules: 'required',
+ componentProps: {
+ placeholder: '璇烽�夋嫨瀹㈡埛',
+ allowClear: true,
+ showSearch: true,
+ api: getCustomerSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'projectName',
+ label: '椤圭洰鍚嶇О',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ユ湰娆℃姇鏍囬」鐩悕绉�' },
+ },
+ {
+ fieldName: 'tenderNo',
+ label: '鎷涙爣缂栧彿',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ユ嫑鏍囨柟鍙戝竷鐨勬嫑鏍囩紪鍙�' },
+ },
+ {
+ fieldName: 'saleOrderId',
+ label: '鍏宠仈閿�鍞鍗�',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '璇峰厛閫夋嫨瀹㈡埛',
+ allowClear: true,
+ showSearch: true,
+ labelField: 'no',
+ valueField: 'id',
+ optionFilterProp: 'label',
+ },
+ dependencies: {
+ triggerFields: ['customerId'],
+ componentProps: (values) => {
+ const customerId = values.customerId as number | undefined;
+ return {
+ placeholder: customerId
+ ? '璇烽�夋嫨璇ュ鎴峰凡瀹℃牳鐨勯攢鍞鍗曪紙閿�鍞彴璐︼級'
+ : '璇峰厛閫夋嫨瀹㈡埛',
+ disabled: !customerId,
+ api: customerId
+ ? () => getSaleOrderOptions(customerId)
+ : () => Promise.resolve([]),
+ };
+ },
+ },
+ },
+ {
+ fieldName: 'bondAmount',
+ label: '淇濊瘉閲戦噾棰�',
+ component: 'InputNumber',
+ rules: 'required',
+ componentProps: {
+ class: '!w-full',
+ placeholder: '璇疯緭鍏ョ即绾崇殑淇濊瘉閲戦噾棰�',
+ min: 0,
+ precision: 2,
+ },
+ },
+ {
+ fieldName: 'payDate',
+ label: '缂寸撼鏃ユ湡',
+ component: 'DatePicker',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨鍚戝鎴风即绾充繚璇侀噾鐨勬棩鏈�',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ },
+ {
+ fieldName: 'bidResult',
+ label: '涓爣缁撴灉',
+ component: 'Select',
+ rules: 'required',
+ componentProps: {
+ placeholder: '璇烽�夋嫨涓爣缁撴灉',
+ options: BID_RESULT_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ defaultValue: 0,
+ },
+ {
+ fieldName: 'refundStatus',
+ label: '閫�鍥炵姸鎬�',
+ component: 'Select',
+ componentProps: {
+ placeholder: '鏈腑鏍囨椂璺熻釜淇濊瘉閲戞槸鍚﹂��鍥�',
+ options: REFUND_STATUS_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ },
+ {
+ fieldName: 'refundAmount',
+ label: '閫�鍥為噾棰�',
+ component: 'InputNumber',
+ componentProps: {
+ class: '!w-full',
+ placeholder: '宸查��鍥炴椂椤荤瓑浜庝繚璇侀噾閲戦锛涢儴鍒嗛��鍥炴椂椤诲皬浜庝繚璇侀噾閲戦',
+ min: 0,
+ precision: 2,
+ },
+ },
+ {
+ fieldName: 'refundDate',
+ label: '閫�鍥炴棩鏈�',
+ component: 'DatePicker',
+ componentProps: {
+ class: 'w-full',
+ placeholder: '璇烽�夋嫨瀹㈡埛瀹為檯閫�鍥炰繚璇侀噾鐨勬棩鏈�',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ componentProps: { placeholder: '璇疯緭鍏ュ娉�', rows: 2 },
+ formItemClass: 'col-span-2',
+ },
+ ];
+}
+
+/** 鎼滅储琛ㄥ崟 */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'no',
+ label: '淇濊瘉閲戝崟鍙�',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ヤ繚璇侀噾鍗曞彿', allowClear: true },
+ },
+ {
+ fieldName: 'customerId',
+ label: '瀹㈡埛',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '璇烽�夋嫨瀹㈡埛',
+ allowClear: true,
+ showSearch: true,
+ api: getCustomerSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'projectName',
+ label: '椤圭洰鍚嶇О',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ラ」鐩悕绉�', allowClear: true },
+ },
+ {
+ fieldName: 'saleOrderNo',
+ label: '閿�鍞鍗曞彿',
+ component: 'Input',
+ componentProps: { placeholder: '璇疯緭鍏ュ叧鑱旈攢鍞鍗曞彿', allowClear: true },
+ },
+ {
+ fieldName: 'bidResult',
+ label: '涓爣缁撴灉',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ allowClear: true,
+ options: BID_RESULT_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ },
+ {
+ fieldName: 'refundStatus',
+ label: '閫�鍥炵姸鎬�',
+ component: 'Select',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ allowClear: true,
+ options: REFUND_STATUS_OPTIONS.map(({ label, value }) => ({
+ label,
+ value,
+ })),
+ },
+ },
+ ];
+}
+
+/** 琛ㄦ牸鍒� */
+export function useGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ { field: 'no', title: '淇濊瘉閲戝崟鍙�', minWidth: 150 },
+ { field: 'customerName', title: '瀹㈡埛锛堟嫑鏍囨柟锛�', minWidth: 160 },
+ { field: 'projectName', title: '椤圭洰鍚嶇О', minWidth: 180 },
+ { field: 'tenderNo', title: '鎷涙爣缂栧彿', minWidth: 140 },
+ {
+ field: 'saleOrderNo',
+ title: '鍏宠仈閿�鍞鍗�',
+ minWidth: 160,
+ slots: { default: 'saleOrderNo' },
+ },
+ {
+ field: 'saleOrderAmount',
+ title: '璁㈠崟閲戦',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ {
+ field: 'bondAmount',
+ title: '淇濊瘉閲戦噾棰�',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ { field: 'payDate', title: '缂寸撼鏃ユ湡', minWidth: 110 },
+ {
+ field: 'bidResult',
+ title: '涓爣缁撴灉',
+ minWidth: 100,
+ slots: { default: 'bidResult' },
+ },
+ {
+ field: 'refundStatus',
+ title: '閫�鍥炵姸鎬�',
+ minWidth: 110,
+ slots: { default: 'refundStatus' },
+ },
+ {
+ field: 'refundAmount',
+ title: '閫�鍥為噾棰�',
+ minWidth: 120,
+ formatter: 'formatAmount2',
+ },
+ { field: 'refundDate', title: '閫�鍥炴棩鏈�', minWidth: 110 },
+ { field: 'remark', title: '澶囨敞', minWidth: 150 },
+ {
+ title: '鎿嶄綔',
+ width: 130,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3