From d86db78f18c03d97b7b856fd37cd10d6297eecc7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 24 二月 2024 13:40:18 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/system/role/index.jsx | 93 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index 19ffeff..ce9021e 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -10,8 +10,12 @@
import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
import Http from '@/utils/http';
import Edit from './components/edit'
+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湪娣诲姞');
@@ -87,6 +91,24 @@
}
};
+const handleScope = async (val) => {
+ const hide = message.loading('姝e湪鍒嗛厤');
+ try {
+ const resp = await Http.doPost('api/role/scope/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 Main = () => {
const formTableRef = useRef();
@@ -95,6 +117,9 @@
const [modalVisible, setModalVisible] = useState(false);
const [currentRow, setCurrentRow] = useState();
const [searchParam, setSearchParam] = useState({});
+
+ const [scopeModalVisible, setScopeModalVisible] = useState(false);
+ const [menuIds, setMenuIds] = useState([]);
useEffect(() => {
@@ -117,6 +142,23 @@
actionRef={actionRef}
setSearchParam={setSearchParam}
/>,
+ render: (_, record) => {
+ return (
+ <a
+ onClick={() => {
+ Http.doGetPromise('/api/role/scope/list', { roleId: record.id }, (res) => {
+ if (res.data) {
+ setMenuIds(res.data);
+ }
+ setScopeModalVisible(true);
+ setCurrentRow(record);
+ });
+ }}
+ >
+ {_}
+ </a>
+ );
+ },
},
{
title: '鏍囪瘑',
@@ -134,7 +176,6 @@
title: '淇敼鏃堕棿',
dataIndex: 'updateTime$',
valueType: 'text',
- width: 300,
filterDropdown: (props) => <DatetimeRangeFilter
name='updateTime'
{...props}
@@ -146,7 +187,6 @@
title: '鐘舵��',
dataIndex: 'status$',
valueType: 'text',
- width: 160,
filterDropdown: (props) => <SelectFilter
name='status'
{...props}
@@ -166,7 +206,6 @@
title: '澶囨敞',
dataIndex: 'memo',
valueType: 'text',
- hidden: false,
filterDropdown: (props) => <TextFilter
name='memo'
{...props}
@@ -177,7 +216,7 @@
{
title: '鎿嶄綔',
dataIndex: 'option',
- width: 140,
+ width: 260,
valueType: 'option',
render: (_, record) => [
<Button
@@ -189,6 +228,21 @@
}}
>
缂栬緫
+ </Button>,
+ <Button
+ type="link"
+ key="scope"
+ onClick={() => {
+ Http.doGetPromise('/api/role/scope/list', { roleId: record.id }, (res) => {
+ if (res.data) {
+ setMenuIds(res.data);
+ }
+ setScopeModalVisible(true);
+ setCurrentRow(record);
+ });
+ }}
+ >
+ 鍒嗛厤鏉冮檺
</Button>,
<Button
type="link"
@@ -229,6 +283,7 @@
formRef={formTableRef}
columns={columns}
cardBordered
+ scroll={{ x: 1300 }}
dateFormatter="string"
pagination={{ pageSize: 20 }}
search={false}
@@ -287,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) {
@@ -356,6 +412,33 @@
}
}
/>
+
+ <Scope
+ open={scopeModalVisible}
+ values={currentRow || {}}
+ originMenuIds={menuIds}
+ onCancel={
+ () => {
+ setScopeModalVisible(false);
+ setCurrentRow(undefined);
+ setMenuIds([]);
+ }
+ }
+ onSubmit={async (values) => {
+ let ok = false;
+ if (values.id) {
+ ok = await handleScope({ ...values })
+ }
+ if (ok) {
+ setScopeModalVisible(false);
+ setCurrentRow(undefined);
+ setMenuIds([]);
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ }}
+ />
</PageContainer>
);
};
--
Gitblit v1.9.1