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

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

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