2.3.25 • Published 1 month ago

fan-planar-viewer v2.3.25

Weekly downloads
2
License
ISC
Repository
-
Last release
1 month ago

二维地图工具

用于展示SVG图纸及绘制图形等工具

编辑功能

1、将CAD转换成.svg文件的建筑底图展示在画布中,并在其基础上绘制添加新的形状与设备图层

2、形状绘制涉及的功能有:移动、修改相关属性、复制、删除等功能

用法

import {PlanarEditor} from 'fan-planar-viewer'
或 import PlanarEditor from 'fan-planar-viewer/dist/planarEditor.js'

<PlanarEditor id="planarEditorID"
                    defaultConfig={{icons: []}}
                    layerFile={[]}
                    planarGraphFile={'/download/map/layout/20191118142438207_23.svg'}
                    displayMode={'edit'}
                    usePlanarEvent={(evnts) => console.log(evnts)}
                    usePlanarState={(state) => console.log(state)}
                    onSave={(list) => {
                      console.log('当前需要保存的控件数量:', list.length, list);
                    }}
                    onDeleteSticky={(data, callback) => {
                      // TODO   如果已绑定在数据库中,即 data.id有值,则需要调用删除接口,成功返回则调用回调,需要过滤对应包含ID的数据
                      message.success('删除成功(如果已绑定在数据库中,即 data.id有值,则需要调用删除接口,成功返回则调用回调)');
                      console.log('删除的数据值:', data)
                      // 单个删除为字符串,多个值为数组
                      callback(Array.isArray(data) ? data.map(child => child.widgetUuid) : data.widgetUuid);
                    }}
                    deviceDataInfo={{
                      placeId: currentPlaceId, // 楼层ID
                      deviceTypeId: currentSysType, // 设备一级分类ID(系统类别)
                      placeTreeList, // 楼层数据
                      deviceTypeList: deviceTypeTreeList, // 系统类别select列表数据
                      deviceSubTypeList: activeSubDeviceType, // 设备类别select列表数据
                      deviceList, // 当前设备类别下的所有设备
                    }}
                    onSelectSticky={handleSelectSticky}
                    // 回路组合相关配置
                    loopConfig={{
                      loopList: [],
                      loopOnSave: ()=> {},
                      loopOnUpdate: ()=> {},
                      loopOnDelete: ()=> {}
                    }}
                    // 设备组合相关配置
                    equipConfig={{
                      equipList:  [],
                      equipOnSave: ()=> {},
                      equipOnUpdate: ()=> {},
                      equipOnDelete: ()=> {}
                    }}
                    // 左侧顶部扩展内容
                    extraSide={renderSideExtraPlace()} 
                    // 顶部靠右扩展内容
                    extraTool={<Space>
                      {/*<Switch  checkedChildren="锁定" unCheckedChildren="解锁" defaultChecked/>*/}
                      <Button type="primary" ghost onClick={() => {
                        console.log('业务功能,点击显示弹窗或获取文件');
                      }}>变更底图</Button>
                    </Space>}
                    // 右侧扩展内容
                    extraRight={renderRightExtraStatic()}
                    onClickBinding={(data, deviceId, type, callSuccess) => {
                      console.log('点击绑定事件,TODO需要加入接口调用,并且对于未保存的控件,在绑定成功时,将同时保存至数据库中,不需要操作画布中的“保存”', type)
                      // type = 'binding' 代表绑定操作,type = 'unbinding'代表解绑操作
                      if (type === 'binding') {
                        const responseParams = {
                          ...data,
                          deviceId
                        } // 可能会当前绑定的ID等其他参数[至少包含deviceId跟widgetUuid]也有可能返回当前控件所属的ID值
                        callSuccess(responseParams) // 如果绑定成功,则调用回调,绑定失败则不调用,即不会更新当前控件设备ID的状态
                      }
                      if (type === 'unbinding') {
                        callSuccess({ ...data, deviceId:undefined }) // 如果解绑成功,则调用回调,绑定失败则不调用,即不会更新当前控件设备ID的状态
                      }
                    }}

      ></PlanarEditor>

展示功能

展示已绘制的建筑底图与设备图层,对已绑定设备可做点击等操作

用法

import {PlanarEditor} from 'fan-planar-viewer'
或 import PlanarEditor from 'fan-planar-viewer/dist/planarEditor.js'

<PlanarEditor id="planarEditorShow"
                    defaultConfig={{icons: []}}
                    layerFile={[]}
                    planarGraphFile={'/download/map/layout/20191118142438207_23.svg'}
                    displayMode={'show'}
                    usePlanarEvent={(evnts) => console.log(evnts)}
                    usePlanarState={(state) => console.log(state)}
                    onHoverSticky={(nodeData, callUpdate, e, node)=>{} }
                    onClickSticky={(nodeData)=> {}}
      ></PlanarEditor>

组态编辑器

绘制与展示设备组态图

编辑用法

import { GraphicEditor } from 'fan-planar-viewer/dist/graphic.js';
或 import { GraphicEditor } from 'fan-planar-viewer';
  <GraphicEditor designInfo={designInfo} additionalTools={additionalTools} absPath={absPath}
                    modelListData={modelListData}
                    attributionsList={currentAttributions}
                    updateFetching={updateFetching} // 更新请求数据
                    comImageGroup={currentCompImageGroup}
                    uploaderBgImage={doUploaderImage}
     />

预览用法

import { GraphicPreview } from 'fan-planar-viewer/dist/graphic.js';
或 import { GraphicPreview } from 'fan-planar-viewer';
 <GraphicPreview designInfo={designInfo} additionalTools={additionalTools} />

插件参考

拖放组件: https://react-dnd.github.io/react-dnd/docs/api/use-drag

注:antd 版本不能使用超过antd@4.23.6

若安装antd@4.24.12以上版本,在弹窗上使用二维地图则会报错

图片

2.3.25

1 month ago

2.3.24

7 months ago

2.3.23

8 months ago

2.3.22

9 months ago

2.3.21

9 months ago

2.3.20

10 months ago

2.2.3-down

11 months ago

2.3.17

11 months ago

2.3.16

11 months ago

2.3.19

10 months ago

2.3.18

10 months ago

2.3.15

11 months ago

2.3.9

1 year ago

2.3.13

11 months ago

2.3.12

12 months ago

2.3.14

11 months ago

2.3.11

12 months ago

2.3.10

1 year ago

2.3.8

1 year ago

2.3.7

1 year ago

2.3.6

1 year ago

2.2.10-beta-1.0

1 year ago

2.2.10-beta-1.1

1 year ago

2.2.3

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.3.0

1 year ago

2.3.2

1 year ago

2.2.2-down

1 year ago

2.3.1

1 year ago

2.3.4

1 year ago

2.3.3

1 year ago

2.3.5

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.5-beta

1 year ago

2.2.1-down

1 year ago

2.2.2

2 years ago

2.2.0-down

1 year ago

2.2.1

2 years ago

2.1.17-down

2 years ago

2.2.0

2 years ago

2.2.0-beta

2 years ago

2.1.17

2 years ago

2.1.18

2 years ago

2.1.19

2 years ago

2.1.20

2 years ago

2.1.16

2 years ago

2.1.16-down

2 years ago

2.1.14-down

3 years ago

2.1.15-down

3 years ago

2.1.14

3 years ago

2.1.15

3 years ago

2.1.12-down

3 years ago

2.1.13-down

3 years ago

2.1.12

3 years ago

2.1.13

3 years ago

2.1.11-down

3 years ago

2.1.11

3 years ago

2.1.10

3 years ago

2.1.10-down

3 years ago

2.1.9

3 years ago

2.1.8

3 years ago

2.1.8-down

3 years ago

2.1.9-down

3 years ago

2.1.7-down

3 years ago

2.1.7

3 years ago

2.1.6

3 years ago

2.1.6-down

3 years ago

2.1.5

3 years ago

2.1.5-down

3 years ago

2.1.4-down

3 years ago

2.1.4

3 years ago

2.1.3-down

3 years ago

2.1.3

3 years ago

2.1.2-down

3 years ago

2.1.2-alone

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

1.2.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.1.2

4 years ago

2.0.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago