| | |
| | | import Edit from './components/edit' |
| | | import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch' |
| | | import { transformTreeData } from '@/utils/tree-util' |
| | | |
| | | const statusMap = { |
| | | 1: { |
| | | color: 'green', |
| | | text: '正常', |
| | | }, |
| | | 0: { |
| | | color: 'red', |
| | | text: '禁用', |
| | | }, |
| | | }; |
| | | import { statusMap } from '@/utils/enum-util' |
| | | |
| | | const handleSave = async (val) => { |
| | | const hide = message.loading('正在添加'); |
| | |
| | | |
| | | const columns = [ |
| | | { |
| | | title: 'No', |
| | | dataIndex: 'index', |
| | | valueType: 'indexBorder', |
| | | width: 48, |
| | | }, |
| | | { |
| | | title: '部门名称', |
| | | dataIndex: 'name', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='name' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | width: 240, |
| | | // filterDropdown: (props) => <TextFilter |
| | | // name='name' |
| | | // {...props} |
| | | // actionRef={actionRef} |
| | | // setSearchParam={setSearchParam} |
| | | // />, |
| | | }, |
| | | { |
| | | title: '上级部门名', |
| | | title: '上级部门', |
| | | dataIndex: 'parentName', |
| | | valueType: 'text', |
| | | hidden: true, |
| | |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='leader' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | // filterDropdown: (props) => <TextFilter |
| | | // name='leader' |
| | | // {...props} |
| | | // actionRef={actionRef} |
| | | // setSearchParam={setSearchParam} |
| | | // />, |
| | | }, |
| | | { |
| | | title: '数量', |
| | |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='sort' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | // filterDropdown: (props) => <TextFilter |
| | | // name='sort' |
| | | // {...props} |
| | | // actionRef={actionRef} |
| | | // setSearchParam={setSearchParam} |
| | | // />, |
| | | render: (_, record) => { |
| | | return <span style={{ fontWeight: "bold" }}>{_}</span> |
| | | } |
| | |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='status' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]} |
| | | />, |
| | | // filterDropdown: (props) => <SelectFilter |
| | | // name='status' |
| | | // {...props} |
| | | // actionRef={actionRef} |
| | | // setSearchParam={setSearchParam} |
| | | // data={[ |
| | | // { label: '正常', value: 1 }, |
| | | // { label: '禁用', value: 0 }, |
| | | // ]} |
| | | // />, |
| | | render: (_, record) => { |
| | | const status = statusMap[record.status] |
| | | return <Tag color={status.color}>{status.text}</Tag> |
| | |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <DatetimeRangeFilter |
| | | name='updateTime' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | // filterDropdown: (props) => <DatetimeRangeFilter |
| | | // name='updateTime' |
| | | // {...props} |
| | | // actionRef={actionRef} |
| | | // setSearchParam={setSearchParam} |
| | | // />, |
| | | }, |
| | | { |
| | | title: '修改人员', |
| | |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='updateBy' |
| | | major='user' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | // filterDropdown: (props) => <LinkFilter |
| | | // name='updateBy' |
| | | // major='user' |
| | | // {...props} |
| | | // actionRef={actionRef} |
| | | // setSearchParam={setSearchParam} |
| | | // />, |
| | | }, |
| | | { |
| | | title: '备注', |
| | |
| | | ]; |
| | | |
| | | return ( |
| | | <PageContainer> |
| | | <PageContainer |
| | | header={{ |
| | | breadcrumb: {}, |
| | | }} |
| | | > |
| | | <div style={{ width: '100%', float: 'right' }}> |
| | | <ProTable |
| | | key="dept" |
| | |
| | | cardBordered |
| | | scroll={{ x: 1300 }} |
| | | dateFormatter="string" |
| | | pagination={{ pageSize: 20 }} |
| | | pagination={{ pageSize: 100 }} |
| | | search={false} |
| | | toolbar={{ |
| | | search: { |