From 0778a1c1aeface0f6602d0fbf44da96e31566034 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 23 二月 2024 15:49:20 +0800
Subject: [PATCH] #

---
 zy-asrs-framework/src/main/resources/templates/react/Index.txt |    5 ++++-
 zy-asrs-flow/src/utils/common-util.js                          |   24 ++++++++++++++++++++++++
 zy-asrs-flow/src/pages/system/role/index.jsx                   |    7 +++++--
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index 77c7957..ce9021e 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -13,6 +13,9 @@
 import Scope from './components/scope'
 import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
 import { statusMap } from '@/utils/enum-util'
+import { repairBug } from '@/utils/common-util';
+
+const TABLE_KEY = "pro-table-role";
 
 const handleSave = async (val) => {
     const hide = message.loading('姝e湪娣诲姞');
@@ -203,7 +206,6 @@
             title: '澶囨敞',
             dataIndex: 'memo',
             valueType: 'text',
-            hidden: false,
             filterDropdown: (props) => <TextFilter
                 name='memo'
                 {...props}
@@ -340,9 +342,10 @@
                         }
                     }}
                     columnsState={{
-                        persistenceKey: 'pro-table-role',
+                        persistenceKey: TABLE_KEY,
                         persistenceType: 'localStorage',
                         defaultValue: {
+                            memo: { show: repairBug(TABLE_KEY, 'memo', false) },
                             option: { fixed: 'right', disable: true },
                         },
                         onChange(value) {
diff --git a/zy-asrs-flow/src/utils/common-util.js b/zy-asrs-flow/src/utils/common-util.js
new file mode 100644
index 0000000..60875e4
--- /dev/null
+++ b/zy-asrs-flow/src/utils/common-util.js
@@ -0,0 +1,24 @@
+export const generateColumnsState = (cols) => cols.reduce((acc, { dataIndex, show = true }) => ({ ...acc, [dataIndex]: { show: show } }), {});
+
+
+export const repairBug = (tabKey, key, val) => {
+    const stateStr = localStorage.getItem(tabKey);
+    if (stateStr) {
+        const state = JSON.parse(stateStr);
+        const oldVal = state[key].show;
+        let hasVal = false;
+        if (oldVal === true) {
+            hasVal = true;
+        }
+        if (oldVal === false) {
+            hasVal = true;
+        }
+        if (hasVal) {
+            return oldVal;
+        } else {
+            return val;
+        }
+    } else {
+        return val;
+    }
+}
\ No newline at end of file
diff --git a/zy-asrs-framework/src/main/resources/templates/react/Index.txt b/zy-asrs-framework/src/main/resources/templates/react/Index.txt
index c68da77..2348d42 100644
--- a/zy-asrs-framework/src/main/resources/templates/react/Index.txt
+++ b/zy-asrs-framework/src/main/resources/templates/react/Index.txt
@@ -12,6 +12,9 @@
 import Edit from './components/edit'
 import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
 import { statusMap } from '@/utils/enum-util'
+import { repairBug } from '@/utils/common-util';
+
+const TABLE_KEY = "pro-table-role";
 
 const handleSave = async (val) => {
     const hide = message.loading('姝e湪娣诲姞');
@@ -221,7 +224,7 @@
                         }
                     }}
                     columnsState={{
-                        persistenceKey: 'pro-table-@{SIMPLEENTITYNAME}',
+                        persistenceKey: TABLE_KEY,
                         persistenceType: 'localStorage',
                         defaultValue: {
                             option: { fixed: 'right', disable: true },

--
Gitblit v1.9.1