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,19 +920,29 @@ const RMSComponents = props => { ...@@ -903,19 +920,29 @@ const RMSComponents = props => {
<div className={styles.checkContent}> <div className={styles.checkContent}>
{emptyValue == 0 ? ( {emptyValue == 0 ? (
<div className={styles.check}> <div className={styles.check}>
<Checkbox {isRadio ? (
indeterminate={indeterminate2} <Radio.Group onChange={radioChange} value={radioValue}>
onChange={onCheckAllChange2} {optionValue['站点']?.map(i => {
checked={checkAll2} return <Radio value={i.value}>{i.label}</Radio>;
> })}
全选 </Radio.Group>
</Checkbox> ) : (
<Divider /> <>
<CheckboxGroup <Checkbox
options={optionValue['站点']} indeterminate={indeterminate2}
value={checkedList[2]} onChange={onCheckAllChange2}
onChange={onChangeListNew2} checked={checkAll2}
/> >
全选
</Checkbox>
<Divider />
<CheckboxGroup
options={optionValue['站点']}
value={checkedList[2]}
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;
}
} }
} }
...@@ -193,4 +206,4 @@ ...@@ -193,4 +206,4 @@
margin-top: 0px; margin-top: 0px;
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
\ No newline at end of file
...@@ -658,51 +658,54 @@ const VectorData = props => { ...@@ -658,51 +658,54 @@ 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}>
{' '} {' '}
Web{' '} Web{' '}
<PlusOutlined <PlusOutlined
onClick={() => { onClick={() => {
addType('add'); addType('add');
}} }}
className={styles.dividerIcon} className={styles.dividerIcon}
/> />
</div> </div>
</Divider> </Divider>
<Table <Table
columns={columns} columns={columns}
dataSource={webData} dataSource={webData}
bordered bordered
// style={{ height: 'calc(100vh - 610px)' }} // style={{ height: 'calc(100vh - 610px)' }}
pagination={false} pagination={false}
rowKey="schemename" rowKey="schemename"
scroll={{ y: 600 }} scroll={{ y: 600 }}
/> />
</div> </div>
<div className={styles.tableContent}> <div className={styles.tableContent}>
<Divider orientation="left"> <Divider orientation="left">
<div className={styles.divider}> <div className={styles.divider}>
Moblie{' '} Moblie{' '}
<PlusOutlined <PlusOutlined
onClick={() => { onClick={() => {
addType('addHand'); addType('addHand');
}} }}
className={styles.dividerIcon} className={styles.dividerIcon}
/> />
</div>{' '} </div>{' '}
</Divider> </Divider>
<Table <Table
columns={columns1} columns={columns1}
dataSource={handData} dataSource={handData}
bordered bordered
rowKey="schemename" rowKey="schemename"
scroll={{ y: 600 }} scroll={{ y: 600 }}
// style={{ height: 'calc(100vh - 610px)' }} // style={{ height: 'calc(100vh - 610px)' }}
pagination={false} pagination={false}
/> />
</div> </div>
</div> </div>
</Spin> </Spin>
...@@ -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