From afc9ca78119731d6679ce49b7eff007b316badf1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 14 二月 2024 22:52:19 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/system/role/index.jsx           |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 zy-asrs-flow/src/pages/system/role/components/edit.jsx |    5 +++++
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/zy-asrs-flow/src/pages/system/role/components/edit.jsx b/zy-asrs-flow/src/pages/system/role/components/edit.jsx
index 1f4c578..c362075 100644
--- a/zy-asrs-flow/src/pages/system/role/components/edit.jsx
+++ b/zy-asrs-flow/src/pages/system/role/components/edit.jsx
@@ -51,6 +51,11 @@
                     layout="horizontal"
                     grid={true}
                 >
+                    <ProFormDigit
+                        name="id"
+                        disabled
+                        hidden={true}
+                    />
                     <ProFormText
                         name="name"
                         label="瑙掕壊鍚嶇О"
diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index b9d4a8a..8b0ea37 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -30,14 +30,15 @@
 const handleUpdate = async (val) => {
     const hide = message.loading('姝e湪鏇存柊');
     try {
-        const resp = await updateRole(val);
+        const resp = await Http.doPost('api/role/update', val);
         hide();
         if (resp.code === 200) {
             message.success('鏇存柊鎴愬姛');
+            return true;
         } else {
             message.error(resp.msg);
+            return false;
         }
-        return true;
     } catch (error) {
         hide();
         message.error('閰嶇疆澶辫触璇烽噸璇曪紒');
@@ -102,6 +103,49 @@
             title: '鏍囪瘑',
             dataIndex: 'code',
             valueType: 'text',
+        },
+        {
+            title: '鎿嶄綔',
+            dataIndex: 'option',
+            width: '220px',
+            valueType: 'option',
+            render: (_, record) => [
+                <Button
+                    type="link"
+                    size="small"
+                    key="edit"
+                    onClick={() => {
+                        setModalVisible(true);
+                        setCurrentRow(record);
+                    }}
+                >
+                    缂栬緫
+                </Button>,
+                <Button
+                    type="link"
+                    size="small"
+                    danger
+                    key="batchRemove"
+                    onClick={async () => {
+                        Modal.confirm({
+                            title: '鍒犻櫎',
+                            content: '纭畾鍒犻櫎璇ラ」鍚楋紵',
+                            okText: '纭',
+                            cancelText: '鍙栨秷',
+                            onOk: async () => {
+                                const success = await handleRemoveOne(record);
+                                if (success) {
+                                    if (actionRef.current) {
+                                        actionRef.current.reload();
+                                    }
+                                }
+                            },
+                        });
+                    }}
+                >
+                    鍒犻櫎
+                </Button>,
+            ],
         },
     ];
 
@@ -226,9 +270,9 @@
                 onSubmit={async (values) => {
                     let ok = false;
                     if (values.id) {
-                        ok = await handleUpdate({...values})
+                        ok = await handleUpdate({ ...values })
                     } else {
-                        ok = await handleSave({...values})
+                        ok = await handleSave({ ...values })
                     }
                     if (ok) {
                         setModalVisible(false);

--
Gitblit v1.9.1