Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
markliu2013 committed Feb 12, 2024
1 parent 489e77b commit 9d8db8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moneywhere-user-fe",
"version": "1.0.54",
"version": "1.0.55",
"private": true,
"scripts": {
"analyze": "cross-env ANALYZE=1 max build",
Expand Down
16 changes: 15 additions & 1 deletion src/pages/reports/components/FlowFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
QueryFilter,
} from '@ant-design/pro-components';
import {useModel, useRequest} from "@umijs/max";
import moment from 'moment/moment';
import {selectMultipleProp, selectSingleProp, treeSelectMultipleProp} from '@/utils/prop';
import {datePickerRanges} from '@/utils/util';
import { queryAll } from '@/services/common';
import {requiredRules} from "@/utils/rules";
import moment from 'moment/moment';
import t from '@/utils/i18n';

// type是支出和收入,cat是分类还是标签
Expand All @@ -38,6 +38,8 @@ export default ({ type, run }) => {
'canIncome': type === 'INCOME' ? true : null,
}), { manual: true });

const { data : accounts = [], loading : accountsLoading, run : loadAccounts} = useRequest(() => queryAll('accounts'), { manual: true });

useEffect(() => {
if (initialState.currentBook?.id) {
formRef.current?.submit();
Expand All @@ -53,6 +55,8 @@ export default ({ type, run }) => {
let form = JSON.parse(JSON.stringify(values));
form.bookId = values.bookId.id;
form.book = values.bookId.id;
if (values.accountId) form.accountId = values.accountId.id;
if (values.accountId) form.account = values.accountId.id;
if (values.payees) form.payees = values.payees.map((i) => i?.id || i);
if (values.categories) form.categories = values.categories.map((i) => i?.value || i);
if (values.tags) form.tags = values.tags.map((i) => i?.value || i);
Expand Down Expand Up @@ -121,6 +125,16 @@ export default ({ type, run }) => {
// treeCheckStrictly: cat === 2,
}}
/>
<ProFormSelect
name="accountId"
label={t('flow.label.account')}
fieldProps={{
...selectSingleProp,
options: accounts,
loading: accountsLoading,
onFocus: loadAccounts,
}}
/>
</QueryFilter>
</Card>
);
Expand Down

0 comments on commit 9d8db8c

Please sign in to comment.