import { BasicColumn, FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '控制项编号',
    align: 'center',
    dataIndex: 'caNo',
    width: 100,
    ifShow: true,
  },
  {
    title: '控制项名称',
    align: 'left',
    dataIndex: 'caName',
    width: 130,
  },
  {
    title: '合规条目',
    align: 'left',
    dataIndex: 'complianeItem',
    width: 100,
  },
  {
    title: '适用对象',
    align: 'left',
    dataIndex: 'applicableCode',
    customRender: ({ text }) => {
      return render.renderDict(text, 'applyobj');
    },
    width: 130,
  },
  {
    title: '合规要求',
    align: 'left',
    dataIndex: 'complianeAsk',
    width: 350,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  // {
  //   label: '控制项编号',
  //   field: 'caNo',
  //   component: 'Input',
  //   dynamicDisabled: true,
  //   colProps: {lg: 12},
  //   itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  // },
  // {
  //   label: '控制项',
  //   field: 'caName',
  //   component: 'Input',
  //   dynamicDisabled: true,
  //   itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
  //   // colProps: {lg: 12},
  //   // itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  // },
  {
    label: '合规条目',
    field: 'complianeItem',
    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: {
      placeholder: '请输入合规条目',
      rows: 2,
    },
  },
  {
    label: '合规要求',
    field: 'complianeAsk',
    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: {
      placeholder: '请输入合规要求',
      rows: 5,
    },
  },
  // {
  //   label: '适用对象',
  //   field: 'applicableCode',
  //   component: 'JSearchSelect',
  //   componentProps:{
  //     dict: "applyobj"
  //   },
  //   itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 8},}},
  //   dynamicRules: ({model,schema}) => {
  //     return [
  //            { required: true, message: '请选择适用对象!'},
  //     ];
  //   },
  // },
  {
    label: '',
    field: 'complianeNo',
    component: 'Input',
    show: false,
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

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