diff --git a/src/pages/register/supplier.tsx b/src/pages/register/supplier.tsx index e135cf5..a7570c7 100644 --- a/src/pages/register/supplier.tsx +++ b/src/pages/register/supplier.tsx @@ -157,7 +157,7 @@ const SupplierRegister: React.FC = (props) => { labelCol={{ span: 7 }} wrapperCol={{ span: 17 }} > - + 境内企业/机构 境外企业 diff --git a/src/pages/supplier/admission/SupplierCategoryEntry/components/SupplierSelector.tsx b/src/pages/supplier/admission/SupplierCategoryEntry/components/SupplierSelector.tsx index 8031353..0fb6b09 100644 --- a/src/pages/supplier/admission/SupplierCategoryEntry/components/SupplierSelector.tsx +++ b/src/pages/supplier/admission/SupplierCategoryEntry/components/SupplierSelector.tsx @@ -79,7 +79,7 @@ const SupplierSelector: React.FC<{ - + diff --git a/src/pages/supplier/admission/admissionManagement/components/SupplierSelector.tsx b/src/pages/supplier/admission/admissionManagement/components/SupplierSelector.tsx index 6e22078..17035e2 100644 --- a/src/pages/supplier/admission/admissionManagement/components/SupplierSelector.tsx +++ b/src/pages/supplier/admission/admissionManagement/components/SupplierSelector.tsx @@ -78,7 +78,7 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel - + diff --git a/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx b/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx index d134df3..d07a829 100644 --- a/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx +++ b/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx @@ -27,10 +27,6 @@ interface Props { onCancel: () => void; onSuccess?: () => void; } -interface DeptOption { - deptId: string; - deptName: string; -} const convertToTreeData = (data: any[] = []): TreeNodeType[] => { return (data || []).map(item => ({ @@ -50,6 +46,21 @@ const updateLockType = (nodes: TreeNodeType[], key: string, val: number) => { }); }; +function hasFuelCategory(checkedKeys: string[], treeData: TreeNodeType[]): boolean { + let found = false; + function dfs(nodes: TreeNodeType[]) { + for (const node of nodes) { + if (checkedKeys.includes(node.key) && node.categoryName.includes('燃油')) { + found = true; + return; + } + if (node.children) dfs(node.children); + } + } + dfs(treeData); + return found; +} + const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => { const [form] = Form.useForm(); @@ -61,8 +72,8 @@ const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => const [expandedKeys, setExpandedKeys] = useState([]); //供应商符合性审查 const [fileList, setFileList] = useState[]>([]); - - const [deptOptions, setDeptOptions] = useState([]); + //品类(燃油)必填区域 + const [areaRequired, setAreaRequired] = useState(false); // 自定义上传 const handleCustomRequest = async (options: any) => { const { file, onSuccess, onError } = options; @@ -92,13 +103,7 @@ const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => const init = async (visible: boolean) => { if (visible) { setLoading(true); - await superiorLockList(); - await getSupplierPage({ basePageRequest: { pageNo: 1, pageSize: 10 } }).then(res => { - if (res.code === 200) { - setDeptOptions(res.data.records); - } - }); - + // await superiorLockList(); await categoryTree() .then(res => { if (res.code === 200 && Array.isArray(res.data)) { @@ -120,8 +125,7 @@ const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => } }) .finally(() => setLoading(false)); - } - // eslint-disable-next-line + } }; // 清空选项 @@ -140,12 +144,14 @@ const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => }, [visible, form]); const handleTreeCheck = (checkedKeysValue: any) => { - const onlyOneEachLevel = checkedKeysValue; - - console.log(onlyOneEachLevel, 'onlyOneEachLevel'); - - setCheckedKeys(onlyOneEachLevel); - form.setFieldsValue({ categoryKeys: onlyOneEachLevel }); + setCheckedKeys(checkedKeysValue); + form.setFieldsValue({ categoryKeys: checkedKeysValue }); + if (hasFuelCategory(checkedKeysValue, treeData)) { + setAreaRequired(true); + form.validateFields(['area']); + } else { + setAreaRequired(false); + } }; // 从树中获取所有选中节点及其父级节点 const collectCheckedWithParents = (nodes: TreeNodeType[], checked: string[]): string[] => { @@ -265,13 +271,14 @@ const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => - {/* { regionOptions.map((item) => { diff --git a/src/pages/supplier/category/CategoryLibraryManage/services.ts b/src/pages/supplier/category/CategoryLibraryManage/services.ts index f9a43b3..386b8d3 100644 --- a/src/pages/supplier/category/CategoryLibraryManage/services.ts +++ b/src/pages/supplier/category/CategoryLibraryManage/services.ts @@ -64,7 +64,7 @@ export const detail = (params: detailData) => request.get(`/cosco/library/detail export const superiorLockList = () => request.get(`/cosco/library/superiorLockList`); /** - * 查询上级部门锁定品类 + * */ interface treeListData { categoryLibraryId: string; diff --git a/src/pages/supplier/category/SupplierEntryReview/components/ViewModal.tsx b/src/pages/supplier/category/SupplierEntryReview/components/ViewModal.tsx index e1e47af..36e7fa3 100644 --- a/src/pages/supplier/category/SupplierEntryReview/components/ViewModal.tsx +++ b/src/pages/supplier/category/SupplierEntryReview/components/ViewModal.tsx @@ -86,7 +86,7 @@ const ViewModal: React.FC<{ { title: '境内/境外', dataIndex: 'supplierCategory', align: 'center', render: (record: any) => { - const supplierCategoryType = record.supplierCategory === 'dvs' ? '境内企业' : '境外企业' + const supplierCategoryType = record.supplierCategory === 'dvs' ? '境内企业' : record.supplierCategory === 'pe' ? '个人':'境外企业' return ( {supplierCategoryType} ) diff --git a/src/pages/supplier/informationManagement/SupplierChangeReviewManage/index.tsx b/src/pages/supplier/informationManagement/SupplierChangeReviewManage/index.tsx index 255bce3..4f707f2 100644 --- a/src/pages/supplier/informationManagement/SupplierChangeReviewManage/index.tsx +++ b/src/pages/supplier/informationManagement/SupplierChangeReviewManage/index.tsx @@ -197,7 +197,7 @@ const SupplierChangeReviewManage: React.FC = ({ dispatch }) => { - + diff --git a/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx b/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx index 48ca154..19eb002 100644 --- a/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx +++ b/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx @@ -231,7 +231,7 @@ const groupQualifiedSupplierQuery: React.FC = ({ dispatch }) => { - + diff --git a/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx b/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx index 5beb376..3358389 100644 --- a/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx +++ b/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx @@ -195,7 +195,7 @@ const mySupplierInquiry: React.FC = ({ dispatch }) => { - + diff --git a/src/pages/supplier/informationRetrieval/registrationQuery/index.tsx b/src/pages/supplier/informationRetrieval/registrationQuery/index.tsx index 349d813..5818480 100644 --- a/src/pages/supplier/informationRetrieval/registrationQuery/index.tsx +++ b/src/pages/supplier/informationRetrieval/registrationQuery/index.tsx @@ -189,7 +189,7 @@ const RegistrationQuery: React.FC = ({ dispatch }) => { - +