From e383ae9d5d4ad2d3a6e964b5d4000f3ba7d67cf5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 28 二月 2024 15:31:10 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/locales/en-US.ts            |   14 +++++++
 zy-asrs-flow/src/pages/system/user/index.jsx |   66 ++++++++++++++++++---------------
 2 files changed, 50 insertions(+), 30 deletions(-)

diff --git a/zy-asrs-flow/src/locales/en-US.ts b/zy-asrs-flow/src/locales/en-US.ts
index ede81c1..fd38f31 100644
--- a/zy-asrs-flow/src/locales/en-US.ts
+++ b/zy-asrs-flow/src/locales/en-US.ts
@@ -36,6 +36,16 @@
   'page.permission.menu':'Menu',
   'page.role.assign.ec':'Expand/Collapse',
   'page.role.assign.sd':'Select All/Deselect All',
+  'page.resetting':'Resetting',
+  'page.reset.success':'Reset Successful',
+  'page.reset.fail':'Reset failed, please try again!"',
+  'page.reset.pwd':'Reset Pwd',
+  'page.assign.role':'Assign Role',
+  '':'',
+  '':'',
+  '':'',
+  '':'',
+  '':'',
   '':'',
   '':'',
   '':'',
@@ -74,4 +84,8 @@
   '':'',
   '':'',
   '':'',
+  '':'',
+  '':'',
+  '':'',
+  'system.dept':'Department',
 };
diff --git a/zy-asrs-flow/src/pages/system/user/index.jsx b/zy-asrs-flow/src/pages/system/user/index.jsx
index 9de058e..dd0f2f9 100644
--- a/zy-asrs-flow/src/pages/system/user/index.jsx
+++ b/zy-asrs-flow/src/pages/system/user/index.jsx
@@ -21,18 +21,18 @@
 const TABLE_KEY = "pro-table-user";
 
 const handleSave = async (val, intl) => {
-    const hide = message.loading('姝e湪娣诲姞');
+    const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '姝e湪娣诲姞' }));
     try {
         const resp = await Http.doPost('api/user/save', val);
         if (resp.code === 200) {
-            message.success('娣诲姞鎴愬姛');
+            message.success(intl.formatMessage({ id: 'page.add.success', defaultMessage: '娣诲姞鎴愬姛' }));
             return true;
         } else {
             message.error(resp.msg);
             return false;
         }
     } catch (error) {
-        message.error('娣诲姞澶辫触璇烽噸璇曪紒');
+        message.error(intl.formatMessage({ id: 'page.add.fail', defaultMessage: '娣诲姞澶辫触璇烽噸璇曪紒' }));
         return false;
     } finally {
         hide();
@@ -40,18 +40,18 @@
 };
 
 const handleUpdate = async (val, intl) => {
-    const hide = message.loading('姝e湪鏇存柊');
+    const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '姝e湪鏇存柊' }));
     try {
         const resp = await Http.doPost('api/user/update', val);
         if (resp.code === 200) {
-            message.success('鏇存柊鎴愬姛');
+            message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '鏇存柊鎴愬姛' }));
             return true;
         } else {
             message.error(resp.msg);
             return false;
         }
     } catch (error) {
-        message.error('閰嶇疆澶辫触璇烽噸璇曪紒');
+        message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '鏇存柊澶辫触璇烽噸璇曪紒' }));
         return false;
     } finally {
         hide();
@@ -60,18 +60,18 @@
 
 const handleRemove = async (rows, intl) => {
     if (!rows) return true;
-    const hide = message.loading('姝e湪鍒犻櫎');
+    const hide = message.loading(intl.formatMessage({ id: 'page.deleting', defaultMessage: '姝e湪鍒犻櫎' }));
     try {
         const resp = await Http.doPost('api/user/remove/' + rows.map((row) => row.id).join(','));
         if (resp.code === 200) {
-            message.success('鍒犻櫎鎴愬姛');
+            message.success(intl.formatMessage({ id: 'page.delete.success', defaultMessage: '鍒犻櫎鎴愬姛' }));
             return true;
         } else {
             message.error(resp.msg);
             return false;
         }
     } catch (error) {
-        message.error('鍒犻櫎澶辫触锛岃閲嶈瘯');
+        message.error(intl.formatMessage({ id: 'page.delete.fail', defaultMessage: '鍒犻櫎澶辫触锛岃閲嶈瘯锛�' }));
         return false;
     } finally {
         hide();
@@ -79,15 +79,15 @@
 };
 
 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/user/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();
@@ -95,18 +95,18 @@
 };
 
 const handlePwd = async (val, intl) => {
-    const hide = message.loading('姝e湪閲嶇疆');
+    const hide = message.loading(intl.formatMessage({ id: 'page.resetting', defaultMessage: '姝e湪閲嶇疆' }));
     try {
         const resp = await Http.doPost('api/user/reset/pwd', val);
         if (resp.code === 200) {
-            message.success('閲嶇疆鎴愬姛');
+            message.success(intl.formatMessage({ id: 'page.reset.success', defaultMessage: '閲嶇疆鎴愬姛' }));
             return true;
         } else {
             message.error(resp.msg);
             return false;
         }
     } catch (error) {
-        message.error('閲嶇疆澶辫触璇烽噸璇曪紒');
+        message.error(intl.formatMessage({ id: 'page.reset.fail', defaultMessage: '閲嶇疆澶辫触璇烽噸璇曪紒' }));
         return false;
     } finally {
         hide();
@@ -161,7 +161,10 @@
 
     const columns = [
         {
-            title: 'No',
+            title: intl.formatMessage({
+                id: 'page.table.no',
+                defaultMessage: 'No'
+            }),
             dataIndex: 'index',
             valueType: 'indexBorder',
             width: 48,
@@ -432,7 +435,7 @@
             title: '鎿嶄綔',
             dataIndex: 'option',
             valueType: 'option',
-            width : 180,
+            width: 180,
             render: (_, record) => [
                 <Button
                     type="link"
@@ -443,7 +446,7 @@
                         setCurrentRow(record);
                     }}
                 >
-                    缂栬緫
+                    <FormattedMessage id='page.edit' defaultMessage='缂栬緫' />
                 </Button>,
                 <Button
                     type="link"
@@ -454,7 +457,7 @@
                         setCurrentRow(record);
                     }}
                 >
-                    閲嶇疆瀵嗙爜
+                    <FormattedMessage id='page.reset.pwd' defaultMessage='閲嶇疆瀵嗙爜' />
                 </Button>,
                 <Button
                     type="link"
@@ -463,8 +466,8 @@
                     key="remove"
                     onClick={async () => {
                         Modal.confirm({
-                            title: '鍒犻櫎',
-                            content: '纭畾鍒犻櫎璇ラ」鍚楋紵',
+                            title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+                            content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
                             onOk: async () => {
                                 const success = await handleRemove([record], intl);
                                 if (success) {
@@ -476,7 +479,7 @@
                         });
                     }}
                 >
-                    鍒犻櫎
+                    <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
                 </Button>,
                 <TableDropdown
                     key="actionGroup"
@@ -488,7 +491,7 @@
                         }
                     }}
                     menus={[
-                        { key: 'assign', name: '鍒嗛厤瑙掕壊' },
+                        { key: 'assign', name: intl.formatMessage({ id: 'page.assign.role', defaultMessage: '鍒嗛厤瑙掕壊' }) },
                     ]}
                 />,
             ],
@@ -503,10 +506,13 @@
         >
             <Row gutter={[16, 24]}>
                 <Col lg={6} md={24}>
-                    <Card title="閮ㄩ棬" style={{ width: '100%', height: 'calc(100vh - 160px)' }}>
+                    <Card
+                        title={intl.formatMessage({ id: 'system.dept', defaultMessage: '閮ㄩ棬' })}
+                        style={{ width: '100%', height: 'calc(100vh - 160px)' }}
+                    >
                         <Input
                             style={{ marginBottom: 10 }}
-                            placeholder="璇疯緭鍏�"
+                            placeholder={intl.formatMessage({ id: 'commont.enter', defaultMessage: '璇疯緭鍏�' })}
                             onChange={(e) => {
                                 const { value } = e.target;
                                 loadDeptTreeData({
@@ -577,9 +583,9 @@
                                     hidden={selectedRows?.length === 0}
                                     onClick={async () => {
                                         Modal.confirm({
-                                            title: '鏄惁纭鍒犻櫎鎵�閫夋暟鎹」?',
+                                            title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+                                            content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
                                             icon: <ExclamationCircleOutlined />,
-                                            content: '璇疯皑鎱庢搷浣�',
                                             async onOk() {
                                                 const success = await handleRemove(selectedRows, intl);
                                                 if (success) {
@@ -592,7 +598,7 @@
                                     }}
                                 >
                                     <DeleteOutlined />
-                                    鍒犻櫎
+                                    <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
                                 </Button>,
                                 <Button
                                     type="primary"
@@ -602,7 +608,7 @@
                                     }}
                                 >
                                     <PlusOutlined />
-                                    娣诲姞
+                                    <FormattedMessage id='page.add' defaultMessage='娣诲姞' />
                                 </Button>,
                                 <Button
                                     key="export"
@@ -611,7 +617,7 @@
                                     }}
                                 >
                                     <ExportOutlined />
-                                    瀵煎嚭
+                                    <FormattedMessage id='page.export' defaultMessage='瀵煎嚭' />
                                 </Button>,
                             ],
                         }}

--
Gitblit v1.9.1