From 9f7d12169367fd15a36e35675e2b3f57026ecae7 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 18 Aug 2026 10:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=80=E6=9C=89=E4=BD=BF=E7=94=A8=20ENTERPRI?= =?UTF-8?q?SE=5FTYPE=20=E7=9A=84=E5=9C=B0=E6=96=B9=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=94=B9=E6=88=90=E8=AF=B7=E6=B1=82=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/enterprise/index.js | 5 -- src/api/global/index.js | 6 ++- .../ChangeList/index.js | 30 +++++------ .../AccountManage/List/index.js | 36 ++++++------- .../AccountManage/View/index.js | 31 +++++------- .../StakeholderUnit/User/List/index.js | 30 ++++++----- .../BranchCompany/AccountManage/List/index.js | 35 ++----------- .../BranchCompany/AccountManage/View/index.js | 46 +++++------------ .../DepartmentManage/List/index.js | 14 ------ .../ChangeList/index.js | 30 +++++------ .../EnterpriseMiddleground/List/index.js | 31 +++++------- .../AccountManage/List/index.js | 50 ++++++------------- .../AccountManage/View/index.js | 30 +++++------ .../StakeholderUnit/User/List/index.js | 30 ++++++----- src/utils/index.js | 20 +++++++- 15 files changed, 171 insertions(+), 253 deletions(-) diff --git a/src/api/enterprise/index.js b/src/api/enterprise/index.js index 14a92c8..c2c64bb 100644 --- a/src/api/enterprise/index.js +++ b/src/api/enterprise/index.js @@ -58,11 +58,6 @@ export const corpDepartlist = declareRequest( "departmentLoading", "Post > @/basicInfo/corpInfo/corpDepartlist", ); -export const tenantTypeConfigList = declareRequest( - "departmentLoading", - "Post > @/appmenu/tenantTypeConfig/list", -); - // 根据登录人密码查手机号 export const getEncryInfo = declareRequest( "departmentLoading", diff --git a/src/api/global/index.js b/src/api/global/index.js index ba35796..55e0352 100644 --- a/src/api/global/index.js +++ b/src/api/global/index.js @@ -1,4 +1,8 @@ -export {}; +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const tenantTypeConfigList = declareRequest( + "Post > @/appmenu/tenantTypeConfig/list", +); // export const riskList = declareRequest( // "loading", diff --git a/src/pages/Container/Enterprise/EnterpriseMiddleground/ChangeList/index.js b/src/pages/Container/Enterprise/EnterpriseMiddleground/ChangeList/index.js index 5365893..c336085 100644 --- a/src/pages/Container/Enterprise/EnterpriseMiddleground/ChangeList/index.js +++ b/src/pages/Container/Enterprise/EnterpriseMiddleground/ChangeList/index.js @@ -1,6 +1,7 @@ import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form, Space } from "antd"; +import { useEffect, useState } from "react"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; import Table from "zy-react-library/components/Table"; @@ -8,24 +9,12 @@ import Table from "zy-react-library/components/Table"; import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useTable from "zy-react-library/hooks/useTable"; -import { NS_USER } from "~/enumerate/namespace"; +import { NS_GLOBAL, NS_USER } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 0, - name: "普通企业", - }, - { - bianma: 1, - name: "集团单位", - }, - { - bianma: 6, - name: "物资中心", - }, -]; function ChangeList(props) { const [form] = Form.useForm(); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const queryParams = useGetUrlQuery(); const { tableProps, getData } = useTable(props["userEmploymentLogAll"], { form, @@ -37,6 +26,12 @@ function ChangeList(props) { }; }, }); + useEffect(() => { + getTenantTypeConfigList({ + request: props.tenantTypeConfigList, + menuPath: "/basicInfo/container/enterprise/enterpriseMiddleground/list", + }).then(setTenantTypeConfigList); + }, []); return (
@@ -52,7 +47,8 @@ function ChangeList(props) { name: "eqtype", label: "企业类型", render: FORM_ITEM_RENDER_ENUM.SELECT, - items: ENTERPRISE_TYPE, + items: tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, }, ]} onFinish={getData} @@ -113,4 +109,4 @@ function ChangeList(props) {
); } -export default Connect([NS_USER], true)(Permission(ChangeList)); +export default Connect([NS_USER, NS_GLOBAL], true)(Permission(ChangeList)); diff --git a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js index be420f9..e16cb3e 100644 --- a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js +++ b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js @@ -7,34 +7,20 @@ import AddIcon from "zy-react-library/components/Icon/AddIcon"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; -import DictionarySelect from "zy-react-library/components/Select/Dictionary"; // import AreaSelect from "zy-react-library/components/SelectTree/Area"; 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 { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular"; import { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; -import { useDebounce } from "~/utils"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList, useDebounce } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 3, - name: "普通企业", - }, - { - bianma: 4, - name: "货主单位", - }, - { - bianma: 5, - name: "驻港单位", - }, -]; function List(props) { const [form] = Form.useForm(); const [cityData, setCityData] = useState([]); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const { tableProps, getData } = useTable(props["corpInfoList"], { form, transform: (formData) => { @@ -54,6 +40,9 @@ function List(props) { }); const [addModalOpen, setAddModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); + useEffect(() => { + getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); + }, []); const onResetPassword = (id) => { Modal.confirm({ title: "提示", @@ -134,7 +123,8 @@ function List(props) { name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, - items: ENTERPRISE_TYPE, + items: tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, }, // { // name: "cityRecord", @@ -204,7 +194,9 @@ function List(props) { render: (_, record) => ( getLabelName({ status: record.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", }) ), @@ -289,6 +281,7 @@ function List(props) { requestChangeCompanyName={props["corpInfoChangeCompanyName"]} requestCorplnfoCheckCorpcode={props["corplnfoCheckCorpcode"]} requestCorplnfoCheckCorpName={props["corplnfoCheckCorpName"]} + tenantTypeConfigList={tenantTypeConfigList} loading={props.enterprise.enterpriseLoading} onCancel={() => { setAddModalOpen(false); @@ -476,7 +469,8 @@ function AddModalComponent(props) { name: "type", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, - items: ENTERPRISE_TYPE, + items: props.tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, componentProps: { disabled: props.currentId, }, @@ -509,4 +503,4 @@ function AddModalComponent(props) { ); } const AddModal = AddModalComponent; -export default Connect([NS_ENTERPRISE], true)(Permission(List)); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List)); diff --git a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/View/index.js b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/View/index.js index e19ef10..a0e16d0 100644 --- a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/View/index.js +++ b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/View/index.js @@ -9,24 +9,12 @@ import useGetFile from "zy-react-library/hooks/useGetFile"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 3, - name: "普通企业", - }, - { - bianma: 4, - name: "货主单位", - }, - { - bianma: 5, - name: "驻港单位", - }, -]; function View(props) { const [info, setInfo] = useState({}); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const [form] = Form.useForm(); const { loading: getFileLoading, getFile } = useGetFile(); const [corpInfoQrCodeOpen, setCorpInfoQrCodeOpen] = useState(false); @@ -61,6 +49,12 @@ function View(props) { }; fetchData(); }, []); + useEffect(() => { + getTenantTypeConfigList({ + request: props.tenantTypeConfigList, + menuPath: "/basicInfo/container/enterprise/stakeholderUnit/accountManage/list", + }).then(setTenantTypeConfigList); + }, []); const handleOk = async () => { const values = await form.validateFields(); @@ -217,12 +211,13 @@ function View(props) { // children: info.totalAssets, // }, - { label: "相关方类型", children: getLabelName({ status: info.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", }), }, { @@ -361,4 +356,4 @@ const CorpInfoQrCode = (props) => { ); }; -export default Connect([NS_ENTERPRISE], true)(View); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(View); diff --git a/src/pages/Container/Enterprise/StakeholderUnit/User/List/index.js b/src/pages/Container/Enterprise/StakeholderUnit/User/List/index.js index 226c2e7..4e8855d 100644 --- a/src/pages/Container/Enterprise/StakeholderUnit/User/List/index.js +++ b/src/pages/Container/Enterprise/StakeholderUnit/User/List/index.js @@ -2,24 +2,18 @@ import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form, Space } from "antd"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; -import AreaSelect from "zy-react-library/components/SelectTree/Area"; 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 { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; -import { getAreaNamePath } from "~/utils"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; // import { getLabelName } from "zy-react-library/utils"; -const ENTERPRISE_TYPE = [ - { bianma: 3, name: "普通企业" }, - { bianma: 4, name: "货主单位" }, - { bianma: 5, name: "驻港单位" }, -]; // const ENTERPRISE_STATUS = [ // { bianma: "filialstate01", name: "在产" }, // { bianma: "filialstate02", name: "在建" }, @@ -31,6 +25,7 @@ const ENTERPRISE_TYPE = [ function List(props) { const [form] = Form.useForm(); const [cityData, setCityData] = useState([]); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const { tableProps, getData } = useTable(props["corpUserMiddlePage"], { form, transform: (formData) => { @@ -45,6 +40,9 @@ function List(props) { }; }, }); + useEffect(() => { + getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); + }, []); // const onFinish = async () => { // // 处理属地查询 // const arr = []; @@ -82,7 +80,13 @@ function List(props) { // /> // ), // }, - { name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE }, + { + name: "eqType", + label: "相关方类型", + render: FORM_ITEM_RENDER_ENUM.SELECT, + items: tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, + }, // { // name: "cityRecord", // label: "属地", @@ -104,7 +108,9 @@ function List(props) { render: (_, record) => ( getLabelName({ status: record.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", }) ), width: 120, @@ -167,4 +173,4 @@ function List(props) { ); } -export default Connect([NS_ENTERPRISE], true)(Permission(List)); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List)); diff --git a/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js b/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js index 667b09f..7b0e681 100644 --- a/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js +++ b/src/pages/Container/Supervision/BranchCompany/AccountManage/List/index.js @@ -12,8 +12,8 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; 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 } from "~/enumerate/namespace"; -import { useDebounce } from "~/utils"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList, useDebounce } from "~/utils"; const USER_FLAG = [ { @@ -25,21 +25,6 @@ const USER_FLAG = [ name: "停用", }, ]; -const ENTERPRISE_TYPE = [ - { - bianma: 0, - name: "普通企业", - }, - { - bianma: 1, - name: "集团单位", - }, - { - bianma: 6, - name: "物资中心", - }, - -]; const ENTERPRISE_STATUS = [ { bianma: "filialstate01", @@ -347,7 +332,7 @@ function List(props) { requestChangeCompanyName={props["corpInfoChangeCompanyName"]} requestCorplnfoCheckCorpcode={props["corplnfoCheckCorpcode"]} requestCorplnfoCheckCorpName={props["corplnfoCheckCorpName"]} - tenantTypeConfigList={props["tenantTypeConfigList"]} + requestTenantTypeConfigList={props["tenantTypeConfigList"]} onCancel={() => { setAddModalOpen(false); setCurrentId(""); @@ -365,18 +350,8 @@ function AddModalComponent(props) { const debouncedCode = useDebounce(codeValue, 600); const debouncedCorpName = useDebounce(corpNameValue, 600); - const getTenantTypeConfigList = async () => { - let menuId = ""; - if (window.__IN_BASE__) { - const res = await window.base.call.getMenuInfoByPath({ path: window.location.pathname }); - menuId = res?.[0].menuCode; - } - const { data } = await props.tenantTypeConfigList({ menuId, pageIndex: 1, pageSize: 9999 }); - setTenantTypeConfigList(data); - }; - useEffect(() => { - getTenantTypeConfigList(); + getTenantTypeConfigList({ request: props.requestTenantTypeConfigList }).then(setTenantTypeConfigList); }, []); useEffect(() => { if (props.currentId) { @@ -585,4 +560,4 @@ function AddModalComponent(props) { ); } const AddModal = AddModalComponent; -export default Connect([NS_ENTERPRISE], true)(Permission(List)); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List)); diff --git a/src/pages/Container/Supervision/BranchCompany/AccountManage/View/index.js b/src/pages/Container/Supervision/BranchCompany/AccountManage/View/index.js index 2a91870..3523369 100644 --- a/src/pages/Container/Supervision/BranchCompany/AccountManage/View/index.js +++ b/src/pages/Container/Supervision/BranchCompany/AccountManage/View/index.js @@ -5,41 +5,13 @@ import Page from "zy-react-library/components/Page"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 0, - name: "普通企业", - }, - { - bianma: 1, - name: "集团单位", - }, - { - bianma: 2, - name: "股份单位", - }, - { - bianma: 3, - name: "普通企业", - }, - { - bianma: 4, - name: "货主单位", - }, - { - bianma: 5, - name: "驻港单位", - }, - { - bianma: 6, - name: "物资中心", - }, -]; function View(props) { const queryParams = useGetUrlQuery(); const [info, setInfo] = useState({}); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); useEffect(() => { const fetchData = async () => { const res = await props.corpInfoDetails({ @@ -50,6 +22,12 @@ function View(props) { }; fetchData(); }, []); + useEffect(() => { + getTenantTypeConfigList({ + request: props.tenantTypeConfigList, + menuPath: "/basicInfo/container/supervision/branchCompany/accountManage/list", + }).then(setTenantTypeConfigList); + }, []); return (
{getLabelName({ status: info.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", })}
), @@ -102,4 +82,4 @@ function View(props) { ); } -export default Connect([NS_ENTERPRISE], true)(View); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(View); diff --git a/src/pages/Container/Supervision/BranchCompany/DepartmentManage/List/index.js b/src/pages/Container/Supervision/BranchCompany/DepartmentManage/List/index.js index 168601a..22ec625 100644 --- a/src/pages/Container/Supervision/BranchCompany/DepartmentManage/List/index.js +++ b/src/pages/Container/Supervision/BranchCompany/DepartmentManage/List/index.js @@ -9,20 +9,6 @@ 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"; -const ENTERPRISE_TYPE = [ - { - bianma: 0, - name: "普通企业", - }, - { - bianma: 1, - name: "集团单位", - }, - { - bianma: 6, - name: "物资中心", - }, -]; const BRANCH_CONPANY_STATUS = [ { bianma: "filialstate01", diff --git a/src/pages/Container/Supervision/EnterpriseMiddleground/ChangeList/index.js b/src/pages/Container/Supervision/EnterpriseMiddleground/ChangeList/index.js index 7c43f53..5846aab 100644 --- a/src/pages/Container/Supervision/EnterpriseMiddleground/ChangeList/index.js +++ b/src/pages/Container/Supervision/EnterpriseMiddleground/ChangeList/index.js @@ -1,5 +1,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form, Space } from "antd"; +import { useEffect, useState } from "react"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; @@ -7,24 +8,12 @@ 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_USER } from "~/enumerate/namespace"; +import { NS_GLOBAL, NS_USER } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 0, - name: "普通企业", - }, - { - bianma: 1, - name: "集团单位", - }, - { - bianma: 6, - name: "物资中心", - }, -]; function List(props) { const [form] = Form.useForm(); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const { tableProps, getData } = useTable(props["userEmploymentLogAll"], { form, usePermission: false, @@ -35,6 +24,12 @@ function List(props) { }; }, }); + useEffect(() => { + getTenantTypeConfigList({ + request: props.tenantTypeConfigList, + menuPath: "/basicInfo/container/supervision/enterpriseMiddleground/list", + }).then(setTenantTypeConfigList); + }, []); return (
); } -export default Connect([NS_USER], true)(List); +export default Connect([NS_USER, NS_GLOBAL], true)(List); diff --git a/src/pages/Container/Supervision/EnterpriseMiddleground/List/index.js b/src/pages/Container/Supervision/EnterpriseMiddleground/List/index.js index 7860174..0e6af5a 100644 --- a/src/pages/Container/Supervision/EnterpriseMiddleground/List/index.js +++ b/src/pages/Container/Supervision/EnterpriseMiddleground/List/index.js @@ -1,6 +1,7 @@ import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form, Space } from "antd"; +import { useEffect, useState } from "react"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; import Table from "zy-react-library/components/Table"; @@ -8,24 +9,12 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import useTable from "zy-react-library/hooks/useTable"; import { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 0, - name: "普通企业", - }, - { - bianma: 1, - name: "集团单位", - }, - { - bianma: 6, - name: "物资中心", - }, -]; function List(props) { const [form] = Form.useForm(); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const { tableProps, getData } = useTable(props["corpUserMiddlePage"], { form, transform: (formData) => { @@ -35,6 +24,9 @@ function List(props) { }; }, }); + useEffect(() => { + getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); + }, []); return ( @@ -49,7 +41,8 @@ function List(props) { name: "eqType", label: "企业类型", render: FORM_ITEM_RENDER_ENUM.SELECT, - items: ENTERPRISE_TYPE, + items: tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, }, ]} onFinish={getData} @@ -67,7 +60,9 @@ function List(props) {
{getLabelName({ status: record.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", })}
), @@ -115,4 +110,4 @@ function List(props) {
); } -export default Connect([NS_ENTERPRISE], true)(Permission(List)); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List)); diff --git a/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js b/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js index 67909fb..729d5af 100644 --- a/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js +++ b/src/pages/Container/Supervision/StakeholderUnit/AccountManage/List/index.js @@ -12,25 +12,12 @@ 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 } from "~/enumerate/namespace"; -import { useDebounce } from "~/utils"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList, useDebounce } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 3, - name: "普通企业", - }, - { - bianma: 4, - name: "货主单位", - }, - { - bianma: 5, - name: "驻港单位", - }, -]; function List(props) { const [form] = Form.useForm(); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); // const [cityData, setCityData] = useState([]); const { tableProps, getData } = useTable(props["corpInfoList"], { form, @@ -51,6 +38,9 @@ function List(props) { }); const [addModalOpen, setAddModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); + useEffect(() => { + getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); + }, []); const onResetPassword = (id) => { Modal.confirm({ title: "提示", @@ -141,7 +131,8 @@ function List(props) { name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, - items: ENTERPRISE_TYPE, + items: tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, }, // { // name: "cityRecord", @@ -212,7 +203,9 @@ function List(props) { render: (_, record) => ( getLabelName({ status: record.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", }) ), @@ -299,7 +292,7 @@ function List(props) { requestChangeCompanyName={props["corpInfoChangeCompanyName"]} requestCorplnfoCheckCorpcode={props["corplnfoCheckCorpcode"]} requestCorplnfoCheckCorpName={props["corplnfoCheckCorpName"]} - tenantTypeConfigList={props["tenantTypeConfigList"]} + tenantTypeConfigList={tenantTypeConfigList} loding={props.enterprise.userLoading} onCancel={() => { setAddModalOpen(false); @@ -314,24 +307,9 @@ function AddModalComponent(props) { const [form] = Form.useForm(); const [codeValue, setCodeValue] = useState(""); const [corpNameValue, setCorpNameValue] = useState(""); - const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const debouncedCode = useDebounce(codeValue, 600); const debouncedCorpName = useDebounce(corpNameValue, 600); // const [selectfromData, setSelectfromData] = useState([]); - - const getTenantTypeConfigList = async () => { - let menuId = ""; - if (window.__IN_BASE__) { - const res = await window.base.call.getMenuInfoByPath({ path: window.location.pathname }); - menuId = res?.[0].menuCode; - } - const { data } = await props.tenantTypeConfigList({ menuId, pageIndex: 1, pageSize: 9999 }); - setTenantTypeConfigList(data); - }; - - useEffect(() => { - getTenantTypeConfigList(); - }, []); useEffect(() => { if (props.currentId) { props @@ -496,7 +474,7 @@ function AddModalComponent(props) { name: "type", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, - items: tenantTypeConfigList, + items: props.tenantTypeConfigList, itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, componentProps: { disabled: props.currentId, @@ -531,4 +509,4 @@ function AddModalComponent(props) { ); } const AddModal = AddModalComponent; -export default Connect([NS_ENTERPRISE], true)(Permission(List)); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List)); diff --git a/src/pages/Container/Supervision/StakeholderUnit/AccountManage/View/index.js b/src/pages/Container/Supervision/StakeholderUnit/AccountManage/View/index.js index 20c4ca1..e6fc99d 100644 --- a/src/pages/Container/Supervision/StakeholderUnit/AccountManage/View/index.js +++ b/src/pages/Container/Supervision/StakeholderUnit/AccountManage/View/index.js @@ -9,25 +9,13 @@ import useGetFile from "zy-react-library/hooks/useGetFile"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; // import { getAreaNamePath, getCorpTypeNamePath } from "~/utils"; -const ENTERPRISE_TYPE = [ - { - bianma: 3, - name: "普通企业", - }, - { - bianma: 4, - name: "货主单位", - }, - { - bianma: 5, - name: "驻港单位", - }, -]; function View(props) { const [info, setInfo] = useState({}); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); const [form] = Form.useForm(); const { loading: getFileLoading, getFile } = useGetFile(); const [corpInfoQrCodeOpen, setCorpInfoQrCodeOpen] = useState(false); @@ -62,6 +50,12 @@ function View(props) { }; fetchData(); }, []); + useEffect(() => { + getTenantTypeConfigList({ + request: props.tenantTypeConfigList, + menuPath: "/basicInfo/container/supervision/stakeholderUnit/accountManage/list", + }).then(setTenantTypeConfigList); + }, []); const handleOk = async () => { const values = await form.validateFields(); @@ -222,7 +216,9 @@ function View(props) { label: "相关方类型", children: getLabelName({ status: info.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", }), }, { @@ -365,4 +361,4 @@ const CorpInfoQrCode = (props) => { ); }; -export default Connect([NS_ENTERPRISE], true)(View); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(View); diff --git a/src/pages/Container/Supervision/StakeholderUnit/User/List/index.js b/src/pages/Container/Supervision/StakeholderUnit/User/List/index.js index 1c0fd4e..312039b 100644 --- a/src/pages/Container/Supervision/StakeholderUnit/User/List/index.js +++ b/src/pages/Container/Supervision/StakeholderUnit/User/List/index.js @@ -2,24 +2,18 @@ import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form, Space } from "antd"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import Search from "zy-react-library/components/Search"; -import AreaSelect from "zy-react-library/components/SelectTree/Area"; 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 { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE } from "~/enumerate/namespace"; -import { getAreaNamePath } from "~/utils"; +import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { getTenantTypeConfigList } from "~/utils"; // import { getLabelName } from "zy-react-library/utils"; -const ENTERPRISE_TYPE = [ - { bianma: 3, name: "普通企业" }, - { bianma: 4, name: "货主单位" }, - { bianma: 5, name: "驻港单位" }, -]; // const ENTERPRISE_STATUS = [ // { bianma: "filialstate01", name: "在产" }, // { bianma: "filialstate02", name: "在建" }, @@ -30,6 +24,7 @@ const ENTERPRISE_TYPE = [ function List(props) { const [form] = Form.useForm(); + const [tenantTypeConfigList, setTenantTypeConfigList] = useState([]); // const [cityData, setCityData] = useState([]); const { tableProps, getData } = useTable(props["corpUserMiddlePage"], { form, @@ -45,6 +40,9 @@ function List(props) { }; }, }); + useEffect(() => { + getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); + }, []); // const onFinish = async () => { // // 处理属地查询 // const arr = []; @@ -85,7 +83,13 @@ function List(props) { // /> // ), // }, - { name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE }, + { + name: "eqType", + label: "相关方类型", + render: FORM_ITEM_RENDER_ENUM.SELECT, + items: tenantTypeConfigList, + itemsField: { labelKey: "tenantTypeName", valueKey: "code" }, + }, // { // name: "cityRecord", // label: "属地", @@ -107,7 +111,9 @@ function List(props) { render: (_, record) => ( getLabelName({ status: record.type, - list: ENTERPRISE_TYPE, + list: tenantTypeConfigList, + idKey: "code", + nameKey: "tenantTypeName", }) ), width: 120, @@ -169,4 +175,4 @@ function List(props) {
); } -export default Connect([NS_ENTERPRISE], true)(Permission(List)); +export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List)); diff --git a/src/utils/index.js b/src/utils/index.js index 348f4e5..c9c3b3a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -32,7 +32,7 @@ export function isValidChineseIdCardFormat(idCard) { } const value = idCard.trim(); - const pattern = /^[1-9][0-9]{5}(18|19|20)[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])[0-9]{3}[0-9Xx]$/; + const pattern = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9X]$/i; if (!pattern.test(value)) { return false; @@ -57,7 +57,7 @@ export function getChineseIdCardInputErrorMessage(idCard) { const value = idCard.trim(); - if (!/^[0-9Xx]*$/.test(value)) { + if (!/^[0-9X]*$/i.test(value)) { return "身份证号只能输入数字或X"; } @@ -206,6 +206,22 @@ export function useDebounce(value, delay = 500) { }, [value, delay]); return debouncedValue; } + +/** + * 根据菜单路由获取当前租户配置的企业类型列表。 + * 子页面需要传入实际菜单入口路由,避免使用非菜单路由查询不到 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 res = await request({ menuId, pageIndex: 1, pageSize: 9999 }); + return Array.isArray(res?.data) ? res.data : []; +} // 手机号脱敏 export function maskPhone(phone) { if (!phone)