af-mobile-client-vue3 1.1.48 → 1.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +113 -112
- package/src/components/core/ImageUploader/index.vue +159 -159
- package/src/components/data/XForm/index.vue +15 -1
- package/src/components/data/XFormItem/index.vue +69 -2
- package/src/components/data/XOlMap/XLocationPicker/index.vue +30 -21
- package/src/components/data/XOlMap/index.vue +3 -3
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
- package/src/views/component/XCellListView/index.vue +13 -96
- package/src/views/component/XFormGroupView/index.vue +2 -39
- package/src/views/component/XFormView/index.vue +30 -9
- package/src/views/component/XFormView/oldindex.vue +70 -0
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
- package/vite.config.ts +11 -18
|
@@ -14,6 +14,7 @@ import { getDict } from '@af-mobile-client-vue3/utils/dictUtil'
|
|
|
14
14
|
import { getRangeByType } from '@af-mobile-client-vue3/utils/queryFormDefaultRangePicker'
|
|
15
15
|
import { executeStrFunctionByContext } from '@af-mobile-client-vue3/utils/runEvalFunction'
|
|
16
16
|
import { areaList } from '@vant/area-data'
|
|
17
|
+
import dayjs from 'dayjs'
|
|
17
18
|
import { debounce } from 'lodash-es'
|
|
18
19
|
import {
|
|
19
20
|
Area as VanArea,
|
|
@@ -196,6 +197,71 @@ function getDefaultValue() {
|
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
function getDateRange({
|
|
201
|
+
type,
|
|
202
|
+
formDefault: defaultValue,
|
|
203
|
+
queryType,
|
|
204
|
+
queryValueFormat: defaultFormat,
|
|
205
|
+
name,
|
|
206
|
+
}: {
|
|
207
|
+
type: string
|
|
208
|
+
formDefault: string
|
|
209
|
+
queryType?: string
|
|
210
|
+
queryValueFormat?: string
|
|
211
|
+
name: string
|
|
212
|
+
}): string | [string, string] | undefined {
|
|
213
|
+
const formatMap: Record<string, string> = {
|
|
214
|
+
yearPicker: 'YYYY',
|
|
215
|
+
yearRangePicker: 'YYYY',
|
|
216
|
+
monthPicker: 'YYYY-MM',
|
|
217
|
+
monthRangePicker: 'YYYY-MM',
|
|
218
|
+
datePicker: 'YYYY-MM-DD HH:mm:ss',
|
|
219
|
+
rangePicker: 'YYYY-MM-DD HH:mm:ss',
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const format = defaultFormat || formatMap[type]
|
|
223
|
+
|
|
224
|
+
let start: string, end: string
|
|
225
|
+
|
|
226
|
+
switch (defaultValue) {
|
|
227
|
+
case 'curYear':
|
|
228
|
+
start = dayjs().startOf('year').format(format)
|
|
229
|
+
end = dayjs().endOf('year').format(format)
|
|
230
|
+
break
|
|
231
|
+
case 'curMonth':
|
|
232
|
+
start = dayjs().startOf('month').format(format)
|
|
233
|
+
end = dayjs().endOf('month').format(format)
|
|
234
|
+
break
|
|
235
|
+
case 'curDay':
|
|
236
|
+
start = dayjs().startOf('day').format(format)
|
|
237
|
+
end = dayjs().endOf('day').format(format)
|
|
238
|
+
break
|
|
239
|
+
case 'curTime':
|
|
240
|
+
start = dayjs().format(format)
|
|
241
|
+
end = dayjs().format(format)
|
|
242
|
+
break
|
|
243
|
+
default:
|
|
244
|
+
return undefined
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (['monthPicker', 'yearPicker', 'datePicker'].includes(type)) {
|
|
248
|
+
if (queryType === 'BETWEEN') {
|
|
249
|
+
return [start, end]
|
|
250
|
+
}
|
|
251
|
+
if (name.includes('开始') || name.includes('起始')) {
|
|
252
|
+
return start
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
return end
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else if (['rangePicker', 'yearRangePicker', 'monthRangePicker'].includes(type)) {
|
|
259
|
+
return [start, end]
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return [start, end]
|
|
263
|
+
}
|
|
264
|
+
|
|
199
265
|
// 改用 ref,并设置初始值
|
|
200
266
|
const localValue = ref(getDefaultValue())
|
|
201
267
|
|
|
@@ -209,7 +275,9 @@ watch(() => props.modelValue, (newVal) => {
|
|
|
209
275
|
if (attr.type === 'rangePicker') {
|
|
210
276
|
console.log('newVal', newVal)
|
|
211
277
|
pickerValue.value = newVal !== undefined ? `${newVal[0]} ~ ${newVal[1]}` : getDefaultValue()
|
|
212
|
-
|
|
278
|
+
}
|
|
279
|
+
else if (['datePicker', 'rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker'].includes(attr.type)) {
|
|
280
|
+
localValue.value = getDateRange(attr)
|
|
213
281
|
}
|
|
214
282
|
else {
|
|
215
283
|
console.log('newVal', newVal)
|
|
@@ -619,7 +687,6 @@ function handleAddressConfirm(location) {
|
|
|
619
687
|
[`${attr.model}_lon_lat`]: `${location.longitude},${location.latitude}`,
|
|
620
688
|
[attr.model]: location.address,
|
|
621
689
|
}
|
|
622
|
-
|
|
623
690
|
// 更新表单数据
|
|
624
691
|
// eslint-disable-next-line vue/custom-event-name-casing
|
|
625
692
|
emits('set-form', formData)
|
|
@@ -12,27 +12,7 @@ interface Props {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
-
defaultCenter: () =>
|
|
16
|
-
try {
|
|
17
|
-
mobileUtil.execute({
|
|
18
|
-
param: {},
|
|
19
|
-
funcName: 'getLocationResult',
|
|
20
|
-
callbackFunc: (result) => {
|
|
21
|
-
const res = result as PhoneLocationStatus
|
|
22
|
-
if (res.status === 'success') {
|
|
23
|
-
const locationResult = JSON.parse(res.data.location)
|
|
24
|
-
if (locationResult.longitude && locationResult.latitude) {
|
|
25
|
-
return [locationResult.longitude, locationResult.latitude]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error('获取位置信息失败:', error)
|
|
33
|
-
}
|
|
34
|
-
return [108.948024, 34.263161] // 北京天安门坐标
|
|
35
|
-
},
|
|
15
|
+
defaultCenter: () => [108.948024, 34.263161],
|
|
36
16
|
defaultZoom: 16,
|
|
37
17
|
})
|
|
38
18
|
|
|
@@ -75,6 +55,32 @@ onMounted(async () => {
|
|
|
75
55
|
})
|
|
76
56
|
// 初始化后尝试获取地址信息
|
|
77
57
|
handleCenterChange(props.defaultCenter)
|
|
58
|
+
|
|
59
|
+
// 异步获取定位,获取到后更新 currentLocation 和地图中心
|
|
60
|
+
try {
|
|
61
|
+
mobileUtil.execute({
|
|
62
|
+
param: {},
|
|
63
|
+
funcName: 'getLocationResult',
|
|
64
|
+
callbackFunc: (result) => {
|
|
65
|
+
const res = result as PhoneLocationStatus
|
|
66
|
+
if (res.status === 'success') {
|
|
67
|
+
const locationResult = JSON.parse(res.data.location)
|
|
68
|
+
if (locationResult.longitude && locationResult.latitude) {
|
|
69
|
+
const newCenter: [number, number] = [locationResult.longitude, locationResult.latitude]
|
|
70
|
+
currentLocation.value = newCenter
|
|
71
|
+
// 设置地图中心
|
|
72
|
+
if (mapRef.value && mapRef.value.setCenter) {
|
|
73
|
+
mapRef.value.setCenter(newCenter)
|
|
74
|
+
}
|
|
75
|
+
handleCenterChange(newCenter)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('获取位置信息失败:', error)
|
|
83
|
+
}
|
|
78
84
|
})
|
|
79
85
|
|
|
80
86
|
// 监听弹窗状态变化
|
|
@@ -137,6 +143,9 @@ watch(() => props.modelValue, (newVal) => {
|
|
|
137
143
|
position: relative;
|
|
138
144
|
flex: 1;
|
|
139
145
|
min-height: 0;
|
|
146
|
+
border-radius: 40px;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
padding: 10px;
|
|
140
149
|
}
|
|
141
150
|
|
|
142
151
|
.map {
|
|
@@ -12,10 +12,10 @@ import type {
|
|
|
12
12
|
PhoneLocationStatus,
|
|
13
13
|
PointData,
|
|
14
14
|
PointLayerConfig,
|
|
15
|
+
TrackData,
|
|
15
16
|
WebGLPointOptions,
|
|
16
17
|
WMSLayerConfig,
|
|
17
18
|
WMSOptions,
|
|
18
|
-
TrackData,
|
|
19
19
|
} from './types'
|
|
20
20
|
import locationIcon from '@af-mobile-client-vue3/assets/img/component/positioning.png'
|
|
21
21
|
import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
|
|
@@ -23,13 +23,13 @@ import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
|
23
23
|
import { Map, View } from 'ol'
|
|
24
24
|
import { defaults as defaultControls, ScaleLine } from 'ol/control'
|
|
25
25
|
import Feature from 'ol/Feature'
|
|
26
|
-
import Point from 'ol/geom/Point'
|
|
27
26
|
import LineString from 'ol/geom/LineString'
|
|
27
|
+
import Point from 'ol/geom/Point'
|
|
28
28
|
import { defaults as defaultInteractions } from 'ol/interaction'
|
|
29
29
|
import { Image as ImageLayer, Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'
|
|
30
30
|
import { fromLonLat, toLonLat } from 'ol/proj'
|
|
31
31
|
import { ImageWMS, Vector as VectorSource, XYZ } from 'ol/source'
|
|
32
|
-
import { Fill, Icon, Stroke, Style, Text
|
|
32
|
+
import { Circle, Fill, Icon, Stroke, Style, Text } from 'ol/style'
|
|
33
33
|
import { Button } from 'vant'
|
|
34
34
|
import { getCurrentInstance, onUnmounted, ref } from 'vue'
|
|
35
35
|
import { wgs84ToGcj02Projection } from './utils/wgs84ToGcj02'
|
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
// 导入proj控件
|
|
2
|
-
import * as proj from 'ol/proj'
|
|
3
|
-
|
|
4
|
-
function forEachPoint(func) {
|
|
5
|
-
return function (input, opt_output, opt_dimension) {
|
|
6
|
-
const len = input.length
|
|
7
|
-
|
|
8
|
-
const dimension = opt_dimension || 2
|
|
9
|
-
let output
|
|
10
|
-
|
|
11
|
-
if (opt_output) {
|
|
12
|
-
output = opt_output
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
if (dimension !== 2) {
|
|
16
|
-
output = input.slice()
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
output = [len]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
for (let offset = 0; offset < len; offset += dimension) {
|
|
23
|
-
func(input, output, offset)
|
|
24
|
-
}
|
|
25
|
-
return output
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const gcj02 = {}
|
|
30
|
-
const PI = Math.PI
|
|
31
|
-
const AXIS = 6378245.0
|
|
32
|
-
// eslint-disable-next-line no-loss-of-precision
|
|
33
|
-
const OFFSET = 0.00669342162296594323 // (a^2 - b^2) / a^2
|
|
34
|
-
|
|
35
|
-
function delta(wgLon, wgLat) {
|
|
36
|
-
let dLat = transformLat(wgLon - 105.0, wgLat - 35.0)
|
|
37
|
-
let dLon = transformLon(wgLon - 105.0, wgLat - 35.0)
|
|
38
|
-
const radLat = (wgLat / 180.0) * PI
|
|
39
|
-
let magic = Math.sin(radLat)
|
|
40
|
-
magic = 1 - OFFSET * magic * magic
|
|
41
|
-
const sqrtMagic = Math.sqrt(magic)
|
|
42
|
-
dLat = (dLat * 180.0) / (((AXIS * (1 - OFFSET)) / (magic * sqrtMagic)) * PI)
|
|
43
|
-
dLon = (dLon * 180.0) / ((AXIS / sqrtMagic) * Math.cos(radLat) * PI)
|
|
44
|
-
return [dLon, dLat]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function outOfChina(lon, lat) {
|
|
48
|
-
if (lon < 72.004 || lon > 137.8347) {
|
|
49
|
-
return true
|
|
50
|
-
}
|
|
51
|
-
return lat < 0.8293 || lat > 55.8271
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function transformLat(x, y) {
|
|
55
|
-
let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
|
|
56
|
-
ret += ((20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0) / 3.0
|
|
57
|
-
ret += ((20.0 * Math.sin(y * PI) + 40.0 * Math.sin((y / 3.0) * PI)) * 2.0) / 3.0
|
|
58
|
-
ret += ((160.0 * Math.sin((y / 12.0) * PI) + 320 * Math.sin((y * PI) / 30.0)) * 2.0) / 3.0
|
|
59
|
-
return ret
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function transformLon(x, y) {
|
|
63
|
-
let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
|
|
64
|
-
ret += ((20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0) / 3.0
|
|
65
|
-
ret += ((20.0 * Math.sin(x * PI) + 40.0 * Math.sin((x / 3.0) * PI)) * 2.0) / 3.0
|
|
66
|
-
ret += ((150.0 * Math.sin((x / 12.0) * PI) + 300.0 * Math.sin((x / 30.0) * PI)) * 2.0) / 3.0
|
|
67
|
-
return ret
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
gcj02.toWGS84 = forEachPoint((input, output, offset) => {
|
|
71
|
-
let lng = input[offset]
|
|
72
|
-
let lat = input[offset + 1]
|
|
73
|
-
if (!outOfChina(lng, lat)) {
|
|
74
|
-
const deltaD = delta(lng, lat)
|
|
75
|
-
lng = lng - deltaD[0] // 改回减法
|
|
76
|
-
lat = lat - deltaD[1] // 改回减法
|
|
77
|
-
}
|
|
78
|
-
output[offset] = lng
|
|
79
|
-
output[offset + 1] = lat
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
gcj02.fromWGS84 = forEachPoint((input, output, offset) => {
|
|
83
|
-
let lng = input[offset]
|
|
84
|
-
let lat = input[offset + 1]
|
|
85
|
-
if (!outOfChina(lng, lat)) {
|
|
86
|
-
const deltaD = delta(lng, lat)
|
|
87
|
-
lng = lng + deltaD[0] // 改回加法
|
|
88
|
-
lat = lat + deltaD[1] // 改回加法
|
|
89
|
-
}
|
|
90
|
-
output[offset] = lng
|
|
91
|
-
output[offset + 1] = lat
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
const sphericalMercator = {}
|
|
95
|
-
const RADIUS = 6378137
|
|
96
|
-
const MAX_LATITUDE = 85.0511287798
|
|
97
|
-
const RAD_PER_DEG = Math.PI / 180
|
|
98
|
-
|
|
99
|
-
sphericalMercator.forward = forEachPoint((input, output, offset) => {
|
|
100
|
-
const lat = Math.max(Math.min(MAX_LATITUDE, input[offset + 1]), -MAX_LATITUDE)
|
|
101
|
-
const sin = Math.sin(lat * RAD_PER_DEG)
|
|
102
|
-
output[offset] = RADIUS * input[offset] * RAD_PER_DEG
|
|
103
|
-
output[offset + 1] = (RADIUS * Math.log((1 + sin) / (1 - sin))) / 2
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
sphericalMercator.inverse = forEachPoint((input, output, offset) => {
|
|
107
|
-
output[offset] = input[offset] / RADIUS / RAD_PER_DEG
|
|
108
|
-
output[offset + 1] = (2 * Math.atan(Math.exp(input[offset + 1] / RADIUS)) - Math.PI / 2) / RAD_PER_DEG
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
const projzh = {}
|
|
112
|
-
|
|
113
|
-
projzh.ll2gmerc = function (input, opt_output, opt_dimension) {
|
|
114
|
-
const output = gcj02.toWGS84(input, opt_output, opt_dimension) // 改用 toWGS84
|
|
115
|
-
return projzh.ll2smerc(output, output, opt_dimension)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
projzh.gmerc2ll = function (input, opt_output, opt_dimension) {
|
|
119
|
-
const output = projzh.smerc2ll(input, input, opt_dimension)
|
|
120
|
-
return gcj02.fromWGS84(output, opt_output, opt_dimension) // 改用 fromWGS84
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// smerc2gmerc 需要修改
|
|
124
|
-
|
|
125
|
-
projzh.smerc2gmerc = function (input, opt_output, opt_dimension) {
|
|
126
|
-
let output = projzh.smerc2ll(input, input, opt_dimension)
|
|
127
|
-
output = gcj02.toWGS84(output, output, opt_dimension) // 这里应该用 toWGS84
|
|
128
|
-
return projzh.ll2smerc(output, output, opt_dimension)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// gmerc2smerc 需要修改
|
|
132
|
-
|
|
133
|
-
projzh.gmerc2smerc = function (input, opt_output, opt_dimension) {
|
|
134
|
-
let output = projzh.smerc2ll(input, input, opt_dimension)
|
|
135
|
-
output = gcj02.fromWGS84(output, output, opt_dimension) // 这里应该用 fromWGS84
|
|
136
|
-
return projzh.ll2smerc(output, output, opt_dimension)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
projzh.ll2smerc = sphericalMercator.forward
|
|
140
|
-
projzh.smerc2ll = sphericalMercator.inverse
|
|
141
|
-
|
|
142
|
-
// 定义WGS84转GCJ02的投影
|
|
143
|
-
const extent = [-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]
|
|
144
|
-
export const wgs84ToGcj02Projection = new proj.Projection({
|
|
145
|
-
code: 'WGS84-TO-GCJ02',
|
|
146
|
-
extent,
|
|
147
|
-
units: 'm',
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
// 添加投影和转换方法
|
|
151
|
-
proj.addProjection(wgs84ToGcj02Projection)
|
|
152
|
-
// 注意这里转换方法的顺序与原来相反
|
|
153
|
-
proj.addCoordinateTransforms('EPSG:4326', wgs84ToGcj02Projection, projzh.ll2gmerc, projzh.gmerc2ll)
|
|
154
|
-
proj.addCoordinateTransforms('EPSG:3857', wgs84ToGcj02Projection, projzh.smerc2gmerc, projzh.gmerc2smerc)
|
|
1
|
+
// 导入proj控件
|
|
2
|
+
import * as proj from 'ol/proj'
|
|
3
|
+
|
|
4
|
+
function forEachPoint(func) {
|
|
5
|
+
return function (input, opt_output, opt_dimension) {
|
|
6
|
+
const len = input.length
|
|
7
|
+
|
|
8
|
+
const dimension = opt_dimension || 2
|
|
9
|
+
let output
|
|
10
|
+
|
|
11
|
+
if (opt_output) {
|
|
12
|
+
output = opt_output
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if (dimension !== 2) {
|
|
16
|
+
output = input.slice()
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
output = [len]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
for (let offset = 0; offset < len; offset += dimension) {
|
|
23
|
+
func(input, output, offset)
|
|
24
|
+
}
|
|
25
|
+
return output
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const gcj02 = {}
|
|
30
|
+
const PI = Math.PI
|
|
31
|
+
const AXIS = 6378245.0
|
|
32
|
+
// eslint-disable-next-line no-loss-of-precision
|
|
33
|
+
const OFFSET = 0.00669342162296594323 // (a^2 - b^2) / a^2
|
|
34
|
+
|
|
35
|
+
function delta(wgLon, wgLat) {
|
|
36
|
+
let dLat = transformLat(wgLon - 105.0, wgLat - 35.0)
|
|
37
|
+
let dLon = transformLon(wgLon - 105.0, wgLat - 35.0)
|
|
38
|
+
const radLat = (wgLat / 180.0) * PI
|
|
39
|
+
let magic = Math.sin(radLat)
|
|
40
|
+
magic = 1 - OFFSET * magic * magic
|
|
41
|
+
const sqrtMagic = Math.sqrt(magic)
|
|
42
|
+
dLat = (dLat * 180.0) / (((AXIS * (1 - OFFSET)) / (magic * sqrtMagic)) * PI)
|
|
43
|
+
dLon = (dLon * 180.0) / ((AXIS / sqrtMagic) * Math.cos(radLat) * PI)
|
|
44
|
+
return [dLon, dLat]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function outOfChina(lon, lat) {
|
|
48
|
+
if (lon < 72.004 || lon > 137.8347) {
|
|
49
|
+
return true
|
|
50
|
+
}
|
|
51
|
+
return lat < 0.8293 || lat > 55.8271
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function transformLat(x, y) {
|
|
55
|
+
let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
|
|
56
|
+
ret += ((20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0) / 3.0
|
|
57
|
+
ret += ((20.0 * Math.sin(y * PI) + 40.0 * Math.sin((y / 3.0) * PI)) * 2.0) / 3.0
|
|
58
|
+
ret += ((160.0 * Math.sin((y / 12.0) * PI) + 320 * Math.sin((y * PI) / 30.0)) * 2.0) / 3.0
|
|
59
|
+
return ret
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function transformLon(x, y) {
|
|
63
|
+
let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
|
|
64
|
+
ret += ((20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0) / 3.0
|
|
65
|
+
ret += ((20.0 * Math.sin(x * PI) + 40.0 * Math.sin((x / 3.0) * PI)) * 2.0) / 3.0
|
|
66
|
+
ret += ((150.0 * Math.sin((x / 12.0) * PI) + 300.0 * Math.sin((x / 30.0) * PI)) * 2.0) / 3.0
|
|
67
|
+
return ret
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
gcj02.toWGS84 = forEachPoint((input, output, offset) => {
|
|
71
|
+
let lng = input[offset]
|
|
72
|
+
let lat = input[offset + 1]
|
|
73
|
+
if (!outOfChina(lng, lat)) {
|
|
74
|
+
const deltaD = delta(lng, lat)
|
|
75
|
+
lng = lng - deltaD[0] // 改回减法
|
|
76
|
+
lat = lat - deltaD[1] // 改回减法
|
|
77
|
+
}
|
|
78
|
+
output[offset] = lng
|
|
79
|
+
output[offset + 1] = lat
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
gcj02.fromWGS84 = forEachPoint((input, output, offset) => {
|
|
83
|
+
let lng = input[offset]
|
|
84
|
+
let lat = input[offset + 1]
|
|
85
|
+
if (!outOfChina(lng, lat)) {
|
|
86
|
+
const deltaD = delta(lng, lat)
|
|
87
|
+
lng = lng + deltaD[0] // 改回加法
|
|
88
|
+
lat = lat + deltaD[1] // 改回加法
|
|
89
|
+
}
|
|
90
|
+
output[offset] = lng
|
|
91
|
+
output[offset + 1] = lat
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const sphericalMercator = {}
|
|
95
|
+
const RADIUS = 6378137
|
|
96
|
+
const MAX_LATITUDE = 85.0511287798
|
|
97
|
+
const RAD_PER_DEG = Math.PI / 180
|
|
98
|
+
|
|
99
|
+
sphericalMercator.forward = forEachPoint((input, output, offset) => {
|
|
100
|
+
const lat = Math.max(Math.min(MAX_LATITUDE, input[offset + 1]), -MAX_LATITUDE)
|
|
101
|
+
const sin = Math.sin(lat * RAD_PER_DEG)
|
|
102
|
+
output[offset] = RADIUS * input[offset] * RAD_PER_DEG
|
|
103
|
+
output[offset + 1] = (RADIUS * Math.log((1 + sin) / (1 - sin))) / 2
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
sphericalMercator.inverse = forEachPoint((input, output, offset) => {
|
|
107
|
+
output[offset] = input[offset] / RADIUS / RAD_PER_DEG
|
|
108
|
+
output[offset + 1] = (2 * Math.atan(Math.exp(input[offset + 1] / RADIUS)) - Math.PI / 2) / RAD_PER_DEG
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const projzh = {}
|
|
112
|
+
|
|
113
|
+
projzh.ll2gmerc = function (input, opt_output, opt_dimension) {
|
|
114
|
+
const output = gcj02.toWGS84(input, opt_output, opt_dimension) // 改用 toWGS84
|
|
115
|
+
return projzh.ll2smerc(output, output, opt_dimension)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
projzh.gmerc2ll = function (input, opt_output, opt_dimension) {
|
|
119
|
+
const output = projzh.smerc2ll(input, input, opt_dimension)
|
|
120
|
+
return gcj02.fromWGS84(output, opt_output, opt_dimension) // 改用 fromWGS84
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// smerc2gmerc 需要修改
|
|
124
|
+
|
|
125
|
+
projzh.smerc2gmerc = function (input, opt_output, opt_dimension) {
|
|
126
|
+
let output = projzh.smerc2ll(input, input, opt_dimension)
|
|
127
|
+
output = gcj02.toWGS84(output, output, opt_dimension) // 这里应该用 toWGS84
|
|
128
|
+
return projzh.ll2smerc(output, output, opt_dimension)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// gmerc2smerc 需要修改
|
|
132
|
+
|
|
133
|
+
projzh.gmerc2smerc = function (input, opt_output, opt_dimension) {
|
|
134
|
+
let output = projzh.smerc2ll(input, input, opt_dimension)
|
|
135
|
+
output = gcj02.fromWGS84(output, output, opt_dimension) // 这里应该用 fromWGS84
|
|
136
|
+
return projzh.ll2smerc(output, output, opt_dimension)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
projzh.ll2smerc = sphericalMercator.forward
|
|
140
|
+
projzh.smerc2ll = sphericalMercator.inverse
|
|
141
|
+
|
|
142
|
+
// 定义WGS84转GCJ02的投影
|
|
143
|
+
const extent = [-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]
|
|
144
|
+
export const wgs84ToGcj02Projection = new proj.Projection({
|
|
145
|
+
code: 'WGS84-TO-GCJ02',
|
|
146
|
+
extent,
|
|
147
|
+
units: 'm',
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// 添加投影和转换方法
|
|
151
|
+
proj.addProjection(wgs84ToGcj02Projection)
|
|
152
|
+
// 注意这里转换方法的顺序与原来相反
|
|
153
|
+
proj.addCoordinateTransforms('EPSG:4326', wgs84ToGcj02Projection, projzh.ll2gmerc, projzh.gmerc2ll)
|
|
154
|
+
proj.addCoordinateTransforms('EPSG:3857', wgs84ToGcj02Projection, projzh.smerc2gmerc, projzh.gmerc2smerc)
|
|
@@ -1,107 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
|
|
3
|
-
import
|
|
4
|
-
import { defineEmits, ref } from 'vue'
|
|
3
|
+
import { ref } from 'vue'
|
|
5
4
|
import { useRouter } from 'vue-router'
|
|
6
5
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// 获取默认值
|
|
12
|
-
const idKey = ref('o_id')
|
|
13
|
-
|
|
14
|
-
// 简易crud表单测试
|
|
15
|
-
const configName = ref('crud_oper_log_manage')
|
|
16
|
-
const serviceName = ref('af-system')
|
|
17
|
-
|
|
18
|
-
// 资源权限测试
|
|
19
|
-
// const configName = ref('crud_sources_test')
|
|
20
|
-
// const serviceName = ref('af-system')
|
|
21
|
-
|
|
22
|
-
// 实际业务测试
|
|
23
|
-
// const configName = ref('lngChargeAuditMobileCRUD')
|
|
24
|
-
// const serviceName = ref('af-gaslink')
|
|
25
|
-
|
|
26
|
-
// 跳转到详情页面
|
|
27
|
-
// function toDetail(item) {
|
|
28
|
-
// router.push({
|
|
29
|
-
// name: 'XCellDetailView',
|
|
30
|
-
// params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
|
|
31
|
-
// query: {
|
|
32
|
-
// operName: item[operNameKey.value],
|
|
33
|
-
// method:item[methodKey.value],
|
|
34
|
-
// requestMethod:item[requestMethodKey.value],
|
|
35
|
-
// operatorType:item[operatorTypeKey.value],
|
|
36
|
-
// operUrl:item[operUrlKey.value],
|
|
37
|
-
// operIp:item[operIpKey.value],
|
|
38
|
-
// costTime:item[costTimeKey.value],
|
|
39
|
-
// operTime:item[operTimeKey.value],
|
|
40
|
-
//
|
|
41
|
-
// title: item[titleKey.value],
|
|
42
|
-
// businessType: item[businessTypeKey.value],
|
|
43
|
-
// status:item[statusKey.value]
|
|
44
|
-
// }
|
|
45
|
-
// })
|
|
46
|
-
// }
|
|
6
|
+
// 巡检计划
|
|
7
|
+
defineOptions({
|
|
8
|
+
name: 'PatrolPlan',
|
|
9
|
+
})
|
|
47
10
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
name: 'XFormGroupView',
|
|
52
|
-
query: {
|
|
53
|
-
id: item[idKey.value],
|
|
54
|
-
// id: item.rr_id,
|
|
55
|
-
// o_id: item.o_id,
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// 新增功能
|
|
61
|
-
// function addOption(totalCount) {
|
|
62
|
-
// router.push({
|
|
63
|
-
// name: 'XFormView',
|
|
64
|
-
// params: { id: totalCount, openid: totalCount },
|
|
65
|
-
// query: {
|
|
66
|
-
// configName: configName.value,
|
|
67
|
-
// serviceName: serviceName.value,
|
|
68
|
-
// mode: '新增',
|
|
69
|
-
// },
|
|
70
|
-
// })
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
// 修改功能
|
|
74
|
-
// function updateRow(result) {
|
|
75
|
-
// router.push({
|
|
76
|
-
// name: 'XFormView',
|
|
77
|
-
// params: { id: result.o_id, openid: result.o_id },
|
|
78
|
-
// query: {
|
|
79
|
-
// configName: configName.value,
|
|
80
|
-
// serviceName: serviceName.value,
|
|
81
|
-
// mode: '修改',
|
|
82
|
-
// },
|
|
83
|
-
// })
|
|
84
|
-
// }
|
|
85
|
-
|
|
86
|
-
// 删除功能
|
|
87
|
-
function deleteRow(result) {
|
|
88
|
-
emit('deleteRow', result.o_id)
|
|
89
|
-
}
|
|
11
|
+
const router = useRouter()
|
|
12
|
+
const configName = ref('crud_patroltask_managePhoneCRUD')
|
|
13
|
+
const xCellListRefPatrolPlan = ref()
|
|
90
14
|
</script>
|
|
91
15
|
|
|
92
16
|
<template>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
:fix-query-form="{ o_f_oper_name: 'edu_test' }"
|
|
99
|
-
:id-key="idKey"
|
|
100
|
-
@to-detail="toDetail"
|
|
101
|
-
@delete-row="deleteRow"
|
|
102
|
-
/>
|
|
103
|
-
</template>
|
|
104
|
-
</NormalDataLayout>
|
|
17
|
+
<XCellList
|
|
18
|
+
ref="xCellListRefPatrolPlan"
|
|
19
|
+
service-name="af-linepatrol"
|
|
20
|
+
:config-name="configName"
|
|
21
|
+
/>
|
|
105
22
|
</template>
|
|
106
23
|
|
|
107
24
|
<style scoped lang="less">
|
|
@@ -6,15 +6,8 @@ import { ref } from 'vue'
|
|
|
6
6
|
import { useRoute } from 'vue-router'
|
|
7
7
|
|
|
8
8
|
// 纯表单
|
|
9
|
-
const configName = ref('
|
|
10
|
-
const serviceName = ref('af-
|
|
11
|
-
|
|
12
|
-
// const configName = ref("计划下发Form")
|
|
13
|
-
// const serviceName = ref("af-linepatrol")
|
|
14
|
-
|
|
15
|
-
// 表单组
|
|
16
|
-
// const configName = ref('lngChargeAuditMobileFormGroup')
|
|
17
|
-
// const serviceName = ref('af-gaslink')
|
|
9
|
+
const configName = ref('AddConstructionForm')
|
|
10
|
+
const serviceName = ref('af-linepatrol')
|
|
18
11
|
|
|
19
12
|
const formData = ref({})
|
|
20
13
|
const formGroup = ref(null)
|
|
@@ -25,36 +18,6 @@ function submit(_result) {
|
|
|
25
18
|
history.back()
|
|
26
19
|
})
|
|
27
20
|
}
|
|
28
|
-
|
|
29
|
-
// 表单组——数据
|
|
30
|
-
// function initComponents () {
|
|
31
|
-
// runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
|
|
32
|
-
// formData.value = {...res}
|
|
33
|
-
// })
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// 纯表单——数据
|
|
37
|
-
// function initComponents() {
|
|
38
|
-
// formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
// function initComponents() {
|
|
42
|
-
// runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
|
|
43
|
-
// console.log('res------', res)
|
|
44
|
-
// formData.value = { ...res }
|
|
45
|
-
// formGroup.value.init({
|
|
46
|
-
// configName: configName.value,
|
|
47
|
-
// serviceName: serviceName.value,
|
|
48
|
-
// groupFormData: { ...res },
|
|
49
|
-
// mode: "新增"
|
|
50
|
-
// })
|
|
51
|
-
// isInit.value = true
|
|
52
|
-
// })
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
|
-
// onBeforeMount(() => {
|
|
56
|
-
// initComponents()
|
|
57
|
-
// })
|
|
58
21
|
</script>
|
|
59
22
|
|
|
60
23
|
<template>
|