import { BasicColumn, FormSchema } from '/@/components/Table';
import { getTown } from '/@/api/common/api';

export const columns: BasicColumn[] = [
  {
    title: '单位名称',
    dataIndex: 'dwmc',
  },
  {
    title: '单位领导',
    dataIndex: 'dwld',
  },
  {
    title: '地址',
    dataIndex: 'address',
  },
  {
    title: '联系人',
    dataIndex: 'lxr',
  },
  {
    title: '联系电话',
    dataIndex: 'phone',
  },
  {
    title: '创建时间',
    dataIndex: 'createTsamp',
  },
  {
    title: '登录账户',
    dataIndex: 'userLogin',
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    label: '单位名称',
    field: 'dwmc',
    component: 'Input',
  },
  {
    label: '日期范围',
    field: 'dateRangeSelect',
    component: 'RangeDate',
    componentProps: {
      //日期格式化
      format: 'YYYY/MM/DD',
      //范围文本描述用集合
      placeholder: ['请选择开始日期', '请选择结束日期']
    },
  },

];

export const formSchema: formSchema[] = [
  {
    label: '主键',
    field: 'id',
    component: 'Input',
    ifShow: false,
  },
  {
    label: '单位名称',
    field: 'dwmc',
    component: 'Input',
    required: true,
  },
  {
    label: '单位领导',
    field: 'dwld',
    component: 'Input',
    required: true,
  },

  {
    label: '地址',
    required: true,
    field: 'address',
    component: 'Input',
  },
  {
    label: '联系人',
    field: 'lxr',
    required: true,
    component: 'Input',
  },
  {
    label: '联系电话',
    required: true,
    field: 'phone',
    component: 'Input',
  },
  {
    label: '行政区',
    field: 'xzqy',
    component: 'ApiSelect',
    required:true,
    componentProps: ({ formModel, formActionType }) => {
      return {
        api: getTown,
        params: 440000, // 行政区划编码
        labelField: 'name',
        valueField: 'id',
      };
    },
  },
]
