create.config.ts 1.03 KB
import { CheckPointFieldsEnum, CheckPointFieldsNameEnum } from '../../../enum/formField/flow';
import { FormSchema, useComponentRegister } from '/@/components/Form';
import ApiComplete from './ApiComplete.vue';
import { getTenantQueue } from '/@/api/ruleChainDesigner';

useComponentRegister('ApiComplete', ApiComplete);

export const formSchemas: FormSchema[] = [
  {
    field: CheckPointFieldsEnum.QUEUE_NAME,
    label: CheckPointFieldsNameEnum.QUEUE_NAME,
    component: 'ApiComplete',
    required: true,
    helpMessage: ['从下拉列表中选择或自定义名称'],
    valueField: 'value',
    changeEvent: 'update:value',
    componentProps: () => {
      return {
        placeholder: `请选择${CheckPointFieldsNameEnum.QUEUE_NAME}`,
        getPopupContainer: () => document.body,
        api: async (params: Recordable) => {
          const options = await getTenantQueue(params);
          return options.map((value) => ({ label: value, value }));
        },
        params: { serviceType: 'TB_RULE_ENGINE' },
      };
    },
  },
];