准入部门 接口联调
This commit is contained in:
@ -7,6 +7,7 @@ export interface AccessDepartmentSelectProps {
|
||||
onChange?: (value: string | number) => void;
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
orgCategory?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
@ -18,6 +19,7 @@ interface OrgNode {
|
||||
isLeaf?: boolean;
|
||||
key?: string;
|
||||
title?: string;
|
||||
orgCategory?: string;
|
||||
}
|
||||
|
||||
const AccessDepartmentSelect: React.FC<AccessDepartmentSelectProps> = ({
|
||||
@ -26,6 +28,7 @@ const AccessDepartmentSelect: React.FC<AccessDepartmentSelectProps> = ({
|
||||
placeholder = '请选择准入部门',
|
||||
disabled = false,
|
||||
style = { width: 200 },
|
||||
orgCategory = 'Org'
|
||||
}) => {
|
||||
const [tree, setTree] = useState<OrgNode[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@ -37,6 +40,7 @@ const AccessDepartmentSelect: React.FC<AccessDepartmentSelectProps> = ({
|
||||
title: item.orgName,
|
||||
value: item.orgId,
|
||||
key: item.orgId,
|
||||
disabled: orgCategory === '' && item.orgCategory === 'Org',
|
||||
// isLeaf: item.isLeaf || false,
|
||||
// children: item.children && item.children.length > 0 ? formatTree(item.children) : undefined,
|
||||
}));
|
||||
@ -46,7 +50,12 @@ const AccessDepartmentSelect: React.FC<AccessDepartmentSelectProps> = ({
|
||||
const onLoadData = async (treeNode: any) => {
|
||||
if (treeNode.children && treeNode.children.length > 0) return;
|
||||
setLoading(true);
|
||||
const { code, data } = await treeData({ upOrgId: treeNode.value });
|
||||
const params: any = { upOrgId: treeNode.value };
|
||||
if(orgCategory) {
|
||||
params.orgCategory = orgCategory
|
||||
}
|
||||
|
||||
const { code, data } = await treeData(params);
|
||||
if (code === 200 && Array.isArray(data)) {
|
||||
setTree(origin => updateNode(origin, treeNode.value, formatTree(data)));
|
||||
}
|
||||
@ -65,7 +74,13 @@ const AccessDepartmentSelect: React.FC<AccessDepartmentSelectProps> = ({
|
||||
// 初始化
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
treeData({}).then(res => {
|
||||
const orgIdStr = sessionStorage.getItem('Userinfo');
|
||||
const currentUser = orgIdStr ? JSON.parse(orgIdStr) : null;
|
||||
const params: any = { orgId: currentUser.organizationId };
|
||||
if(orgCategory) {
|
||||
params.orgCategory = orgCategory
|
||||
}
|
||||
treeData(params).then(res => {
|
||||
if (res.code === 200 && Array.isArray(res.data)) {
|
||||
setTree(formatTree(res.data));
|
||||
}
|
||||
|
@ -1,23 +1,28 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
|
||||
/**
|
||||
* 获取全部组织树形结构
|
||||
*/
|
||||
interface treeInterface {
|
||||
upOrgId?: string;
|
||||
orgId?: string;
|
||||
orgCategory?: string; //Org
|
||||
}
|
||||
export const treeData = (params: treeInterface) => request.get('/org/list', { params });
|
||||
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
export const queryUserOrgAll = () => request.get(`/org/queryUserOrgAll`);
|
||||
|
||||
|
||||
/**
|
||||
* 部门列表
|
||||
*
|
||||
* 获取当前登录人所属单位以及下级单位
|
||||
*/
|
||||
interface treeInterface {
|
||||
upOrgId?: string
|
||||
}
|
||||
export const treeData = (params: treeInterface) => request.get('/org/list', { params });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const queryOrgWithChildren = (params: treeInterface) => request.get('/org/queryOrgWithChildren', { params });
|
||||
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ const LoginPage: React.FC = () => {
|
||||
return item.roleId
|
||||
})
|
||||
console.log(roleIdList, 'roleIdList');
|
||||
|
||||
sessionStorage.setItem('Userinfo', JSON.stringify(res));
|
||||
// const menuList = await findMenuList({ roleIdList });
|
||||
// sessionStorage.setItem('menuList', JSON.stringify(menuList.data));
|
||||
// }
|
||||
|
@ -197,7 +197,7 @@ form.setFieldsValue({ accessWorkName: autoTitle });
|
||||
name="deptId"
|
||||
rules={[{ required: true, message: '请选择准入部门' }]}
|
||||
>
|
||||
<AccessDepartmentSelect />
|
||||
<AccessDepartmentSelect style={{width: '100%'}} orgCategory='' />
|
||||
</Form.Item>
|
||||
|
||||
|
||||
|
@ -216,7 +216,7 @@ const SupplierEntryReview: React.FC = () => {
|
||||
<AdmissionTypeSelect/>
|
||||
</Form.Item>
|
||||
<Form.Item name="deptId" label="准入部门">
|
||||
<AccessDepartmentSelect />
|
||||
<AccessDepartmentSelect orgCategory='' />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="approveStatus" label="审批状态">
|
||||
|
@ -273,7 +273,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
|
||||
name="deptId"
|
||||
rules={[{ required: true, message: '请选择准入部门' }]}
|
||||
>
|
||||
<AccessDepartmentSelect style={{width: '100%'}} />
|
||||
<AccessDepartmentSelect style={{width: '100%'}} orgCategory='' />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
@ -1,10 +1,10 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Modal, Form, Input, DatePicker, Button, Tree, Select, message, Spin, Upload } from 'antd';
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import { categoryTree, uploadFile, superiorLockList, getSupplierPage, library, libraryData } from '../services';
|
||||
import { categoryTree, uploadFile, library, libraryData } from '../services';
|
||||
import type { UploadFile } from 'antd/es/upload/interface';
|
||||
import AccessDepartmentSelect from '@/components/AccessDepartmentSelect';
|
||||
import { getregionInternational, getAllAreaList } from '@/servers/api/register';
|
||||
import { getAllAreaList } from '@/servers/api/register';
|
||||
const { Option } = Select;
|
||||
|
||||
const approveTypeOptions = [
|
||||
|
Reference in New Issue
Block a user