|
@@ -10,17 +10,17 @@ import './index.less'
|
|
*/
|
|
*/
|
|
interface Props {
|
|
interface Props {
|
|
onChange?: (groupId?: number) => void
|
|
onChange?: (groupId?: number) => void
|
|
- groupId?: number
|
|
|
|
|
|
+ value?: number
|
|
}
|
|
}
|
|
const GroupLeft: React.FC<Props> = (props) => {
|
|
const GroupLeft: React.FC<Props> = (props) => {
|
|
|
|
|
|
/*************************/
|
|
/*************************/
|
|
- const { onChange } = props
|
|
|
|
|
|
+ const { onChange, value } = props
|
|
const [isNewGrouping, setIsNewGrouping] = useState<boolean>(false); // 是否新增分组
|
|
const [isNewGrouping, setIsNewGrouping] = useState<boolean>(false); // 是否新增分组
|
|
const inputRef = useRef<any>(null);
|
|
const inputRef = useRef<any>(null);
|
|
const [groupData, setGroupData] = useState<{ groupName: string, remark?: string, groupId?: number }>({ groupName: '' }) // 分组添加
|
|
const [groupData, setGroupData] = useState<{ groupName: string, remark?: string, groupId?: number }>({ groupName: '' }) // 分组添加
|
|
const [selectAccData, setSelectAccData] = useState<{ id: number, mpName: string }[]>([]) // 选中
|
|
const [selectAccData, setSelectAccData] = useState<{ id: number, mpName: string }[]>([]) // 选中
|
|
- const [groupId, setGroupId] = useState<number>(0)
|
|
|
|
|
|
+ const [groupId, setGroupId] = useState<number>(value || 0)
|
|
|
|
|
|
const addGroup = useAjax((params) => addGroupApi(params))
|
|
const addGroup = useAjax((params) => addGroupApi(params))
|
|
const editGroup = useAjax((params) => editGroupApi(params))
|
|
const editGroup = useAjax((params) => editGroupApi(params))
|
|
@@ -29,10 +29,10 @@ const GroupLeft: React.FC<Props> = (props) => {
|
|
/*************************/
|
|
/*************************/
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- if (props?.groupId) {
|
|
|
|
- setGroupId(props?.groupId || 0)
|
|
|
|
|
|
+ if (value) {
|
|
|
|
+ setGroupId(value || 0)
|
|
}
|
|
}
|
|
- }, [props.groupId])
|
|
|
|
|
|
+ }, [value])
|
|
|
|
|
|
/** 点击新增处理聚焦 */
|
|
/** 点击新增处理聚焦 */
|
|
useEffect(() => {
|
|
useEffect(() => {
|