Commit 401771cf authored by 田翔's avatar 田翔

fix: 代码优化

parent ad4fee0a
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.8.17", "version": "6.9.5",
"description": "6.8.17 设备选择增加传入参数", "description": "6.9.5 列表查看设备传参只读",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -3,7 +3,7 @@ import styles from './index.less' ...@@ -3,7 +3,7 @@ import styles from './index.less'
import { Button } from 'antd' import { Button } from 'antd'
import { import {
ArcGISSceneMap, ArcGISSceneMap,
ClickQuery, WorkFlowEquipmentQuery,
geomUtils, geomUtils,
GraphicsLayer, GraphicsLayer,
Graphic, Graphic,
...@@ -50,11 +50,12 @@ const CoordView = (props) => { ...@@ -50,11 +50,12 @@ const CoordView = (props) => {
zoom: 15 zoom: 15
}) })
} }
clickref.current = new ClickQuery({ clickref.current = new WorkFlowEquipmentQuery({
view: view.current, view: view.current,
offsetX: -150, offsetX: -150,
offsetY: -310, offsetY: -310,
continuous: false, continuous: false,
onlyWhatch: true,
...obj, ...obj,
callback: ({ clickPoint, matchPoint, data }) => { callback: ({ clickPoint, matchPoint, data }) => {
gisInfo = {} gisInfo = {}
...@@ -177,6 +178,7 @@ const CoordView = (props) => { ...@@ -177,6 +178,7 @@ const CoordView = (props) => {
okText={'确定'} okText={'确定'}
bodyStyle={{ height: 600, overflowY: 'auto', position: 'relative' }} bodyStyle={{ height: 600, overflowY: 'auto', position: 'relative' }}
destroyOnClose destroyOnClose
footer={null}
> >
<ArcGISSceneMap <ArcGISSceneMap
getMapInfo={getMapInfo} getMapInfo={getMapInfo}
......
...@@ -314,6 +314,7 @@ const Account = (props, ref) => { ...@@ -314,6 +314,7 @@ const Account = (props, ref) => {
} }
} }
setSubmitLoading(false); setSubmitLoading(false);
props?.submitOK?.()
}; };
const search = (values) => { const search = (values) => {
......
...@@ -3,7 +3,7 @@ import { Input, Button } from 'antd' ...@@ -3,7 +3,7 @@ import { Input, Button } from 'antd'
import { CompassOutlined, DownOutlined } from '@ant-design/icons' import { CompassOutlined, DownOutlined } from '@ant-design/icons'
import { import {
ArcGISSceneMap, ArcGISSceneMap,
ClickQuery, WorkFlowEquipmentQuery,
geomUtils, geomUtils,
GraphicsLayer, GraphicsLayer,
Graphic Graphic
...@@ -66,7 +66,11 @@ const Device = (props) => { ...@@ -66,7 +66,11 @@ const Device = (props) => {
zoom: 15 zoom: 15
}) })
} }
clickref.current = new ClickQuery({ if (clickref.current) {
clickref.current?.closetip()
clickref.current = null
}
clickref.current = new WorkFlowEquipmentQuery({
layerInfos: layersInfo, layerInfos: layersInfo,
view: view.current, view: view.current,
offsetX: -150, offsetX: -150,
...@@ -86,7 +90,8 @@ const Device = (props) => { ...@@ -86,7 +90,8 @@ const Device = (props) => {
} }
if (matchPoint) { if (matchPoint) {
geometrystr = `${matchPoint.x},${matchPoint.y}` geometrystr = `${matchPoint.x},${matchPoint.y}`
gisInfo = { layerName: data.layerName, gisCode: data.attributes.code } gisInfo = { layerName: data.layerName, gisCode: data.attributes.code, ...data.attributes }
console.log('gisInfo', gisInfo)
} else if (clickPoint) { } else if (clickPoint) {
geometrystr = `${clickPoint.x},${clickPoint.y}` geometrystr = `${clickPoint.x},${clickPoint.y}`
layer = new GraphicsLayer({ layer = new GraphicsLayer({
...@@ -144,7 +149,11 @@ const Device = (props) => { ...@@ -144,7 +149,11 @@ const Device = (props) => {
zoom: 15 zoom: 15
}) })
} }
clickref.current = new ClickQuery({ if (clickref.current) {
clickref.current?.closetip()
clickref.current = null
}
clickref.current = new WorkFlowEquipmentQuery({
view: view.current, view: view.current,
offsetX: -150, offsetX: -150,
offsetY: -310, offsetY: -310,
...@@ -163,7 +172,7 @@ const Device = (props) => { ...@@ -163,7 +172,7 @@ const Device = (props) => {
} }
if (matchPoint) { if (matchPoint) {
geometrystr = `${matchPoint.x},${matchPoint.y}` geometrystr = `${matchPoint.x},${matchPoint.y}`
gisInfo = { layerName: data.layerName, gisCode: data.attributes.code } gisInfo = { layerName: data.layerName, gisCode: data.attributes.code, ...data.attributes }
} else if (clickPoint) { } else if (clickPoint) {
geometrystr = `${clickPoint.x},${clickPoint.y}` geometrystr = `${clickPoint.x},${clickPoint.y}`
layer = new GraphicsLayer({ layer = new GraphicsLayer({
...@@ -200,12 +209,27 @@ const Device = (props) => { ...@@ -200,12 +209,27 @@ const Device = (props) => {
const onOk = () => { const onOk = () => {
onChange(geometrystr) onChange(geometrystr)
console.log('fieldshine', fieldshine, gisInfo)
let { paths } = addons.getSchemaByPath('#') let { paths } = addons.getSchemaByPath('#')
if (Array.isArray(paths)) { if (Array.isArray(paths)) {
paths.forEach(v => { paths.forEach(v => {
let values = addons.getValue(v) let values = addons.getValue(v)
if (isObject(values)) { if (isObject(values)) {
for (let key in values) { for (let key in values) {
if (Array.isArray(fieldshine) && fieldshine.length) {
fieldshine.forEach(item => {
if (item.toField === key && gisInfo?.[item.fromField]) {
const schema = addons.getSchemaByPath(`${v}.${key}`);
if (['FileUpload', 'TextInput'].includes(schema.widget)) {
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo?.[item?.fromField] });
} else if (['NumberInput'].includes(schema.widget)) {
addons.setValueByPath(`${v}.${key}`, gisInfo?.[item?.fromField] + '')
} else {
addons.setValueByPath(`${v}.${key}`, gisInfo?.[item?.fromField])
}
}
})
}
if (key === 'GIS编码' && gisInfo.gisCode) { if (key === 'GIS编码' && gisInfo.gisCode) {
const schema = addons.getSchemaByPath(`${v}.${key}`); const schema = addons.getSchemaByPath(`${v}.${key}`);
if (['FileUpload', 'TextInput'].includes(schema.widget)) { if (['FileUpload', 'TextInput'].includes(schema.widget)) {
......
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