|
|
@@ -7,6 +7,7 @@ import dayjs from 'dayjs'
|
|
|
import { Pie } from '@ant-design/charts'
|
|
|
import OptionSelect from '../../components/OptionSelect'
|
|
|
import { disabledDate } from '@/utils/utils'
|
|
|
+import { PageContainer } from '@ant-design/pro-layout'
|
|
|
|
|
|
const { Text } = Typography
|
|
|
|
|
|
@@ -119,89 +120,79 @@ const Usage = () => {
|
|
|
setState({ ...state, params: { ...state.params, optionType: type, dataIds: ids } })
|
|
|
|
|
|
return (
|
|
|
- <div className="flex flex-col">
|
|
|
- <div className="flex flex-row justify-between mb-4">
|
|
|
- <div className="card-transition w-1/2 bg-white mr-2">
|
|
|
- {pieData.pieLeft ? <Pie {...leftConfig} /> : null}
|
|
|
+ <PageContainer title={false} breadcrumb={false} waterMarkProps={{ offsetTop: 111 }}>
|
|
|
+ <div className="flex flex-col">
|
|
|
+ <div className="flex flex-row justify-between mb-4">
|
|
|
+ <div className="card-transition w-1/2 bg-white mr-2">
|
|
|
+ {pieData.pieLeft ? <Pie {...leftConfig} /> : null}
|
|
|
+ </div>
|
|
|
+ <div className="card-transition w-1/2 bg-white ml-2">
|
|
|
+ {pieData.pieRight ? <Pie {...rightConfig} /> : null}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div className="card-transition w-1/2 bg-white ml-2">
|
|
|
- {pieData.pieRight ? <Pie {...rightConfig} /> : null}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
|
|
|
- <BasicTable
|
|
|
- // manualRequest
|
|
|
- search={false}
|
|
|
- columns={columns}
|
|
|
- actionRef={tRef}
|
|
|
- rowkey="id"
|
|
|
- toolbar={{
|
|
|
- title: <OptionSelect onChange={optionChange} type="SoftwareUsage" />,
|
|
|
- actions: [
|
|
|
- <DatePicker.RangePicker
|
|
|
- picker="month"
|
|
|
- allowClear={false}
|
|
|
- key="DatePicker"
|
|
|
- disabledDate={current => disabledDate(current, 'month')}
|
|
|
- value={state.params.startMonth}
|
|
|
- onChange={val => setState({ ...state, params: { ...state.params, startMonth: val } })}
|
|
|
- />
|
|
|
- ]
|
|
|
- }}
|
|
|
- params={state.params}
|
|
|
- pagination={false}
|
|
|
- bordered
|
|
|
- request={async (params, sort, filter) => {
|
|
|
- const {
|
|
|
- code = -1,
|
|
|
- data: { list, sum, chart, create }
|
|
|
- } = await querySoftwareUsageList({ ...params, ...sort, ...filter })
|
|
|
- setState({ ...state, sum, chart, create })
|
|
|
- return {
|
|
|
- data: list,
|
|
|
- success: code === consts.RET_CODE.SUCCESS,
|
|
|
- total: list?.length || 0
|
|
|
+ <BasicTable
|
|
|
+ // manualRequest
|
|
|
+ search={false}
|
|
|
+ columns={columns}
|
|
|
+ actionRef={tRef}
|
|
|
+ rowkey="id"
|
|
|
+ toolbar={{
|
|
|
+ title: <OptionSelect onChange={optionChange} type="SoftwareUsage" />,
|
|
|
+ actions: [
|
|
|
+ <DatePicker.RangePicker
|
|
|
+ picker="month"
|
|
|
+ allowClear={false}
|
|
|
+ key="DatePicker"
|
|
|
+ disabledDate={current => disabledDate(current, 'month')}
|
|
|
+ value={state.params.startMonth}
|
|
|
+ onChange={val => setState({ ...state, params: { ...state.params, startMonth: val } })}
|
|
|
+ />
|
|
|
+ ]
|
|
|
+ }}
|
|
|
+ params={state.params}
|
|
|
+ pagination={false}
|
|
|
+ bordered
|
|
|
+ request={async (params, sort, filter) => {
|
|
|
+ const {
|
|
|
+ code = -1,
|
|
|
+ data: { list, sum, chart, create }
|
|
|
+ } = await querySoftwareUsageList({ ...params, ...sort, ...filter })
|
|
|
+ setState({ ...state, sum, chart, create })
|
|
|
+ return {
|
|
|
+ data: list,
|
|
|
+ success: code === consts.RET_CODE.SUCCESS,
|
|
|
+ total: list?.length || 0
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ summary={data =>
|
|
|
+ data?.length ? (
|
|
|
+ <>
|
|
|
+ <Table.Summary.Row>
|
|
|
+ <Table.Summary.Cell className="text-center">小计</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell className="text-center">{state.sum?.createCount}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell className="text-center">{state.sum?.receiveCount}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell className="text-center">{state.sum?.lendCount}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell className="text-center">{state.sum?.salesCount}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell className="text-center">{state.sum?.giftsCount}</Table.Summary.Cell>
|
|
|
+ </Table.Summary.Row>
|
|
|
+ <Table.Summary.Row>
|
|
|
+ <Table.Summary.Cell className="text-center">总计</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell colSpan={2} className="text-center">
|
|
|
+ <Text type="danger">{(state.sum?.createCount || 0) + state.sum?.receiveCount}</Text>
|
|
|
+ </Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell colSpan={3} className="text-center">
|
|
|
+ <Text type="danger">
|
|
|
+ {state.sum?.lendCount + state.sum?.salesCount + state.sum?.giftsCount}
|
|
|
+ </Text>
|
|
|
+ </Table.Summary.Cell>
|
|
|
+ </Table.Summary.Row>
|
|
|
+ </>
|
|
|
+ ) : null
|
|
|
}
|
|
|
- }}
|
|
|
- summary={data =>
|
|
|
- data?.length ? (
|
|
|
- <>
|
|
|
- <Table.Summary.Row>
|
|
|
- <Table.Summary.Cell className="text-center">小计</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell className="text-center">
|
|
|
- {state.sum?.createCount}
|
|
|
- </Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell className="text-center">
|
|
|
- {state.sum?.receiveCount}
|
|
|
- </Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell className="text-center">
|
|
|
- {state.sum?.lendCount}
|
|
|
- </Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell className="text-center">
|
|
|
- {state.sum?.salesCount}
|
|
|
- </Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell className="text-center">
|
|
|
- {state.sum?.giftsCount}
|
|
|
- </Table.Summary.Cell>
|
|
|
- </Table.Summary.Row>
|
|
|
- <Table.Summary.Row>
|
|
|
- <Table.Summary.Cell className="text-center">总计</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell colSpan={2} className="text-center">
|
|
|
- <Text type="danger">
|
|
|
- {(state.sum?.createCount || 0) + state.sum?.receiveCount}
|
|
|
- </Text>
|
|
|
- </Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell colSpan={3} className="text-center">
|
|
|
- <Text type="danger">
|
|
|
- {state.sum?.lendCount + state.sum?.salesCount + state.sum?.giftsCount}
|
|
|
- </Text>
|
|
|
- </Table.Summary.Cell>
|
|
|
- </Table.Summary.Row>
|
|
|
- </>
|
|
|
- ) : null
|
|
|
- }
|
|
|
- />
|
|
|
- </div>
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </PageContainer>
|
|
|
)
|
|
|
}
|
|
|
|