Skip to content
On this page

头部配置

queryConfig 页面查询配置

1.不配置 formState, 默认取 fieldName 作为 formState 的 key

2.查询事件支持 change 事件回调

代码展示

js
const pageData =
  reactive <
  GlobalListPageLayoutTypes.PageData >
  {
    // 省略其他配置代码...
    queryConfig: {
      form: [
        {
          type: "input",
          label: srmI18n("i18n_title_keyword", "关键字"),
          fieldName: "keyWord",
          placeholder: srmI18n(
            "i18n_title_enterTitleOriPurchaseRequisitionNo",
            "请输入标题/采购申请单号"
          ),
        },
        {
          type: "select",
          label: srmI18n("i18n_field_purchaseRequestType", "采购申请类型"),
          fieldName: "requestType",
          dictCode: "srmRequestType",
          placeholder: srmI18n("i18n_title_pleaseChoose", "请选择采购申请类型"),
          change: (args) => {
            console.log(args);
            // do something
          },
        },
      ],
      // 默认
      // formState: {
      //   keyWord: '',
      //   requestType: '',
      // },
    },
  };

TS 类型

typescript
queryConfig?: {
     attrs?: ObjectMap;
     extend?: ObjectMap;
     form: QueryFormItem[];
     formState: ObjectMap;
  }

 interface QueryFormItem {
    type: string;
    label: string;
    fieldName: string;
    placeholder?: string;
    options?: ObjectMap[];
    dictCode?: string;
}

listMergeConfig 页面合并配置

使用代码展示

js
const pageData =
  reactive <
  GlobalListPageLayoutTypes.PageData >
  {
    // 省略其他配置代码...
    listMergeConfig: {
      options: [
        {
          title: srmI18n("i18n_field_it_c9c61", "整单"),
          key: "head",
        },
        {
          title: srmI18n("i18n_dict_RH_cda78", "明细"),
          key: "item",
        },
      ],
      change(event, value, options) {
        console.log(event, value, options);
        if (value === "head") {
          // router.push({ path: '/srm/order/purchase/OrderHeadList' })
        } else {
          // router.push({ path: '/srm/order/purchase/OrderItemList' })
        }
      },
      currentValue: "head",
    },
  };

TS 类型

listMergeConfig?: {
    show?: (() => boolean | void) | boolean
    options: ListMergeDataItem[]
    currentValue: string | number
    change: (event: Event, value?: string | number, options?: ListMergeDataItem[]) => void
 }
export interface ListMergeDataItem {
  title: string
  key: number | string
}

头部其他配置

navConfig 快速导航

statusConfig 事项状态

filterConfig 快速筛选

隐藏某个功能配置

js
const pageData =
  reactive <
  GlobalListPageLayoutTypes.PageData >
  {
    // 省略其他配置代码...
    statusConfig: {
      show: false,
    },
    filterConfig: {
      show: false,
    },
    navConfig: {
      show: false,
    },
  };

设置事项状态,默认选中某个状态值

js
pageData.statusConfig.currentValue = currentVal;

TS 类型

typescript
statusConfig?: {
        show?: (() => boolean | void) | boolean;
        filter?: ObjectMap;
        currentValue?: TabListItem;
    };
    filterConfig?: {
        show?: (() => boolean | void) | boolean;
        filter?: ObjectMap;
    };
    navConfig?: {
        show?: (() => boolean | void) | boolean;
    };