工具
This commit is contained in:
@ -1,138 +1,141 @@
|
||||
import Dialog from '../BaseDialog'
|
||||
import { Proj } from './proj'
|
||||
import { legp } from '../Obj/Element/datalist';
|
||||
import Tools from "../Tools";
|
||||
let _DialogObject
|
||||
const open = async (sdk, closeCallBack) => {
|
||||
let proj = new Proj()
|
||||
if (_DialogObject && _DialogObject.close) {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
}
|
||||
_DialogObject = await new Dialog(sdk.viewer._container, {
|
||||
title: '度分秒',
|
||||
left: '180px',
|
||||
top: '100px',
|
||||
closeCallBack: () => {
|
||||
closeCallBack && closeCallBack()
|
||||
}
|
||||
})
|
||||
await _DialogObject.init()
|
||||
let tools = new Tools(sdk)
|
||||
// if (_DialogObject && _DialogObject.close) {
|
||||
// _DialogObject.close()
|
||||
// _DialogObject = null
|
||||
// }
|
||||
// _DialogObject = await new Dialog(sdk.viewer._container, {
|
||||
// title: '度分秒',
|
||||
// left: '180px',
|
||||
// top: '100px',
|
||||
// closeCallBack: () => {
|
||||
// closeCallBack && closeCallBack()
|
||||
// }
|
||||
// })
|
||||
// await _DialogObject.init()
|
||||
|
||||
let html = `
|
||||
<span class="custom-divider"></span>
|
||||
<div class="div-item">
|
||||
<div class="row">
|
||||
<div class="col input-select-box">
|
||||
<span class="label" style="flex: 0 0 60px;">输入格式</span>
|
||||
<div class="input-select"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="${0}">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
<span style="margin-right: 10px;">度</span>
|
||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如116.6°, 39.9°</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="label" style="flex: auto;">经度</span>
|
||||
<input class="input lng" type="number" min="-180" max="180" value="0" title="">
|
||||
</div>
|
||||
<div class="col" style="margin: 0;">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat" type="number" min="-90" max="90" value="0" title="">
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px;">
|
||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;">
|
||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="${1}">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
<span style="margin-right: 10px;">度分</span>
|
||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如95°10.1702', 49°12.4015'</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col" style="flex-direction: column;">
|
||||
<div class="row" style="margin-bottom: 15px;">
|
||||
<span class="label">经度</span>
|
||||
<input class="input lng-dm-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lng-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<span class="top-line"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat-dm-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lat-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<span class="bottom-line"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px;margin: 0;">
|
||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="${2}">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
<span style="margin-right: 10px;">度分秒</span>
|
||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如11°18'54.37", 39°13'46.57"</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col" style="flex-direction: column;">
|
||||
<div class="row" style="margin-bottom: 15px;">
|
||||
<span class="label">经度</span>
|
||||
<input class="input lng-dms-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lng-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<input class="input lng-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
<span class="top-line"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat-dms-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lat-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<input class="input lat-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
<span class="bottom-line"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px; margin: 0;">
|
||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="custom-divider" style="order: 10;margin-top: 12px;"></span>
|
||||
`
|
||||
_DialogObject._element.body.className = _DialogObject._element.body.className + ' proj-convert'
|
||||
let contentElm = document.createElement('div')
|
||||
contentElm.style.width = '460px'
|
||||
contentElm.style.display = 'flex'
|
||||
contentElm.style.flexDirection = 'column'
|
||||
contentElm.innerHTML = html
|
||||
_DialogObject.contentAppChild(contentElm)
|
||||
// let html = `
|
||||
// <span class="custom-divider"></span>
|
||||
// <div class="div-item">
|
||||
// <div class="row">
|
||||
// <div class="col input-select-box">
|
||||
// <span class="label" style="flex: 0 0 60px;">输入格式</span>
|
||||
// <div class="input-select"></div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="div-item item" data-type="${0}">
|
||||
// <span class="custom-divider"></span>
|
||||
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
// <span style="margin-right: 10px;">度</span>
|
||||
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如116.6°, 39.9°</span>
|
||||
// </p>
|
||||
// <div class="row">
|
||||
// <div class="col">
|
||||
// <span class="label" style="flex: auto;">经度</span>
|
||||
// <input class="input lng" type="number" min="-180" max="180" value="0" title="">
|
||||
// </div>
|
||||
// <div class="col" style="margin: 0;">
|
||||
// <span class="label">纬度</span>
|
||||
// <input class="input lat" type="number" min="-90" max="90" value="0" title="">
|
||||
// </div>
|
||||
// <div class="col" style="flex: 0 0 24px;">
|
||||
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;">
|
||||
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
// </i>
|
||||
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="div-item item" data-type="${1}">
|
||||
// <span class="custom-divider"></span>
|
||||
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
// <span style="margin-right: 10px;">度分</span>
|
||||
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如95°10.1702', 49°12.4015'</span>
|
||||
// </p>
|
||||
// <div class="row">
|
||||
// <div class="col" style="flex-direction: column;">
|
||||
// <div class="row" style="margin-bottom: 15px;">
|
||||
// <span class="label">经度</span>
|
||||
// <input class="input lng-dm-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lng-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <span class="top-line"></span>
|
||||
// </div>
|
||||
// <div class="row">
|
||||
// <span class="label">纬度</span>
|
||||
// <input class="input lat-dm-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lat-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <span class="bottom-line"></span>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="col" style="flex: 0 0 24px;margin: 0;">
|
||||
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
// </i>
|
||||
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="div-item item" data-type="${2}">
|
||||
// <span class="custom-divider"></span>
|
||||
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
// <span style="margin-right: 10px;">度分秒</span>
|
||||
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如11°18'54.37", 39°13'46.57"</span>
|
||||
// </p>
|
||||
// <div class="row">
|
||||
// <div class="col" style="flex-direction: column;">
|
||||
// <div class="row" style="margin-bottom: 15px;">
|
||||
// <span class="label">经度</span>
|
||||
// <input class="input lng-dms-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lng-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <input class="input lng-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
// <span class="top-line"></span>
|
||||
// </div>
|
||||
// <div class="row">
|
||||
// <span class="label">纬度</span>
|
||||
// <input class="input lat-dms-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lat-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <input class="input lat-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
// <span class="bottom-line"></span>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="col" style="flex: 0 0 24px; margin: 0;">
|
||||
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
// </i>
|
||||
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <span class="custom-divider" style="order: 10;margin-top: 12px;"></span>
|
||||
// `
|
||||
// _DialogObject._element.body.className = _DialogObject._element.body.className + ' proj-convert'
|
||||
// let contentElm = document.createElement('div')
|
||||
// contentElm.style.width = '460px'
|
||||
// contentElm.style.display = 'flex'
|
||||
// contentElm.style.flexDirection = 'column'
|
||||
// contentElm.innerHTML = html
|
||||
// _DialogObject.contentAppChild(contentElm)
|
||||
|
||||
let contentElm = document.getElementsByClassName('proj-convert')[0].getElementsByClassName('content')[0]
|
||||
|
||||
let items = contentElm.getElementsByClassName('item')
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let type = items[i].getAttribute('data-type')
|
||||
let convertElm = items[i].getElementsByClassName('convert')[0]
|
||||
@ -183,20 +186,10 @@ const open = async (sdk, closeCallBack) => {
|
||||
});
|
||||
|
||||
clipboard.on('success', function (e) {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '已复制到剪切板',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
tools.message({ text: '已复制到剪切板' })
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '复制失败',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
})
|
||||
tools.message({ type: 'warning', text: '复制失败' })
|
||||
});
|
||||
convertElm.addEventListener('click', () => {
|
||||
// let a = proj.degreesToDMS(100.345546743)
|
||||
@ -317,12 +310,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
contentElm.getElementsByClassName('lat-dm-m')[0].value = latdnArr2[0]
|
||||
break
|
||||
}
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '转换成功',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
tools.message({ text: '转换成功' })
|
||||
for (let m = 0; m < items.length; m++) {
|
||||
items[m].style.display = 'block'
|
||||
}
|
||||
@ -372,10 +360,10 @@ const open = async (sdk, closeCallBack) => {
|
||||
}
|
||||
]
|
||||
|
||||
let selectDataLegpObject = legp(_DialogObject._element.content.getElementsByClassName('input-select-box')[0], ".input-select")
|
||||
let selectDataLegpObject = legp(contentElm.getElementsByClassName('input-select-box')[0], ".input-select")
|
||||
if (selectDataLegpObject) {
|
||||
selectDataLegpObject.legp_search(selectData)
|
||||
let selectDataLegpElm = _DialogObject._element.content.getElementsByClassName('input-select')[0].getElementsByTagName('input')[0]
|
||||
let selectDataLegpElm = contentElm.getElementsByClassName('input-select')[0].getElementsByTagName('input')[0]
|
||||
selectDataLegpElm.value = selectData[0].value
|
||||
selectDataLegpElm.addEventListener('input', () => {
|
||||
for (let i = 0; i < selectData.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user