import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '邮箱账号',
    align: "center",
    dataIndex: 'account'
  },
  {
    title: '密码',
    align: "center",
    dataIndex: 'password'
  },
  {
    title: '手机号',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '小二账号id',
    align: "center",
    dataIndex: 'userId'
  },
  // {
  //   title: '关联站点',
  //   align: "center",
  //   dataIndex: 'siteIds_dictText',
  //   slots: { customRender: 'siteTag' },
  //   ellipsis: true,
  // },
  {
    title: '用户角色',
    align:"center",
    dataIndex: 'userRole_dictText'
  },
  {
    title: '所属人员',
    align: "center",
    dataIndex: 'sysUserCode_dictText'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '邮箱账号',
    field: 'account',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入邮箱账号!'},
      ];
    },
  },
  {
    label: '密码',
    field: 'password',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入密码!'},
      ];
    },
  },
  {
    label: '关联站点',
    field: 'siteIds',
    component: 'JCheckbox',
    componentProps:{
        dictCode:"okki_site,company_name,site_id"
     },
  },
  {
    label: '用户角色',
    field: 'userRole',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"user_role"
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请选择用户角色!'},
      ];
    },
  },
  {
    label: '所属人员',
    field: 'sysUserCode',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '名称',order: 0,view: 'text', type: 'string',},
  account: {title: '邮箱账号',order: 0,view: 'text', type: 'string',},
  password: {title: '密码',order: 1,view: 'text', type: 'string',},
  userId: {title: '小二账号id',order: 2,view: 'number', type: 'number',},
  siteIds: {title: '关联站点',order: 3,view: 'checkbox', type: 'string',dictTable: "okki_site", dictCode: 'site_id', dictText: 'company_name',},
  userRole: {title: '用户角色',order: 7,view: 'number', type: 'number',},
  sysUserCode: {title: '所属人员',order: 4,view: 'sel_user', type: 'string',},
  status: {title: '状态',order: 5,view: 'number', type: 'number',},
};
