import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '用户id',
    align:"center",
    dataIndex: 'userId'
   },
   {
    title: '用户姓名',
    align:"center",
    dataIndex: 'userName'
   },
   {
    title: '手机号码',
    align:"center",
    dataIndex: 'userPhone'
   },
   {
    title: '身份证号',
    align:"center",
    dataIndex: 'identityId'
   },
   {
    title: '开户行名称',
    align:"center",
    dataIndex: 'bankName'
   },
   {
    title: '卡号',
    align:"center",
    dataIndex: 'bankNum'
   },
   {
    title: '预留手机号',
    align:"center",
    dataIndex: 'bankPhone'
   },
   {
    title: '是否默认',
    align:"center",
    dataIndex: 'isDefault_dictText'
   },
   {
    title: '卡片类型',
    align:"center",
    dataIndex: 'cardType_dictText'
   },
   {
    title: '持卡人',
    align:"center",
    dataIndex: 'cardUserName'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "用户姓名",
      field: "userName",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "手机号码",
      field: "userPhone",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "身份证号",
      field: "identityId",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "卡号",
      field: "bankNum",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "预留手机号",
      field: "bankPhone",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
	{
      label: "卡片类型",
      field: 'cardType',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"card_type"
      },
      //colProps: {span: 6},
 	},
	{
      label: "持卡人",
      field: 'cardUserName',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户id',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户id!'},
          ];
     },
  },
  {
    label: '用户姓名',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入用户姓名!'},
          ];
     },
  },
  {
    label: '手机号码',
    field: 'userPhone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入手机号码!'},
                 { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
          ];
     },
  },
  {
    label: '身份证号',
    field: 'identityId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入身份证号!'},
          ];
     },
  },
  {
    label: '开户行名称',
    field: 'bankName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入开户行名称!'},
          ];
     },
  },
  {
    label: '卡号',
    field: 'bankNum',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入卡号!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '开户行地址',
    field: 'bankAddress',
    component: 'Input',
  },
  {
    label: '预留手机号',
    field: 'bankPhone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入预留手机号!'},
          ];
     },
  },
  {
    label: '是否默认',
    field: 'isDefault',
    defaultValue: "0",
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_default"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入是否默认(0.否1.是)!'},
          ];
     },
  },
  {
    label: '卡片类型',
    field: 'cardType',
    defaultValue: "1",
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"card_type"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入卡片类型!'},
          ];
     },
  },
  {
    label: '持卡人',
    field: 'cardUserName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入持卡人!'},
          ];
     },
  },
  {
    label: '预留字段',
    field: 'a1',
    component: 'Input',
  },
  {
    label: '预留字段',
    field: 'a2',
    component: 'Input',
  },
  {
    label: '预留字段',
    field: 'a3',
    component: 'Input',
  },
  {
    label: '预留字段',
    field: 'a4',
    component: 'Input',
  },
  {
    label: '预留字段',
    field: 'a5',
    component: 'Input',
  },
	// TODO 主键隐藏字段,目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  userId: {title: '用户id',order: 0,view: 'text', type: 'string',},
  userName: {title: '用户姓名',order: 1,view: 'text', type: 'string',},
  userPhone: {title: '手机号码',order: 2,view: 'text', type: 'string',},
  identityId: {title: '身份证号',order: 3,view: 'text', type: 'string',},
  bankName: {title: '开户行名称',order: 4,view: 'text', type: 'string',},
  bankNum: {title: '卡号',order: 5,view: 'text', type: 'string',},
  bankPhone: {title: '预留手机号',order: 7,view: 'text', type: 'string',},
  isDefault: {title: '是否默认',order: 8,view: 'list', type: 'string',dictCode: 'is_default',},
  cardType: {title: '卡片类型',order: 9,view: 'list', type: 'string',dictCode: 'card_type',},
  cardUserName: {title: '持卡人',order: 10,view: 'text', type: 'string',},
};

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