index.js 2.3 KB
Newer Older
王绍森's avatar
王绍森 committed
1 2
import React from 'react';
import PageTypeMatching from '@/highOrderComponent/PageTypeMatching';
王绍森's avatar
王绍森 committed
3
import getInfoGenerator from '../getInfoGenerator';
王绍森's avatar
王绍森 committed
4

王绍森's avatar
王绍森 committed
5
export { DataType } from '../getInfoGenerator';
王绍森's avatar
王绍森 committed
6 7 8

const defaultNameSpan = { big: 9, small: 9 };
const defaultFieldSpan = { big: 4, small: 4 };
王绍森's avatar
王绍森 committed
9

王绍森's avatar
王绍森 committed
10 11 12 13 14
const defaultPageSetting = {
  selectRows: true, // 是否可以行选择,
  paging: true, // 是否可以分页,
  searchArea: true, // 是否拥有 搜索区dom,
  buttonArea: true, // 是否拥有 按钮区,
王绍森's avatar
王绍森 committed
15 16
};

王绍森's avatar
王绍森 committed
17 18 19 20
export default function AuditPage({ appId, tab1 = {}, tab2 = {} }) {
  const pageSearch = {
    tab1: {
      search: {
21
        searchType: 'cascadeSearchNew',
王绍森's avatar
王绍森 committed
22
        getInfo: tab1.getInfo || getInfoGenerator(tab1.condition),
王绍森's avatar
王绍森 committed
23 24 25 26 27 28
        url: '/common/assigneeTasks',
        field: {
          appId: {
            required: true,
            defaultValue: appId,
          },
王绍森's avatar
王绍森 committed
29
        },
王绍森's avatar
王绍森 committed
30 31 32
        condition: tab1.condition || [],
        nameSpan: tab1.nameSpan || defaultNameSpan,
        fileSpan: tab1.fieldSpan || defaultFieldSpan,
王绍森's avatar
王绍森 committed
33
      },
王绍森's avatar
王绍森 committed
34 35
      tableRowKey: tab1.tableRowKey || 'buzinessId',
      columns: tab1.columns || [],
王绍森's avatar
王绍森 committed
36
    },
王绍森's avatar
王绍森 committed
37 38
    tab2: {
      search: {
39
        searchType: 'cascadeSearchNew',
王绍森's avatar
王绍森 committed
40
        getInfo: tab2.getInfo || getInfoGenerator(tab2.condition),
王绍森's avatar
王绍森 committed
41 42 43 44 45
        url: '/common/assigneeDTasks',
        field: {
          appId: {
            required: true,
            defaultValue: appId,
王绍森's avatar
王绍森 committed
46 47
          },
        },
王绍森's avatar
王绍森 committed
48 49 50
        condition: tab2.condition || [],
        nameSpan: tab2.nameSpan || defaultNameSpan,
        fileSpan: tab2.fieldSpan || defaultFieldSpan,
王绍森's avatar
王绍森 committed
51
      },
王绍森's avatar
王绍森 committed
52 53 54
      tableRowKey: tab2.tableRowKey || 'id',
      columns: tab2.columns || [],
    },
王绍森's avatar
王绍森 committed
55
  };
王绍森's avatar
王绍森 committed
56 57 58 59

  const pageButton = {
    tab1: tab1.pageButton || [],
    tab2: tab2.pageButton || [],
王绍森's avatar
王绍森 committed
60
  };
王绍森's avatar
王绍森 committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

  const pageSetting = {
    type: 'listTab', // 页面类型
    tabList: {
      tab1: {
        key: 0,
        name: '待审核',
        listConfig: { ...defaultPageSetting, ...tab1.pageSetting },
      },
      tab2: {
        name: '已审核',
        key: 1,
        listConfig: { ...defaultPageSetting, ...tab2.pageSetting },
      },
    },
  };

王绍森's avatar
王绍森 committed
78
  return (
王绍森's avatar
王绍森 committed
79 80 81 82 83 84
    <PageTypeMatching
      tabsShellStyle={{ marginTop: 0 }}
      pageSetting={pageSetting}
      pageButton={pageButton}
      pageSearch={pageSearch}
    />
王绍森's avatar
王绍森 committed
85 86
  );
}