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: '主站点id',
    align: "center",
    dataIndex: 'mainSiteId'
  },
  {
    title: '主站点名称',
    align: "center",
    dataIndex: 'mainSiteName'
  },
  {
    title: '主站点URL',
    align: "center",
    dataIndex: 'mainSiteUrl'
  },
  {
    title: '元素定位类型css或xpath',
    align: "center",
    dataIndex: 'elementPositioningType'
  },
  {
    title: '定位类型',
    align: "center",
    dataIndex: 'typeCssXpath_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "主站点id",
    field: 'mainSiteId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "主站点名称",
    field: 'mainSiteName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "主站点URL",
    field: 'mainSiteUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "元素定位类型css或xpath",
    field: 'elementPositioningType',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "定位类型",
    field: 'typeCssXpath',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "positioning_type"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '主站点id',
    field: 'mainSiteId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点id!'},
             ];
    },
  },
  {
    label: '主站点名称',
    field: 'mainSiteName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点名称!'},
             ];
    },
  },
  {
    label: '主站点URL',
    field: 'mainSiteUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点URL!'},
             ];
    },
  },
  {
    label: '元素定位类型css或xpath',
    field: 'elementPositioningType',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入元素定位类型css或xpath!'},
             ];
    },
  },
  {
    label: '定位类型',
    field: 'typeCssXpath',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "positioning_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入定位类型!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
