import { FormSchema } from '/@/components/Form';

export const dataFormSchema: FormSchema[] = [
  {
    field: 'type',
    label: '节点类型',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入节点类型',
    },
    ifShow: false,
  },
  {
    field: 'name',
    label: '节点名称',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入节点名称',
    },
  },
  {
    field: 'hatyp',
    label: '审批人类型',
    component: 'RadioGroup',
    required: true,
    componentProps: {
      options: [
        { label: '从组织架构选择', value: 1 },
        { label: '使用公式定义器', value: 2 },
      ],
    },
    defaultValue: 1,
    ifShow: ({ values }) =>
      values.type != 'bpmn:EndEvent' &&
      values.type != 'bpmn:StartEvent' &&
      values.type != 'bpmn:SequenceFlow',
  },
  {
    field: 'hamen',
    label: '审批人',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入审批人',
    },
    defaultValue: '1,2,3,4',
    ifShow: ({ values }) =>
      values.type != 'bpmn:EndEvent' &&
      values.type != 'bpmn:StartEvent' &&
      values.type != 'bpmn:SequenceFlow',
  },
  {
    field: 'flway',
    label: '流转方式',
    component: 'RadioGroup',
    required: true,
    componentProps: {
      options: [
        { label: '串行', value: 1 },
        { label: '并行', value: 2 },
        { label: '会审', value: 3 },
      ],
    },
    defaultValue: 1,
    ifShow: ({ values }) => values.type == 'bpmn:UserTask',
  },
  {
    field: 'remod',
    label: '身份重复配置',
    component: 'RadioGroup',
    required: true,
    componentProps: {
      options: [
        { label: '仅相邻处理人身份重复跳过', value: 1 },
        { label: '处理人身份重复跳过', value: 2 },
        { label: '处理人身份重复不跳过', value: 3 },
      ],
    },
    defaultValue: 1,
    ifShow: ({ values }) => values.type == 'bpmn:UserTask',
  },
  {
    field: 'edtag',
    label: '权限',
    component: 'RadioGroup',
    componentProps: {
      options: [{ label: '编辑主文档', value: 1 }],
    },
    defaultValue: 1,
    ifShow: ({ values }) => values.type == 'bpmn:UserTask',
  },
  {
    label: '流转条件',
    field: 'conds',
    component: 'InputTextArea',
    componentProps: {
      placeholder:
        '编写JS代码，返回true，则往下流。（注1：$代表form对象；注2：如果是表达式，则表达式为返回结果；注3：如果是复杂的多条语句，则z代表返回结果；）',
    },
    ifShow: ({ values }) => values.type == 'bpmn:SequenceFlow',
  },
  {
    label: '节点备注',
    field: 'notes',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '节点备注',
    },
  },
];
