Newer
Older
dxCard-admin / src / views / delivery / CardDeliveryPerson.data.ts
jiangqihao 7 days ago 4 KB bug fixed
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import { on } from 'events';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '送卡人姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '手机号',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '电信工号',
    align:"center",
    dataIndex: 'dxWorkNo'
   },
   {
    title: '应收办卡费用',
    align:"center",
    dataIndex: 'receivableFee'
   },
   {
    title: '全部办卡费用',
    align:"center",
    dataIndex: 'allFee'
   },
   {
    title: '省市区',
    align:"center",
    dataIndex: 'area',
   },
   {
    title: '详细地址',
    align:"center",
    dataIndex: 'address'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'status',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'正常',value:'1'},{text:'失效',value:'0'}])
     },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "送卡人姓名",
      field: 'name',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "手机号",
      field: 'phone',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "区",
      field: 'area',
      component: 'JAreaLinkage',
      componentProps: {
        saveCode: 'region',
      },
      //colProps: {span: 6},
 	},
	{
      label: "状态",
      field: 'status',
      component: 'JSwitch',
      componentProps:{
           query:true,
       },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '送卡人姓名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入送卡人姓名!'},
          ];
     },
  },
  {
    label: '手机号',
    field: 'phone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入手机号!'},
                 { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
          ];
     },
  },
  {
    label: '电信工号',
    field: 'dxWorkNo',
    component: 'Input',
  },
/*   {
    label: '应收办卡费用',
    field: 'receivableFee',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
          ];
     },
  },
  {
    label: '全部办卡费用',
    field: 'allFee',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
          ];
     },
  }, */
  {
    label: '省市区',
    field: 'area',
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'all',
      showAll: true,
      // onChange: (value) => {
      //   console.log(value);
      // }
    },
  },
  {
    label: '详细地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
     component: 'JSwitch',
     componentProps:{
        options: ['1','0'],
        labelOptions: ['正常','失效'],
        checked: true,
     },
  },
	// TODO 主键隐藏字段,目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '送卡人姓名',order: 0,view: 'text', type: 'string',},
  phone: {title: '手机号',order: 1,view: 'text', type: 'string',},
  dxWorkNo: {title: '电信工号',order: 2,view: 'text', type: 'string',},
  receivableFee: {title: '应收办卡费用',order: 3,view: 'number', type: 'number',},
  allFee: {title: '全部办卡费用',order: 4,view: 'number', type: 'number',},
  province: {title: '省',order: 5,view: 'pca', type: 'string',},
  city: {title: '市',order: 6,view: 'pca', type: 'string',},
  area: {title: '区',order: 7,view: 'pca', type: 'string',},
  address: {title: '详细地址',order: 8,view: 'text', type: 'string',},
  status: {title: '状态',order: 9,view: 'switch', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
  return formSchema;
}