import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
    {
    title: '图片',
    align:"center",
    dataIndex: 'image',
    customRender:render.renderAvatar,
   },
   {
    title: '地址',
    align:"center",
    dataIndex: 'address'
   },
   {
    title: '关联活动',
    align:"center",
    dataIndex: 'activityId_dictText'
   },
   {
    title: '关联用户',
    align:"center",
    dataIndex: 'userId_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '图片',
    field: 'image',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '关联活动',
    field: 'activityId',
    component: 'JSearchSelect',
    componentProps:{
       dict:"studytour_activity,title,id"
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 {...rules.duplicateCheckRule('studytour_image', 'activity_id',model,schema,true)[0]},
          ];
     },
  },
  {
    label: '关联用户',
    field: 'userId',
    component: 'JSearchSelect',
    componentProps:{
       dict:"han_hai_member,nick_name,id"
    },
  },
];
//子表单数据
//子表表格配置
export const studytourImageContentColumns: JVxeColumn[] = [
    {
      title: '图片',
      key: 'image',
      type: JVxeTypes.image,
      token:true,
      responseName:"message",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '地址',
      key: 'address',
       type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '关联用户',
      key: 'userId',
      type: JVxeTypes.selectSearch,
      dictCode:"han_hai_member,nick_name,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]
