| | |
| | | const handleSave = async (val) => { |
| | | const hide = message.loading('正在添加'); |
| | | try { |
| | | const resp = await Http.doPost('api/role/save', val); |
| | | const resp = await Http.doPost('api/@{SIMPLEENTITYNAME}/save', val); |
| | | if (resp.code === 200) { |
| | | message.success('添加成功'); |
| | | return true; |
| | |
| | | const handleUpdate = async (val) => { |
| | | const hide = message.loading('正在更新'); |
| | | try { |
| | | const resp = await Http.doPost('api/role/update', val); |
| | | const resp = await Http.doPost('api/@{SIMPLEENTITYNAME}/update', val); |
| | | if (resp.code === 200) { |
| | | message.success('更新成功'); |
| | | return true; |
| | |
| | | if (!rows) return true; |
| | | const hide = message.loading('正在删除'); |
| | | try { |
| | | const resp = await Http.doPost('api/role/remove/' + rows.map((row) => row.id).join(',')); |
| | | const resp = await Http.doPost('api/@{SIMPLEENTITYNAME}/remove/' + rows.map((row) => row.id).join(',')); |
| | | if (resp.code === 200) { |
| | | message.success('删除成功'); |
| | | return true; |
| | |
| | | const handleExport = async () => { |
| | | const hide = message.loading('正在导出'); |
| | | try { |
| | | const resp = await Http.doPostBlob('api/role/export'); |
| | | const resp = await Http.doPostBlob('api/@{SIMPLEENTITYNAME}/export'); |
| | | const blob = new Blob([resp], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | message.success('导出成功'); |
| | |
| | | valueType: 'indexBorder', |
| | | width: 48, |
| | | }, |
| | | { |
| | | title: '姓名', |
| | | dataIndex: 'name', |
| | | valueType: 'text', |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='name' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '标识', |
| | | dataIndex: 'code', |
| | | valueType: 'text', |
| | | filterDropdown: (props) => <TextFilter |
| | | name='code' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '机构', |
| | | dataIndex: 'hostId$', |
| | | valueType: 'text', |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='hostId' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status$', |
| | | valueType: 'text', |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='status' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]} |
| | | />, |
| | | }, |
| | | { |
| | | title: '修改时间', |
| | | dataIndex: 'updateTime$', |
| | | valueType: 'text', |
| | | filterDropdown: (props) => <DatetimeRangeFilter |
| | | name='updateTime' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | @{TABLECOLUMNS} |
| | | { |
| | | title: '操作', |
| | | dataIndex: 'option', |
| | |
| | | <PageContainer> |
| | | <div style={{ width: '100%', float: 'right' }}> |
| | | <ProTable |
| | | key="role" |
| | | key="@{SIMPLEENTITYNAME}" |
| | | rowKey="id" |
| | | actionRef={actionRef} |
| | | formRef={formTableRef} |
| | | columns={columns} |
| | | cardBordered |
| | | scroll={{ x: 1300 }} |
| | | dateFormatter="string" |
| | | pagination={{ pageSize: 20 }} |
| | | search={false} |
| | |
| | | ], |
| | | }} |
| | | request={(params, sorter, filter) => |
| | | Http.doPostPromise('/api/role/page', { ...params, ...searchParam }, (res) => { |
| | | Http.doPostPromise('/api/@{SIMPLEENTITYNAME}/page', { ...params, ...searchParam }, (res) => { |
| | | return { |
| | | data: res.data.records, |
| | | total: res.data.total, |
| | |
| | | } |
| | | }} |
| | | columnsState={{ |
| | | persistenceKey: 'pro-table-role', |
| | | persistenceKey: 'pro-table-@{SIMPLEENTITYNAME}', |
| | | persistenceType: 'localStorage', |
| | | defaultValue: { |
| | | option: { fixed: 'right', disable: true }, |