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: 'address'
   },
   {
    title: '报价照片',
    align:"center",
    dataIndex: 'pic',
    customRender:render.renderAvatar,
   },
   {
    title: '单价',
    align:"center",
    dataIndex: 'price'
   },
   {
    title: '暂定数量、',
    align:"center",
    dataIndex: 'num'
   },
   {
    title: '审核状态 0审核中 1 审核通过 2审核未通过',
    align:"center",
    dataIndex: 'auditStatus_dictText'
   },
   {
    title: '挂单状态 0挂单 1 已撤单',
    align:"center",
    dataIndex: 'showStatus_dictText'
   },
   {
    title: '期货现货 0期货 1 现货',
    align:"center",
    dataIndex: 'productType_dictText'
   },
   {
    title: '交货时间',
    align:"center",
    dataIndex: 'transactionTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "供应商名称",
      field: "companyName",
      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 已撤单",
      field: "showStatus",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"show_status"
      },
      colProps: {span: 6},
 	},
	{
      label: "期货现货 0期货 1 现货",
      field: "productType",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"product_type"
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '供应商名称',
    field: 'companyName',
    component: 'Input',
  },
  {
    label: '提货地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '报价照片',
    field: 'pic',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '单价',
    field: 'price',
    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 已撤单',
    field: 'showStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"show_status"
     },
  },
  {
    label: '期货现货 0期货 1 现货',
    field: 'productType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"product_type"
     },
  },
  {
    label: '交货时间',
    field: 'transactionTime',
    component: 'DatePicker',
  },
];
