pageSearch.js 3.3 KB
Newer Older
1 2 3 4 5
import moment from 'moment';
import { Link } from 'react-router-dom';
import React, { Fragment } from 'react';
import { getAppList } from '@/webPublic/Services';
import { redText } from '@/pages/zydxg/CheckManage/PiciSetting/publicFunc';
钟是志's avatar
钟是志 committed
6 7
import { getInfo } from '@/highOrderComponent/Service';
import res from '@/pages/zydjy/system/StuBaseInfoManage/StuBaseManage/exportConfig';
8

9

10
const width = 110;
钟是志's avatar
钟是志 committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
const deleteChildren = (response) => {
  if (response && response.length) {
    for (let item of response) {
      if (item.children && !item.children.length) {
        delete item.children;
      } else if (item.children) {
        deleteChildren(item.children);
      }
    }
    return response;
  } else {
    return [];
  }
};

26 27 28 29 30 31 32 33 34
const handlePageSearch = (props) => {
  const pageSearch = {
    search: {
      url: '/asdasd/asdgggki',
      field: {
        groupId: { //
          required: true,
          defaultValue: props.typeList[0].key,
        },
35 36 37 38
        sysCode: {
          required: true,
          defaultValue: 'xg',
        },
钟是志's avatar
钟是志 committed
39
        applyType: {
40
          required: true,
钟是志's avatar
钟是志 committed
41
          defaultValue: 'role',
42
        },
43 44
      },
      getInfo: (data, url) => {
钟是志's avatar
钟是志 committed
45 46 47 48 49
        return getInfo({
          appId: props.selectKey,
          applyType: data.applyType,
          sysCode: data.sysCode,
        }, '/CommonApi/queryApplyTarget');
50 51 52
      },
      giveFieldsToFormValues: true,
      afterFormValuesChange: (key, oldValue, getPage) => {
钟是志's avatar
钟是志 committed
53
        getPage();
54
        props.changeFormValues(oldValue);
55 56
      },
      responseCallBack: (response) => {
钟是志's avatar
钟是志 committed
57
        return deleteChildren(response);
58 59
      },
      condition: [
60 61 62 63 64 65 66
        {
          key: 'groupId',
          name: '类别',
          type: 'select',
          options: props.typeList,
          required: true,
        },
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        {
          key: 'sysCode',
          type: 'select',
          required: true,
          options: [
            { key: 'xg', name: '学工' },
            { key: 'sg', name: '宿管' },
            { key: 'jy', name: '就业' },
            { key: 'yx', name: '迎新' },
            { key: 'zs', name: '招生' },
            { key: 'xljk', name: '心理健康' },
            { key: 'uaa', name: '认证系统' },
            { key: 'lx', name: '离校' },
            { key: 'tw', name: '团委' },
            { key: 'szxf', name: '素质学分' },
          ],
          name: '系统',
        },

钟是志's avatar
钟是志 committed
86
        {
钟是志's avatar
钟是志 committed
87
          key: 'applyType',
88 89 90 91 92
          type: 'radioGroup',
          required: true,
          name: '权限分类',
          options: [
            {
钟是志's avatar
钟是志 committed
93
              key: 'role',
94 95 96
              name: '角色',
            },
            {
钟是志's avatar
钟是志 committed
97
              key: 'group',
98 99 100 101
              name: '分组',
            },
          ],
        },
102

103
      ],
104 105 106
      nameSpan: { big: 6, small: 7 },
      fileSpan: { big: 4, small: 4 },
      noNeedReset: true, // 不需要重置按钮
107 108 109 110 111 112 113 114 115
    },
    tableRowKey: 'id',
    columns: [
      {
        dataIndex: 'groupName',
        title: '类别',
        width,
      },
      {
钟是志's avatar
钟是志 committed
116 117
        dataIndex: 'title',
        title: '角色/分组',
118 119 120
        width: width + 150,
      },
      {
钟是志's avatar
钟是志 committed
121
        dataIndex: 'hasAuth',
122 123
        title: '是否已授权',
        render: (text, record) => {
钟是志's avatar
钟是志 committed
124
          return text ? redText('已授权') : '未授权';
125 126 127 128 129 130 131 132 133
        },
      },
    ],
  };
  return pageSearch;
};


export default handlePageSearch;