From 95f7d94911cde215ecfaa07b8705f5768ab867d8 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 18 Aug 2026 14:43:50 +0800 Subject: [PATCH] =?UTF-8?q?/basicInfo/corpInfo/basicList=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8E=BB=E6=8E=89enterpriseType=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0menuId=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AccountManage/List/index.js | 9 ++++++-- .../BranchCompany/AccountManage/List/index.js | 14 ++++++------- .../EnterpriseInfo/List/index.js | 10 +++++++-- .../AccountManage/List/index.js | 9 ++++++-- src/utils/index.js | 21 ++++++++++++------- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js index e16cb3e..f20aede 100644 --- a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js +++ b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js @@ -14,19 +14,21 @@ import useTable from "zy-react-library/hooks/useTable"; import { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular"; import { getLabelName } from "zy-react-library/utils"; import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; -import { getTenantTypeConfigList, useDebounce } from "~/utils"; +import { getMenuIdByPath, getTenantTypeConfigList, useDebounce } from "~/utils"; function List(props) { const [form] = Form.useForm(); const [cityData, setCityData] = useState([]); const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); + const [menuId, setMenuId] = useState(); const { tableProps, getData } = useTable(props["corpInfoList"], { form, + ready: menuId !== undefined, + params: () => ({ menuid: menuId }), transform: (formData) => { return { ...formData, - enterpriseType: 3, geCreateTime: formData.CreateTime?.[0], leCreateTime: formData.CreateTime?.[1], // eqProvince: formData.cityRecord?.[0], @@ -40,6 +42,9 @@ function List(props) { }); const [addModalOpen, setAddModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); + useEffect(() => { + getMenuIdByPath().then(setMenuId); + }, []); useEffect(() => { getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); }, []); diff --git a/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js b/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js index 7b0e681..2c4bda3 100644 --- a/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js +++ b/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js @@ -13,7 +13,7 @@ import useTable from "zy-react-library/hooks/useTable"; import { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular"; import { getLabelName } from "zy-react-library/utils"; import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; -import { getTenantTypeConfigList, useDebounce } from "~/utils"; +import { getMenuIdByPath, getTenantTypeConfigList, useDebounce } from "~/utils"; const USER_FLAG = [ { @@ -50,18 +50,18 @@ const ENTERPRISE_STATUS = [ function List(props) { const [form] = Form.useForm(); + const [menuId, setMenuId] = useState(); const { tableProps, getData } = useTable(props["corpInfoList"], { form, - transform: (formData) => { - return { - ...formData, - enterpriseType: 2, - }; - }, + ready: menuId !== undefined, + params: () => ({ menuid: menuId }), }); const [addModalOpen, setAddModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); const [openType, setOpenType] = useState(""); + useEffect(() => { + getMenuIdByPath().then(setMenuId); + }, []); const onResetPassword = (id) => { Modal.confirm({ title: "提示", diff --git a/src/pages/Container/Supervision/BranchCompany/EnterpriseInfo/List/index.js b/src/pages/Container/Supervision/BranchCompany/EnterpriseInfo/List/index.js index 3191378..31909d2 100644 --- a/src/pages/Container/Supervision/BranchCompany/EnterpriseInfo/List/index.js +++ b/src/pages/Container/Supervision/BranchCompany/EnterpriseInfo/List/index.js @@ -1,7 +1,7 @@ import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form, message, Space } from "antd"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import MapSelector from "zy-react-library/components/Map/MapSelector"; import Page from "zy-react-library/components/Page"; @@ -10,6 +10,7 @@ import Table from "zy-react-library/components/Table"; import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import useTable from "zy-react-library/hooks/useTable"; import { NS_ENTERPRISE } from "~/enumerate/namespace"; +import { getMenuIdByPath } from "~/utils"; const ENTERPRISE_STATUS = [ { @@ -45,17 +46,22 @@ const STATUS = [ ]; function List(props) { const [form] = Form.useForm(); + const [menuId, setMenuId] = useState(); const { tableProps, getData } = useTable(props["corpInfoList"], { form, + ready: menuId !== undefined, + params: () => ({ menuid: menuId }), transform: (formData) => { return { ...formData, - enterpriseType: 2, geCreateDate: formData.eqCreateDate?.[0], leCreateDate: formData.eqCreateDate?.[1], }; }, }); + useEffect(() => { + getMenuIdByPath().then(setMenuId); + }, []); const [visible, setVisible] = useState(false); const [selectedLng, setSelectedLng] = useState(""); const [selectedLat, setSelectedLat] = useState(""); diff --git a/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js b/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js index 729d5af..80c9d69 100644 --- a/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js +++ b/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js @@ -13,18 +13,20 @@ import useTable from "zy-react-library/hooks/useTable"; import { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular"; import { getLabelName } from "zy-react-library/utils"; import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; -import { getTenantTypeConfigList, useDebounce } from "~/utils"; +import { getMenuIdByPath, getTenantTypeConfigList, useDebounce } from "~/utils"; function List(props) { const [form] = Form.useForm(); const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); + const [menuId, setMenuId] = useState(); // const [cityData, setCityData] = useState([]); const { tableProps, getData } = useTable(props["corpInfoList"], { form, + ready: menuId !== undefined, + params: () => ({ menuid: menuId }), transform: (formData) => { return { ...formData, - enterpriseType: 3, geCreateTime: formData.CreateTime?.[0], leCreateTime: formData.CreateTime?.[1], // eqProvince: formData.cityRecord?.[0], @@ -38,6 +40,9 @@ function List(props) { }); const [addModalOpen, setAddModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); + useEffect(() => { + getMenuIdByPath().then(setMenuId); + }, []); useEffect(() => { getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); }, []); diff --git a/src/utils/index.js b/src/utils/index.js index c9c3b3a..f6ec3cb 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -207,18 +207,25 @@ export function useDebounce(value, delay = 500) { return debouncedValue; } +/** + * 根据页面路由获取底座菜单编码。 + * 非底座环境或没有匹配菜单时返回空字符串。 + */ +export async function getMenuIdByPath(menuPath = window.location.pathname) { + if (!window.__IN_BASE__) { + return ""; + } + + const menuInfo = await window.base.call.getMenuInfoByPath({ path: menuPath }); + return menuInfo?.[0]?.menuCode || ""; +} + /** * 根据菜单路由获取当前租户配置的企业类型列表。 * 子页面需要传入实际菜单入口路由,避免使用非菜单路由查询不到 menuId。 */ export async function getTenantTypeConfigList({ request, menuPath = window.location.pathname }) { - let menuId = ""; - - if (window.__IN_BASE__) { - const menuInfo = await window.base.call.getMenuInfoByPath({ path: menuPath }); - menuId = menuInfo?.[0]?.menuCode || ""; - } - + const menuId = await getMenuIdByPath(menuPath); const res = await request({ menuId, pageIndex: 1, pageSize: 9999 }); return Array.isArray(res?.data) ? res.data : []; }