Commit ad4583e4 authored by 皮倩雯's avatar 皮倩雯

fix: '表字段关联表单字段映射支持下拉选择,机构管理不允许删除和冻结panda和admin'

parent 1e9cbff9
Pipeline #63506 passed with stages
...@@ -22,6 +22,7 @@ import { ...@@ -22,6 +22,7 @@ import {
SortDescendingOutlined, SortDescendingOutlined,
PlusSquareOutlined, PlusSquareOutlined,
RollbackOutlined, RollbackOutlined,
ConsoleSqlOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
reloadTableFields, reloadTableFields,
...@@ -64,6 +65,7 @@ const AddModal = props => { ...@@ -64,6 +65,7 @@ const AddModal = props => {
const [selectGroup, setSelectGroup] = useState([]); const [selectGroup, setSelectGroup] = useState([]);
const [keepStandingBook, setKeepStandingBook] = useState([]); const [keepStandingBook, setKeepStandingBook] = useState([]);
const [keepTreeData, setKeepTreeData] = useState([]); const [keepTreeData, setKeepTreeData] = useState([]);
const [keepTree, setKeepTree] = useState([]); // 保存树字段名称
const editor = record => { const editor = record => {
console.log(record); console.log(record);
...@@ -310,7 +312,7 @@ const AddModal = props => { ...@@ -310,7 +312,7 @@ const AddModal = props => {
res.data.root.map(i => { res.data.root.map(i => {
data.push(i.name); data.push(i.name);
}); });
setKeepStandingBook(data); setKeepStandingBook(res.data.root);
} }
}); });
}, []); }, []);
...@@ -335,6 +337,8 @@ const AddModal = props => { ...@@ -335,6 +337,8 @@ const AddModal = props => {
res.data.root.map(i => { res.data.root.map(i => {
arrlist.push(i.name); arrlist.push(i.name);
}); });
console.log(arrlist);
setKeepTree(arrlist);
data.TableFieldNames = arrlist; data.TableFieldNames = arrlist;
data.TableName = treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@')); data.TableName = treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@'));
listArr.push(data); listArr.push(data);
...@@ -374,6 +378,8 @@ const AddModal = props => { ...@@ -374,6 +378,8 @@ const AddModal = props => {
res.data.root.map(i => { res.data.root.map(i => {
arrlist.push(i.name); arrlist.push(i.name);
}); });
console.log(arrlist);
setKeepTree(arrlist);
data.TableFieldNames = arrlist; data.TableFieldNames = arrlist;
data.TableName = props.location.state.id; data.TableName = props.location.state.id;
listArr.push(data); listArr.push(data);
...@@ -590,6 +596,8 @@ const AddModal = props => { ...@@ -590,6 +596,8 @@ const AddModal = props => {
res.data.root.map(i => { res.data.root.map(i => {
arrlist.push(i.name); arrlist.push(i.name);
}); });
console.log(arrlist);
setKeepTree(arrlist);
data.TableFieldNames = arrlist; data.TableFieldNames = arrlist;
data.TableName = e.substring(0, e.lastIndexOf('@')); data.TableName = e.substring(0, e.lastIndexOf('@'));
listArr.push(data); listArr.push(data);
...@@ -761,6 +769,7 @@ const AddModal = props => { ...@@ -761,6 +769,7 @@ const AddModal = props => {
</Modal> </Modal>
<FieldEditor <FieldEditor
isVisible={isVisible} isVisible={isVisible}
keepTree={keepTree}
keepTreeData={keepTreeData} keepTreeData={keepTreeData}
isType={isType} isType={isType}
itemData={itemData} itemData={itemData}
......
/* eslint-disable no-unused-expressions */
/* eslint-disable eqeqeq */ /* eslint-disable eqeqeq */
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import {
...@@ -169,6 +170,7 @@ const UserManage = () => { ...@@ -169,6 +170,7 @@ const UserManage = () => {
const flagRef = useRef(1); const flagRef = useRef(1);
const [searchWordOrg, setSearchWordOrg] = useState(''); const [searchWordOrg, setSearchWordOrg] = useState('');
const [keepDataList, setKeepDataList] = useState([]);
const setRowClassName = record => const setRowClassName = record =>
record.userID === selectColor.userID ? styles.clickRowStyle : ''; record.userID === selectColor.userID ? styles.clickRowStyle : '';
// 用户表列名 // 用户表列名
...@@ -274,7 +276,9 @@ const UserManage = () => { ...@@ -274,7 +276,9 @@ const UserManage = () => {
</Tooltip> </Tooltip>
{(record.state == 0 || record.state == null) && ( {(record.state == 0 || record.state == null) && (
<> <>
{/* { console.log(record.state,'record.state')} */} {record.loginName == 'panda' || record.loginName == 'admin' ? (
<StopOutlined style={{ fontSize: '16px' }} />
) : (
<Tooltip title="冻结用户"> <Tooltip title="冻结用户">
<Popconfirm <Popconfirm
placement="bottomRight" placement="bottomRight"
...@@ -292,6 +296,7 @@ const UserManage = () => { ...@@ -292,6 +296,7 @@ const UserManage = () => {
<StopOutlined style={{ fontSize: '16px', color: '#e86060' }} /> <StopOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm> </Popconfirm>
</Tooltip> </Tooltip>
)}
</> </>
)} )}
{record.state == 1 && ( {record.state == 1 && (
...@@ -345,6 +350,9 @@ const UserManage = () => { ...@@ -345,6 +350,9 @@ const UserManage = () => {
/> />
</Popconfirm> </Popconfirm>
</Tooltip> */} </Tooltip> */}
{record.loginName == 'panda' || record.loginName == 'admin' ? (
<DeleteOutlined style={{ fontSize: '16px' }} />
) : (
<Tooltip title="删除用户"> <Tooltip title="删除用户">
<Popconfirm <Popconfirm
placement="bottomRight" placement="bottomRight"
...@@ -363,6 +371,7 @@ const UserManage = () => { ...@@ -363,6 +371,7 @@ const UserManage = () => {
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} /> <DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm> </Popconfirm>
</Tooltip> </Tooltip>
)}
</Space> </Space>
), ),
}, },
...@@ -706,16 +715,27 @@ const UserManage = () => { ...@@ -706,16 +715,27 @@ const UserManage = () => {
setOrgTitle(res.data.GroupName); setOrgTitle(res.data.GroupName);
setDescription(res.data.Description); setDescription(res.data.Description);
// 返回用户表数据结构处理,扁平化 // 返回用户表数据结构处理,扁平化
console.log(res.data);
const temp = flatten(getUsers(res.data)); const temp = flatten(getUsers(res.data));
console.log(temp);
// 设置过滤字段 // 设置过滤字段
let arr = temp.map(item => item.OUName); let arr = temp.map(item => item.OUName);
console.log(arr);
arr = arr.filter((value, index) => arr.indexOf(value) === index); arr = arr.filter((value, index) => arr.indexOf(value) === index);
console.log(arr);
setOrgFilters(arr.map(item => ({ text: item, value: item }))); setOrgFilters(arr.map(item => ({ text: item, value: item })));
setTableLength(temp.length); setTableLength(temp.length);
let datalist = [];
const table = temp.map((item, index) => { const table = temp.map((item, index) => {
console.log(item);
if (item.loginName == 'panda' || item.loginName == 'admin') {
datalist.push(item.userID);
}
item.key = index; item.key = index;
return item; return item;
}); });
console.log(datalist);
setKeepDataList(datalist);
setShowSearchStyle(false); setShowSearchStyle(false);
setTableData(table); setTableData(table);
} else { } else {
...@@ -901,6 +921,7 @@ const UserManage = () => { ...@@ -901,6 +921,7 @@ const UserManage = () => {
}; };
// 冻结用户 // 冻结用户
const freezeUser = record => { const freezeUser = record => {
console.log(currentUser);
// setFreezeUserVisible(true); // setFreezeUserVisible(true);
setCurrentUser(record); setCurrentUser(record);
setSelectColor(record); setSelectColor(record);
...@@ -1265,6 +1286,25 @@ const UserManage = () => { ...@@ -1265,6 +1286,25 @@ const UserManage = () => {
}; };
// 提交-批量删除用户 // 提交-批量删除用户
const submitDeleteUsers = () => { const submitDeleteUsers = () => {
console.log(userIDs);
console.log(keepDataList);
console.log(userIDs.split(','));
let data = [];
keepDataList.length > 0 &&
keepDataList.map(i => {
let aa = userIDs.split(',').indexOf(i);
console.log(aa);
if (aa !== -1) {
data.push(aa);
}
});
console.log(data);
if (data.length > 0) {
notification.error({
message: '操作失败',
description: '选中项包含不可删除的用户panda或admin',
});
} else {
multiDeleteUsers(userIDs) multiDeleteUsers(userIDs)
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -1287,6 +1327,7 @@ const UserManage = () => { ...@@ -1287,6 +1327,7 @@ const UserManage = () => {
setTableLoading(false); setTableLoading(false);
message.error(err); message.error(err);
}); });
}
}; };
// 重置默认第一个 // 重置默认第一个
const handleReset = () => { const handleReset = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment