From 8f7dd147703c853f0168b1bcfcc153a3b0a6b7e7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 28 二月 2024 14:49:04 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/system/operationRecord/index.jsx | 163 ++++--------------------------------------------------
1 files changed, 12 insertions(+), 151 deletions(-)
diff --git a/zy-asrs-flow/src/pages/system/operationRecord/index.jsx b/zy-asrs-flow/src/pages/system/operationRecord/index.jsx
index 117c123..a4ce3f8 100644
--- a/zy-asrs-flow/src/pages/system/operationRecord/index.jsx
+++ b/zy-asrs-flow/src/pages/system/operationRecord/index.jsx
@@ -27,74 +27,16 @@
},
};
-const handleSave = async (val, intl) => {
- const hide = message.loading('姝e湪娣诲姞');
- try {
- const resp = await Http.doPost('api/operationRecord/save', val);
- if (resp.code === 200) {
- message.success('娣诲姞鎴愬姛');
- return true;
- } else {
- message.error(resp.msg);
- return false;
- }
- } catch (error) {
- message.error('娣诲姞澶辫触璇烽噸璇曪紒');
- return false;
- } finally {
- hide();
- }
-};
-
-const handleUpdate = async (val, intl) => {
- const hide = message.loading('姝e湪鏇存柊');
- try {
- const resp = await Http.doPost('api/operationRecord/update', val);
- if (resp.code === 200) {
- message.success('鏇存柊鎴愬姛');
- return true;
- } else {
- message.error(resp.msg);
- return false;
- }
- } catch (error) {
- message.error('閰嶇疆澶辫触璇烽噸璇曪紒');
- return false;
- } finally {
- hide();
- }
-};
-
-const handleRemove = async (rows, intl) => {
- if (!rows) return true;
- const hide = message.loading('姝e湪鍒犻櫎');
- try {
- const resp = await Http.doPost('api/operationRecord/remove/' + rows.map((row) => row.id).join(','));
- if (resp.code === 200) {
- message.success('鍒犻櫎鎴愬姛');
- return true;
- } else {
- message.error(resp.msg);
- return false;
- }
- } catch (error) {
- message.error('鍒犻櫎澶辫触锛岃閲嶈瘯');
- return false;
- } finally {
- hide();
- }
-};
-
const handleExport = async (intl) => {
- const hide = message.loading('姝e湪瀵煎嚭');
+ const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '姝e湪瀵煎嚭' }));
try {
const resp = await Http.doPostBlob('api/operationRecord/export');
const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
window.location.href = window.URL.createObjectURL(blob);
- message.success('瀵煎嚭鎴愬姛');
+ message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '瀵煎嚭鎴愬姛' }));
return true;
} catch (error) {
- message.error('瀵煎嚭澶辫触锛岃閲嶈瘯');
+ message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '瀵煎嚭澶辫触锛岃閲嶈瘯' }));
return false;
} finally {
hide();
@@ -117,7 +59,10 @@
const columns = [
{
- title: 'No',
+ title: intl.formatMessage({
+ id: 'page.table.no',
+ defaultMessage: 'No'
+ }),
dataIndex: 'index',
valueType: 'indexBorder',
width: 48,
@@ -304,39 +249,6 @@
valueType: 'option',
hidden: true,
render: (_, record) => [
- <Button
- type="link"
- key="edit"
- hidden="true"
- onClick={() => {
- setModalVisible(true);
- setCurrentRow(record);
- }}
- >
- 缂栬緫
- </Button>,
- <Button
- type="link"
- danger
- key="batchRemove"
- hidden="true"
- onClick={async () => {
- Modal.confirm({
- title: '鍒犻櫎',
- content: '纭畾鍒犻櫎璇ラ」鍚楋紵',
- onOk: async () => {
- const success = await handleRemove([record], intl);
- if (success) {
- if (actionRef.current) {
- actionRef.current.reload();
- }
- }
- },
- });
- }}
- >
- 鍒犻櫎
- </Button>,
],
},
];
@@ -381,24 +293,13 @@
),
actions: [
<Button
- type="primary"
- key="save"
- hidden="true"
- onClick={async () => {
- setModalVisible(true)
- }}
- >
- <PlusOutlined />
- 娣诲姞
- </Button>,
- <Button
key="export"
onClick={async () => {
handleExport(intl);
}}
>
<ExportOutlined />
- 瀵煎嚭
+ <FormattedMessage id='page.export' defaultMessage='瀵煎嚭' />
</Button>,
],
}}
@@ -428,38 +329,6 @@
/>
</div>
- {selectedRows?.length > 0 && false && (
- <FooterToolbar
- extra={
- <div>
- 宸查�夋嫨
- <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
- 椤�
- </div>
- }
- >
- <Button
- key="remove"
- danger
- onClick={async () => {
- Modal.confirm({
- title: '鍒犻櫎',
- content: '纭畾鍒犻櫎璇ラ」鍚楋紵',
- onOk: async () => {
- const success = await handleRemove(selectedRows, intl);
- if (success) {
- setSelectedRows([]);
- actionRef.current?.reloadAndRest?.();
- }
- },
- });
- }}
- >
- 鎵归噺鍒犻櫎
- </Button>
- </FooterToolbar>
- )}
-
<Edit
open={modalVisible}
values={currentRow || {}}
@@ -470,18 +339,10 @@
}
}
onSubmit={async (values) => {
- let ok = false;
- if (values.id) {
- ok = await handleUpdate({ ...values }, intl)
- } else {
- ok = await handleSave({ ...values }, intl)
- }
- if (ok) {
- setModalVisible(false);
- setCurrentRow(undefined);
- if (actionRef.current) {
- actionRef.current.reload();
- }
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ if (actionRef.current) {
+ actionRef.current.reload();
}
}
}
--
Gitblit v1.9.1