0.0.9 • Published 1 year ago

map-point-config v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

安装依赖

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>
  )
0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago