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

fix: '角色部门站点选择器支持站点单选逻辑'

parent 3516e5dc
Pipeline #77266 passed with stages
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* eslint-disable eqeqeq */ /* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */ /* eslint-disable no-plusplus */
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Modal, Checkbox, Tabs, Input, Button, Pagination, Empty, Tag, Divider } from 'antd'; import { Modal, Checkbox, Tabs, Input, Button, Pagination, Empty, Tag, Divider, Radio } from 'antd';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import styles from './index.less'; import styles from './index.less';
...@@ -31,6 +31,7 @@ const RMSComponents = props => { ...@@ -31,6 +31,7 @@ const RMSComponents = props => {
groupName, groupName,
chooseGroupName, chooseGroupName,
dataType, dataType,
isRadio,
} = props; } = props;
const [checkedList, setCheckedList] = useState([]); // 选中复选框内容 const [checkedList, setCheckedList] = useState([]); // 选中复选框内容
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
...@@ -54,6 +55,18 @@ const RMSComponents = props => { ...@@ -54,6 +55,18 @@ const RMSComponents = props => {
const [indeterminate2, setIndeterminate2] = useState(false); const [indeterminate2, setIndeterminate2] = useState(false);
const [checkAll2, setCheckAll2] = useState(false); const [checkAll2, setCheckAll2] = useState(false);
const keepFiled = useRef({}); const keepFiled = useRef({});
const [radioValue, setRadioValue] = useState();
const radioChange = e => {
setRadioValue(e.target.value);
let data = optionValue['站点'].find(i => i.value === e.target.value);
let cs = new Map();
cs.set(data.value, {
value: data.label,
type: 2,
});
setSelected(cs);
};
const onSubmit = () => { const onSubmit = () => {
let selectData = []; let selectData = [];
...@@ -62,7 +75,6 @@ const RMSComponents = props => { ...@@ -62,7 +75,6 @@ const RMSComponents = props => {
selectData.push(val.value); selectData.push(val.value);
ids.push(key); ids.push(key);
}); });
console.log(ids, 'selected');
callBackSubmit({ callBackSubmit({
str: selectData.join(','), str: selectData.join(','),
pickItem, pickItem,
...@@ -161,8 +173,10 @@ const RMSComponents = props => { ...@@ -161,8 +173,10 @@ const RMSComponents = props => {
let datasiteId = Array.from(new Set(siteId)); let datasiteId = Array.from(new Set(siteId));
setCheckDataSite(datasiteId); setCheckDataSite(datasiteId);
checkArr[2] = datasiteId; checkArr[2] = datasiteId;
if (isRadio) {
setRadioValue(siteId[0]);
}
setSaveCheckValue(checkArr); setSaveCheckValue(checkArr);
console.log(checkArr, 'checkArr');
setCheckedList(checkArr); setCheckedList(checkArr);
} }
}); });
...@@ -172,6 +186,9 @@ const RMSComponents = props => { ...@@ -172,6 +186,9 @@ const RMSComponents = props => {
setCurrentPage(1); setCurrentPage(1);
setIndeterminate(false); setIndeterminate(false);
setCheckAll(false); setCheckAll(false);
setCheckedList([]);
setRadioValue();
setOptionValue([]);
} }
}, [visible]); }, [visible]);
...@@ -293,7 +310,6 @@ const RMSComponents = props => { ...@@ -293,7 +310,6 @@ const RMSComponents = props => {
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
setTotal(res.data.count); setTotal(res.data.count);
console.log(groupArr(res.data, 'groupType'), 'groupType');
setOptionValue(groupArr(res.data, 'groupType')); setOptionValue(groupArr(res.data, 'groupType'));
let aa = groupArr(res.data, 'groupType'); let aa = groupArr(res.data, 'groupType');
let list = []; let list = [];
...@@ -615,6 +631,7 @@ const RMSComponents = props => { ...@@ -615,6 +631,7 @@ const RMSComponents = props => {
// 删除已选中列表 // 删除已选中列表
const delSelected = value => { const delSelected = value => {
setRadioValue('');
let aa = selected.get(value).type; let aa = selected.get(value).type;
let list = []; let list = [];
let checkedListArr = saveCheckValue; let checkedListArr = saveCheckValue;
...@@ -903,6 +920,14 @@ const RMSComponents = props => { ...@@ -903,6 +920,14 @@ const RMSComponents = props => {
<div className={styles.checkContent}> <div className={styles.checkContent}>
{emptyValue == 0 ? ( {emptyValue == 0 ? (
<div className={styles.check}> <div className={styles.check}>
{isRadio ? (
<Radio.Group onChange={radioChange} value={radioValue}>
{optionValue['站点']?.map(i => {
return <Radio value={i.value}>{i.label}</Radio>;
})}
</Radio.Group>
) : (
<>
<Checkbox <Checkbox
indeterminate={indeterminate2} indeterminate={indeterminate2}
onChange={onCheckAllChange2} onChange={onCheckAllChange2}
...@@ -916,6 +941,8 @@ const RMSComponents = props => { ...@@ -916,6 +941,8 @@ const RMSComponents = props => {
value={checkedList[2]} value={checkedList[2]}
onChange={onChangeListNew2} onChange={onChangeListNew2}
/> />
</>
)}
</div> </div>
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />
......
...@@ -83,6 +83,19 @@ ...@@ -83,6 +83,19 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.ant-radio-wrapper {
width: 180px;
margin-bottom: 10px;
margin-left: 6px;
}
.ant-radio-wrapper span {
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
} }
} }
......
...@@ -658,7 +658,10 @@ const VectorData = props => { ...@@ -658,7 +658,10 @@ const VectorData = props => {
return ( return (
<div className={styles.solutionContainer}> <div className={styles.solutionContainer}>
<Spin tip="loading..." spinning={checkLoading}> <Spin tip="loading..." spinning={checkLoading}>
<div className={styles.tableContainer} style={{ height: 'calc(100vh - 150px)', width: '100%', overflow: 'scroll' }}> <div
className={styles.tableContainer}
style={{ height: 'calc(100vh - 150px)', width: '100%', overflow: 'scroll' }}
>
<div className={styles.tableContent}> <div className={styles.tableContent}>
<Divider orientation="left"> <Divider orientation="left">
<div className={styles.divider}> <div className={styles.divider}>
...@@ -733,6 +736,7 @@ const VectorData = props => { ...@@ -733,6 +736,7 @@ const VectorData = props => {
groupName="站点" // 打开组件展示的分组名,用来首次获取数据 groupName="站点" // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={['站点']} // 可选分组名 chooseGroupName={['站点']} // 可选分组名
dataType="id" dataType="id"
isRadio={true} // 站点单选
/> />
{/* <RoleModal {/* <RoleModal
selectValue={checkValue.toString()} selectValue={checkValue.toString()}
......
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