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: 'companyName'
   },
   {
    title: '客户姓名',
    align:"center",
    dataIndex: 'userName'
   },
   {
    title: '客户电话',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '提货地址',
    align:"center",
    dataIndex: 'address'
   },
   {
    title: '单价',
    align:"center",
    dataIndex: 'price'
   },
   {
    title: '定金',
    align:"center",
    dataIndex: 'deposit'
   },
   {
    title: '暂定数量、',
    align:"center",
    dataIndex: 'num'
   },
   {
    title: '审核状态 0审核中 1 审核通过 2审核未通过',
    align:"center",
    dataIndex: 'auditStatus_dictText'
   },
   {
    title: '挂单状态 0挂单 1 已撤单 2未挂单',
    align:"center",
    dataIndex: 'showStatus_dictText'
   },
   {
    title: '期货现货 0期货 1 现货 2 未选择',
    align:"center",
    dataIndex: 'productType_dictText'
   },
   {
    title: '交货时间',
    align:"center",
    dataIndex: 'transactionTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '提货时间',
    align:"center",
    dataIndex: 'takeTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '排序',
    align:"center",
    dataIndex: 'sortNum'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "供应商名称",
      field: "companyName",
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "客户姓名",
      field: "userName",
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "客户电话",
      field: "phone",
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "审核状态 0审核中 1 审核通过 2审核未通过",
      field: "auditStatus",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"audit_status"
      },
      colProps: {span: 6},
 	},
	{
      label: "挂单状态 0挂单 1 已撤单 2未挂单",
      field: "showStatus",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"show_status"
      },
      colProps: {span: 6},
 	},
	{
      label: "期货现货 0期货 1 现货 2 未选择",
      field: "productType",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"product_type"
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '供应商名称',
    field: 'companyName',
    component: 'Input',
  },
  {
    label: '客户姓名',
    field: 'userName',
    component: 'Input',
  },
  {
    label: '客户电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '提货地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '单价',
    field: 'price',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入单价!'},
          ];
     },
  },
  {
    label: '定金',
    field: 'deposit',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入定金!'},
          ];
     },
  },
  {
    label: '暂定数量、',
    field: 'num',
    component: 'InputNumber',
  },
  {
    label: '审核状态 0审核中 1 审核通过 2审核未通过',
    field: 'auditStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"audit_status"
     },
  },
  {
    label: '挂单状态 0挂单 1 已撤单 2未挂单',
    field: 'showStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"show_status"
     },
  },
  {
    label: '期货现货 0期货 1 现货 2 未选择',
    field: 'productType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"product_type"
     },
  },
  {
    label: '交货时间',
    field: 'transactionTime',
    component: 'DatePicker',
  },
  {
    label: '提货时间',
    field: 'takeTime',
    component: 'DatePicker',
  },
  {
    label: '排序',
    field: 'sortNum',
    component: 'InputNumber',
  },
];
