liu
23 小时以前 0af5e35af8338cc8a2e38c19ab79efbb9eff0b2c
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,12 +115,34 @@
      },
    },
    {
      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',