Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
markliu2013 committed Jan 6, 2024
1 parent 02c0f30 commit 9940fe9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/Footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default () => {
<Divider type="vertical" />
{/*<a target="_blank" href="https://beian.miit.gov.cn/" rel="noreferrer">{t('footer.no')}</a>*/}
{/*<Divider type="vertical" />*/}
v1.0.27
v1.0.28
<Divider type="vertical" />
api-version: {version}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en-US/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default {
'label.enable': 'Enable',
'label.notes': 'Notes',

'delete.confirm': 'This action can\'t redo,Are you sure to delete {name}?',
'delete.confirm': 'Are you sure to delete {name}?',
'delete.confirm2': 'This action can\'t redo,Are you sure to delete {name}?',
'click.edit': 'Click to Edit',

'today': 'Today',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-CN/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default {
'label.enable': '是否可用',
'label.notes': '备注',

'delete.confirm': '删除之后无法恢复,确定删除{name}吗?',
'delete.confirm': '确定删除{name}吗?',
'delete.confirm2': '删除之后无法恢复,确定删除{name}吗?',
'click.edit': '点击修改',

'today': '今天',
Expand Down
20 changes: 15 additions & 5 deletions src/pages/Account/DataTable.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useState } from 'react';
import {Alert, Button, Form, Input, Space} from 'antd';
import {Alert, Button, Form, Input, Modal, Space} from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { ProTable } from '@ant-design/pro-components';
import {useModel, useRequest} from '@umijs/max';
import {queryAll, query, toggle, removeSoft} from '@/services/common';
import {useIntl, useModel, useRequest} from '@umijs/max';
import {queryAll, query, toggle, removeSoft, remove} from '@/services/common';
import {
statistics,
toggleCanExpense,
Expand All @@ -24,6 +24,7 @@ export default ({ type, actionRef }) => {

const { show } = useModel('modal');
const [statisticsData, setStatisticsData] = useState([0, 0, 0]);
const intl = useIntl();

const { data : currencyOptions = [], loading : currencyLoading, run : loadCurrencies} = useRequest(() => queryAll('currencies'), { manual: true });

Expand All @@ -32,8 +33,17 @@ export default ({ type, actionRef }) => {
}

const deleteHandler = async (record) => {
await removeSoft('accounts', record.id);
successHandler();
const messageConfirm = intl.formatMessage(
{ id: 'delete.confirm' },
{ name: record.name },
);
Modal.confirm({
title: messageConfirm,
onOk: async () => {
await removeSoft('accounts', record.id);
successHandler();
},
});
};

const addHandler = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BalanceFlow/DataTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default () => {
successHandler();
};

const messageDeleteConfirm = t('delete.confirm', { name: '' });
const messageDeleteConfirm = t('delete.confirm2', { name: '' });
const messageDeleteConfirmBalance = t('delete.confirm.balance');
const deleteHandler = (record) => {
Modal.confirm({
Expand Down
15 changes: 11 additions & 4 deletions src/pages/BalanceFlow/FileUploadModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default ({ flowId }) => {
const maxFileCount = 6;

const fileSizeError = t('flow.file.size.error');
const messageDeleteConfirm = t('delete.confirm', { name: '' });

const uploadProps = {
accept: 'image/jpeg, image/png, application/pdf',
Expand Down Expand Up @@ -53,11 +54,17 @@ export default ({ flowId }) => {
return true;
},
onRemove(file) {
remove('flow-files', file.id).then(res => {
if (res.success) {
fetchFiles(flowId);
}
Modal.confirm({
title: messageDeleteConfirm,
onOk: async () => {
remove('flow-files', file.id).then(res => {
if (res.success) {
fetchFiles(flowId);
}
});
},
});
return false;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/services/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export async function getFiles(id) {
});
}



export function buildUrl(file) {
return `api/v1/flow-files/view?id=${file.id}&createTime=${file.createTime}`
}

0 comments on commit 9940fe9

Please sign in to comment.