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

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

parent 3516e5dc
Pipeline #77266 passed with stages
......@@ -16,7 +16,7 @@
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
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 styles from './index.less';
......@@ -31,6 +31,7 @@ const RMSComponents = props => {
groupName,
chooseGroupName,
dataType,
isRadio,
} = props;
const [checkedList, setCheckedList] = useState([]); // 选中复选框内容
const [searchWord, setSearchWord] = useState(''); // 关键字
......@@ -54,6 +55,18 @@ const RMSComponents = props => {
const [indeterminate2, setIndeterminate2] = useState(false);
const [checkAll2, setCheckAll2] = useState(false);
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 = () => {
let selectData = [];
......@@ -62,7 +75,6 @@ const RMSComponents = props => {
selectData.push(val.value);
ids.push(key);
});
console.log(ids, 'selected');
callBackSubmit({
str: selectData.join(','),
pickItem,
......@@ -161,8 +173,10 @@ const RMSComponents = props => {
let datasiteId = Array.from(new Set(siteId));
setCheckDataSite(datasiteId);
checkArr[2] = datasiteId;
if (isRadio) {
setRadioValue(siteId[0]);
}
setSaveCheckValue(checkArr);
console.log(checkArr, 'checkArr');
setCheckedList(checkArr);
}
});
......@@ -172,6 +186,9 @@ const RMSComponents = props => {
setCurrentPage(1);
setIndeterminate(false);
setCheckAll(false);
setCheckedList([]);
setRadioValue();
setOptionValue([]);
}
}, [visible]);
......@@ -293,7 +310,6 @@ const RMSComponents = props => {
}).then(res => {
if (res.msg === 'Ok') {
setTotal(res.data.count);
console.log(groupArr(res.data, 'groupType'), 'groupType');
setOptionValue(groupArr(res.data, 'groupType'));
let aa = groupArr(res.data, 'groupType');
let list = [];
......@@ -615,6 +631,7 @@ const RMSComponents = props => {
// 删除已选中列表
const delSelected = value => {
setRadioValue('');
let aa = selected.get(value).type;
let list = [];
let checkedListArr = saveCheckValue;
......@@ -903,19 +920,29 @@ const RMSComponents = props => {
<div className={styles.checkContent}>
{emptyValue == 0 ? (
<div className={styles.check}>
<Checkbox
indeterminate={indeterminate2}
onChange={onCheckAllChange2}
checked={checkAll2}
>
全选
</Checkbox>
<Divider />
<CheckboxGroup
options={optionValue['站点']}
value={checkedList[2]}
onChange={onChangeListNew2}
/>
{isRadio ? (
<Radio.Group onChange={radioChange} value={radioValue}>
{optionValue['站点']?.map(i => {
return <Radio value={i.value}>{i.label}</Radio>;
})}
</Radio.Group>
) : (
<>
<Checkbox
indeterminate={indeterminate2}
onChange={onCheckAllChange2}
checked={checkAll2}
>
全选
</Checkbox>
<Divider />
<CheckboxGroup
options={optionValue['站点']}
value={checkedList[2]}
onChange={onChangeListNew2}
/>
</>
)}
</div>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />
......
......@@ -83,6 +83,19 @@
text-overflow: ellipsis;
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 @@
margin-top: 0px;
margin-bottom: 10px;
}
}
\ No newline at end of file
}
......@@ -658,51 +658,54 @@ const VectorData = props => {
return (
<div className={styles.solutionContainer}>
<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}>
<Divider orientation="left">
<div className={styles.divider}>
{' '}
Web{' '}
<PlusOutlined
onClick={() => {
addType('add');
}}
className={styles.dividerIcon}
/>
</div>
</Divider>
<Table
columns={columns}
dataSource={webData}
bordered
// style={{ height: 'calc(100vh - 610px)' }}
pagination={false}
rowKey="schemename"
scroll={{ y: 600 }}
/>
<Divider orientation="left">
<div className={styles.divider}>
{' '}
Web{' '}
<PlusOutlined
onClick={() => {
addType('add');
}}
className={styles.dividerIcon}
/>
</div>
</Divider>
<Table
columns={columns}
dataSource={webData}
bordered
// style={{ height: 'calc(100vh - 610px)' }}
pagination={false}
rowKey="schemename"
scroll={{ y: 600 }}
/>
</div>
<div className={styles.tableContent}>
<Divider orientation="left">
<div className={styles.divider}>
Moblie{' '}
<PlusOutlined
onClick={() => {
addType('addHand');
}}
className={styles.dividerIcon}
/>
</div>{' '}
</Divider>
<Table
columns={columns1}
dataSource={handData}
bordered
rowKey="schemename"
scroll={{ y: 600 }}
// style={{ height: 'calc(100vh - 610px)' }}
pagination={false}
/>
<Divider orientation="left">
<div className={styles.divider}>
Moblie{' '}
<PlusOutlined
onClick={() => {
addType('addHand');
}}
className={styles.dividerIcon}
/>
</div>{' '}
</Divider>
<Table
columns={columns1}
dataSource={handData}
bordered
rowKey="schemename"
scroll={{ y: 600 }}
// style={{ height: 'calc(100vh - 610px)' }}
pagination={false}
/>
</div>
</div>
</Spin>
......@@ -733,6 +736,7 @@ const VectorData = props => {
groupName="站点" // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={['站点']} // 可选分组名
dataType="id"
isRadio={true} // 站点单选
/>
{/* <RoleModal
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