From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/crm/credit-rating/data.ts | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 212 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/credit-rating/data.ts b/src/views/crm/credit-rating/data.ts
new file mode 100644
index 0000000..e8e59c2
--- /dev/null
+++ b/src/views/crm/credit-rating/data.ts
@@ -0,0 +1,212 @@
+import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { CrmCustomerApi } from '#/api/crm/customer';
+import type { CrmCreditRatingApi } from '#/api/crm/credit-rating';
+
+import { markRaw } from 'vue';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
+
+/** 鏂板/淇敼淇$敤璇勭骇 */
+export function useFormSchema(
+ formApi?: VbenFormApi,
+): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'id',
+ component: 'Input',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'customerId',
+ label: '瀹㈡埛',
+ component: markRaw(CrmCustomerSelect),
+ componentProps: {
+ placeholder: '璇烽�夋嫨瀹㈡埛',
+ onChange: (item?: CrmCustomerApi.Customer) => {
+ formApi?.setFieldValue('customerName', item?.name);
+ },
+ },
+ },
+ {
+ fieldName: 'customerName',
+ label: '瀹㈡埛鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '瀹㈡埛鍚嶇О',
+ readonly: true,
+ },
+ },
+ {
+ fieldName: 'level',
+ label: '淇$敤绛夌骇',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.CRM_CREDIT_LEVEL),
+ placeholder: '璇烽�夋嫨淇$敤绛夌骇',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'score',
+ label: '淇$敤鍒�',
+ component: 'InputNumber',
+ componentProps: {
+ class: 'w-full',
+ min: 0,
+ max: 100,
+ precision: 0,
+ placeholder: '0-100',
+ },
+ },
+ {
+ fieldName: 'evalType',
+ label: '璇勫畾绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: [
+ { label: '鍒濊瘎', value: 'INITIAL' },
+ { label: '澶嶈瘎', value: 'REVIEW' },
+ { label: '鍔ㄦ�佽皟鏁�', value: 'ADJUST' },
+ ],
+ placeholder: '璇烽�夋嫨璇勫畾绫诲瀷',
+ },
+ },
+ {
+ fieldName: 'evalReason',
+ label: '璇勫畾鐞嗙敱',
+ component: 'Textarea',
+ formItemClass: 'col-span-2',
+ componentProps: {
+ placeholder: '璇疯緭鍏ヨ瘎瀹氱悊鐢�',
+ rows: 2,
+ },
+ },
+ {
+ fieldName: 'operateTime',
+ label: '璇勫畾鏃堕棿',
+ component: 'DatePicker',
+ componentProps: {
+ class: '!w-full',
+ format: 'YYYY-MM-DD HH:mm:ss',
+ showTime: true,
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ },
+ },
+ {
+ fieldName: 'validUntil',
+ label: '鏈夋晥鏈熻嚦',
+ component: 'DatePicker',
+ componentProps: {
+ class: '!w-full',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ },
+ {
+ fieldName: 'operatorName',
+ label: '璇勫畾浜�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ヨ瘎瀹氫汉濮撳悕',
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ formItemClass: 'col-span-2',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ娉�',
+ rows: 2,
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'level',
+ label: '淇$敤绛夌骇',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.CRM_CREDIT_LEVEL),
+ placeholder: '璇烽�夋嫨淇$敤绛夌骇',
+ },
+ },
+ {
+ fieldName: 'evalType',
+ label: '璇勫畾绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: [
+ { label: '鍒濊瘎', value: 'INITIAL' },
+ { label: '澶嶈瘎', value: 'REVIEW' },
+ { label: '鍔ㄦ�佽皟鏁�', value: 'ADJUST' },
+ ],
+ placeholder: '璇烽�夋嫨璇勫畾绫诲瀷',
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<CrmCreditRatingApi.CreditRating>['columns'] {
+ return [
+ { field: 'customerName', title: '瀹㈡埛鍚嶇О', minWidth: 180 },
+ {
+ field: 'level',
+ title: '淇$敤绛夌骇',
+ width: 100,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.CRM_CREDIT_LEVEL },
+ },
+ },
+ { field: 'score', title: '淇$敤鍒�', width: 90 },
+ {
+ field: 'evalType',
+ title: '璇勫畾绫诲瀷',
+ width: 120,
+ slots: { default: 'evalType' },
+ },
+ { field: 'evalReason', title: '璇勫畾鐞嗙敱', minWidth: 200, showOverflow: true },
+ { field: 'operatorName', title: '璇勫畾浜�', width: 100 },
+ {
+ field: 'operateTime',
+ title: '璇勫畾鏃堕棿',
+ width: 170,
+ formatter: 'formatDateTime',
+ },
+ {
+ field: 'validUntil',
+ title: '鏈夋晥鏈熻嚦',
+ width: 120,
+ formatter: 'formatDate',
+ },
+ {
+ field: 'createTime',
+ title: '鍒涘缓鏃堕棿',
+ width: 170,
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '鎿嶄綔',
+ width: 160,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3