import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '活动编号',
    align: 'left',
    dataIndex: 'caNo',
    width: '100',
  },
  {
    title: '控制活动名称',
    align: 'left',
    dataIndex: 'caName',
    width: '200',
  },
  {
    title: '所属领域',
    align: 'left',
    dataIndex: 'domainName',
    width: '150',
  },
  {
    title: '内控策略',
    align: 'left',
    dataIndex: 'innerControlStrategy',
    width: '150',
  },
  {
    title: '内控要求',
    align: 'left',
    dataIndex: 'innerControlClaim',
    width: '200',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '控制活动',
    field: 'caName',
    component: 'JInput',
    colProps: { span: 6 },
  },
  {
    label: '内控策略',
    field: 'innerControlStrategy',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '内控要求',
    field: 'innerControlClaim',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '所属领域',
    field: 'domainCodeMore',
    component: 'JInput',
    colProps: { span: 6 },
  },
  {
    label: '标签',
    field: 'lableName',
    component: 'JInput',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '内控等级',
    field: 'controlLevelCode',
    component: 'JSearchSelect',
    componentProps: {
      dict: 'innerlevel', //innerleve
    },
    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: 'innerControlStrategy',
    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: 3,
    },
  },
  {
    label: '制度要求',
    field: 'innerControlClaim',
    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;
}
