diff --git a/src/components/AccessDepartmentSelect/index.tsx b/src/components/AccessDepartmentSelect/index.tsx index e8bbc15..49276dc 100644 --- a/src/components/AccessDepartmentSelect/index.tsx +++ b/src/components/AccessDepartmentSelect/index.tsx @@ -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 = ({ @@ -26,6 +28,7 @@ const AccessDepartmentSelect: React.FC = ({ placeholder = '请选择准入部门', disabled = false, style = { width: 200 }, + orgCategory = 'Org' }) => { const [tree, setTree] = useState([]); const [loading, setLoading] = useState(false); @@ -37,6 +40,7 @@ const AccessDepartmentSelect: React.FC = ({ 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 = ({ 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 = ({ // 初始化 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)); } diff --git a/src/components/AccessDepartmentSelect/services.ts b/src/components/AccessDepartmentSelect/services.ts index c7c7c07..b2a44e4 100644 --- a/src/components/AccessDepartmentSelect/services.ts +++ b/src/components/AccessDepartmentSelect/services.ts @@ -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 }); diff --git a/src/pages/login/login.tsx b/src/pages/login/login.tsx index 4e69680..70bba38 100644 --- a/src/pages/login/login.tsx +++ b/src/pages/login/login.tsx @@ -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)); // } diff --git a/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx b/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx index 9a3a4d8..c99143b 100644 --- a/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx +++ b/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx @@ -197,7 +197,7 @@ form.setFieldsValue({ accessWorkName: autoTitle }); name="deptId" rules={[{ required: true, message: '请选择准入部门' }]} > - + diff --git a/src/pages/supplier/admission/SupplierEntryReview/index.tsx b/src/pages/supplier/admission/SupplierEntryReview/index.tsx index 34794ed..f557562 100644 --- a/src/pages/supplier/admission/SupplierEntryReview/index.tsx +++ b/src/pages/supplier/admission/SupplierEntryReview/index.tsx @@ -216,7 +216,7 @@ const SupplierEntryReview: React.FC = () => { - + diff --git a/src/pages/supplier/admission/admissionManagement/components/CreateModal.tsx b/src/pages/supplier/admission/admissionManagement/components/CreateModal.tsx index 012aa3a..3ca1af1 100644 --- a/src/pages/supplier/admission/admissionManagement/components/CreateModal.tsx +++ b/src/pages/supplier/admission/admissionManagement/components/CreateModal.tsx @@ -273,7 +273,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi name="deptId" rules={[{ required: true, message: '请选择准入部门' }]} > - +