Commit 59cc7cc4 authored by Bill's avatar Bill

fix: bug

parent 082d1ef7
...@@ -50,7 +50,7 @@ const HandlingRoute = { ...@@ -50,7 +50,7 @@ const HandlingRoute = {
path: '/memberCenter/handling/assign/tobeAddQuery/add', path: '/memberCenter/handling/assign/tobeAddQuery/add',
name: '新增成产通知单(新建)', name: '新增成产通知单(新建)',
icon: 'smile', icon: 'smile',
component: '@/pages/handling/assign/add', component: '@/pages/handling/assign/create',
hideInMenu: true hideInMenu: true
}, },
// 指派生产通知单 -> 待新增生产通知单详情 // 指派生产通知单 -> 待新增生产通知单详情
...@@ -67,7 +67,7 @@ const HandlingRoute = { ...@@ -67,7 +67,7 @@ const HandlingRoute = {
path: '/memberCenter/handling/assign/tobeAddQuery/edit', path: '/memberCenter/handling/assign/tobeAddQuery/edit',
name: '修改', name: '修改',
icon: 'smile', icon: 'smile',
component: '@/pages/handling/assign/add', component: '@/pages/handling/assign/create',
hideInMenu: true hideInMenu: true
}, },
// 指派生产通知单 -> 待审核通知单(一级) // 指派生产通知单 -> 待审核通知单(一级)
......
...@@ -60,6 +60,8 @@ const defaultFooterDom = ( ...@@ -60,6 +60,8 @@ const defaultFooterDom = (
/> />
); );
const DEFAULT_COLLAPSED_LIST = ["/memberCenter/home", "/memberCenter/noAuth"];
const BasicLayout: React.FC<BasicLayoutProps> = (props) => { const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
const { const {
// dispatch, // dispatch,
...@@ -77,7 +79,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => { ...@@ -77,7 +79,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
const isHome = location.pathname === '/memberCenter/home' const isHome = location.pathname === '/memberCenter/home'
const handleMenuCollapse = (payload: boolean): void => { const handleMenuCollapse = (payload: boolean): void => {
if(isHome) { if(DEFAULT_COLLAPSED_LIST.includes(location.pathname)) {
return ; return ;
} }
setCollapsed(payload) setCollapsed(payload)
...@@ -137,7 +139,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => { ...@@ -137,7 +139,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
}, [currentRouter, collapsed]) }, [currentRouter, collapsed])
useLayoutEffect(() => { useLayoutEffect(() => {
if(isHome) { if(DEFAULT_COLLAPSED_LIST.includes(location.pathname)) {
setCollapsed(true) setCollapsed(true)
} else { } else {
setCollapsed(false); setCollapsed(false);
...@@ -165,7 +167,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => { ...@@ -165,7 +167,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
</Link> </Link>
)} )}
collapsed={collapsed} collapsed={collapsed}
collapsedButtonRender={(flag) => (isHome ? null : flag ? <MenuUnfoldOutlined /> : <MenuFoldOutlined/>) } collapsedButtonRender={(flag) => (DEFAULT_COLLAPSED_LIST.includes(location.pathname) ? null : flag ? <MenuUnfoldOutlined /> : <MenuFoldOutlined/>) }
onCollapse={handleMenuCollapse} onCollapse={handleMenuCollapse}
disableContentMargin={currentRouter?.noMargin !== undefined} disableContentMargin={currentRouter?.noMargin !== undefined}
breadcrumbRender={(routers = []) => [ breadcrumbRender={(routers = []) => [
......
...@@ -73,10 +73,10 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => { ...@@ -73,10 +73,10 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
const handleOpenchange = (keys: string[]) => { const handleOpenchange = (keys: string[]) => {
changeOpenKeys(keys) changeOpenKeys(keys)
} }
/** @tofix 这里体验不好,不太明白点击子路由的时候为什么需要去reload */
const clickMenuItem = ({ item, key, keyPath, domEvent }) => { const clickMenuItem = ({ item, key, keyPath, domEvent }) => {
// 对比url和点击项的key 相同的话重载页面 并清空筛选的store // 对比url和点击项的key 相同的话重载页面 并清空筛选的store
if(key === currentSelectKey[currentSelectKey.length-1]) { if(key === pathname) {
clearHeightSearchParams() clearHeightSearchParams()
window.location.reload() window.location.reload()
} }
......
...@@ -75,7 +75,7 @@ const WarningArea = () => { ...@@ -75,7 +75,7 @@ const WarningArea = () => {
<div className={styles.radioContainer}> <div className={styles.radioContainer}>
<CustomizeRadio options={warningOptions} /> <CustomizeRadio options={warningOptions} />
</div> </div>
<RecordList height={384} /> <RecordList height={384} dataSource={[]}/>
</div> </div>
</div> </div>
</Card> </Card>
......
...@@ -10,68 +10,42 @@ import Geom from 'bizcharts/lib/geometry' ...@@ -10,68 +10,42 @@ import Geom from 'bizcharts/lib/geometry'
import * as turf from '@turf/turf'; import * as turf from '@turf/turf';
import DataSet from '@antv/data-set'; import DataSet from '@antv/data-set';
interface Iprops {
mapData: any,
}
function keepMapRatio(mapData, c, type) {
if (mapData && turf) {
// 获取数据外接矩形,计算宽高比
const bbox = turf.bbox(mapData);
const width = bbox[2] - bbox[0];
const height = bbox[3] - bbox[1];
const ratio = height / width;
const cWidth = c.width; type PropertiesType = {
const cHeight = c.height; acroutes: [100000],
const cRatio = cHeight / cWidth; adchar: null,
adcode: "110000",
let scale = {}; center: number[],
centroid: number[],
if (cRatio >= ratio) { childrenNum: number
const halfDisRatio = (cRatio - ratio) / 2 / cRatio; level: string,
scale = { name: string,
x: { parent: {
range: [0, 1], adcode: number,
},
y: {
range: [halfDisRatio, 1 - halfDisRatio],
}, },
}; subFeatureIndex: number,
} else { /** 值 */
const halfDisRatio = ((1 / cRatio - 1 / ratio) / 2) * cRatio; size: number,
scale = { }
y: { interface Iprops {
range: [0, 1], mapData: {
}, type: "FeatureCollection",
x: { features: {
range: [halfDisRatio, 1 - halfDisRatio], geometry: {
coordinates: [],
type: "MultiPolygon",
}, },
}; properties: PropertiesType,
} type: "Feature"
const curScaleXRange = c.getScaleByField('x').range;
const curScaleYRange = c.getScaleByField('y').range;
console.log(curScaleYRange, scale.y.range);
if (
curScaleXRange[0] !== scale.x.range[0] ||
curScaleXRange[1] !== scale.x.range[1] ||
curScaleYRange[0] !== scale.y.range[0] ||
curScaleYRange[1] !== scale.y.range[1]
) {
setTimeout(() => {
c.scale(scale);
c.render(true);
}, 1);
}
} }
},
} }
const colors = '#075A84,#3978A4,#6497C0,#91B6D7,#C0D6EA,#F2F7F8' type SelectEleType = {
.split(',') /** 省名 */
.reverse(); name: string,
properties: PropertiesType
}
const MapChart: React.FC<Iprops> = (props: Iprops) => { const MapChart: React.FC<Iprops> = (props: Iprops) => {
// const [mapData, setMapData] = useState(undefined) // const [mapData, setMapData] = useState(undefined)
...@@ -103,6 +77,13 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => { ...@@ -103,6 +77,13 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => {
x: { sync: true }, x: { sync: true },
y: { sync: true }, y: { sync: true },
}; };
const onSelectProvince = (e: any) => {
const { data } = e;
const elementData = data.data as SelectEleType;
console.log(elementData)
}
return ( return (
<div style={{ background: '#FAFBFC'}}> <div style={{ background: '#FAFBFC'}}>
<Chart <Chart
...@@ -115,9 +96,11 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => { ...@@ -115,9 +96,11 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => {
autoFit autoFit
placeholder={<div>Loading</div>} placeholder={<div>Loading</div>}
padding={[20, 0, 0, 0]} padding={[20, 0, 0, 0]}
onAfterRender={(e, c) => { // onAfterRender={(e, c) => {
keepMapRatio(mapData, c, "rerender") // keepMapRatio(mapData, c, "rerender")
}} // }}
onPlotClick={onSelectProvince}
> >
<Coord reflect="y" /> <Coord reflect="y" />
<Tooltip title="name" /> <Tooltip title="name" />
...@@ -125,12 +108,22 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => { ...@@ -125,12 +108,22 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => {
type="polygon" type="polygon"
position="x*y" position="x*y"
style={{ style={{
fill: '#EDEEEF',
stroke: '#fff', stroke: '#fff',
lineWidth: 1, lineWidth: 1,
fillOpacity: 0.85, fillOpacity: 0.85,
}} }}
color={['centroidY', '#777090-#493398']} color={
['properties', (v) => {
if (v.size > 220) {
return '#F7A128'
} else if (v.size > 160) {
return '#4B8BFA'
} else if (v.size > 80) {
return '#E05A55'
}
return '#EDEEEF'
}]
}
tooltip={[ tooltip={[
'name*properties', 'name*properties',
(t, p) => { (t, p) => {
...@@ -145,9 +138,9 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => { ...@@ -145,9 +138,9 @@ const MapChart: React.FC<Iprops> = (props: Iprops) => {
state={{ state={{
selected: { selected: {
style: (t) => { style: (t) => {
return { fill: 'purple', stroke: '#ccc',lineWidth:1 } return { fill: 'purple', stroke: 'green',lineWidth:1 }
}
} }
},
}} }}
/> />
<Interaction type='element-single-selected' /> <Interaction type='element-single-selected' />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment