import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '控制活动',
    align: 'left',
    dataIndex: 'caName',
    width: 150,
  },
  {
    title: '所属领域',
    align: 'left',
    dataIndex: 'domainName',
    width: 200,
  },
  {
    title: '行业实践',
    align: 'left',
    dataIndex: 'practiceInfo',
    width: 200,
  },
  {
    title: '适用对象',
    align: 'left',
    dataIndex: 'applicableName',
    width: 100,
  },
  {
    title: '执行规则',
    align: 'left',
    dataIndex: 'execRule',
    width: 100,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '控制活动名称',
    field: 'caName',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '行业实践',
    field: 'practiceInfo',
    component: 'ApiSelect',
    colProps: { span: 6 },
  },
  {
    label: '适用对象',
    field: 'applicableCode',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '所属领域',
    field: 'domainCodeMore',
    component: 'ApiSelect',
    colProps: { span: 6 },
  },
  {
    label: '标签',
    field: 'lableName',
    component: 'JInput',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '行业实践',
    field: 'practiceInfo',
    component: 'Input',
    colProps: { lg: 12 },
    itemProps: { labelCol: { xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 18 } } },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入行业实践!' }];
    },
  },
  // {
  //   label: '适用对象',
  //   field: 'applicableCode',
  //   component: 'JSearchSelect',
  //   componentProps: {
  //     dict: 'applyobj',
  //   },
  //   colProps: { lg: 12 },
  //   itemProps: { labelCol: { xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 18 } } },
  //   dynamicRules: ({ model, schema }) => {
  //     return [{ required: true, message: '请选择适用对象!' }];
  //   },
  // },
  {
    label: '执行规则',
    field: 'execRule',
    component: 'InputTextArea',
    itemProps: { labelCol: { xs: { span: 24 }, sm: { span: 3 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 21 } } },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入执行规则!' }];
    },
    componentProps: {
      rows: 5,
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
