Commit 08310f08 authored by 皮倩雯's avatar 皮倩雯

fix: '权限选择器全局组件'

parent b9dd692f
Pipeline #56794 waiting for manual action with stages
This diff is collapsed.
.modalContainer {
.ant-modal-body {
padding: 0;
}
.ant-modal-header {
padding: 28px 16px;
}
.pageContent {
display: flex;
height: 100%;
.optionalList {
position: relative;
width: 60%;
border-right: 1px solid #e7e7e7;
.title {
position: absolute;
left: 17px;
top: 10px;
font-weight: 700;
font-size: 14px;
z-index: 1;
color: #00070d;
}
.tabContent {
height: 550px;
.ant-tabs-content-holder {
height: 480px;
}
}
.searchInput {
position: absolute;
width: 200px;
z-index: 1;
top: 3px;
right: 40px;
.anticon svg {
margin-top: 0px;
}
.ant-input,
.ant-input-affix-wrapper {
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.ant-input-group-addon {
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
.ant-input-search-button {
width: 40px;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
}
.checkContent {
display: flex;
flex-wrap: wrap;
margin-left: 32px;
.check {
.ant-checkbox-wrapper {
width: 180px;
margin-bottom: 10px;
margin-left: 6px;
}
.ant-checkbox-wrapper span {
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.footer {
padding-left: 25px;
.ant-pagination {
border: none;
}
}
.ant-tabs-nav {
background-color: #f2f1f1;
}
.ant-tabs-tab {
background-color: #f2f1f1;
color: #666666;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.ant-tabs-tab-active {
background-color: #fff;
color: #1685ff;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.selectedList {
position: relative;
width: 40%;
.header {
height: 40px;
width: 100%;
background-color: #f2f1f1;
.title {
position: absolute;
left: 17px;
top: 10px;
font-weight: 700;
font-size: 14px;
z-index: 1;
color: #00070d;
}
.tagHead {
display: flex;
position: absolute;
top: 10px;
left: 88px;
.tagContent {
display: flex;
align-items: center;
margin-right: 11px;
}
.tagRol,
.tagOrg,
.tagSite {
width: 10px;
height: 3px;
margin-right: 5px;
}
.tagRol {
background-color: #87e8de;
}
.tagOrg {
background-color: #ffd591;
}
.tagSite {
background-color: #a785dd;
}
}
}
.selectBox {
height: 490px;
padding: 10px;
overflow-y: scroll;
.selectContent {
display: flex;
flex-wrap: wrap;
flex-direction: row;
.selectValue {
margin-bottom: 15px;
}
}
}
}
}
}
......@@ -31,6 +31,7 @@ import {
CM_XWBPlan_DataList,
} from '@/services/maintenance/api';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import RMSComponents from '@/components/RolePmSite/index';
import ChangeAdd from './ChangeAdd';
......@@ -56,6 +57,9 @@ const AddModal = props => {
const [characterValue, setCharacterValue] = useState(''); // 打开弹框之前数据
const [ff, setFf] = useState([]);
const [chee, setChee] = useState('');
const [isVisibleRoles, setIsVisibleRoles] = useState(false);
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色']);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -181,7 +185,7 @@ const AddModal = props => {
console.log(inputValue[fileds]);
console.log(inputValue[fileds].split(','));
setPickItem(fileds);
setIsVisible(true);
setIsVisibleRoles(true);
};
const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
......@@ -197,7 +201,7 @@ const AddModal = props => {
};
const getFeedbackTable = () => {
CM_XWBPlan_feedbackTable().then(res => {
if (res.msg === 'Ok') {
if (res.code === 0) {
let arr = [];
res.data.map((item, index) => {
arr.push(item.accountName);
......@@ -278,6 +282,7 @@ const AddModal = props => {
};
const onOK = prop => {
console.log(prop.isType);
setIsVisibleRoles(false);
setIsVisible(false);
console.log(props);
let inputText = { ...inputValue };
......@@ -547,6 +552,16 @@ const AddModal = props => {
pickItem={pickItem}
characterValue={characterValue}
/>
<RMSComponents
visible={isVisibleRoles}
onCancel={() => setIsVisibleRoles(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
/>
</Drawer>
);
};
......
/* eslint-disable no-lonely-if */
/* eslint-disable eqeqeq */
import React, { useState, useEffect, PureComponent } from 'react';
import { Modal, Divider, Checkbox, Space, Button } from 'antd';
import { Modal, Divider, Checkbox, Space, Button, Empty } from 'antd';
import styles from './maintenance.less';
const CheckboxGroup = Checkbox.Group;
......@@ -29,23 +29,10 @@ const ChangeAdd = props => {
list.map((item, index) => {
arr.push(item);
});
console.log(list);
console.log(arr);
setCheckedList(arr);
setIndeterminate(!!list.length && list.length < filed.length);
setCheckAll(list.length === filed.length);
};
const onChangeList1 = list => {
let arr = [];
list.map((item, index) => {
arr.push(item);
});
console.log(list);
console.log(arr);
setCheckedList(arr);
setIndeterminate(!!list.length && list.length < ff.length);
setCheckAll(list.length === ff.length);
};
const onSubmit = () => {
isType === 'rule'
......@@ -66,12 +53,9 @@ const ChangeAdd = props => {
setIndeterminate(false);
setCheckAll(e.target.checked);
};
const onCheckAllChange1 = e => {
setCheckedList(e.target.checked ? ff : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
useEffect(() => {
console.log(filed);
selectAll();
}, [checkedList]);
......@@ -90,7 +74,6 @@ const ChangeAdd = props => {
if (isType != '' && isType === 'add') {
// 反馈名称
let checkArr = [];
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (filed.includes(checkItem)) {
checkArr.push(checkItem);
......@@ -101,136 +84,32 @@ const ChangeAdd = props => {
setCheckAll(checkArr.length === filed.length && filed.length != 0);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
} else if (isType === 'app') {
// 执行角色
let checkArr = [];
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (ff.includes(checkItem)) {
checkArr.push(checkItem);
}
});
setCheckedList(checkArr);
setIndeterminate(!!checkArr.length && checkArr.length < ff.length);
setCheckAll(checkArr.length === ff.length && ff.length != 0);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
}
} else {
if (isType != '' && isType === 'add') {
// 反馈名称
let checkArr = [];
console.log(filed);
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (filed.includes(checkItem)) {
checkArr.push(checkItem);
}
});
console.log(checkArr);
setCheckedList(checkArr);
setIndeterminate(!!checkArr.length && checkArr.length < filed.length);
setCheckAll(checkArr.length === filed.length && filed.length != 0);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
} else if (isType === 'app') {
// 执行角色
let checkArr = [];
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (ff.includes(checkItem)) {
checkArr.push(checkItem);
}
});
setCheckedList(checkArr);
setIndeterminate(!!checkArr.length && checkArr.length < ff.length);
setCheckAll(checkArr.length === ff.length && ff.length != 0);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
}
}
}, [visible]);
if (isType != 'app') {
return (
<div className={styles.ChangeAddContainer}>
<Modal
title="反馈名称"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="400px"
destroyOnClose
centered
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem}>
{JSON.stringify(filed) == '{}' ? (
<>
<div className={styles.cardContent}>
<span
style={{
color: 'red',
fontSize: '1rem',
marginLeft: '25px',
}}
>
暂无数据请先配置台账管理台账名称为反馈
</span>
</div>
</>
) : (
<>
<div className={styles.cardContent}>
<div className={styles.cardItemData}>
<Divider
orientation="left"
style={{
margin: '0 0 5px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
全选
<Checkbox
style={{ marginLeft: '10px' }}
indeterminate={indeterminate}
onChange={onCheckAllChange}
checkvalue={filed}
checked={checkAll}
>
{' '}
</Checkbox>
</Divider>
<CheckboxGroup
options={filed}
value={checkedList}
onChange={e => onChangeList(e)}
/>
</div>
</div>
</>
)}
</div>
</div>
)}
</Modal>
</div>
);
}
if (isType === 'app') {
return (
return (
<div className={styles.ChangeAddContainer}>
<Modal
title="角色"
title="反馈名称"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="450px"
width="400px"
destroyOnClose
centered
cancelText="取消"
......@@ -243,40 +122,53 @@ const ChangeAdd = props => {
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem}>
<div className={styles.cardContent}>
<div className={styles.cardItemData}>
<Divider
orientation="left"
style={{
margin: '0 0 5px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
全选
<Checkbox
style={{ marginLeft: '10px' }}
indeterminate={indeterminate}
onChange={onCheckAllChange1}
checkvalue={ff}
checked={checkAll}
>
{' '}
</Checkbox>
</Divider>
<CheckboxGroup
options={ff}
value={checkedList}
onChange={e => onChangeList1(e)}
/>
{filed.length == 0 ? (
<>
<div className={styles.cardContent}>
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据请先在台账管理中配置台账类型为反馈"
/>
</div>
</>
) : (
<div>
<div className={styles.cardContent}>
<div className={styles.cardItemData}>
<Divider
orientation="left"
style={{
margin: '0 0 5px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
全选
<Checkbox
style={{ marginLeft: '10px' }}
indeterminate={indeterminate}
onChange={onCheckAllChange}
checkvalue={filed}
checked={checkAll}
>
{' '}
</Checkbox>
</Divider>
<CheckboxGroup
options={filed}
value={checkedList}
onChange={e => onChangeList(e)}
/>
</div>
</div>
</div>
</div>
)}
</div>
</div>
)}
</Modal>
);
}
</div>
);
};
export default ChangeAdd;
......@@ -17,6 +17,7 @@ import {
CM_Feedback_QueryPatrolFeedback,
} from '@/services/PatrolFeedback/api';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import RMSComponents from '@/components/RolePmSite/index';
import ChangeRoles from './ChangeRoles';
import ChangeFields from './ChangeFields';
......@@ -36,6 +37,8 @@ const AddModal = props => {
const [isVisibleRoles, setIsVisibleRoles] = useState(false);
const [nu, setNu] = useState([]);
const [nu1, setNu1] = useState([]);
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -430,13 +433,23 @@ const AddModal = props => {
pickItem={pickItem}
formObj={formObj}
/>
<ChangeRoles
{/* <ChangeRoles
visible={isVisibleRoles}
onCancel={() => setIsVisibleRoles(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1}
filed11={filed1}
pickItem={pickItem}
/> */}
<RMSComponents
visible={isVisibleRoles}
onCancel={() => setIsVisibleRoles(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
/>
</Drawer>
);
......
......@@ -13,7 +13,7 @@
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Divider, Checkbox, Tabs } from 'antd';
import { Form, Modal, Divider, Checkbox, Tabs, Empty } from 'antd';
import DragTable from '@/components/DragTable/DragTable';
import styles from '../../workOrder/incident/incident.less';
const CheckboxGroup = Checkbox.Group;
......@@ -304,7 +304,11 @@ const ChangeFields = props => {
{JSON.stringify(filed) == '{}' ? (
<>
<div className={styles.cardContent}>
<span
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="表字段缺失请先配置表/字段"
/>
{/* <span
style={{
color: 'red',
fontSize: '1rem',
......@@ -312,7 +316,7 @@ const ChangeFields = props => {
}}
>
表字段缺失请先配置表/字段
</span>
</span> */}
</div>
</>
) : (
......
......@@ -23,6 +23,7 @@ import {
} from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import ChangeAddFlows from './ChangeAddFlows';
import RMSComponents from '@/components/RolePmSite/index';
import {
CM_Event_ReloadFlows,
CM_Event_LoadDepartmentAndRoles,
......@@ -56,22 +57,19 @@ const AddFlowsModal = props => {
const [inputValue, setInputValue] = useState({ Roles: '' });
const [selectValue, setSelectValue] = useState('');
const [characterValue, setCharacterValue] = useState('');
const [Order, setOrder] = useState(''); // 弹窗类型
const [strr, setStrr] = useState('');
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
useEffect(() => {
console.log(formObj);
getRole();
console.log(obj);
CM_Event_ReloadFlows({ eventTypeId: obj }).then(res => {
if (res.msg === 'Ok') {
console.log(res.data);
let arr = formateArrDataA(res.data, 'System');
let newArr = [];
Object.keys(arr).map((item, index) => {
newArr.push(item);
});
console.log(newArr);
setStandingTable(newArr);
}
});
......@@ -81,12 +79,10 @@ const AddFlowsModal = props => {
form.resetFields();
} else if (type === 'edit') {
setStrr(record.FlowRoles);
console.log(record);
setInputValue({
Roles: record.FlowRoles,
});
setSelectValue(record.FlowName);
console.log(selectValue);
}
}, [visible]);
const formateArrDataA = (initialArr, name) => {
......@@ -320,46 +316,9 @@ const AddFlowsModal = props => {
setVisible1(true);
};
const onOKk = prop => {
// let { title } = prop;
// let selectData = prop.stt;
// let ff = prop.filed22;
// let aa = [];
// let bb = 0;
// title.map((item, index) => {
// console.log(ff[item]);
// aa = [];
// selectData.map((item1, index1) => {
// console.log(item1);
// if (ff[item].indexOf(item1) != -1) {
// aa.push(item1);
// }
// });
// console.log(aa);
// if (aa.length == 0) {
// bb = 1;
// }
// });
// console.log(aa);
// if (bb == 1) {
// notification.error({
// message: '提示',
// description: '权限角色部门必须都选至少一项',
// });
// } else {
// setVisible1(false);
// let inputText = { ...inputValue };
// inputText[prop.pickItem] = prop.str;
// console.log(prop.str);
// console.log(inputText);
// setStrr(prop.str);
// setCheckedList1(prop.checkedList);
// setInputValue(inputText);
// }
setVisible1(false);
let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str;
console.log(prop.str);
console.log(inputText);
setStrr(prop.str);
setCheckedList1(prop.stt);
setInputValue(inputText);
......@@ -433,15 +392,23 @@ const AddFlowsModal = props => {
</Col>
</Row>
</Form>
<ChangeAddFlows
{/* <ChangeAddFlows
visible={visible1}
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1}
filed11={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/> */}
<RMSComponents
visible={visible1}
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
/>
</Drawer>
);
......
......@@ -48,6 +48,7 @@ import { PlusOutlined, DownOutlined, InfoCircleOutlined } from '@ant-design/icon
import styles from './incident.less';
import ChangeAdd from './changeAdd';
import ChangeEdit from './changeEdit';
import RMSComponents from '@/components/RolePmSite/index';
const { Option } = Select;
const AddModal = props => {
......@@ -474,6 +475,9 @@ const AddModal = props => {
const [editableValue, setEditableValue] = useState(); // 保存编辑字段外部字段
const [transitValue, setTransitValue] = useState(); // 保存转单字段外部字段
const [relatedEventValue, setRelatedEventValue] = useState(); // 保存关联字段外部字段
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
const [keepFiled, setKeepFiled] = useState([]);
const { Item } = Form;
const onSubmit = () => {
......@@ -684,6 +688,7 @@ const AddModal = props => {
if (res.msg === 'Ok') {
setNu1(res.data);
setFiled1(formateArrDataA1(res.data, 'groupType'));
setKeepFiled(groupArr(res.data, 'groupType'));
}
});
};
......@@ -963,6 +968,26 @@ const AddModal = props => {
}
return tempObj;
};
const groupArr = (initialArr, name) => {
let list = {};
console.log(initialArr);
initialArr.data.map(i => {
console.log(i);
let ar = [];
i.root.map(j => {
let ss = {};
ss.label = j.Name;
ss.value = j.ID;
ar.push(ss);
console.log(ss);
});
list[i.groupType] = ar;
});
console.log(list);
return list;
};
const formateArrDataA1 = (initialArr, name) => {
console.log(initialArr);
let aa = [];
......@@ -1018,7 +1043,6 @@ const AddModal = props => {
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = [];
tempObj[key].map(item => {
......@@ -1152,7 +1176,9 @@ const AddModal = props => {
};
const pickFiled1 = fileds => {
console.log(nu1);
let pp = formateArrDataA1(nu1, 'group');
setKeepFiled(groupArr(nu1, 'group'));
if (form.getFieldValue(fileds)) {
setFiled1(pp);
setCheckedList1(form.getFieldValue(fileds).split(','));
......@@ -1748,13 +1774,24 @@ const AddModal = props => {
</Col>
</Row>
</Form>
<ChangeAdd
{/* <ChangeAdd
visible={isVisible}
onCancel={onCancel}
callBackSubmit={onOK}
newCheckedList={checkedList1}
filed11={filed1}
pickItem={pickItem}
/> */}
<RMSComponents
visible={isVisible}
onCancel={onCancel}
callBackSubmit={onOK}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
keepFiled={keepFiled}
/>
<ChangeEdit
visible={isVisibleEdit}
......
......@@ -13,7 +13,7 @@
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Divider, Checkbox, Tabs } from 'antd';
import { Form, Modal, Divider, Checkbox, Tabs, Empty } from 'antd';
import DragTable from '@/components/DragTable/DragTable';
import styles from './incident.less';
const CheckboxGroup = Checkbox.Group;
......@@ -302,15 +302,10 @@ const EditModal = props => {
{JSON.stringify(filed) == '{}' ? (
<>
<div className={styles.cardContent}>
<span
style={{
color: 'red',
fontSize: '1rem',
marginLeft: '25px',
}}
>
表字段缺失请先配置表/字段
</span>
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="表字段缺失请先配置表/字段"
/>
</div>
</>
) : (
......
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