diff --git a/src/assets/images/brdige/bridge1.png b/src/assets/images/brdige/bridge1.png new file mode 100644 index 0000000000000000000000000000000000000000..b10846e258d52cf2d79af44a6faf6a78e8101b10 Binary files /dev/null and b/src/assets/images/brdige/bridge1.png differ diff --git a/src/assets/images/brdige/bridge2.png b/src/assets/images/brdige/bridge2.png new file mode 100644 index 0000000000000000000000000000000000000000..a04503e06526cac3620910ba28ca2632df0af368 Binary files /dev/null and b/src/assets/images/brdige/bridge2.png differ diff --git a/src/assets/images/brdige/bridge3.png b/src/assets/images/brdige/bridge3.png new file mode 100644 index 0000000000000000000000000000000000000000..bac2be7371352bcfac504f41c18bc3c8164fb683 Binary files /dev/null and b/src/assets/images/brdige/bridge3.png differ diff --git a/src/assets/images/brdige/bridge4.png b/src/assets/images/brdige/bridge4.png new file mode 100644 index 0000000000000000000000000000000000000000..1478e470189ac585c3b521e121203153b53f56a8 Binary files /dev/null and b/src/assets/images/brdige/bridge4.png differ diff --git a/src/assets/images/brdige/bridge5.png b/src/assets/images/brdige/bridge5.png new file mode 100644 index 0000000000000000000000000000000000000000..d7c3173bc167b405b74c554ae6368f4516b15e16 Binary files /dev/null and b/src/assets/images/brdige/bridge5.png differ diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeAreaDistribution/index.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeAreaDistribution/index.tsx index 78d113de602a60edfc2f795e63dce2d694f4a1bb..727665f5b95150eb1b47fa44a24aa68ac532e6df 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeAreaDistribution/index.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeAreaDistribution/index.tsx @@ -6,27 +6,25 @@ import styles from './index.less'; import { useBridgeManage } from '../../context'; const BridgeAreaDistribution: React.FC = () => { - const { viewType } = useBridgeManage(); + const { viewType, isUsingValue } = useBridgeManage(); // 根据viewType显示不同的数据 const areaData = { bridge: [ - { name: '高新区', value: 152 }, - { name: '天府新区', value: 152 }, - { name: '锦江区', value: 152 }, - { name: '金牛区', value: 152 }, - { name: '武侯区', value: 152 }, - { name: '成华区', value: 152 }, - { name: '维修公司', value: 152 } + { name: isUsingValue ? '高新区' : '--区', value: isUsingValue ? 152 : '--' }, + { name: isUsingValue ? '天府新区' : '--区', value: isUsingValue ? 152 : '--' }, + { name: isUsingValue ? '锦江区' : '--区', value: isUsingValue ? 152 : '--' }, + { name: isUsingValue ? '青羊区' : '--区', value: isUsingValue ? 152 : '--' }, + { name: isUsingValue ? '金牛区' : '--区', value: isUsingValue ? 152 : '--' }, + { name: isUsingValue ? '武侯区' : '--区', value: isUsingValue ? 152 : '--' } ], road: [ - { name: '高新区', value: 256 }, - { name: '天府新区', value: 245 }, - { name: '锦江区', value: 234 }, - { name: '金牛区', value: 223 }, - { name: '武侯区', value: 212 }, - { name: '成华区', value: 201 }, - { name: '维修公司', value: 190 } + { name: isUsingValue ? '高新区' : '--区', value: isUsingValue ? 252 : '--' }, + { name: isUsingValue ? '天府新区' : '--区', value: isUsingValue ? 252 : '--' }, + { name: isUsingValue ? '锦江区' : '--区', value: isUsingValue ? 252 : '--' }, + { name: isUsingValue ? '青羊区' : '--区', value: isUsingValue ? 252 : '--' }, + { name: isUsingValue ? '金牛区' : '--区', value: isUsingValue ? 252 : '--' }, + { name: isUsingValue ? '武侯区' : '--区', value: isUsingValue ? 252 : '--' } ] }; diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeMaintenance/index.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeMaintenance/index.tsx index 3fb3106f3c0230ed8ccddb32a7fcfe23a8b7f234..d239a972f8e1d6c05f2c9e42f5ff4b6eccc8deee 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeMaintenance/index.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeMaintenance/index.tsx @@ -7,7 +7,7 @@ type TabKey = 'month' | 'year'; const BridgeMaintenance: React.FC = () => { const [activeTab, setActiveTab] = useState('month'); - const { viewType } = useBridgeManage(); + const { viewType, isUsingValue } = useBridgeManage(); const tabLabels: Record = { month: '本月', @@ -20,23 +20,23 @@ const BridgeMaintenance: React.FC = () => { bridge: { title: '桥梁维护情况', subtitle: '巡查发现桥梁病害', - subtitleCount: 182, + subtitleCount: isUsingValue ? 182 : '--', topTitle: '桥梁病害类型TOP3', items: [ - { label: '破损', value: 456, percent: 69.5 }, - { label: '松动', value: 456, percent: 69.5 }, - { label: '移位', value: 456, percent: 69.5 } + { label: '破损', value: isUsingValue ? 456 : '--', percent: isUsingValue ? 69.5 : '--' }, + { label: '松动', value: isUsingValue ? 456 : '--', percent: isUsingValue ? 69.5 : '--' }, + { label: '移位', value: isUsingValue ? 456 : '--', percent: isUsingValue ? 69.5 : '--' } ] }, road: { title: '道路维护情况', subtitle: '巡查发现道路病害', - subtitleCount: 182, + subtitleCount: isUsingValue ? 182 : '--', topTitle: '道路病害类型TOP3', items: [ - { label: '破损', value: 456, percent: 69.5 }, - { label: '松动', value: 456, percent: 69.5 }, - { label: '移位', value: 456, percent: 69.5 } + { label: '破损', value: isUsingValue ? 456 : '--', percent: isUsingValue ? 69.5 : '--' }, + { label: '松动', value: isUsingValue ? 456 : '--', percent: isUsingValue ? 69.5 : '--' }, + { label: '移位', value: isUsingValue ? 456 : '--', percent: isUsingValue ? 69.5 : '--' } ] } }; diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTrend/index.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTrend/index.tsx index 58727a327140ab40d0756b9f424a3da7190d1292..b7200dadb03e36ee05177726bb1ad61834ebaf95 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTrend/index.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTrend/index.tsx @@ -6,7 +6,7 @@ import { useBridgeManage } from '../../context'; const BridgeTrend: React.FC = () => { const [activeYear, setActiveYear] = useState('2024'); - const { viewType } = useBridgeManage(); + const { viewType, isUsingValue } = useBridgeManage(); const years = ['2022', '2023', '2024']; @@ -20,7 +20,6 @@ const BridgeTrend: React.FC = () => { title: '道路检测', legend: ['道路定期检测', '特殊检测', '应急检测'], yAxisLabels: ['A', 'B', 'C', 'D', 'E'], - // data: [320, 302, 301, 334, 390, 330] } }; @@ -83,7 +82,7 @@ const BridgeTrend: React.FC = () => { emphasis: { focus: 'series' }, - data: [320, 302, 301, 334, 390, 330, 30] + data: isUsingValue ? [320, 302, 301, 334, 390, 330, 30] : ['--', '--', '--', '--', '--', '--', '--'] })) // series: [ // { diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.css b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.css index 5df1589aa20b903b0c252af4d8277f0d47232eca..ec7bfb2cae1a60825418fc178dd5b46951ae449a 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.css +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.css @@ -41,6 +41,9 @@ } .container .content { margin-top: 16px; + display: flex; + flex-direction: row; + align-items: center; } .container .content .chart { padding-left: 13px; @@ -50,6 +53,11 @@ display: flex; flex-direction: column; justify-content: center; + gap: 20px; + margin-top: -50px; +} +.container .content .legend.roadLegend { + gap: 13px; } .container .content .legend .legendItem { width: 280px; @@ -57,7 +65,6 @@ padding: 0px 14px; border-radius: 7px; background: rgba(41, 181, 255, 0.12); - margin-bottom: 10px; } .container .content .legend .legendItem .name { color: #bccee9; @@ -80,5 +87,5 @@ .container .content .legend .legendItem .percent { color: #bccee9; font-size: 16px; - margin-left: 8px; + margin-left: 38px; } diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.less b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.less index 621d75ff7f3fca4b60037446450a5fc575dd2971..a5639f292c9dc8d42f1834a686fb30db689e2b49 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.less +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.less @@ -46,6 +46,9 @@ .content { margin-top: 16px; + display: flex; + flex-direction: row; + align-items: center; .chart { padding-left: 13px; @@ -53,9 +56,16 @@ } .legend { + // flex: 1; display: flex; flex-direction: column; justify-content: center; + gap: 20px; + margin-top: -50px; + + &.roadLegend { + gap: 13px; + } .legendItem { width: 280px; @@ -63,7 +73,7 @@ padding: 0px 14px; border-radius: 7px; background: rgba(41, 181, 255, 0.12); - margin-bottom: 10px; + // margin-bottom: 10px; .name { color: rgb(188, 206, 233); @@ -89,7 +99,7 @@ .percent { color: rgb(188, 206, 233); font-size: 16px; - margin-left: 8px; + margin-left: 38px; } } } diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.tsx index ec699fc01187a2a63204a855527834f2c32ddee5..8a21ad704a16586e54887bd287a66212b8f5e5e5 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/BridgeTypeDistribution/index.tsx @@ -15,34 +15,39 @@ const BridgeTypeDistribution: React.FC = () => { const data = { bridge: { level: [ - { value: isUsingValue ? 16 : '--', name: 'I等', percent: isUsingValue ? 36.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: 'II等', percent: isUsingValue ? 46.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: 'III等', percent: isUsingValue ? 56.25 : '--' } + { value: 16, name: 'I等', percent: 36.25}, + { value: 16, name: 'II等', percent: 46.25}, + { value: 16, name: 'III等', percent: 56.25} ], type: [ - { value: isUsingValue ? 16 : '--', name: '特大桥', percent: isUsingValue ? 36.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: '大桥', percent: isUsingValue ? 46.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: '中桥', percent: isUsingValue ? 56.25 : '--' } + { value: 16, name: '特大桥', percent: 36.25}, + { value: 16, name: '大桥', percent: 46.25}, + { value: 16, name: '中桥', percent: 56.25} ], }, road: { level: [ - { value: isUsingValue ? 16 : '--', name: 'I等', percent: isUsingValue ? 36.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: 'II等', percent: isUsingValue ? 46.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: 'III等', percent: isUsingValue ? 56.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: 'IV等', percent: isUsingValue ? 66.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: 'V等', percent: isUsingValue ? 76.25 : '--' }, + { value: 16, name: 'I等', percent: 36.25}, + { value: 16, name: 'II等', percent: 46.25}, + { value: 16, name: 'III等', percent: 56.25}, + { value: 16, name: 'IV等', percent: 66.25}, + { value: 16, name: 'V等', percent: 76.25}, ], type: [ - { value: isUsingValue ? 16 : '--', name: '主干道', percent: isUsingValue ? 36.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: '次干道', percent: isUsingValue ? 46.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: '支路', percent: isUsingValue ? 56.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: '一级公路', percent: isUsingValue ? 66.25 : '--' }, - { value: isUsingValue ? 16 : '--', name: '二级公路', percent: isUsingValue ? 76.25 : '--' }, + { value: 16, name: '主干道', percent: 36.25}, + { value: 16, name: '次干道', percent: 46.25}, + { value: 16, name: '支路', percent: 56.25}, + { value: 16, name: '一级公路', percent: 66.25}, + { value: 16, name: '二级公路', percent: 76.25}, ] } }; +// const fixedData = { +// bridge: [36.25, 46.25, 56.25], +// road: [36.25, 46.25, 56.25, 66.25, 76.25] +// }; + const tabLabels: Record = { level: '养护等级', type: '养护类别' @@ -59,7 +64,7 @@ const BridgeTypeDistribution: React.FC = () => { label: { show: false }, - data: data[viewType === 'road' ? 'road' : 'bridge'][activeTab] + data: data[viewType === 'road' ? 'road' : 'bridge'][activeTab], }] }; @@ -99,14 +104,15 @@ const BridgeTypeDistribution: React.FC = () => { /> -
+
+ {/*
*/} {pieOption.series[0].data.map((item, index) => ( {item.name} - {item.value} + {isUsingValue ? item.value : '--'} {unit} - {item.percent}% + {isUsingValue ? item.percent : '--'}% ))}
diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.css b/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.css index 056c70dd1ad8ee03a6eb62b7e6895a126ec69ca0..299c9bd2c406a674fbb94cf1c2b2d2ae3557fe3c 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.css +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.css @@ -13,17 +13,17 @@ z-index: 1; } .container .tabBar .tabBtn { - background: #062F5A; - border-radius: 26px; + background: rgba(30, 107, 180, 0.5); + border-radius: 10px; padding: 8px 20px; color: #fff; font-family: 'DingTalk JinBuTi'; - font-size: 18px; + font-size: 22px; cursor: pointer; transition: all 0.3s; } .container .tabBar .tabBtn.active { - background: #0099f7; + background: #1e6bb4; } .container .mapInfo { position: absolute; @@ -92,48 +92,112 @@ } .container .monitorStats { position: absolute; - bottom: 0; + bottom: 10px; left: 50%; transform: translateX(-50%); width: 902px; height: 60px; background: rgba(60, 92, 143, 0.5); - border-radius: 20px; backdrop-filter: blur(10px); + border-radius: 20px; display: flex; align-items: center; justify-content: center; padding: 0 20px; } +.container .monitorStats .statGroup { + padding: 0 20px; + display: flex; + align-items: center; + gap: 8px; +} .container .monitorStats .icon { + width: 22px; + height: 22px; +} +.container .monitorStats .icon img { + width: 100%; + height: 100%; + object-fit: contain; +} +.container .monitorStats .icon.largeIcon { + width: 34px; + height: 34px; +} +.container .monitorStats .name { color: #BCCEE9; - font-size: 16px; + font-size: 14px; + line-height: 1; +} +.container .monitorStats .valueWrapper { + display: flex; + align-items: center; + gap: 4px; } .container .monitorStats .count { - color: #fff; font-family: 'D-DIN'; font-size: 20px; + font-weight: 700; + line-height: 1; +} +.container .monitorStats .count.count0 { + color: #FFFFFF; +} +.container .monitorStats .count.count1 { + color: #FFFFFF; +} +.container .monitorStats .count.count2 { + color: #FFE546; +} +.container .monitorStats .count.count3 { + color: #FF9B6E; +} +.container .monitorStats .count.count4 { + color: #FF8888; } .container .monitorStats .unit { color: #BCCEE9; - font-size: 16px; + font-size: 14px; + line-height: 1; } -.container .monitorStats .status { - width: 12px; - height: 12px; - border-radius: 50%; +.container .collapseBtn { + position: absolute; + top: 40px; + right: 350px; + width: 30px; + height: 82px; + background: rgba(12, 60, 112, 0.7); + border-radius: 10px 0 0 10px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 8px; + cursor: pointer; + z-index: 3; + transition: all 0.3s; } -.container .monitorStats .status.normal { - background: #00FF00; +.container .collapseBtn .btnText { + display: flex; + flex-direction: column; + align-items: center; } -.container .monitorStats .status.yellow { - background: #FFE335; +.container .collapseBtn .btnText span { + color: #b3d6f7; + font-size: 18px; + font-weight: 400; + line-height: 24px; } -.container .monitorStats .status.orange { - background: #FF9B5D; +.container .collapseBtn .collapseIcon { + color: #b3d6f7; + font-size: 12px; + transition: all 0.3s; } -.container .monitorStats .status.red { - background: #FF0000; +.container .collapseBtn.collapsed { + right: 0; +} +.container .collapseBtn.collapsed .collapseIcon { + transform: rotate(180deg); } .container .bridgeList { position: absolute; @@ -147,32 +211,11 @@ transition: all 0.3s; z-index: 2; } -.container .bridgeList .collapseBtn { - position: absolute; - top: 20px; - left: -30px; - width: 30px; - height: 32px; - background: rgba(12, 60, 112, 0.7); - border-radius: 4px 0 0 4px; - display: flex; - align-items: center; - justify-content: center; - color: #CBEDFF; - cursor: pointer; -} -.container .bridgeList .collapseBtn .collapseIcon { - margin-right: 4px; - transition: all 0.3s; -} .container .bridgeList.collapsed { width: 0; padding: 0; overflow: hidden; } -.container .bridgeList.collapsed .collapseIcon { - transform: rotate(180deg); -} .container .bridgeList .listHeader { height: 50px; display: flex; @@ -196,6 +239,7 @@ padding: 0 20px; display: flex; align-items: center; + justify-content: space-between; } .container .bridgeList .listContent .bridgeItem .bridgeName { color: #E4EDFF; @@ -213,7 +257,7 @@ display: flex; align-items: center; justify-content: center; - margin-left: 8px; + margin-right: 8px; cursor: pointer; flex-shrink: 0; } diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.less b/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.less index da4221e0b5cfffa9a44160f42a5c7572bd4465d6..0b222f56622c06354c8f6e03ca4257f807e09e8b 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.less +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.less @@ -13,17 +13,30 @@ z-index: 1; .tabBtn { - background: #062F5A; - border-radius: 26px; + background: rgba(30, 107, 180, 0.5); + border-radius: 10px; padding: 8px 20px; color: #fff; font-family: 'DingTalk JinBuTi'; - font-size: 18px; + font-size: 22px; cursor: pointer; transition: all 0.3s; + +// left: 1144px; +// right: -1144px; +// top: 218px; +// bottom: -218px; +// position: absolute; +// width: 123px; +// height: 48px; +// background: rgb(30, 107, 180); +// opacity:0.5; +// border-raius: 10px; + &.active { - background: rgb(0, 153, 247); + background: rgba(30, 107, 180, 1); + // background: rgb(0, 153, 247); } } } @@ -108,57 +121,114 @@ .monitorStats { position: absolute; - // left: 0; - // right: 0; - bottom: 0; + bottom: 10px; left: 50%; transform: translateX(-50%); width: 902px; height: 60px; background: rgba(60, 92, 143, 0.5); - border-radius: 20px; backdrop-filter: blur(10px); + border-radius: 20px; display: flex; align-items: center; justify-content: center; padding: 0 20px; - // left: 1330px; + + .statGroup { + padding: 0 20px; + display: flex; + align-items: center; + gap: 8px; + } .icon { + width: 22px; + height: 22px; + + img { + width: 100%; + height: 100%; + object-fit: contain; + } + + &.largeIcon { + width: 34px; + height: 34px; + } + } + + .name { color: #BCCEE9; - font-size: 16px; + font-size: 14px; + line-height: 1; + } + + .valueWrapper { + display: flex; + align-items: center; + gap: 4px; } .count { - color: #fff; font-family: 'D-DIN'; font-size: 20px; + font-weight: 700; + line-height: 1; + + &.count0 { color: #FFFFFF; } + &.count1 { color: #FFFFFF; } + &.count2 { color: #FFE546; } + &.count3 { color: #FF9B6E; } + &.count4 { color: #FF8888; } } .unit { color: #BCCEE9; - font-size: 16px; + font-size: 14px; + line-height: 1; } + } - .status { - width: 12px; - height: 12px; - border-radius: 50%; - - &.normal { - background: #00FF00; - } - - &.yellow { - background: #FFE335; + .collapseBtn { + position: absolute; + top: 40px; + right: 350px; + width: 30px; + height: 82px; + background: rgba(12, 60, 112, 0.7); + border-radius: 10px 0 0 10px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 8px; + cursor: pointer; + z-index: 3; + transition: all 0.3s; + + .btnText { + display: flex; + flex-direction: column; + align-items: center; + + span { + color: rgb(179, 214, 247); + font-size: 18px; + font-weight: 400; + line-height: 24px; } + } - &.orange { - background: #FF9B5D; - } + .collapseIcon { + color: rgb(179, 214, 247); + font-size: 12px; + transition: all 0.3s; + } - &.red { - background: #FF0000; + &.collapsed { + right: 0; + .collapseIcon { + transform: rotate(180deg); } } } @@ -175,35 +245,10 @@ transition: all 0.3s; z-index: 2; - .collapseBtn { - position: absolute; - top: 20px; - left: -30px; - width: 30px; - height: 32px; - background: rgba(12, 60, 112, 0.7); - border-radius: 4px 0 0 4px; - display: flex; - align-items: center; - justify-content: center; - color: #CBEDFF; - cursor: pointer; - - .collapseIcon { - margin-right: 4px; - transition: all 0.3s; - } - } - &.collapsed { width: 0; - // right: -400px; padding: 0; overflow: hidden; - - .collapseIcon { - transform: rotate(180deg); - } } .listHeader { @@ -230,6 +275,7 @@ padding: 0 20px; display: flex; align-items: center; + justify-content: space-between; .bridgeName { color: #E4EDFF; @@ -248,7 +294,8 @@ display: flex; align-items: center; justify-content: center; - margin-left: 8px; + margin-right: 8px; + // margin-left: 128px; cursor: pointer; flex-shrink: 0; } diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.tsx index 0fd802fbf995c968a0f8ceb7568a23301aefde84..7ff7bc55d3cf2f15c11cc27cfad51453457e31c2 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/components/MapBase/index.tsx @@ -6,6 +6,11 @@ import styles from './index.less'; import { useBridgeManage } from '../../context'; import type { ViewType } from '../../context'; import locationIcon from '@/assets/images/location.png'; +import bridge1Icon from '@/assets/images/brdige/bridge1.png'; +import bridge2Icon from '@/assets/images/brdige/bridge2.png'; +import bridge3Icon from '@/assets/images/brdige/bridge3.png'; +import bridge4Icon from '@/assets/images/brdige/bridge4.png'; +import bridge5Icon from '@/assets/images/brdige/bridge5.png'; interface MapBaseProps { type?: ViewType; @@ -69,21 +74,21 @@ const MapBase: React.FC = ({ type = 'bridge' }) => { // 桥梁列表数据 const bridgeList = [ - { name: '桥梁名称桥梁名称桥梁...', location: 'XXXXXXXXXXXXXX' }, - { name: '桥梁名称桥梁名称桥梁...', location: 'XXXXXXXXXXXXXX' }, - { name: '桥梁名称桥梁名称桥梁...', location: 'XXXXXXXXXXXXXX' }, - { name: '桥梁名称桥梁名称桥梁...', location: 'XXXXXXXXXXXXXX' }, - { name: '桥梁名称桥梁名称桥梁...', location: 'XXXXXXXXXXXXXX' }, - { name: '桥梁名称桥梁名称桥梁...', location: 'XXXXXXXXXXXXXX' } + { name: '桥梁名称...', location: 'XXXXXXXXXXXXXX' }, + { name: '桥梁名称...', location: 'XXXXXXXXXXXXXX' }, + { name: '桥梁名称...', location: 'XXXXXXXXXXXXXX' }, + { name: '桥梁名称...', location: 'XXXXXXXXXXXXXX' }, + { name: '桥梁名称...', location: 'XXXXXXXXXXXXXX' }, + { name: '桥梁名称...', location: 'XXXXXXXXXXXXXX' } ]; // 监测统计数据 const monitorStats = [ - { icon: '已接入监测', count: isUsingValue ? 50 : '--', unit: '座' }, - { icon: '正常', count: isUsingValue ? 50 : '--', status: 'normal' }, - { icon: '黄色预警', count: isUsingValue ? 0 : '--', status: 'yellow' }, - { icon: '橙色预警', count: isUsingValue ? 0 : '--', status: 'orange' }, - { icon: '红色预警', count: isUsingValue ? 0 : '--', status: 'red' } + { name: '已接入监测', count: isUsingValue ? 50 : '--', unit: '座', icon: bridge1Icon }, + { name: '正常', count: isUsingValue ? 50 : '--', unit: '', icon: bridge2Icon }, + { name: '黄色预警', count: isUsingValue ? 0 : '--', unit: '', icon: bridge3Icon }, + { name: '橙色预警', count: isUsingValue ? 0 : '--', unit: '', icon: bridge4Icon }, + { name: '红色预警', count: isUsingValue ? 0 : '--', unit: '', icon: bridge5Icon } ]; return ( @@ -184,13 +189,19 @@ const MapBase: React.FC = ({ type = 'bridge' }) => { {/* 桥梁位置分布特有的底部监测统计 */} {viewType === 'location' && (
- + {monitorStats.map((stat, index) => ( - -
{stat.icon}
- {stat.count} - {stat.unit && {stat.unit}} - {stat.status &&
} + +
+ {stat.name} +
+ {stat.name} + + + {stat.count} + + {stat.unit && {stat.unit}} +
))} @@ -200,35 +211,38 @@ const MapBase: React.FC = ({ type = 'bridge' }) => { {/* 桥梁位置分布特有的右侧列表 */} {viewType === 'location' && ( -
+ <> + {/* 收起按钮独立放置 */}
setIsListCollapsed(!isListCollapsed)} > + {!isListCollapsed &&( +
+ + +
+ )} - {/* 收起 */}
- {!isListCollapsed && ( - <> -
- 桥梁列表 -
-
- {bridgeList.map((bridge, index) => ( -
- - {bridge.name} -
- location icon -
-
+ {/* 列表内容 */} +
+
+ 桥梁列表 +
+
+ {bridgeList.map((bridge, index) => ( +
+ {bridge.name} +
+ location icon
- ))} -
- - )} -
+
+ ))} +
+
+ )}
); diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/context.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/context.tsx index 47b9f36480c6d066065c42fd03b1d1a532699fc0..8db0c2c4a91f88bc98eb6cc4d50268a765dc99cf 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/context.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/context.tsx @@ -12,13 +12,21 @@ interface BridgeManageContextType { const BridgeManageContext = createContext({ viewType: 'bridge', setViewType: () => {}, - isUsingValue: true, + isUsingValue: false, setIsUsingValue: () => {} }); -export const BridgeManageProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { - const [viewType, setViewType] = useState('bridge'); - const [isUsingValue, setIsUsingValue] = useState(true); +interface BridgeManageProviderProps { + children: React.ReactNode; + initialViewType?: ViewType; +} + +export const BridgeManageProvider: React.FC = ({ + children, + initialViewType = 'bridge' +}) => { + const [viewType, setViewType] = useState(initialViewType); + const [isUsingValue, setIsUsingValue] = useState(false); return ( diff --git a/src/pages/GlobalModalServices/modals/BridgeManage/index.tsx b/src/pages/GlobalModalServices/modals/BridgeManage/index.tsx index bec463a99a4548a9972df58fdd34d62c044e8af2..68403e5b21b67a854a537fdbe8315efb79cd1119 100644 --- a/src/pages/GlobalModalServices/modals/BridgeManage/index.tsx +++ b/src/pages/GlobalModalServices/modals/BridgeManage/index.tsx @@ -1,31 +1,22 @@ -import React, { useState } from 'react'; -import { Flex, Tabs, Switch } from 'antd'; +import React from 'react'; +import { Flex } from 'antd'; import styles from './index.less'; -import BridgeDistribution from './components/BridgeDistribution'; -import BridgeLocation from './components/BridgeLocation'; -import RoadDistribution from './components/RoadDistribution'; -import BridgeTrend from './components/BridgeTrend'; import BridgeTypeDistribution from './components/BridgeTypeDistribution'; import BridgeAreaDistribution from './components/BridgeAreaDistribution'; import BridgeMaintenance from './components/BridgeMaintenance'; +import BridgeTrend from './components/BridgeTrend'; import MapBase from './components/MapBase'; -import { BridgeManageProvider, useBridgeManage } from './context'; +import { BridgeManageProvider } from './context'; +import type { ViewType } from './context'; -const BridgeManage: React.FC = () => { - const { isUsingValue, setIsUsingValue } = useBridgeManage(); +interface BridgeManageProps { + defaultViewType?: ViewType; +} +const BridgeManage: React.FC = ({ defaultViewType = 'bridge' }) => { return ( - +
- {/*
- -
*/} -
diff --git a/src/pages/GlobalModalServices/modals/Category/SignLeft/index.less b/src/pages/GlobalModalServices/modals/Category/SignLeft/index.less index 4e95945bcb99775435220cf7a3e55d2e88e6c8f8..28d29a033297658a672e33885055da6548d0e8e5 100644 --- a/src/pages/GlobalModalServices/modals/Category/SignLeft/index.less +++ b/src/pages/GlobalModalServices/modals/Category/SignLeft/index.less @@ -1,6 +1,6 @@ .container { width: 294px; - height: 100%; + // height: 100%; border-radius: 20px; background: rgba(57, 122, 183, 0.2); display: flex; diff --git a/src/pages/GlobalModalServices/modals/Category/TraceSourceOfLostPoints/index.tsx b/src/pages/GlobalModalServices/modals/Category/TraceSourceOfLostPoints/index.tsx index c505e23796a274b37dab5ecd93204b9bcac3a87c..bb8234864fe050aa042685fd205f1a871e790461 100644 --- a/src/pages/GlobalModalServices/modals/Category/TraceSourceOfLostPoints/index.tsx +++ b/src/pages/GlobalModalServices/modals/Category/TraceSourceOfLostPoints/index.tsx @@ -1,4 +1,5 @@ import EmptySpace from '@/components/EmptySpace'; +import { useGlobalModalServices } from '@/pages/GlobalModalServices/provider'; import services from '@/services'; import { useModel } from '@umijs/max'; import ReactEcharts from 'echarts-for-react'; @@ -14,6 +15,7 @@ const TraceSourceOfLostPoints: React.FC = ( props, ) => { const { data, showLostPoints } = props; + const { dispatch } = useGlobalModalServices(); const { initialState } = useModel('@@initialState'); const { areaId } = initialState; @@ -156,17 +158,17 @@ const TraceSourceOfLostPoints: React.FC = ( indexType: data.indexType, physicalSignType: 1, objectId: areaId, - indexId: 26, + indexId: data.id, n: 1, }).then((res) => { if (res.code === 200) { const data = res.data; if (data?.length) { - setModalOpt([ - ...modalOpt, - { title: '影响指标', type: 'influenceSign' }, - ]); - setInfluenceIndexData(data[0] || {}); + dispatch.push('InfluenceSign', { + props: { + data: data[0], + }, + }); } } }); diff --git a/src/pages/GlobalModalServices/modals/DifficultEvents/index.tsx b/src/pages/GlobalModalServices/modals/DifficultEvents/index.tsx index 19caa192d60b3e791f51fffda5250309e6c91b5f..71d08dc83e59434f56d809e340096ad371e6c74e 100644 --- a/src/pages/GlobalModalServices/modals/DifficultEvents/index.tsx +++ b/src/pages/GlobalModalServices/modals/DifficultEvents/index.tsx @@ -8,6 +8,8 @@ import styles from './index.less'; import CountyProblem from './CountyProblem'; import DisposeProblem from './DisposeProblem'; import ProblemRank from './ProblemRank'; +import { useRequest } from 'ahooks'; +import services from '@/services'; const DifficultEvents = () => { @@ -28,6 +30,9 @@ const DifficultEvents = () => { children: , }, ]; + const { data, run } = useRequest(services.Physicalsign.getEventCountForLeft, { + defaultParams:[{difficultFlag:'1'}] + }); return ( diff --git a/src/pages/GlobalModalServices/modals/ToDisposed/index.tsx b/src/pages/GlobalModalServices/modals/ToDisposed/index.tsx index 81a6d2c42ad452202b1dee7904ce23436f0492e7..6e3b5c6c5bc662cdc244ba4632eb30a1b7650319 100644 --- a/src/pages/GlobalModalServices/modals/ToDisposed/index.tsx +++ b/src/pages/GlobalModalServices/modals/ToDisposed/index.tsx @@ -191,7 +191,7 @@ const ToDisposed = ({ { // 视图 // const [viewType, setViewType] = useState<'list' | 'pic'>('pic'); //展示 @@ -34,10 +37,10 @@ const UrbanOperation = ({ const fetchParams = useRef({ page: 1, count: 10, - caseStatus:'40,50,60,70,80,90,100', + sourceSystemCode, type: datetType, - time + time, }); // tabs内容 @@ -70,17 +73,17 @@ const UrbanOperation = ({ const [areaStatistics, setAreaStatistics] = useState([]); // 获取左侧顶部事件相关统计 - const getCityStatistics = () => { + const getCityStatistics = (value?: string) => { const params = { - caseStatus:'40,50,60,70,80,90,100', + sourceSystemCodeY: fetchParams.current.sourceSystemCodeY, sourceSystemCode, type: datetType, - time + time, }; services.CityProblemApi.getSourceSystemCloseRate(params).then((res) => { if (res.code === 200) { console.log(res); - + setEventStatistics(res.data); } }); @@ -91,10 +94,10 @@ const UrbanOperation = ({ const params = { category: category, top: 3, - caseStatus:'40,50,60,70,80,90,100', + sourceSystemCodeY: fetchParams.current.sourceSystemCodeY, sourceSystemCode, type: datetType, - time + time, }; services.CityProblemApi.getCategoryTopAnalysisApi(params).then((res) => { if (res.code === 200) { @@ -108,14 +111,14 @@ const UrbanOperation = ({ }; // 高发类别统计 - const getAreaAnalysis = () => { + const getAreaAnalysis = (value?: string) => { const params = { region: 'district', top: 3, - caseStatus:'40,50,60,70,80,90,100', + sourceSystemCodeY: fetchParams.current.sourceSystemCodeY, sourceSystemCode, type: datetType, - time + time, }; services.CityProblemApi.getAreaDistribAnalysisApi(params).then((res) => { if (res.code === 200) { @@ -158,21 +161,40 @@ const UrbanOperation = ({ }); getEventsList(); }; - // 获取数据来源 筛选项 - const getSourceOptions = () => { - services.CityProblemApi.getCaseSourceTypeList().then((res) => { - if (res.code === 200) { + + useRequest(services.CityProblemApi.getSourceSystemList, { + onSuccess: (res: any) => { + const data = res.data; + if (res.code !== 200) { + return; + } + if (sourceType && sourceType === 'all') { + const options = Object.entries(data?.all).map((item) => { + return { label: item[1], value: item[0] }; + }); setCaseSourceOptions([ - { sourceName: '全部来源', sourceCode: '' }, - ...res.data, + { label: '全部来源', value: 'all' }, + ...options, ]); } - }); - }; + if (sourceType && sourceType === 'wnywxt') { + const options = data?.wnywxt?.map((item) => ({ + ...item, + label: item?.name, + })); + setCaseSourceOptions([ + { label: '全部来源', value: 'all' }, + ...options, + ]); + } + }, + }); const onChangeCaseSource = (value: string) => { + console.log(value); + // setSourceSystemCode(value); - fetchParams.current.sourceSystemCode = value; + fetchParams.current.sourceSystemCodeY = value=='all'?undefined:value; fetchParams.current.caseStatus = ''; fetchParams.current.eventType = ''; fetchParams.current.page = 1; @@ -183,9 +205,9 @@ const UrbanOperation = ({ page: 1, hasNext: false, }); - getCityStatistics(); + getCityStatistics(value); getCategoryAnalysis(); - getAreaAnalysis(); + getAreaAnalysis(value); getEventsList(); }; useEffect(() => { @@ -194,26 +216,22 @@ const UrbanOperation = ({ getAreaAnalysis(); getEventsList(); }, []); - - return ( - { showSourceSelect&&
- + } + onChange={onChangeCaseSource} + /> +
+ )} - {eventStatistics?.total?.value} + + {eventStatistics?.total?.value} + 总量 @@ -239,7 +259,9 @@ const UrbanOperation = ({ - {eventStatistics?.rate?.value} + + {eventStatistics?.rate?.value} + % 办结率 @@ -255,7 +277,7 @@ const UrbanOperation = ({ >
{/* */} - +
diff --git a/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.less b/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.less index d09f740ebd3063437224ebe8650a26fd76a71cfb..fedd9e2920ee0ca8311ae1f28a6022baa99eca7c 100644 --- a/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.less +++ b/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.less @@ -236,4 +236,11 @@ font-weight: 700; } } +} + +.countBlue { + background: linear-gradient(180deg, #aafff6, #25bbff); + background-clip: 'text'; + -webkit-text-fill-color: transparent; + } \ No newline at end of file diff --git a/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.tsx b/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.tsx index 005252f122f7284c332e9ec2e52cca87f5e0561c..c061984839f168b25e27506ced8047d3708636de 100644 --- a/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.tsx +++ b/src/pages/NewHome/NewLeftSidebar/OperatingSituation/index.tsx @@ -1,7 +1,6 @@ import { useGlobalModalServices } from '@/pages/GlobalModalServices/provider'; import services from '@/services'; -import { formatNumber } from '@/utils/ui'; -import { CaretDownOutlined } from '@ant-design/icons'; +import { convertUnits, formatNumber } from '@/utils/ui'; import { useRequest } from 'ahooks'; import { DatePicker, Progress, Statistic, StatisticProps } from 'antd'; import dayjs from 'dayjs'; @@ -18,6 +17,27 @@ const formatter: StatisticProps['formatter'] = (value: any) => { /> ); }; + +const commonStatistic = ( + value: number | string, + fontSize: number | string = 30, +) => { + return ( + ( + + )} + /> + ); +}; + const OperatingSituation = () => { const [searchParams, setSearchParams] = useState({ type: 2 }); const { dispatch } = useGlobalModalServices(); @@ -137,7 +157,7 @@ const OperatingSituation = () => { datetType: searchParams?.type, lineData: data?.data?.timeItems['szcg']?.map((item: any) => ({ ...item, - + name: item.time, })), time: dayjs(searchParams?.time).format('YYYY-MM'), }, @@ -223,7 +243,8 @@ const OperatingSituation = () => { name: item.time, })), time: dayjs(searchParams?.time).format('YYYY-MM'), - showSourceSelect:true + showSourceSelect: true, + sourceType: 'wnywxt', }, }); }, @@ -274,13 +295,10 @@ const OperatingSituation = () => { />
- - - {item?.unit} + {commonStatistic(convertUnits(item.value)?.num, 36)} + + {convertUnits(item.value)?.unit} +
); @@ -304,49 +322,49 @@ const OperatingSituation = () => { dispatch.push('UrbanOperation', { title: '总体情况', props: { - sourceSystemCode: data?.data?.items?.find( - (item: any) => item.code === 'wnywxt', - )?.code, + // sourceSystemCode: data?.data?.items?.find( + // (item: any) => item.code === 'wnywxt', + // )?.code, datetType: searchParams?.type, - lineData:data?.data?.timeItems['城市管理综合问题总数']?.map( - (item: any) => ({ - ...item, - name: item.time, - }), - ), + lineData: data?.data?.timeItems[ + '城市管理综合问题总数' + ]?.map((item: any) => ({ + ...item, + name: item.time, + })), time: dayjs(searchParams?.time).format('YYYY-MM'), - showSourceSelect:true + showSourceSelect: true, + sourceType: 'all', }, }); }} > - + {commonStatistic(convertUnits(data?.data?.total?.value)?.num, 38)} - {formatNumber(data?.data?.total?.value)?.unit} + {convertUnits(data?.data?.total?.value)?.unit}
-
- 环比 +
+ + {/* 环比 - {/* */} + 0.25 - % + % */}
({ - ...item, - name: item.time, - }), - )} + data={ + data?.data?.timeItems['城市管理综合问题总数']?.map( + (item: any) => ({ + ...item, + name: item.time, + }), + ) || [] + } style={{ width: '100%', height: 64 }} />
@@ -358,36 +376,40 @@ const OperatingSituation = () => { />
- + {commonStatistic( + convertUnits(data?.data?.accept?.value)?.num, + )} - {formatNumber(data?.data?.accept?.value)?.unit} + {convertUnits(data?.data?.accept?.value)?.unit}
立案
-
+
{ + dispatch.push('ToDisposed', { + title: '待处置事件', + }); + }} + >
- + {commonStatistic( + convertUnits(data?.data?.disposing?.value)?.num, + )} - {formatNumber(data?.data?.waitDisposal?.value)?.unit} + {convertUnits(data?.data?.disposing?.value)?.unit}
-
应处置
+
处置中
@@ -398,44 +420,30 @@ const OperatingSituation = () => { />
- + {commonStatistic(convertUnits(data?.data?.close?.value)?.num)} - {formatNumber(data?.data?.close?.value)?.unit} + {convertUnits(data?.data?.close?.value)?.unit}
已结案
-
{ - dispatch.push('ToDisposed', { - title: '待处置事件', - }); - }} - > +
+ - - {formatNumber(data?.data?.disposing?.value)?.unit} - + %
-
处置中
+
结案率
@@ -451,13 +459,11 @@ const OperatingSituation = () => { }); }} > - + {commonStatistic( + convertUnits(data?.data?.totalKnotty?.value)?.num, + )} - {formatNumber(data?.data?.totalKnotty?.value)?.unit} + {convertUnits(data?.data?.totalKnotty?.value)?.unit}
@@ -496,14 +502,12 @@ const OperatingSituation = () => { style={{ background: 'rgb(255, 198, 20)' }} >
城市管理类 - + {commonStatistic( + convertUnits(data?.data?.cityKnotty?.value)?.num, + 24, + )} - {' '} - {formatNumber(data?.data?.cityKnotty?.value)?.unit} + {convertUnits(data?.data?.cityKnotty?.value)?.unit}
{ style={{ background: 'rgb(255, 95, 95)' }} >
其它 - + {commonStatistic( + convertUnits(data?.data?.otherKnotty?.value)?.num, + 24, + )} - {' '} - {formatNumber(data?.data?.otherKnotty?.value)?.unit} + {convertUnits(data?.data?.otherKnotty?.value)?.unit}
diff --git a/src/pages/NewHome/NewLeftSidebar/UrbanManagementIssues/PeopleComplaint/HighIncidenceTime/index.tsx b/src/pages/NewHome/NewLeftSidebar/UrbanManagementIssues/PeopleComplaint/HighIncidenceTime/index.tsx index f6dd4abebd4443f018fb4162bda4e5a6713a0c5c..365d67ee7dd028c62e242859987c1adb127a617d 100644 --- a/src/pages/NewHome/NewLeftSidebar/UrbanManagementIssues/PeopleComplaint/HighIncidenceTime/index.tsx +++ b/src/pages/NewHome/NewLeftSidebar/UrbanManagementIssues/PeopleComplaint/HighIncidenceTime/index.tsx @@ -122,7 +122,7 @@ const HighIncidenceTime: React.FC = () => { 高发时间 { 投诉类型分布 { const { dispatch } = useGlobalModalServices(); const handleBridgeClick = () => { - dispatch.push('BridgeManage'); + dispatch.push('BridgeManage', { + props: { + defaultViewType: 'bridge' + } + }); + }; + + const handleRoadClick = () => { + dispatch.push('BridgeManage', { + props: { + defaultViewType: 'road' + } + }); }; return ( @@ -98,6 +110,7 @@ const MunicipalFacilities: React.FC = () => { { // dispatch.push('PipelinePassage'); // }} diff --git a/src/services/CityProblem.ts b/src/services/CityProblem.ts index 2b94b7d4ac98cbb74ea1dfe9e49a19c67efda127..0c9be9417c49039be845ba5c1da15a10ea0555f9 100644 --- a/src/services/CityProblem.ts +++ b/src/services/CityProblem.ts @@ -119,7 +119,15 @@ export async function getCaseSourceTypeList() { }, ); } - +/**来源列表 */ +export async function getSourceSystemList() { + return request>( + urlProxyApis('/comprehensiveDiscovery/sourceSystemList'), + { + method: 'post', + }, + ); +} /** * diff --git a/src/services/Physicalsign.ts b/src/services/Physicalsign.ts index 7cfea43e00e34bb1b9a791d453de0a2fcdb7188d..5402df40137b26ca33f83c9540bd6c90f1a22fad 100644 --- a/src/services/Physicalsign.ts +++ b/src/services/Physicalsign.ts @@ -491,4 +491,14 @@ export async function getOverdueStatusCount(params: any): Promise { method: 'GET', params, }); -} \ No newline at end of file +} + +//疑难问题库统计 +export const getEventCountForLeft = (data: { + difficultFlag?: string; + emergencyFlag?: string; +}): Promise> => { + return request(urlProxyApis(`/tzzsEventInfo/getEventCountForLeft`), { + params: data, + }); +}; \ No newline at end of file diff --git a/src/utils/ui.ts b/src/utils/ui.ts index 4ee3f7c9b81dc4ffa0e84b361aeaf053da1c7bc4..eaae9fec41d88fbf88140355995aa148be283114 100644 --- a/src/utils/ui.ts +++ b/src/utils/ui.ts @@ -201,3 +201,28 @@ export function formatNumber( }; } } + +export function convertUnits(value: string | number): { num: number; unit: string } { + const numericValue = typeof value === 'string' ? parseFloat(value) : value; // 将字符串转换为数字 + + if (isNaN(numericValue)) { + console.log('输入的值无效'); // 处理无效输入 + return { + num: 0, + unit: '件' + } + } + + if (numericValue < 10000) { + return { num: numericValue, unit: '件' }; // 小于 10000,单位为件 + } else { + const convertedValue = numericValue / 10000; // 转换为万 + // 判断是否为整数 + console.log('isInteger', Number.isInteger(convertedValue)) + console.log(Number.isInteger(convertedValue) ? Math.floor(convertedValue) : parseFloat(convertedValue.toFixed(2))) + return { + num: Number.isInteger(convertedValue) ? Math.floor(convertedValue) : parseFloat(convertedValue.toFixed(2)), + unit: '万件' + }; // 如果是整数,不保留小数位 + } +} diff --git a/src/utils/variables.ts b/src/utils/variables.ts index c3b67e681671bc091dd4a56ad0dad1ebdb66303d..537dd0b4ca29a79ddd07473e5f5f63ca08a022c4 100644 --- a/src/utils/variables.ts +++ b/src/utils/variables.ts @@ -7,4 +7,4 @@ const IS_PROD = process.env.NODE_ENV === 'production' ? true : false; export const IMG_URL = IS_PROD ? 'FILE_IMG_URL' : 'https://xct.cdhncy.cn/file'; //登录统一地址 -export const LOGIN_URL = IS_PROD ? 'LOGIN_URL' : 'http://171.217.92.33:21602'; +export const LOGIN_URL = IS_PROD ? 'LOGIN_URL' : 'http://171.217.92.33:21602'; // https://10.1.214.178:3007 http://171.217.92.33:21602