map-point-config
v0.0.9
Published
npm i --save map-point-config
Downloads
2
Readme
安装依赖
npm i --save map-point-config
需手动导入 inputNumber 样式 在全局 less 文件中 @import '~antd/es/input-number/style/index.less';
import MapPointConfig from 'map-point-config';
// 详情
<MapPointConfig mode="DETAIL" value={pointLngLat} />
//
/**
* 表单提交
* @param 提交的数据
* @description 处理数据注意接口约束
*/
const handleOk = useDebounceFn(async () => {
const info: CurrentItem & { machineType?: any, plantPicture?: any, oid?: any } & Record<string, any> = await form?.validateFields();
info.lng = info?.lnglat?.[0];
info.lat = info?.lnglat?.[1];
delete info?.lnglat;
onOk({
...info!,
});
});
/** 基础信息 */
const formViewProps1: FormViewProps = {
onCancel: modalProps?.onCancel,
footerVisible: false,
type: 2,
list: [
{
label: '经纬度',
name: 'lnglat',
view: <MapPointConfig keepDecimalNum={6} onChange={(info) => {
form?.setFieldsValue({
lnglat: info,
address: info?.[2],
})
}} />
},
],
}
// 回显
return (
<Form form={form} onFinish={handleOk} initialValues={{
lnglat: currentItem?.lng && currentItem?.lat ? [currentItem?.lng, currentItem?.lat, currentItem?.address] : defaultPoint,
}}>
<FormView {...formViewProps1} />
</Form>
)