liu
21 小时以前 0af5e35af8338cc8a2e38c19ab79efbb9eff0b2c
feat(crm): 信用评级评定人改为下拉选择并默认当前账号

- 新增/修改信用评级表单的评定人由手动输入改为下拉框,数据来源系统用户接口 getSimpleUserList
- 默认选中当前登录账号,支持按昵称搜索
- 隐藏 operatorName 字段随选择自动同步昵称,保证 operatorId/operatorName 一并落库

Co-Authored-By: Claude <noreply@anthropic.com>
已修改1个文件
31 ■■■■■ 文件已修改
src/views/crm/credit-rating/data.ts 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/credit-rating/data.ts
@@ -7,13 +7,16 @@
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { useUserStore } from '@vben/stores';
import { getSimpleUserList } from '#/api/system/user';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
/** 新增/修改信用评级 */
export function useFormSchema(
  formApi?: VbenFormApi,
): VbenFormSchema[] {
  const userStore = useUserStore();
  return [
    {
      fieldName: 'id',
@@ -112,13 +115,35 @@
      },
    },
    {
      fieldName: 'operatorName',
      fieldName: 'operatorId',
      label: '评定人',
      component: 'Input',
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请输入评定人姓名',
        api: getSimpleUserList,
        labelField: 'nickname',
        valueField: 'id',
        allowClear: true,
        showSearch: true,
        optionFilterProp: 'label',
        placeholder: '请选择评定人',
        onChange: (
          _value?: number,
          option?: { nickname?: string },
        ) => {
          formApi?.setFieldValue('operatorName', option?.nickname);
      },
    },
      defaultValue: userStore.userInfo?.id,
    },
    {
      fieldName: 'operatorName',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
      defaultValue: userStore.userInfo?.nickname,
    },
    {
      fieldName: 'remark',
      label: '备注',