diff --git a/builder.sh b/builder.sh index 30990eadf32ba849dead3b52e5725932d2b705fe..7e56ded9065b9afe520a77dcb84355528cbb7dbe 100755 --- a/builder.sh +++ b/builder.sh @@ -9,8 +9,8 @@ if [ ! -f regist-to-eureka/reg2eureka.sh ]; then exit 1 fi rm -rf dist -yarn -yarn build -# docker buildx use desktop-linux +pnpm i +pnpm run build +docker buildx use desktop-linux docker buildx build --platform linux/amd64 -t $repo:$tag . --push \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index 0055201aafa919b7a30df095185eb69f3b322382..7752b23318a83552951267fe603af00b42e05669 100644 --- a/src/app.ts +++ b/src/app.ts @@ -5,9 +5,10 @@ import { } from '@/utils/request'; import type { RequestConfig } from '@umijs/max'; import { Base64 } from 'js-base64'; -import { getUrlQuery } from './utils/comm'; +import { getUrlQuery } from './utils/comm'; import { setCookie } from './utils/cookie'; import { setSession } from './utils/session'; +import services from './services'; //request 配置 export const request: RequestConfig = { @@ -23,3 +24,19 @@ if (token) { setSession('token', Base64.decode(token)); } + +export async function getInitialState(): Promise{ + let areaId: string = "" + try { + const userPermDataResp = await services.CommQuery.getUserDataPermission(); + if(userPermDataResp.code === 200) { + areaId = userPermDataResp?.data?.areaGrid[0] + } + } catch (error) { + console.error('获取初始数据出错:', error); + } + return { + areaId + }; +} + diff --git a/src/components/CooglMap b/src/components/CooglMap index a76d618711d51a8ad0980fd873faf162abcade6d..ae2f1bd98e282e06ebdc0d3f0791422a6757367a 160000 --- a/src/components/CooglMap +++ b/src/components/CooglMap @@ -1 +1 @@ -Subproject commit a76d618711d51a8ad0980fd873faf162abcade6d +Subproject commit ae2f1bd98e282e06ebdc0d3f0791422a6757367a diff --git a/src/pages/Common/Quality/Category/SignTop/index.tsx b/src/pages/Common/Quality/Category/SignTop/index.tsx index 4038241164b9a33546dbfc07cd85346963dc641a..8b40f4a34f12dba6301660748297ff8eacf6711c 100644 --- a/src/pages/Common/Quality/Category/SignTop/index.tsx +++ b/src/pages/Common/Quality/Category/SignTop/index.tsx @@ -3,8 +3,11 @@ import { useRequest } from 'ahooks'; import { useEffect } from 'react'; import styles from './index.less'; import TopItem from './TopItem'; +import { useModel } from '@umijs/max'; export default ({ items }: { items: any }) => { + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const { data, runAsync } = useRequest( services.Physicalsign.getlistTopNItems, { manual: true }, @@ -12,62 +15,13 @@ export default ({ items }: { items: any }) => { useEffect(() => { if (!items) return; runAsync({ - objectId: '510100', + objectId: areaId, indexId: items.id, n: 5, indexType: 1, physicalSignType: 1 }); }, [items]); - // const data = { - // data: [ - // { - // image: 'https://xct.cdhncy.cn/file/zgf/2024/10/10/e1d7cf31199b47528085fffd93af2bee_1728549037097.jpg', - // name: '过街天桥破损', - // fullName: '安全-道路桥梁安全-桥梁安全', - // percentage: '41', - // count: '16', - // deduction: '0.5', - // weight: '0.86' - // }, - // { - // image: 'https://xct.cdhncy.cn/file/zgf/2024/10/10/e1d7cf31199b47528085fffd93af2bee_1728549037097.jpg', - // name: '过街天桥破损', - // fullName: '安全-道路桥梁安全-桥梁安全', - // percentage: '41', - // count: '16', - // deduction: '0.5', - // weight: '0.86' - // }, - // { - // image: 'https://xct.cdhncy.cn/file/zgf/2024/10/10/e1d7cf31199b47528085fffd93af2bee_1728549037097.jpg', - // name: '过街天桥破损', - // fullName: '安全-道路桥梁安全-桥梁安全', - // percentage: '41', - // count: '16', - // deduction: '0.5', - // weight: '0.86' - // }, - // { - // image: 'https://xct.cdhncy.cn/file/zgf/2024/10/10/e1d7cf31199b47528085fffd93af2bee_1728549037097.jpg', - // name: '过街天桥破损', - // fullName: '安全-道路桥梁安全-桥梁安全', - // percentage: '41', - // count: '16', - // deduction: '0.5', - // weight: '0.86' - // }, - // { - // image: 'https://xct.cdhncy.cn/file/zgf/2024/10/10/e1d7cf31199b47528085fffd93af2bee_1728549037097.jpg', - // name: '过街天桥破损', - // fullName: '安全-道路桥梁安全-桥梁安全', - // percentage: '41', - // count: '16', - // deduction: '0.5', - // weight: '0.86' - // } - // ] - // } return (
{data?.data?.map((item, index) => { diff --git a/src/pages/Common/Quality/SafetyProblem/index.tsx b/src/pages/Common/Quality/SafetyProblem/index.tsx index 03af606b705f85d2c760f5a30abde05b75688b75..0c33c16901bd98bdda7582028b54ffd3e0e3226f 100644 --- a/src/pages/Common/Quality/SafetyProblem/index.tsx +++ b/src/pages/Common/Quality/SafetyProblem/index.tsx @@ -6,6 +6,7 @@ import React, { useRef, useEffect, useState } from 'react'; import InfiniteScroll from 'react-infinite-scroller'; import services from '@/services'; import styles from './index.less'; +import { useModel } from '@umijs/max'; /** * @description 城市cqi-安全问题 @@ -18,6 +19,9 @@ interface SafetyProblemProps { } const SafetyProblem: React.FC = ({ listHeight = 650 }) => { + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; + const [listData, setListData] = useState([]) const page = useRef({ @@ -32,7 +36,7 @@ const SafetyProblem: React.FC = ({ listHeight = 650 }) => { const getListData = () => { const params = { conditionId: 'RC001', - objectId: '510100', + objectId: areaId, indexType: '1' } services.Physicalsign.getIndexSafetyProblemList(params).then((res: any) => { diff --git a/src/pages/IndustryOperation/index.tsx b/src/pages/IndustryOperation/index.tsx index 718b44bdbf86ee386dec4e8a9c1300a1ff00413c..def2b7178bfd4e966a9d09efd0c86530e00aa7e8 100644 --- a/src/pages/IndustryOperation/index.tsx +++ b/src/pages/IndustryOperation/index.tsx @@ -15,6 +15,7 @@ import RaiseDust from './components/RaiseDust'; import RefuseDisposal from './components/RefuseDisposal'; import RoadAndBridge from './components/RoadAndBridge'; import styles from './index.less'; +import { useModel } from '@umijs/max'; export const IndustryContext = React.createContext( {} as { indutryIndexData: PhysicalsignApi.IndutryIndexInstanceDto[]; @@ -22,6 +23,8 @@ export const IndustryContext = React.createContext( ); /** @module 行业运行情况 */ const IndustryOperation: React.FC = () => { + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const [modalOpt, setModalOpt] = useState<{ open: boolean; title: string; @@ -32,7 +35,7 @@ const IndustryOperation: React.FC = () => { const { data: indutryIndexData, loading } = useRequest(() => services.Physicalsign.getAllIndutryIndexInstance({ physicalSignType: '1', - objectId: '510100', + objectId: areaId, }), ); const views = useMemo(() => { diff --git a/src/pages/SecurityServiceOverview/SecurityState/SecurityCqi/index.tsx b/src/pages/SecurityServiceOverview/SecurityState/SecurityCqi/index.tsx index c3e7f00426468e3ae0f01980bd9053a2cca635ca..fb556cd13e47af16f37c40f33293e6d92ba76ddf 100644 --- a/src/pages/SecurityServiceOverview/SecurityState/SecurityCqi/index.tsx +++ b/src/pages/SecurityServiceOverview/SecurityState/SecurityCqi/index.tsx @@ -39,7 +39,8 @@ const StatusMap = { }, }; const SecurityCqi = () => { - const { areaId } = useModel('areaGrid'); + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const [modalOpt, setModalOpt] = useState<{ open: boolean; title: string; diff --git a/src/pages/SecurityServiceOverview/components/IndustrySign/index.tsx b/src/pages/SecurityServiceOverview/components/IndustrySign/index.tsx index 3ad35c03d1081d152c9f6abe0ad94690c16e9e07..9c8c89b593268a4cf9764e771f7f0b94c4c2b71b 100644 --- a/src/pages/SecurityServiceOverview/components/IndustrySign/index.tsx +++ b/src/pages/SecurityServiceOverview/components/IndustrySign/index.tsx @@ -18,7 +18,8 @@ import styles from './index.less'; */ const IndustrySign = ({ param }: { param: any }) => { - const { areaId } = useModel('areaGrid'); + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const indexIdMap: Record = { dlql: '202', //道桥 gf: '209', //固废 diff --git a/src/pages/TheOperationOfCityOverall/index.tsx b/src/pages/TheOperationOfCityOverall/index.tsx index a51119798fce7ad5112fe27e370207315afbdedc..1cecf27e176d483dc66bf282c91fb74a17492dc9 100644 --- a/src/pages/TheOperationOfCityOverall/index.tsx +++ b/src/pages/TheOperationOfCityOverall/index.tsx @@ -9,13 +9,16 @@ import GarbageDisposal from './components/GarbageDisposal'; import RaiseDust from './components/RaiseDust'; import Situation from './components/Situation'; import styles from './index.less'; +import { useModel } from '@umijs/max'; /** @module 行业运行情况 */ const TheOperationOfCityOverall: React.FC = () => { + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const { data: indutryIndexData, loading } = useRequest(() => services.Physicalsign.getCityRunIndutryIndexInstance({ physicalSignType: '1', - objectId: '510100', + objectId: areaId, }), ); const views = useMemo(() => { diff --git a/src/pages/UrbanSecuritySituation/index.tsx b/src/pages/UrbanSecuritySituation/index.tsx index becaa19b7c9b5131871c7bb52d009f13869384ae..5f6f6bee9b50b15dc5ecae8837d902aba17e730a 100644 --- a/src/pages/UrbanSecuritySituation/index.tsx +++ b/src/pages/UrbanSecuritySituation/index.tsx @@ -2,7 +2,7 @@ import Modal from '@/components/HncyModal'; import services from '@/services'; import { getCqiStatusStyle, getCqiStatusTexts } from '@/utils/ui'; import { CaretDownOutlined, CaretUpFilled } from '@ant-design/icons'; -import { history } from '@umijs/max'; +import { history, useModel } from '@umijs/max'; import { useRequest } from 'ahooks'; import { Flex, Space } from 'antd'; import React, { useEffect, useState } from 'react'; @@ -14,13 +14,15 @@ import RiskLevelNum from './RiskLevelNum'; /** @module 城市安全态势 */ const UrbanSecuritySituation: React.FC = () => { + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const [cqiData, setCqiData] = useState({}); const { data: signData } = useRequest(() => { return services.Physicalsign.getComparisonIndexInstance({ indexId: 2, physicalSignType: 1, indexType: 1, - objectId: '510100', + objectId: areaId, }); }); const { data: thirtyDayTrend } = useRequest( @@ -28,7 +30,7 @@ const UrbanSecuritySituation: React.FC = () => { { defaultParams: [ { - objectId: '510100', + objectId: areaId, indexId: '2', indexType: 1, }, diff --git a/src/pages/UrbanSituation/Quality/InfluenceIndex/index.tsx b/src/pages/UrbanSituation/Quality/InfluenceIndex/index.tsx index 3913c86bce4d6384e12bd9e772ff19b58600b772..fd36bb5930ca14e23219e819dadd1b24885106d9 100644 --- a/src/pages/UrbanSituation/Quality/InfluenceIndex/index.tsx +++ b/src/pages/UrbanSituation/Quality/InfluenceIndex/index.tsx @@ -4,37 +4,21 @@ import styles from './index.less' import Modal from '@/components/HncyModal'; import InfluenceSign from '@/pages/Common/Sign/InfluenceSign' import services from '@/services'; +import { useModel } from '@umijs/max'; const InfluenceIndex = () => { - + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const [modalOpen, setModalOpen] = useState(false) const [questionData, setQuestionData] = useState([]) const [loading, setLoading] = useState(false) - const ranks = [ - { - fullName: '公共广场私搭乱建', - conditionName: '安全', - weight: 41, - }, - { - fullName: '建筑物外立面不洁', - conditionName: '整洁', - weight: 21, - }, - { - fullName: '人行道(含盲道)破损', - conditionName: '安全', - weight: 41, - } - ] - const getListData = () => { setLoading(true) const params = { - objectId: '510100', // 对象id + objectId: areaId, // 对象id indexId: '1', n: '3', // 默认5 indexType: '1', // 内评价0,外评价1,默认外评价 diff --git a/src/pages/UrbanSituation/Quality/WarningArea/index.tsx b/src/pages/UrbanSituation/Quality/WarningArea/index.tsx index c45966761891c646fafaad37fd47b8708f0bcfb7..109854c2fca36e929cab14561ca38f6888ee972e 100644 --- a/src/pages/UrbanSituation/Quality/WarningArea/index.tsx +++ b/src/pages/UrbanSituation/Quality/WarningArea/index.tsx @@ -4,9 +4,11 @@ import { Flex, Progress, Space, Spin } from 'antd'; import classNames from 'classnames'; import styles from './index.less' import services from '@/services'; +import { useModel } from '@umijs/max'; const WarningArea = () => { - + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const [tabKey, setTabKey] = useState('street') const [groupData, setGroupData] = useState({}) const [loading, setLoading] = useState(false) @@ -32,7 +34,7 @@ const WarningArea = () => { physicalSignType: '1', // 1实况指数 3周期指数 indexType: '1', // 指数体系类型 0:内评价 1:外评价 indexId: '', // 指数id - objectId: '510100', // 网格id + objectId: areaId, // 网格id indexHierarchy: '1', // 指数层级,从1开始,多个用,逗号隔开 objectHierarchy: '2,4', // 对象层级,从1开始,多个用,逗号隔开 } diff --git a/src/pages/UrbanSituation/Quality/index.tsx b/src/pages/UrbanSituation/Quality/index.tsx index 687750ecfcd7b339b75c3e0d6569be0e35c9b40b..b4f76517d02abc32cc21010f4ff7eaf3a51e062e 100644 --- a/src/pages/UrbanSituation/Quality/index.tsx +++ b/src/pages/UrbanSituation/Quality/index.tsx @@ -24,6 +24,8 @@ import WarningArea from './WarningArea'; */ const Quality = () => { + const { initialState } = useModel('@@initialState'); + const { areaId } = initialState; const { setModalOpen, setModalOpt, setCurrentCqiData } = useModel( 'qualityModal', (model) => ({ @@ -70,7 +72,7 @@ const Quality = () => { physicalSignType: '1', // 1实况指数 3周期指数 indexType: '1', // 指数体系类型 0:内评价 1:外评价 indexHierarchy: '1,2', // 指数层级,从1开始,多个用,逗号隔开 - objectId: '510100', // 区域网格id + objectId: areaId, // 区域网格id indexId: '', // 指数id }; services.Physicalsign.getComparisonIndexInstance(params).then((res) => { diff --git a/src/services/Physicalsign.ts b/src/services/Physicalsign.ts index d05619fdb446f6c6607cb3178c26d18b6ce675d1..e059c09e5faa3c897c7b6b847aa34bb51e729d74 100644 --- a/src/services/Physicalsign.ts +++ b/src/services/Physicalsign.ts @@ -283,8 +283,8 @@ export async function getCityEventGroupBySource(params: { //获取所有行业情况 export async function getAllIndutryIndexInstance( params: { - physicalSignType: '1'; - objectId: '510100'; + physicalSignType: string; + objectId: string; }, ): Promise> { return request(urlProxyApis(`/zhgl/getAllIndutryIndexInstance`), { @@ -296,8 +296,8 @@ export async function getAllIndutryIndexInstance( //城市运行情况的行业体征 export async function getCityRunIndutryIndexInstance( params: { - physicalSignType: '1'; - objectId: '510100'; + physicalSignType: string; + objectId: string; }, ): Promise> { return request(urlProxyApis(`/zhgl/getCityRunIndutryIndexInstance`), {