Commit c6ace4be authored by 田翔's avatar 田翔

fix: 地址转化地名优化

parent 3b8604aa
{
"name": "panda-xform",
"version": "6.10.13",
"description": "6.10.13 坐标控件回填地址名称支持文本形态",
"version": "6.10.14",
"description": "6.10.14 地址转化地名优化",
"keywords": [
"panda-xform"
],
......
This diff is collapsed.
@imgSrc: '../../../assets/images/designer';
.helpTitle {
height: 24px;
display: flex;
align-items: center;
.titleIcon {
width: 23px;
height: 23px;
background: url('@{imgSrc}/控件说明.png');
background-size: 100% 100%;
margin-right: 10px;
}
.titleText {
color: black;
font-weight: bold;
font-size: 16px;
}
}
.help-content {
width: 100%;
height: 100%;
display: flex;
.c-left {
width: 120px;
height: 100%;
overflow: auto;
.t-item {
width: 100%;
.m-header {
width: 100%;
padding-left: 15px;
height: 40px;
line-height: 40px;
position: relative;
color: #646464;
}
.m-content {
overflow: hidden;
width: 100%;
transition: all 0.3s ease-in-out;
.t-list {
width: 100%;
height: 40px;
line-height: 40px;
padding-left: 15px;
&:hover {
cursor: pointer;
}
&[active='true'] {
border-left: 2px solid #1685FF;
background: #E9F3FF;
}
}
}
}
}
.c-right {
width: calc(100% - 120px);
padding: 10px;
height: 100%;
overflow: auto;
background: #F1F1F1;
transition: all 0.3s all;
.t-box {
margin-bottom: 10px;
border-radius: 5px;
background: white;
.x-title {
padding-left: 10px;
width: 100%;
height: 40px;
line-height: 40px;
background: linear-gradient(to right, #EAF3FF, #FCFDFF);
font-size: 14px;
font-weight: bold;
}
.x-content {
padding: 10px;
color: #646464;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -10,6 +10,30 @@ import FormRender from '../FormRender'
import { isObject, getVerify, setFieldJson, getNanoid } from '../../utils'
import Drag from '../components/Drag'
import styles from '../../main.less'
import Help from './Help'
const options = [
{
title: '布局控件',
one: '',
background: '#F8F7FF',
},
{
title: '基础控件',
one: '单行文本',
background: '#F4F8FF',
},
{
title: 'GIS控件',
one: '地图坐标',
background: '#F2F9F4',
},
{
title: '高级控件',
one: '富文本',
background: '#FDF8EC',
},
]
const FormDesigner = (props, ref) => {
......@@ -30,6 +54,7 @@ const FormDesigner = (props, ref) => {
const [open, setOpen] = useState(false)
const designerRef = useRef(null)
const formRenderRef = useRef(null)
const helpRef = useRef(null)
const settingsParent = useMemo(() => {
let settingsParent = []
......@@ -355,8 +380,42 @@ const FormDesigner = (props, ref) => {
return null
}
const addHelp = () => {
let eles = document.querySelectorAll('.left-layout .f6')
eles.forEach((v, i) => {
let div = document.createElement('div')
div.setAttribute('class', 'iocn-help')
div.setAttribute('type', options?.[i]?.title)
v.appendChild(div)
div.onclick = (e) => {
helpRef.current.open(options?.[i]?.one)
}
})
}
const changeUI = () => {
let eles = document.querySelectorAll('.left-layout .pl0')
eles.forEach((ele, i) => {
let item = ele.querySelectorAll('.left-item')
item.forEach(sls => {
sls.style.background = options?.[i]?.background
})
})
}
const changeElement = () => {
// addHelp()
changeUI()
}
useEffect(() => {
setTimeout(() => {
changeElement()
}, 1000)
}, [])
return (
<div className={styles.pandaXform} style={{ height: '100%' }}>
<div className={styles.pandaXform} style={{ height: '100%', padding: 0 }}>
<div style={{ width: '100%', height: '100%' }}>
<Generator
// configProvider={{ prefixCls: prefixClsPandaXform }}
......@@ -405,13 +464,10 @@ const FormDesigner = (props, ref) => {
<FormRender
ref={formRenderRef}
schemaValues={{ formJson: schema }}
// codes={{
// 工单编号: '12421413431',
// 事件编号: 'PO230000013',
// }}
/>
</Drag>
</div>
<Help ref={helpRef} />
</div>
)
......
......@@ -174,9 +174,10 @@ const Coordinate = (props) => {
addons.setValue(targetPath, targetPathText)
} else {
let LngLat = mercatorToLngLat(currentPointerCoordinate[0], currentPointerCoordinate[1])
let newCoord = gcj02_To_gps84(LngLat[0], LngLat[1])
let postStr = {
lon: LngLat[0],
lat: LngLat[1],
lon: newCoord.lng,
lat: newCoord.lat,
ver: 1,
}
let url = `http://api.tianditu.gov.cn/geocoder?postStr=${JSON.stringify(postStr)}&type=geocode&tk=a1d480f55b805db96e1ed295e62c72b1`
......@@ -208,13 +209,62 @@ const Coordinate = (props) => {
onChange(currentPointerCoordinate.join(','))
}
/**火星转84*/
const gcj02_To_gps84 = (lng, lat) => {
const pi = 3.1415926535897932384626;
const a = 6378245.0;
const ee = 0.00669342162296594323;
const x_pi = (pi * 3000.0) / 180.0;
const R = 6378137;
const transformLat = (x, y) => {
var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
ret += ((20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0) / 3.0;
ret += ((20.0 * Math.sin(y * pi) + 40.0 * Math.sin((y / 3.0) * pi)) * 2.0) / 3.0;
ret += ((160.0 * Math.sin((y / 12.0) * pi) + 320 * Math.sin((y * pi) / 30.0)) * 2.0) / 3.0;
return ret;
};
const transformLng = (x, y) => {
var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
ret += ((20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0) / 3.0;
ret += ((20.0 * Math.sin(x * pi) + 40.0 * Math.sin((x / 3.0) * pi)) * 2.0) / 3.0;
ret += ((150.0 * Math.sin((x / 12.0) * pi) + 300.0 * Math.sin((x / 30.0) * pi)) * 2.0) / 3.0;
return ret;
};
const transform = (lng, lat) => {
var dLat = transformLat(lng - 105.0, lat - 35.0);
var dLng = transformLng(lng - 105.0, lat - 35.0);
var radLat = (lat / 180.0) * pi;
var magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
var sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * pi);
dLng = (dLng * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * pi);
var mgLat = lat + dLat;
var mgLng = lng + dLng;
var newCoord = {
lng: mgLng,
lat: mgLat,
};
return newCoord;
};
var coord = transform(lng, lat);
var lontitude = lng * 2 - coord.lng;
var latitude = lat * 2 - coord.lat;
var newCoord = {
lng: lontitude,
lat: latitude,
};
return newCoord;
};
const getAddress = async (presetValue) => {
if (presetValue) {
let coordinate = presetValue.split(',')
let LngLat = mercatorToLngLat(coordinate[0], coordinate[1])
let newCoord = gcj02_To_gps84(LngLat[0], LngLat[1])
let postStr = {
lon: LngLat[0],
lat: LngLat[1],
lon: newCoord.lng,
lat: newCoord.lat,
ver: 1,
}
let url = `http://api.tianditu.gov.cn/geocoder?postStr=${JSON.stringify(postStr)}&type=geocode&tk=a1d480f55b805db96e1ed295e62c72b1`
......
......@@ -9,7 +9,6 @@ const Placeholder = (props) => {
const { title } = addons.formData
const [visible, setVisible] = useState(false)
const [areaValue, setAreaValue] = useState('')
console.log('props', props)
const inputChange = (e) => {
onChange(e.target.value)
......
......@@ -6,7 +6,6 @@ import { filenameVerification } from '../../../../../utils'
const TemplateFile = (props) => {
console.log('TemplateFile', props)
const site = window.globalConfig?.userInfo?.site || window.globalConfig?.userInfo?.LocalSite
const { value, onChange, addons } = props
......
@import '~antd/es/style/themes/default.less';
@imgSrc: './assets/images/designer';
@disabledBgColor: rgb(248, 250, 252);
@disabledColor: rgba(0, 0, 0, 0.7);
......@@ -12,6 +13,86 @@ body #app {
}
}
.pandaXform {
//最外层样式
.dnd-container.edit>.field-wrapper.relative.w-100 {
border: none;
padding: 0 !important;
}
.object>.field-wrapper.relative.w-100 {
padding: 0 !important;
margin: 0 !important;
}
//内层框线样式
.fr-content.ml3 {
.field-wrapper.relative.w-100 {
border: none !important;
}
}
//
.fr-field-complex {
border: none !important;
}
.flex.flex-wrap.pl0 {
padding: 10px;
padding-bottom: 0;
}
//选中样式
.field-wrapper.selected-field-wrapper.relative.w-100 {
background: #ecf7ff !important;
}
.left-layout {
width: 267px !important;
padding: 7px;
background: #F1F3F6;
&::-webkit-scrollbar {
width: 0;
}
}
.left-layout>div {
border-radius: 5px;
background: white;
.f6 {
position: relative;
padding: 5px 10px;
margin: 0;
font-weight: bold;
.iocn-help {
position: absolute;
right: 10px;
top: 10px;
width: 12px;
height: 12px;
background: url('@{imgSrc}/帮助.png');
background-size: 100% 100%;
&:hover {
cursor: pointer;
}
}
}
.pl0 {
margin-bottom: 7px;
}
}
.mid-layout.pr2 {
border: none;
}
}
.formRender {
.fr-content {
.fr-field.w-100.flex-column {
......@@ -34,7 +115,6 @@ body #app {
padding-top: 0;
.fr-generator-container .left-layout {
padding: 10px 0 0 0;
.left-item {
justify-content: left;
......
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