Commit b1884113 authored by 田翔's avatar 田翔

fix: 搜索坐标地名原样输出

parent 3ff0cd3a
{
"name": "panda-xform",
"version": "6.9.18",
"description": "6.9.18 台账选择器支持存储ID",
"version": "6.9.20",
"description": "6.9.20 搜索坐标地名原样输出",
"keywords": [
"panda-xform"
],
......
......@@ -169,7 +169,7 @@ const TablePack = (props, ref) => {
}
//关联表单表头
const getRelevanceColumnProps = ({ json, field, isEdit, autoArray }) => {
const getRelevanceColumnProps = ({ json, field, isEdit, autoArray, accountFieids }) => {
const { fieldName, columnWidth, isSort, accurateSearch, alignment } = field
const { widget } = json?.[fieldName] || {}
let searchProps = {}
......@@ -254,7 +254,14 @@ const TablePack = (props, ref) => {
},
}),
render: (value, record) => {
let props = { ...json[fieldName], fieldName, value, autoArray, record: { ...record } }
let props = {
...json[fieldName],
fieldName,
value,
autoArray,
disabled: !accountFieids?.some(v => v.fieldName === fieldName && v.isEdit),
record: { ...record },
}
if (isEdit && !notUse?.includes('edit')) {
return (
<ValueEdit
......@@ -358,13 +365,13 @@ const TablePack = (props, ref) => {
showField.forEach((v, i) => {
if (parent === '关联表单') {
// array.push(getRelevanceColumnProps(json, v, isEdit))
array.push(getRelevanceColumnProps({ json, field: v, isEdit, autoArray }))
array.push(getRelevanceColumnProps({ json, field: v, isEdit, autoArray, accountFieids }))
} else {
array.push(getColumnProps(json, v))
}
})
return array
}, [parent, formJson, showField, fieldResize, filteredInfo, sortedInfo, isEdit, dataSource])
}, [parent, formJson, showField, fieldResize, filteredInfo, sortedInfo, isEdit, dataSource, accountFieids])
const showColumns = useMemo(() => {
return fileColumns.filter(v => checks.includes(v.dataIndex))
......
......@@ -36,6 +36,7 @@ const Coordinate = (props) => {
const [visible, setVisible] = useState(false)
const [initCoordinate, setInitCoordinate] = useState([])
const [currentPointerCoordinate, setCurrentPointerCoordinate] = useState([])
const [targetPathText, setTargetPathText] = useState('')
const [text, setText] = useState(presetValue ? '加载中...' : '(空)')
const [put, setPut] = useState(true)
const [view, setView] = useState(null)
......@@ -127,6 +128,7 @@ const Coordinate = (props) => {
target: 'erroSendUpWidget',// 随便写
toolTip: '左键选择位置',
drawEnd: geometry => {
setTargetPathText('')
setCurrentPointerCoordinate([geometry.x, geometry.y])
coordGetLayer && coordGetLayer.removeAll()
const coordGraphic = createGraphic(geometry)
......@@ -168,18 +170,22 @@ const Coordinate = (props) => {
if (addressSync) {
let targetPath = getTargetPath(addressSync)
if (targetPath) {
let LngLat = mercatorToLngLat(currentPointerCoordinate[0], currentPointerCoordinate[1])
let postStr = {
lon: LngLat[0],
lat: LngLat[1],
ver: 1,
}
let url = `http://api.tianditu.gov.cn/geocoder?postStr=${JSON.stringify(postStr)}&type=geocode&tk=a1d480f55b805db96e1ed295e62c72b1`
const { code, data } = await placeAroundRelay(url)
if (code === '0' && isJson(data)) {
let res = JSON.parse(data) || {}
let text = res?.result?.addressComponent?.poi || res?.result?.formatted_address || ''
addons.setValue(targetPath, text)
if (targetPathText) {
addons.setValue(targetPath, targetPathText)
} else {
let LngLat = mercatorToLngLat(currentPointerCoordinate[0], currentPointerCoordinate[1])
let postStr = {
lon: LngLat[0],
lat: LngLat[1],
ver: 1,
}
let url = `http://api.tianditu.gov.cn/geocoder?postStr=${JSON.stringify(postStr)}&type=geocode&tk=a1d480f55b805db96e1ed295e62c72b1`
const { code, data } = await placeAroundRelay(url)
if (code === '0' && isJson(data)) {
let res = JSON.parse(data) || {}
let text = res?.result?.addressComponent?.poi || res?.result?.formatted_address || ''
addons.setValue(targetPath, text)
}
}
}
}
......@@ -220,6 +226,11 @@ const Coordinate = (props) => {
let array = value.location.split(',')
let point = lngmkt({ lng: Number(array[0]), lat: Number(array[1]) })
onChange(`${point.x},${point.y}`)
if (value?.name) {
setTargetPathText(`${value?.name}`)
} else {
setTargetPathText('')
}
}
}
......
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