|
@@ -8,7 +8,8 @@ import { downloadFile, getToken } from '@/utils/utils.js';
|
|
const { RangePicker } = DatePicker;
|
|
const { RangePicker } = DatePicker;
|
|
|
|
|
|
function Finance(props) {
|
|
function Finance(props) {
|
|
- const { dispatch, form, loading, finance } = props;
|
|
|
|
|
|
+ const { dispatch, loading, finance } = props;
|
|
|
|
+ const [form] = Form.useForm();
|
|
const [modalFilter, setModalFilter] = useState({});
|
|
const [modalFilter, setModalFilter] = useState({});
|
|
const columns = [
|
|
const columns = [
|
|
{ title: '资源名称', dataIndex: 'c_name' },
|
|
{ title: '资源名称', dataIndex: 'c_name' },
|
|
@@ -41,18 +42,17 @@ function Finance(props) {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const handleSearch = () => {
|
|
const handleSearch = () => {
|
|
- form.validateFields((error, { time, project_name, project_status }) => {
|
|
|
|
- filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
|
|
|
|
- filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
|
|
|
|
- filterRef.current.project_name = project_name;
|
|
|
|
- filterRef.current.project_status = project_status;
|
|
|
|
|
|
+ const { time, project_name, project_status } = form.getFieldsValue();
|
|
|
|
+ filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
|
|
|
|
+ filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
|
|
|
|
+ filterRef.current.project_name = project_name;
|
|
|
|
+ filterRef.current.project_status = project_status;
|
|
|
|
|
|
- dispatch({
|
|
|
|
- type: 'report/queryFinanceReport',
|
|
|
|
- payload: {
|
|
|
|
- ...filterRef.current,
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'report/queryFinanceReport',
|
|
|
|
+ payload: {
|
|
|
|
+ ...filterRef.current,
|
|
|
|
+ },
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const handleDownload = () => {
|
|
const handleDownload = () => {
|
|
@@ -68,24 +68,20 @@ function Finance(props) {
|
|
};
|
|
};
|
|
const renderSearch = () => {
|
|
const renderSearch = () => {
|
|
return (
|
|
return (
|
|
- <Form layout="inline">
|
|
|
|
- <Form.Item label="时间">
|
|
|
|
- {form.getFieldDecorator('time', {
|
|
|
|
- initialValue: [moment().startOf('years'), moment()],
|
|
|
|
- })(<RangePicker placeholder="选择时间" />)}
|
|
|
|
|
|
+ <Form layout="inline" form={form}>
|
|
|
|
+ <Form.Item label="时间" name="time" initialValue={[moment().startOf('years'), moment()]}>
|
|
|
|
+ <RangePicker placeholder="选择时间" allowClear={false} />
|
|
|
|
+ </Form.Item>
|
|
|
|
+ <Form.Item label="项目名称" name="project_name">
|
|
|
|
+ <Input />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="项目名称">{form.getFieldDecorator('project_name')(<Input />)}</Form.Item>
|
|
|
|
- <Form.Item label="项目状态">
|
|
|
|
- {form.getFieldDecorator('project_status', {
|
|
|
|
- initialValue: null,
|
|
|
|
- })(
|
|
|
|
- <Select style={{ width: 120 }}>
|
|
|
|
- <Select.Option value={null}>全部</Select.Option>
|
|
|
|
- {STATUS.map(item => (
|
|
|
|
- <Select.Option key={item.value}>{item.label}</Select.Option>
|
|
|
|
- ))}
|
|
|
|
- </Select>
|
|
|
|
- )}
|
|
|
|
|
|
+ <Form.Item label="项目状态" name="project_status" initialValue={null}>
|
|
|
|
+ <Select style={{ width: 120 }}>
|
|
|
|
+ <Select.Option value={null}>全部</Select.Option>
|
|
|
|
+ {STATUS.map(item => (
|
|
|
|
+ <Select.Option key={item.value}>{item.label}</Select.Option>
|
|
|
|
+ ))}
|
|
|
|
+ </Select>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Form.Item>
|
|
<Button type="primary" loading={loading} onClick={handleSearch}>
|
|
<Button type="primary" loading={loading} onClick={handleSearch}>
|
|
@@ -123,4 +119,4 @@ function Finance(props) {
|
|
export default connect(({ report, loading }) => ({
|
|
export default connect(({ report, loading }) => ({
|
|
finance: report.finance,
|
|
finance: report.finance,
|
|
loading: loading.models.report,
|
|
loading: loading.models.report,
|
|
-}))(Form.create()(Finance));
|
|
|
|
|
|
+}))(Finance);
|