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: 'title'
   },
   {
    title: '简介',
    align:"center",
    dataIndex: 'brief'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'image',
    customRender:render.renderAvatar,
   },
   {
    title: '原价',
    align:"center",
    dataIndex: 'priceOrigin'
   },
   {
    title: '优惠价',
    align:"center",
    dataIndex: 'priceDiscount'
   },
   {
    title: '列表标签',
    align:"center",
    dataIndex: 'tagList'
   },
   {
    title: '详情标签',
    align:"center",
    dataIndex: 'tagDetails'
   },
   {
    title: '已报名人数',
    align:"center",
    dataIndex: 'applyNum'
   },
   {
    title: '行程亮点 ',
    align:"center",
    dataIndex: 'special',
    slots: { customRender: 'htmlSlot' },
   },
   {
    title: '课程目标',
    align:"center",
    dataIndex: 'target',
    slots: { customRender: 'htmlSlot' },
   },
   {
    title: '详细行程',
    align:"center",
    dataIndex: 'process',
    slots: { customRender: 'htmlSlot' },
   },
   {
    title: '导师联系方式',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '是否限时优惠',
    align:"center",
    dataIndex: 'isDiscount_dictText'
   },
   {
    title: '是否口碑爆款',
    align:"center",
    dataIndex: 'isHot_dictText'
   },
   {
    title: '是否新上线路',
    align:"center",
    dataIndex: 'isNew_dictText'
   },
   {
    title: '地点',
    align:"center",
    dataIndex: 'addressId_dictText'
   },
   {
    title: '适合年龄',
    align:"center",
    dataIndex: 'ageId_dictText'
   },
   {
    title: '活动时长',
    align:"center",
    dataIndex: 'timeId_dictText'
   },
   {
    title: '活动分类',
    align:"center",
    dataIndex: 'categoryId_dictText'
   },
   {
    title: '是否下架',
    align:"center",
    dataIndex: 'isDel_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '简介',
    field: 'brief',
    component: 'InputTextArea',//TODO 注意string转换问题
  },
  {
    label: '图片',
    field: 'image',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '原价',
    field: 'priceOrigin',
    component: 'InputNumber',
  },
  {
    label: '优惠价',
    field: 'priceDiscount',
    component: 'InputNumber',
  },
  {
    label: '列表标签',
    field: 'tagList',
    component: 'Input',
  },
  {
    label: '详情标签',
    field: 'tagDetails',
    component: 'Input',
  },
  {
    label: '已报名人数',
    field: 'applyNum',
    component: 'InputNumber',
  },
  {
    label: '行程亮点 ',
    field: 'special',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
  {
    label: '课程目标',
    field: 'target',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
  {
    label: '详细行程',
    field: 'process',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
  {
    label: '导师联系方式',
    field: 'phone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
          ];
     },
  },
  {
    label: '是否限时优惠',
    field: 'isDiscount',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_true"
     },
  },
  {
    label: '是否口碑爆款',
    field: 'isHot',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_true"
     },
  },
  {
    label: '是否新上线路',
    field: 'isNew',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_true"
     },
  },
  {
    label: '地点',
    field: 'addressId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"studytour_address,title,id"
     },
  },
  {
    label: '适合年龄',
    field: 'ageId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"studytour_age,title,id"
     },
  },
  {
    label: '活动时长',
    field: 'timeId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"studytour_time,title,id"
     },
  },
  {
    label: '活动分类',
    field: 'categoryId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"studytour_category,title,id"
     },
  },
  {
    label: '是否下架',
    field: 'isDel',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_true"
     },
  },
];
