Commit 59cc7cc4 authored by Bill's avatar Bill

fix: bug

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