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