From 3293769b9d7c76265a18f08692ed5a9f7ad30114 Mon Sep 17 00:00:00 2001 From: shenzhidan Date: Mon, 2 Mar 2026 14:40:45 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=BC=80=E7=9B=91=E7=AE=A1?= =?UTF-8?q?=E7=AB=AF=E8=B7=B3=E8=BD=AC=E5=AD=90=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BranchCompany/ControlRoom/List/index.js | 21 ++++++++--- .../BranchCompany/PumpRoom/List/index.js | 22 +++++++++--- .../BranchCompany/RescueTeam/List/index.js | 24 ++++++++++--- .../BranchCompany/WaterSource/List/index.js | 21 ++++++++--- .../Filiale/FireResourceStats/index.js | 35 ++++++++++++++++++- .../Supervision/FireResourceStats/index.js | 32 ++++++++++++++++- 6 files changed, 135 insertions(+), 20 deletions(-) diff --git a/src/pages/Container/BranchCompany/ControlRoom/List/index.js b/src/pages/Container/BranchCompany/ControlRoom/List/index.js index 48c9f22..bd4ce38 100644 --- a/src/pages/Container/BranchCompany/ControlRoom/List/index.js +++ b/src/pages/Container/BranchCompany/ControlRoom/List/index.js @@ -9,6 +9,7 @@ import Table from "zy-react-library/components/Table"; import useDictionary from "zy-react-library/hooks/useDictionary"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useTable from "zy-react-library/hooks/useTable"; +import { FIRE_RESOURCE_PERMISSION_QUERY_KEYS, getPermissionKeyFromSearch } from "~/enumerate/constant/fireResourcePermission"; import { NS_CONTROL_ROOM } from "~/enumerate/namespace"; function List(props) { @@ -32,6 +33,18 @@ function List(props) { } }; const isFromSupervision = !!query.eqCorpId; + const searchParams = new URLSearchParams(props.location?.search || ""); + const getPermissionValue = (action, defaultKey) => { + const queryKey = FIRE_RESOURCE_PERMISSION_QUERY_KEYS[action]; + const dynamicPermissionKey = queryKey ? searchParams.get(queryKey) : ""; + + if (isFromSupervision && dynamicPermissionKey) { + return props.permission(dynamicPermissionKey); + } + + return props.permission(getPermissionKeyFromSearch(props.location?.search, action, defaultKey)); + }; + const hasPermission = (action, defaultKey) => getPermissionValue(action, defaultKey); const supervisionBackPath = normalizeBackPath(query.backPath || props.location?.state?.backPath || window.sessionStorage.getItem("supervisionFireResourceStatsBackPath") @@ -167,7 +180,7 @@ function List(props) { ( - {props.permission("xfkzs-add") && ( + {hasPermission("add", "xfkzs-add") && (
( - {props.permission("xfbf-add") && ( + {hasPermission("add", "xfbf-add") && ( )} @@ -166,13 +178,13 @@ function List(props) { align: "center", render: (_, record) => ( - {props.permission("xfbf-info") && ( + {hasPermission("info", "xfbf-info") && ( )} - {props.permission("xfbf-update") && ( + {hasPermission("update", "xfbf-update") && ( )} - {props.permission("xfbf-remove") && ( + {hasPermission("remove", "xfbf-remove") && ( )} diff --git a/src/pages/Container/BranchCompany/RescueTeam/List/index.js b/src/pages/Container/BranchCompany/RescueTeam/List/index.js index 8469807..ec7060c 100644 --- a/src/pages/Container/BranchCompany/RescueTeam/List/index.js +++ b/src/pages/Container/BranchCompany/RescueTeam/List/index.js @@ -8,12 +8,13 @@ import DictionarySelect from "zy-react-library/components/Select/Dictionary"; import Table from "zy-react-library/components/Table"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useTable from "zy-react-library/hooks/useTable"; +import { FIRE_RESOURCE_PERMISSION_QUERY_KEYS, getPermissionKeyFromSearch } from "~/enumerate/constant/fireResourcePermission"; import { NS_RESCUE_TEAM } from "~/enumerate/namespace"; + function List(props) { const [form] = Form.useForm(); const query = useGetUrlQuery(); - const normalizeBackPath = (path) => { if (!path) return ""; try { @@ -29,6 +30,19 @@ function List(props) { }; const isFromSupervision = !!query.eqCorpId; + const searchParams = new URLSearchParams(props.location?.search || ""); + const getPermissionValue = (action, defaultKey) => { + const queryKey = FIRE_RESOURCE_PERMISSION_QUERY_KEYS[action]; + const dynamicPermissionKey = queryKey ? searchParams.get(queryKey) : ""; + + if (isFromSupervision && dynamicPermissionKey) { + return props.permission(dynamicPermissionKey); + } + + return props.permission(getPermissionKeyFromSearch(props.location?.search, action, defaultKey)); + }; + const canAdd = getPermissionValue("add", "xfjyd-add"); + const hasPermission = (action, defaultKey) => getPermissionValue(action, defaultKey); const supervisionBackPath = normalizeBackPath( query.backPath || props.location?.state?.backPath @@ -131,7 +145,7 @@ function List(props) {
( - {props.permission("xfjyd-add") && ( + {canAdd && ( )} @@ -150,13 +164,13 @@ function List(props) { align: "center", render: (_, record) => ( - {props.permission("xfjyd-info") && ( + {hasPermission("info", "xfjyd-info") && ( )} - {props.permission("xfjyd-update") && ( + {hasPermission("update", "xfjyd-update") && ( )} - {props.permission("xfjyd-remove") && ( + {hasPermission("remove", "xfjyd-remove") && ( )} diff --git a/src/pages/Container/BranchCompany/WaterSource/List/index.js b/src/pages/Container/BranchCompany/WaterSource/List/index.js index d019000..578919c 100644 --- a/src/pages/Container/BranchCompany/WaterSource/List/index.js +++ b/src/pages/Container/BranchCompany/WaterSource/List/index.js @@ -9,6 +9,7 @@ import Table from "zy-react-library/components/Table"; import useDictionary from "zy-react-library/hooks/useDictionary"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useTable from "zy-react-library/hooks/useTable"; +import { FIRE_RESOURCE_PERMISSION_QUERY_KEYS, getPermissionKeyFromSearch } from "~/enumerate/constant/fireResourcePermission"; import { NS_WATER_SOURCE } from "~/enumerate/namespace"; function List(props) { @@ -32,6 +33,18 @@ function List(props) { } }; const isFromSupervision = !!query.eqCorpId; + const searchParams = new URLSearchParams(props.location?.search || ""); + const getPermissionValue = (action, defaultKey) => { + const queryKey = FIRE_RESOURCE_PERMISSION_QUERY_KEYS[action]; + const dynamicPermissionKey = queryKey ? searchParams.get(queryKey) : ""; + + if (isFromSupervision && dynamicPermissionKey) { + return props.permission(dynamicPermissionKey); + } + + return props.permission(getPermissionKeyFromSearch(props.location?.search, action, defaultKey)); + }; + const hasPermission = (action, defaultKey) => getPermissionValue(action, defaultKey); const supervisionBackPath = normalizeBackPath(query.backPath || props.location?.state?.backPath || window.sessionStorage.getItem("supervisionFireResourceStatsBackPath") @@ -161,7 +174,7 @@ function List(props) {
( - {props.permission("xfsy-add") && ( + {hasPermission("add", "xfsy-add") && (