feat(crm): 信用评级评定人改为下拉选择并默认当前账号
- 新增/修改信用评级表单的评定人由手动输入改为下拉框,数据来源系统用户接口 getSimpleUserList
- 默认选中当前登录账号,支持按昵称搜索
- 隐藏 operatorName 字段随选择自动同步昵称,保证 operatorId/operatorName 一并落库
Co-Authored-By: Claude <noreply@anthropic.com>
| | |
| | | |
| | | 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', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | 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', |