af-mobile-client-vue3 1.3.19 → 1.3.21
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 +1 -1
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
- package/src/router/routes.ts +0 -6
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/views/component/XCellListView/index.vue +15 -142
- package/src/views/component/XFormGroupView/index.vue +15 -11
- package/src/views/component/XFormView/index.vue +15 -0
- package/src/views/component/XFormView/oldindex.vue +70 -0
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
- package/src/views/user/login/LoginForm.vue +1 -0
- package/src/views/user/my/index.vue +151 -1
- package/src/views/component/XFormGroupView/xformgroup222.vue +0 -97
package/package.json
CHANGED
|
@@ -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)
|
package/src/router/routes.ts
CHANGED
|
@@ -12,7 +12,6 @@ import XCellDetailView from '@af-mobile-client-vue3/views/component/XCellDetailV
|
|
|
12
12
|
import XCellListView from '@af-mobile-client-vue3/views/component/XCellListView/index.vue'
|
|
13
13
|
import XFormAppraiseView from '@af-mobile-client-vue3/views/component/XFormAppraiseView/index.vue'
|
|
14
14
|
import XFormGroupView from '@af-mobile-client-vue3/views/component/XFormGroupView/index.vue'
|
|
15
|
-
import xformgroup222 from '@af-mobile-client-vue3/views/component/XFormGroupView/xformgroup222.vue'
|
|
16
15
|
import XFormView from '@af-mobile-client-vue3/views/component/XFormView/index.vue'
|
|
17
16
|
import XOlMapView from '@af-mobile-client-vue3/views/component/XOlMapView/index.vue'
|
|
18
17
|
import XLocationPicker from '@af-mobile-client-vue3/views/component/XOlMapView/XLocationPicker/index.vue'
|
|
@@ -85,11 +84,6 @@ const routes: Array<RouteRecordRaw> = [
|
|
|
85
84
|
name: 'XCellDetailView',
|
|
86
85
|
component: XCellDetailView,
|
|
87
86
|
},
|
|
88
|
-
{
|
|
89
|
-
path: '/xformgroup222',
|
|
90
|
-
name: 'xformgroup222',
|
|
91
|
-
component: xformgroup222,
|
|
92
|
-
},
|
|
93
87
|
{
|
|
94
88
|
path: '/Component/XFormGroupView',
|
|
95
89
|
name: 'XFormGroupView',
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 根据类型获取日期区间字符串
|
|
3
|
-
* @param type '当年' | 'curMonth' | '当日'
|
|
4
|
-
* @param show 区分实际值还是显示值, true为实际值, false为显示值
|
|
5
|
-
* @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
|
|
6
|
-
*/
|
|
7
|
-
export function getRangeByType(type: string, show: boolean): [string, string] {
|
|
8
|
-
const now = new Date()
|
|
9
|
-
const year = now.getFullYear()
|
|
10
|
-
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
|
11
|
-
const day = now.getDate().toString().padStart(2, '0')
|
|
12
|
-
|
|
13
|
-
if (!show) {
|
|
14
|
-
if (type === 'curYear') {
|
|
15
|
-
return [
|
|
16
|
-
`${year}-01-01 00:00:00`,
|
|
17
|
-
`${year}-12-31 23:59:59`,
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
if (type === 'curMonth') {
|
|
21
|
-
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
22
|
-
return [
|
|
23
|
-
`${year}-${month}-01 00:00:00`,
|
|
24
|
-
`${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
if (type === 'curDay') {
|
|
28
|
-
return [
|
|
29
|
-
`${year}-${month}-${day} 00:00:00`,
|
|
30
|
-
`${year}-${month}-${day} 23:59:59`,
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (show) {
|
|
35
|
-
if (type === 'curYear') {
|
|
36
|
-
return [
|
|
37
|
-
`${year}-01-01`,
|
|
38
|
-
`${year}-12-31`,
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
if (type === 'curMonth') {
|
|
42
|
-
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
43
|
-
return [
|
|
44
|
-
`${year}-${month}-01`,
|
|
45
|
-
`${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
if (type === 'curDay') {
|
|
49
|
-
return [
|
|
50
|
-
`${year}-${month}-${day}`,
|
|
51
|
-
`${year}-${month}-${day}`,
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// 兜底返回空字符串数组
|
|
56
|
-
return ['', '']
|
|
57
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 根据类型获取日期区间字符串
|
|
3
|
+
* @param type '当年' | 'curMonth' | '当日'
|
|
4
|
+
* @param show 区分实际值还是显示值, true为实际值, false为显示值
|
|
5
|
+
* @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
|
|
6
|
+
*/
|
|
7
|
+
export function getRangeByType(type: string, show: boolean): [string, string] {
|
|
8
|
+
const now = new Date()
|
|
9
|
+
const year = now.getFullYear()
|
|
10
|
+
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
|
11
|
+
const day = now.getDate().toString().padStart(2, '0')
|
|
12
|
+
|
|
13
|
+
if (!show) {
|
|
14
|
+
if (type === 'curYear') {
|
|
15
|
+
return [
|
|
16
|
+
`${year}-01-01 00:00:00`,
|
|
17
|
+
`${year}-12-31 23:59:59`,
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
if (type === 'curMonth') {
|
|
21
|
+
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
22
|
+
return [
|
|
23
|
+
`${year}-${month}-01 00:00:00`,
|
|
24
|
+
`${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
if (type === 'curDay') {
|
|
28
|
+
return [
|
|
29
|
+
`${year}-${month}-${day} 00:00:00`,
|
|
30
|
+
`${year}-${month}-${day} 23:59:59`,
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (show) {
|
|
35
|
+
if (type === 'curYear') {
|
|
36
|
+
return [
|
|
37
|
+
`${year}-01-01`,
|
|
38
|
+
`${year}-12-31`,
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
if (type === 'curMonth') {
|
|
42
|
+
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
43
|
+
return [
|
|
44
|
+
`${year}-${month}-01`,
|
|
45
|
+
`${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
if (type === 'curDay') {
|
|
49
|
+
return [
|
|
50
|
+
`${year}-${month}-${day}`,
|
|
51
|
+
`${year}-${month}-${day}`,
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// 兜底返回空字符串数组
|
|
56
|
+
return ['', '']
|
|
57
|
+
}
|
|
@@ -1,156 +1,29 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
|
|
3
|
-
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
4
|
-
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
5
3
|
import { defineEmits, ref } from 'vue'
|
|
6
4
|
import { useRouter } from 'vue-router'
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
const emit = defineEmits(['deleteRow'])
|
|
10
|
-
const userInfo = useUserStore().getUserInfo()
|
|
11
|
-
// 访问路由
|
|
6
|
+
const emit = defineEmits(['addressSelected'])
|
|
12
7
|
const router = useRouter()
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const configName = ref('测试2')
|
|
21
|
-
const serviceName = ref('af-gaslink')
|
|
22
|
-
// const configName = ref('mobile_liushuiQueryCRUD')
|
|
23
|
-
// const serviceName = ref('af-revenue')
|
|
24
|
-
|
|
25
|
-
// 资源权限测试
|
|
26
|
-
// const configName = ref('crud_sources_test')
|
|
27
|
-
// const serviceName = ref('af-system')
|
|
28
|
-
|
|
29
|
-
// 实际业务测试
|
|
30
|
-
// const configName = ref('lngChargeAuditMobileCRUD')
|
|
31
|
-
// const serviceName = ref('af-gaslink')
|
|
32
|
-
|
|
33
|
-
// 跳转到详情页面
|
|
34
|
-
// function toDetail(item) {
|
|
35
|
-
// router.push({
|
|
36
|
-
// name: 'XCellDetailView',
|
|
37
|
-
// params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
|
|
38
|
-
// query: {
|
|
39
|
-
// operName: item[operNameKey.value],
|
|
40
|
-
// method:item[methodKey.value],
|
|
41
|
-
// requestMethod:item[requestMethodKey.value],
|
|
42
|
-
// operatorType:item[operatorTypeKey.value],
|
|
43
|
-
// operUrl:item[operUrlKey.value],
|
|
44
|
-
// operIp:item[operIpKey.value],
|
|
45
|
-
// costTime:item[costTimeKey.value],
|
|
46
|
-
// operTime:item[operTimeKey.value],
|
|
47
|
-
//
|
|
48
|
-
// title: item[titleKey.value],
|
|
49
|
-
// businessType: item[businessTypeKey.value],
|
|
50
|
-
// status:item[statusKey.value]
|
|
51
|
-
// }
|
|
52
|
-
// })
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
|
-
// 跳转到表单——以表单组来渲染纯表单
|
|
56
|
-
function toDetail(item) {
|
|
57
|
-
router.push({
|
|
58
|
-
name: 'xformgroup222',
|
|
59
|
-
// query: {
|
|
60
|
-
// id: item[idKey.value],
|
|
61
|
-
// id: item.rr_id,
|
|
62
|
-
// o_id: item.o_id,
|
|
63
|
-
// },
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 新增功能
|
|
68
|
-
// function addOption(totalCount) {
|
|
69
|
-
// router.push({
|
|
70
|
-
// name: 'XFormView',
|
|
71
|
-
// params: { id: totalCount, openid: totalCount },
|
|
72
|
-
// query: {
|
|
73
|
-
// configName: configName.value,
|
|
74
|
-
// serviceName: serviceName.value,
|
|
75
|
-
// mode: '新增',
|
|
76
|
-
// },
|
|
77
|
-
// })
|
|
78
|
-
// }
|
|
79
|
-
function addOption() {
|
|
80
|
-
console.log('用户----', userInfo)
|
|
81
|
-
router.push({
|
|
82
|
-
name: 'XFormGroupView',
|
|
83
|
-
// params: { id: totalCount.value },
|
|
84
|
-
// query: {
|
|
85
|
-
// configName: configName.value,
|
|
86
|
-
// serviceName: serviceName.value,
|
|
87
|
-
// mode: '新增',
|
|
88
|
-
// },
|
|
8
|
+
const configName = ref('ApplyContractPhoneCRUD')
|
|
9
|
+
const xCellListRefPatrolPlan = ref()
|
|
10
|
+
// 详情
|
|
11
|
+
function toDetail(row) {
|
|
12
|
+
emit('addressSelected', {
|
|
13
|
+
f_address: row.tua_f_address,
|
|
14
|
+
f_address_id: row.tua_id,
|
|
89
15
|
})
|
|
90
|
-
// 如果存在回调函数,调用它并传递true表示已处理
|
|
91
|
-
// if (typeof callback === 'function') {
|
|
92
|
-
// callback(true)
|
|
93
|
-
// }
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// 修改功能
|
|
97
|
-
function updateRow(result) {
|
|
98
|
-
console.log('用户----', userInfo)
|
|
99
|
-
router.push({
|
|
100
|
-
name: 'XFormView',
|
|
101
|
-
params: { id: 1, openid: 2 },
|
|
102
|
-
query: {
|
|
103
|
-
configName: configName.value,
|
|
104
|
-
serviceName: serviceName.value,
|
|
105
|
-
mode: '修改',
|
|
106
|
-
},
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 删除功能
|
|
111
|
-
function deleteRow(result) {
|
|
112
|
-
emit('deleteRow', result.o_id)
|
|
113
16
|
}
|
|
114
17
|
</script>
|
|
115
18
|
|
|
116
19
|
<template>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<!-- :id-key="idKey" -->
|
|
125
|
-
<!-- @to-detail="toDetail" -->
|
|
126
|
-
<!-- @delete-row="deleteRow" -->
|
|
127
|
-
<!-- @update="updateRow" -->
|
|
128
|
-
<!-- @add="addOption" -->
|
|
129
|
-
<!-- /> -->
|
|
130
|
-
|
|
131
|
-
<!-- :fix-query-form="{ u_f_price_state: ['生效', '待生效'] }" -->
|
|
132
|
-
|
|
133
|
-
<!-- <XCellList -->
|
|
134
|
-
<!-- config-name="ApplyMobileSuperviseCRUD" -->
|
|
135
|
-
<!-- service-name="af-apply" -->
|
|
136
|
-
<!-- @to-detail="toDetail" -->
|
|
137
|
-
<!-- @delete-row="deleteRow" -->
|
|
138
|
-
<!-- /> -->
|
|
139
|
-
|
|
140
|
-
<!-- <XCellList -->
|
|
141
|
-
<!-- service-name="af-revenue" -->
|
|
142
|
-
<!-- config-name="userfiles_sel_address" -->
|
|
143
|
-
<!-- @to-detail="toDetail" -->
|
|
144
|
-
<!-- /> -->
|
|
145
|
-
<XCellList
|
|
146
|
-
service-name="af-safecheck"
|
|
147
|
-
config-name="temporarySecurityCheckCRUD"
|
|
148
|
-
:custom-add="true"
|
|
149
|
-
@to-detail="toDetail"
|
|
150
|
-
@add="addOption"
|
|
151
|
-
/>
|
|
152
|
-
</template>
|
|
153
|
-
</NormalDataLayout>
|
|
20
|
+
<XCellList
|
|
21
|
+
ref="xCellListRefPatrolPlan"
|
|
22
|
+
service-name="af-apply"
|
|
23
|
+
:config-name="configName"
|
|
24
|
+
:hide-all-actions="true"
|
|
25
|
+
@to-detail="toDetail"
|
|
26
|
+
/>
|
|
154
27
|
</template>
|
|
155
28
|
|
|
156
29
|
<style scoped lang="less">
|
|
@@ -5,28 +5,30 @@ import { showDialog } from 'vant'
|
|
|
5
5
|
import { ref } from 'vue'
|
|
6
6
|
import { useRoute } from 'vue-router'
|
|
7
7
|
|
|
8
|
-
// const configName = ref('reviewFormGroup')
|
|
9
|
-
// const serviceName = ref('af-revenue')
|
|
10
|
-
|
|
11
8
|
// 纯表单
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const configName = ref('appapplyuserinfoFormGroup')
|
|
10
|
+
const serviceName = ref('af-apply')
|
|
14
11
|
|
|
15
12
|
// const configName = ref("计划下发Form")
|
|
16
13
|
// const serviceName = ref("af-linepatrol")
|
|
17
14
|
|
|
18
15
|
// 表单组
|
|
19
|
-
const configName = ref('lngChargeAuditMobileFormGroup')
|
|
20
|
-
const serviceName = ref('af-gaslink')
|
|
16
|
+
// const configName = ref('lngChargeAuditMobileFormGroup')
|
|
17
|
+
// const serviceName = ref('af-gaslink')
|
|
21
18
|
|
|
22
19
|
const formData = ref({})
|
|
23
20
|
const formGroup = ref(null)
|
|
24
21
|
const route = useRoute()
|
|
25
22
|
const isInit = ref(false)
|
|
23
|
+
|
|
24
|
+
const formShow = {
|
|
25
|
+
showt_userinfo: true,
|
|
26
|
+
showdevices: true
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
function submit(_result) {
|
|
27
30
|
showDialog({ message: '提交成功' }).then(() => {
|
|
28
|
-
|
|
29
|
-
// history.back()
|
|
31
|
+
history.back()
|
|
30
32
|
})
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -67,10 +69,12 @@ function submit(_result) {
|
|
|
67
69
|
<!-- v-if="isInit" -->
|
|
68
70
|
<XFormGroup
|
|
69
71
|
ref="formGroup"
|
|
70
|
-
config-name="
|
|
71
|
-
service-name="
|
|
72
|
+
:config-name="configName"
|
|
73
|
+
:service-name="serviceName"
|
|
72
74
|
:group-form-data="formData"
|
|
75
|
+
:form-show="formShow"
|
|
73
76
|
mode="新增"
|
|
77
|
+
:is-scrollspy="true"
|
|
74
78
|
@submit="submit"
|
|
75
79
|
/>
|
|
76
80
|
</template>
|
|
@@ -7,8 +7,19 @@ const configName = ref('AddConstructionForm')
|
|
|
7
7
|
const serviceName = ref('af-linepatrol')
|
|
8
8
|
|
|
9
9
|
const formGroupAddConstruction = ref(null)
|
|
10
|
+
function emitFunc(func, data) {
|
|
11
|
+
if (func === 'selectAddress') {
|
|
12
|
+
const add = 'ccss'
|
|
13
|
+
// 设置单个字段
|
|
14
|
+
formGroupAddConstruction.value?.setForm({ address: '你的字符串' })
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function submit(data) {
|
|
18
|
+
console.log('>>>> data: ', JSON.stringify(data))
|
|
19
|
+
}
|
|
10
20
|
</script>
|
|
11
21
|
|
|
22
|
+
<!-- workflowId -->
|
|
12
23
|
<template>
|
|
13
24
|
<NormalDataLayout id="XFormGroupView" title="纯表单">
|
|
14
25
|
<template #layout_content>
|
|
@@ -17,6 +28,10 @@ const formGroupAddConstruction = ref(null)
|
|
|
17
28
|
mode="新增"
|
|
18
29
|
:config-name="configName"
|
|
19
30
|
:service-name="serviceName"
|
|
31
|
+
:param-logic-name-param="{ aa: 123 }"
|
|
32
|
+
:form-data="{ f_project_name: 333 }"
|
|
33
|
+
@x-form-item-emit-func="emitFunc"
|
|
34
|
+
@on-submit="submit"
|
|
20
35
|
/>
|
|
21
36
|
</template>
|
|
22
37
|
</NormalDataLayout>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
|
|
3
|
+
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
4
|
+
import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
|
|
5
|
+
import { onBeforeMount, ref, toRaw } from 'vue'
|
|
6
|
+
|
|
7
|
+
const configName = ref('AddConstructionForm')
|
|
8
|
+
const serviceName = ref('af-linepatrol')
|
|
9
|
+
const formGroup = ref(null)
|
|
10
|
+
const formConfig = ref(null)
|
|
11
|
+
const submitSimple = ref(null)
|
|
12
|
+
const isLoading = ref(true)
|
|
13
|
+
|
|
14
|
+
function safeStringify(obj) {
|
|
15
|
+
const seen = new WeakSet()
|
|
16
|
+
return JSON.stringify(toRaw(obj), (key, val) => {
|
|
17
|
+
if (typeof val === 'object' && val !== null) {
|
|
18
|
+
if (seen.has(val))
|
|
19
|
+
return
|
|
20
|
+
seen.add(val)
|
|
21
|
+
}
|
|
22
|
+
return val
|
|
23
|
+
}, 2)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function submit(result) {
|
|
27
|
+
console.log('>>>> result: ', safeStringify(result))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function loadConfig() {
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
getConfigByName(configName.value, (result) => {
|
|
33
|
+
submitSimple.value = result.showSubmitBtn
|
|
34
|
+
formConfig.value = result
|
|
35
|
+
resolve(result)
|
|
36
|
+
}, serviceName.value)
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onBeforeMount(async () => {
|
|
41
|
+
try {
|
|
42
|
+
await loadConfig()
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
isLoading.value = false
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<NormalDataLayout id="XFormGroupView" title="纯表单">
|
|
52
|
+
<template #layout_content>
|
|
53
|
+
<van-loading v-if="isLoading" />
|
|
54
|
+
<XForm
|
|
55
|
+
v-else
|
|
56
|
+
ref="formGroup"
|
|
57
|
+
mode="查询"
|
|
58
|
+
:service-name="serviceName"
|
|
59
|
+
:group-form-items="formConfig"
|
|
60
|
+
:form-data="{}"
|
|
61
|
+
:form-name="formConfig?.groupName || '11111'"
|
|
62
|
+
:submit-button="submitSimple"
|
|
63
|
+
@on-submit="submit"
|
|
64
|
+
/>
|
|
65
|
+
</template>
|
|
66
|
+
</NormalDataLayout>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<style scoped lang="less">
|
|
70
|
+
</style>
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
|
|
3
|
-
import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
|
|
4
|
-
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
5
|
-
import { showNotify } from 'vant'
|
|
6
|
-
import { ref } from 'vue'
|
|
7
|
-
|
|
8
|
-
const selectedLocation = ref<LocationResult>()
|
|
9
|
-
|
|
10
|
-
// 处理位置选择
|
|
11
|
-
function handleLocationConfirm(location: LocationResult) {
|
|
12
|
-
// console.log('选择的位置:', location)
|
|
13
|
-
// selectedLocation.value = location
|
|
14
|
-
showNotify({ type: 'success', message: '位置已选择' })
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
|
|
20
|
-
<template #layout_content>
|
|
21
|
-
<div class="location-picker-demo">
|
|
22
|
-
<!-- 页面标题 -->
|
|
23
|
-
<div class="page-header">
|
|
24
|
-
<div class="title">
|
|
25
|
-
位置选择
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<!-- 选择结果展示 -->
|
|
30
|
-
<div v-if="selectedLocation" class="location-result">
|
|
31
|
-
<div class="label">
|
|
32
|
-
已选位置:
|
|
33
|
-
</div>
|
|
34
|
-
<div class="value">
|
|
35
|
-
{{ selectedLocation.address }}
|
|
36
|
-
</div>
|
|
37
|
-
<div class="coordinates">
|
|
38
|
-
经度: {{ selectedLocation.longitude.toFixed(6) }},
|
|
39
|
-
纬度: {{ selectedLocation.latitude.toFixed(6) }}
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<!-- 地图组件 -->
|
|
44
|
-
<div class="map-container">
|
|
45
|
-
<LocationPicker
|
|
46
|
-
v-model="selectedLocation"
|
|
47
|
-
:default-center="[108.948024, 34.263161]"
|
|
48
|
-
:default-zoom="12"
|
|
49
|
-
@confirm="handleLocationConfirm"
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
</NormalDataLayout>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<style scoped lang="less">
|
|
58
|
-
.location-picker-demo {
|
|
59
|
-
width: 100%;
|
|
60
|
-
height: 100%;
|
|
61
|
-
position: relative;
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
background-color: #f7f8fa;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.page-header {
|
|
68
|
-
height: 44px;
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
justify-content: center;
|
|
72
|
-
background: white;
|
|
73
|
-
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
|
74
|
-
position: relative;
|
|
75
|
-
z-index: 1;
|
|
76
|
-
|
|
77
|
-
.title {
|
|
78
|
-
font-size: 16px;
|
|
79
|
-
color: #333;
|
|
80
|
-
font-weight: 500;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.location-result {
|
|
85
|
-
background: white;
|
|
86
|
-
padding: 12px 16px;
|
|
87
|
-
margin: 10px;
|
|
88
|
-
border-radius: 8px;
|
|
89
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
90
|
-
|
|
91
|
-
.label {
|
|
92
|
-
font-size: 14px;
|
|
93
|
-
color: #666;
|
|
94
|
-
margin-bottom: 4px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.value {
|
|
98
|
-
font-size: 16px;
|
|
99
|
-
color: #333;
|
|
100
|
-
margin-bottom: 8px;
|
|
101
|
-
word-break: break-all;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.coordinates {
|
|
105
|
-
font-size: 12px;
|
|
106
|
-
color: #999;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.map-container {
|
|
111
|
-
flex: 1;
|
|
112
|
-
position: relative;
|
|
113
|
-
margin: 0 10px 10px 10px;
|
|
114
|
-
border-radius: 8px;
|
|
115
|
-
overflow: hidden;
|
|
116
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
117
|
-
}
|
|
118
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
|
|
3
|
+
import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
|
|
4
|
+
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
5
|
+
import { showNotify } from 'vant'
|
|
6
|
+
import { ref } from 'vue'
|
|
7
|
+
|
|
8
|
+
const selectedLocation = ref<LocationResult>()
|
|
9
|
+
|
|
10
|
+
// 处理位置选择
|
|
11
|
+
function handleLocationConfirm(location: LocationResult) {
|
|
12
|
+
// console.log('选择的位置:', location)
|
|
13
|
+
// selectedLocation.value = location
|
|
14
|
+
showNotify({ type: 'success', message: '位置已选择' })
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
|
|
20
|
+
<template #layout_content>
|
|
21
|
+
<div class="location-picker-demo">
|
|
22
|
+
<!-- 页面标题 -->
|
|
23
|
+
<div class="page-header">
|
|
24
|
+
<div class="title">
|
|
25
|
+
位置选择
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- 选择结果展示 -->
|
|
30
|
+
<div v-if="selectedLocation" class="location-result">
|
|
31
|
+
<div class="label">
|
|
32
|
+
已选位置:
|
|
33
|
+
</div>
|
|
34
|
+
<div class="value">
|
|
35
|
+
{{ selectedLocation.address }}
|
|
36
|
+
</div>
|
|
37
|
+
<div class="coordinates">
|
|
38
|
+
经度: {{ selectedLocation.longitude.toFixed(6) }},
|
|
39
|
+
纬度: {{ selectedLocation.latitude.toFixed(6) }}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<!-- 地图组件 -->
|
|
44
|
+
<div class="map-container">
|
|
45
|
+
<LocationPicker
|
|
46
|
+
v-model="selectedLocation"
|
|
47
|
+
:default-center="[108.948024, 34.263161]"
|
|
48
|
+
:default-zoom="12"
|
|
49
|
+
@confirm="handleLocationConfirm"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</NormalDataLayout>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<style scoped lang="less">
|
|
58
|
+
.location-picker-demo {
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 100%;
|
|
61
|
+
position: relative;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
background-color: #f7f8fa;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.page-header {
|
|
68
|
+
height: 44px;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
background: white;
|
|
73
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
|
74
|
+
position: relative;
|
|
75
|
+
z-index: 1;
|
|
76
|
+
|
|
77
|
+
.title {
|
|
78
|
+
font-size: 16px;
|
|
79
|
+
color: #333;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.location-result {
|
|
85
|
+
background: white;
|
|
86
|
+
padding: 12px 16px;
|
|
87
|
+
margin: 10px;
|
|
88
|
+
border-radius: 8px;
|
|
89
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
90
|
+
|
|
91
|
+
.label {
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
color: #666;
|
|
94
|
+
margin-bottom: 4px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.value {
|
|
98
|
+
font-size: 16px;
|
|
99
|
+
color: #333;
|
|
100
|
+
margin-bottom: 8px;
|
|
101
|
+
word-break: break-all;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.coordinates {
|
|
105
|
+
font-size: 12px;
|
|
106
|
+
color: #999;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.map-container {
|
|
111
|
+
flex: 1;
|
|
112
|
+
position: relative;
|
|
113
|
+
margin: 0 10px 10px 10px;
|
|
114
|
+
border-radius: 8px;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -1,20 +1,145 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { PhoneLocationStatus } from '@af-mobile-client-vue3/components/data/XOlMap/types'
|
|
2
3
|
import useSettingStore from '@af-mobile-client-vue3/stores/modules/setting'
|
|
3
4
|
import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
|
|
5
|
+
import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
4
6
|
import { Dialog as vanDialog, Icon as vanIcon } from 'vant'
|
|
5
|
-
import { ref } from 'vue'
|
|
7
|
+
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
|
6
8
|
import { useRouter } from 'vue-router'
|
|
7
9
|
import ModifyPassword from './comm/ModifyPassword.vue'
|
|
8
10
|
|
|
9
11
|
const router = useRouter()
|
|
10
12
|
const username = useUserStore().getUserInfo().name
|
|
11
13
|
const fullnames = useUserStore().getLogin().f.resources.fullnames
|
|
14
|
+
const roleName = useUserStore().getLogin().f.resources.f_role_name
|
|
12
15
|
|
|
13
16
|
// 修改密码弹窗显示状态
|
|
14
17
|
const showModifyPassword = ref(false)
|
|
15
18
|
// 退出登录确认弹窗显示状态
|
|
16
19
|
const showLogoutConfirm = ref(false)
|
|
20
|
+
// 在setup函数中
|
|
21
|
+
let intervalId = null
|
|
22
|
+
|
|
23
|
+
// 定义一个变量来存储上一次的上传结果
|
|
24
|
+
const lastUploadResult = ref(null)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 上次上传结果类型定义
|
|
28
|
+
*/
|
|
29
|
+
interface LocationInfo {
|
|
30
|
+
uploadTime: string
|
|
31
|
+
f_realtime: string
|
|
32
|
+
f_latitude: number
|
|
33
|
+
f_longitude: number
|
|
34
|
+
f_address?: string
|
|
35
|
+
f_speed?: number
|
|
36
|
+
f_bearing?: number
|
|
37
|
+
f_altitude?: number
|
|
38
|
+
isError: boolean
|
|
39
|
+
errorCode?: string
|
|
40
|
+
// ... 其他字段
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface UploadResult {
|
|
44
|
+
uploadTime: string
|
|
45
|
+
location: LocationInfo
|
|
46
|
+
response: {
|
|
47
|
+
code: number
|
|
48
|
+
msg?: string
|
|
49
|
+
[key: string]: any
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 兼容 lastUploadResult 可能为字符串或对象
|
|
54
|
+
const lastUploadResultObj = computed<UploadResult | null>(() => {
|
|
55
|
+
if (!lastUploadResult.value)
|
|
56
|
+
return null
|
|
57
|
+
if (typeof lastUploadResult.value === 'string') {
|
|
58
|
+
try {
|
|
59
|
+
return JSON.parse(lastUploadResult.value)
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return lastUploadResult.value
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const uploadDisplayInfo = computed(() => {
|
|
69
|
+
const result = lastUploadResultObj.value
|
|
70
|
+
if (!result)
|
|
71
|
+
return { error: null, info: null }
|
|
72
|
+
// response.code 不为 200
|
|
73
|
+
if (result.response && result.response.code !== 200) {
|
|
74
|
+
return { error: result.response.msg || '未知错误', info: null }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// location.errorCode 存在且 isError 为 true
|
|
78
|
+
if (result.location && result.location.isError && result.location.errorCode) {
|
|
79
|
+
return { error: result.location.errorCode, info: null }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 正常展示
|
|
83
|
+
if (result.location) {
|
|
84
|
+
return {
|
|
85
|
+
error: null,
|
|
86
|
+
info: {
|
|
87
|
+
uploadTime: result.uploadTime,
|
|
88
|
+
latitude: result.location.f_latitude,
|
|
89
|
+
longitude: result.location.f_longitude,
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return { error: null, info: null }
|
|
95
|
+
})
|
|
17
96
|
|
|
97
|
+
const uploadStatusTag = computed(() => {
|
|
98
|
+
const result = uploadDisplayInfo.value
|
|
99
|
+
if (result.error) {
|
|
100
|
+
return { text: '上传定位失败', color: 'red' }
|
|
101
|
+
}
|
|
102
|
+
if (result.info) {
|
|
103
|
+
return { text: '正在上传定位', color: 'green' }
|
|
104
|
+
}
|
|
105
|
+
return null
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
onMounted(() => {
|
|
109
|
+
if (roleName.includes('需要定位人员')) {
|
|
110
|
+
// 立即执行一次
|
|
111
|
+
mobileUtil.execute({
|
|
112
|
+
param: {},
|
|
113
|
+
funcName: 'getLastRealtimeUploadResult',
|
|
114
|
+
callbackFunc: (result: PhoneLocationStatus) => {
|
|
115
|
+
if (result.status === 'success') {
|
|
116
|
+
lastUploadResult.value = result.data
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// 设置每5秒执行一次的定时器
|
|
122
|
+
intervalId = setInterval(() => {
|
|
123
|
+
mobileUtil.execute({
|
|
124
|
+
param: {},
|
|
125
|
+
funcName: 'getLastRealtimeUploadResult',
|
|
126
|
+
callbackFunc: (result: PhoneLocationStatus) => {
|
|
127
|
+
if (result.status === 'success') {
|
|
128
|
+
lastUploadResult.value = result.data
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
}, 5000) // 5000毫秒 = 5秒
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
onUnmounted(() => {
|
|
137
|
+
// 组件卸载时清除定时器
|
|
138
|
+
if (intervalId) {
|
|
139
|
+
clearInterval(intervalId)
|
|
140
|
+
intervalId = null
|
|
141
|
+
}
|
|
142
|
+
})
|
|
18
143
|
function exit_login() {
|
|
19
144
|
showLogoutConfirm.value = true
|
|
20
145
|
}
|
|
@@ -65,6 +190,12 @@ const webMobileConfig = useSettingStore().getSetting()
|
|
|
65
190
|
<div class="user-detail">
|
|
66
191
|
<h2 class="username">
|
|
67
192
|
{{ username }}
|
|
193
|
+
<span
|
|
194
|
+
v-if="uploadStatusTag"
|
|
195
|
+
class="upload-status-tag" :class="[uploadStatusTag.color]"
|
|
196
|
+
>
|
|
197
|
+
{{ uploadStatusTag.text }}
|
|
198
|
+
</span>
|
|
68
199
|
</h2>
|
|
69
200
|
<p class="user-role">
|
|
70
201
|
{{ fullnames }}
|
|
@@ -237,6 +368,25 @@ const webMobileConfig = useSettingStore().getSetting()
|
|
|
237
368
|
color: #333;
|
|
238
369
|
margin: 0 0 4px 0;
|
|
239
370
|
}
|
|
371
|
+
.upload-status-tag {
|
|
372
|
+
display: inline-block;
|
|
373
|
+
margin-left: 8px;
|
|
374
|
+
padding: 2px 8px;
|
|
375
|
+
border-radius: 8px;
|
|
376
|
+
font-size: 12px;
|
|
377
|
+
font-weight: 400;
|
|
378
|
+
background: #f0f0f0;
|
|
379
|
+
&.green {
|
|
380
|
+
color: #10b981;
|
|
381
|
+
background: #e6f9f0;
|
|
382
|
+
border: 1px solid #10b981;
|
|
383
|
+
}
|
|
384
|
+
&.red {
|
|
385
|
+
color: #ef4444;
|
|
386
|
+
background: #fdeaea;
|
|
387
|
+
border: 1px solid #ef4444;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
240
390
|
|
|
241
391
|
.user-role {
|
|
242
392
|
font-size: 14px;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
|
|
3
|
-
import { runLogic } from '@af-mobile-client-vue3/services/api/common'
|
|
4
|
-
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
5
|
-
import dayjs from 'dayjs/esm/index'
|
|
6
|
-
import { showToast } from 'vant'
|
|
7
|
-
import { onMounted, ref } from 'vue'
|
|
8
|
-
import { useRoute } from 'vue-router'
|
|
9
|
-
|
|
10
|
-
const configName = ref('appapplyuserinfoFormGroup')
|
|
11
|
-
const serviceName = ref('af-apply')
|
|
12
|
-
const route = useRoute()
|
|
13
|
-
const userInfo = useUserStore().getUserInfo()
|
|
14
|
-
const workflowId = ref('3045')
|
|
15
|
-
const userinfoid = ref('93116')
|
|
16
|
-
const model = ref('编辑')
|
|
17
|
-
const groupFormData = ref({})
|
|
18
|
-
|
|
19
|
-
function submit(res) {
|
|
20
|
-
if (model.value === '新增') {
|
|
21
|
-
res.t_userinfo.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
22
|
-
res.t_userinfo.f_orgid = userInfo.f_orgid
|
|
23
|
-
res.t_userinfo.f_orgname = userInfo.f_orgname
|
|
24
|
-
res.t_userinfo.f_depid = userInfo.f_depid
|
|
25
|
-
res.t_userinfo.f_depname = userInfo.f_depname
|
|
26
|
-
res.t_userinfo.f_operatorid = userInfo.f_operatorid
|
|
27
|
-
res.t_userinfo.f_operator = userInfo.f_operator
|
|
28
|
-
res.t_userinfo.f_workflow_id = this.f_workflow_id
|
|
29
|
-
res.t_userinfo.f_user_state = '预备'
|
|
30
|
-
|
|
31
|
-
res.t_userfiles.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
32
|
-
res.t_userfiles.f_orgid = userInfo.f_orgid
|
|
33
|
-
res.t_userfiles.f_orgname = userInfo.f_orgname
|
|
34
|
-
res.t_userfiles.f_depid = userInfo.f_depid
|
|
35
|
-
res.t_userfiles.f_depname = userInfo.f_depname
|
|
36
|
-
res.t_userfiles.f_operatorid = userInfo.f_operatorid
|
|
37
|
-
res.t_userfiles.f_operator = userInfo.f_operator
|
|
38
|
-
res.t_userfiles.f_workflow_id = this.f_workflow_id
|
|
39
|
-
res.t_userfiles.f_table_state = '待开通'
|
|
40
|
-
}
|
|
41
|
-
let saveData = res
|
|
42
|
-
if (saveData.t_userfiles.f_gasbrand_id.length > 0) {
|
|
43
|
-
saveData.t_userfiles.f_gasbrand_id = saveData.t_userfiles.f_gasbrand_id[0]
|
|
44
|
-
}
|
|
45
|
-
if (saveData.t_userfiles.f_price_id.length > 0) {
|
|
46
|
-
saveData.t_userfiles.f_price_id = saveData.t_userfiles.f_price_id[0]
|
|
47
|
-
}
|
|
48
|
-
if (model.value === '编辑') {
|
|
49
|
-
saveData = Object.assign(saveData, {
|
|
50
|
-
f_operator_record: userInfo.f_operator,
|
|
51
|
-
f_operatorid_record: userInfo.f_operatorid,
|
|
52
|
-
f_orgid_record: userInfo.f_orgid,
|
|
53
|
-
f_orgname_record: userInfo.f_orgname,
|
|
54
|
-
f_depid_record: userInfo.f_depid,
|
|
55
|
-
f_depname_record: userInfo.f_depname,
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
runLogic('userFIleSaveLogic', saveData, 'af-revenue').then((res) => {
|
|
59
|
-
showToast('操作成功!')
|
|
60
|
-
history.back()
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
const isInit = ref(false)
|
|
64
|
-
function init() {
|
|
65
|
-
if (model.value === '编辑') {
|
|
66
|
-
runLogic('getFileDetailForEdit', { f_userinfo_id: userinfoid.value }, 'af-revenue').then((res) => {
|
|
67
|
-
// if (res.t_userfiles.f_gasmodel_id) {
|
|
68
|
-
// res.t_userfiles.f_gasmodel_id = 76
|
|
69
|
-
// }
|
|
70
|
-
// if (res.t_userfiles.f_price_id) {
|
|
71
|
-
// res.t_userfiles.f_price_id = [res.t_userfiles.f_price_id]
|
|
72
|
-
// }
|
|
73
|
-
console.log('1111111----,', res)
|
|
74
|
-
groupFormData.value = res
|
|
75
|
-
isInit.value = true
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
onMounted(() => {
|
|
80
|
-
init()
|
|
81
|
-
})
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<template>
|
|
85
|
-
<XFormGroup
|
|
86
|
-
v-if="isInit"
|
|
87
|
-
mode="修改"
|
|
88
|
-
:config-name="configName"
|
|
89
|
-
:service-name="serviceName"
|
|
90
|
-
:group-form-data="groupFormData"
|
|
91
|
-
@submit="submit"
|
|
92
|
-
/>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<style scoped lang="less">
|
|
96
|
-
|
|
97
|
-
</style>
|