af-mobile-client-vue3 1.1.9 → 1.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.1.9",
4
+ "version": "1.1.10",
5
5
  "description": "Vue + Vite component lib",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -145,88 +145,91 @@ const showFormItemFunc = debounce(async () => {
145
145
  }
146
146
  }, 500)
147
147
 
148
- const localValue = computed({
149
- get() {
150
- switch (attr.type) {
151
- case 'uploader':
152
- if (mode === '查询') {
153
- return props.modelValue !== undefined ? props.modelValue : querySelectDefaultValue.value
154
- }
155
- else {
156
- return props.modelValue !== undefined ? props.modelValue : formSelectDefaultValue.value
157
- }
158
- case 'switch':
159
- return props.modelValue !== undefined ? props.modelValue : false
160
- case 'checkbox':
161
- case 'file':
162
- case 'image':
163
- case 'timePicker':
164
- case 'datePicker':
165
- if (mode === '查询') {
166
- // console.log(querySelectDefaultValue.value)
167
- return props.modelValue !== undefined ? props.modelValue : querySelectDefaultValue.value
168
- }
169
- else {
170
- // console.log(formSelectDefaultValue.value)
171
- return props.modelValue !== undefined ? props.modelValue : formSelectDefaultValue.value
172
- }
173
- // case 'datePicker':
174
- // if (mode === '查询') {
175
- // // console.log(querySelectDefaultValue.value)
176
- // return props.modelValue !== undefined ? props.modelValue : querySelectDefaultValue.value
177
- // }
178
- // else {
179
- // if (props.modelValue !== undefined) {
180
- // // 拆分日期和时间
181
- // const [dateStr, timeStr] = props.modelValue.split(' ')
182
- // // 拆分日期部分
183
- // const date = dateStr.split('-')
184
- // // 拆分时间部分
185
- // const time = timeStr.split(':')
186
- // // 赋值给 dateTimePickerValue
187
- // // eslint-disable-next-line vue/no-side-effects-in-computed-properties
188
- // dateTimePickerValue.value = {
189
- // date,
190
- // time,
191
- // }
192
- // return dateTimePickerValue.value
193
- // }
194
- // return formSelectDefaultValue.value
195
- // }
196
- case 'radio':
197
- case 'rate':
198
- case 'slider':
199
- case 'area':
200
- case 'citySelect':
201
- case 'calendar':
202
- case 'textarea':
203
- case 'intervalPicker':
204
- case 'input':
205
- case 'select':
206
- if (mode === '查询')
207
- return props.modelValue !== undefined ? props.modelValue : queryInputDefaultValue.value
208
- else
209
- return props.modelValue !== undefined ? props.modelValue : formInputDefaultValue.value
210
- case 'stepper':
211
- return props.modelValue !== undefined ? props.modelValue : 1
212
- case 'rangePicker':
213
- if (props.modelValue && Array.isArray(props.modelValue) && props.modelValue.length > 1)
214
- return `${props.modelValue[0]} ~ ${props.modelValue[1]}`
215
-
216
- else
217
- return props.modelValue
218
- case 'addressSearch':
148
+ // 获取默认值的函数
149
+ function getDefaultValue() {
150
+ switch (attr.type) {
151
+ case 'uploader':
152
+ case 'checkbox':
153
+ case 'file':
154
+ case 'image':
155
+ case 'timePicker':
156
+ case 'datePicker':
157
+ if (mode === '查询')
158
+ return props.modelValue !== undefined ? props.modelValue : querySelectDefaultValue.value
159
+ else
160
+ return props.modelValue !== undefined ? props.modelValue : formSelectDefaultValue.value
161
+ case 'switch':
162
+ return props.modelValue !== undefined ? props.modelValue : false
163
+ case 'radio':
164
+ case 'rate':
165
+ case 'slider':
166
+ case 'area':
167
+ case 'citySelect':
168
+ case 'calendar':
169
+ case 'textarea':
170
+ case 'intervalPicker':
171
+ case 'input':
172
+ case 'select':
173
+ if (mode === '查询')
174
+ return props.modelValue !== undefined ? props.modelValue : queryInputDefaultValue.value
175
+ else
176
+ return props.modelValue !== undefined ? props.modelValue : formInputDefaultValue.value
177
+ case 'stepper':
178
+ return props.modelValue !== undefined ? props.modelValue : 1
179
+ case 'rangePicker':
180
+ if (props.modelValue && Array.isArray(props.modelValue) && props.modelValue.length > 1)
181
+ return `${props.modelValue[0]} ~ ${props.modelValue[1]}`
182
+ else
219
183
  return props.modelValue
220
- default:
221
- return undefined
222
- }
223
- },
224
- set(newValue) {
225
- emits('update:modelValue', newValue)
226
- dataChangeFunc()
227
- },
184
+ case 'addressSearch':
185
+ return props.modelValue
186
+ default:
187
+ return undefined
188
+ }
189
+ }
190
+
191
+ // 改用 ref,并设置初始值
192
+ const localValue = ref(getDefaultValue())
193
+
194
+ // 监听 props.modelValue 的变化
195
+ watch(() => props.modelValue, (newVal) => {
196
+ // 如果是文件上传类型,需要特殊处理
197
+ if (attr.type === 'image' || attr.type === 'file') {
198
+ localValue.value = Array.isArray(newVal) ? newVal : []
199
+ }
200
+ else {
201
+ localValue.value = newVal !== undefined ? newVal : getDefaultValue()
202
+ }
228
203
  })
229
204
 
205
+ // 监听 localValue 的变化
206
+ watch(localValue, (newVal) => {
207
+ if (attr.type === 'image' || attr.type === 'file') {
208
+ // 确保上传组件的值始终是数组
209
+ const value = Array.isArray(newVal) ? newVal : []
210
+ emits('update:modelValue', value)
211
+ }
212
+ else {
213
+ emits('update:modelValue', newVal)
214
+ }
215
+ dataChangeFunc()
216
+ })
217
+
218
+ function updateFile(files, _index) {
219
+ // 处理文件数据
220
+ // 更新本地值
221
+ localValue.value = files.map((file) => {
222
+ const newFile = { ...file }
223
+ if (newFile.content)
224
+ delete newFile.content
225
+ if (newFile.file)
226
+ delete newFile.file
227
+ if (newFile.objectUrl)
228
+ delete newFile.objectUrl
229
+ return newFile
230
+ })
231
+ }
232
+
230
233
  // 表单校验的类型校验
231
234
  function formTypeCheck(attr, value) {
232
235
  switch (attr.rule.type) {
@@ -553,30 +556,6 @@ function onAreaConfirm({ selectedOptions }) {
553
556
  }])
554
557
  }
555
558
 
556
- function updateFile(files, _index) {
557
- files.forEach((file) => {
558
- if (file.content)
559
- delete file.content
560
- if (file.file)
561
- delete file.file
562
- if (file.objectUrl)
563
- delete file.objectUrl
564
- })
565
- localValue.value = files
566
- emits('update:modelValue', localValue.value)
567
- }
568
- // 监听表单发生变化后触发展示函数
569
- watch(() => form, (_oldVal, _newVal) => {
570
- showFormItemFunc()
571
- // 数据源来自人员联动时更新数据
572
- if (attr?.keyName?.toString()?.startsWith('search@根据表单项[') && attr?.keyName?.toString().endsWith(']联动人员'))
573
- debouncedUserLinkFunc()
574
-
575
- // 数据源来自部门联动时更新数据
576
- if (attr?.keyName?.toString()?.startsWith('search@根据表单项[') && attr?.keyName?.toString().endsWith(']联动部门'))
577
- debouncedDepLinkFunc()
578
- }, { deep: true })
579
-
580
559
  function onDateTimePickerConfirm() {
581
560
  showDatePicker.value = false
582
561
  const dateStr = dateTimePickerValue.value.date.join('-')
@@ -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,16 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import Tabbar from '@af-mobile-client-vue3/components/core/Tabbar/index.vue'
3
- import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
3
+ import useRouteCache from '@af-mobile-client-vue3/stores/modules/routeCache'
4
4
  import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
5
5
  import { getFunction } from '@af-mobile-client-vue3/utils/common'
6
6
  import { storeToRefs } from 'pinia'
7
7
  import { computed } from 'vue'
8
8
  import { useRoute } from 'vue-router'
9
9
 
10
- const cachedViews = computed(() => {
11
- return useCachedViewStore().cachedViewList
10
+ const keepAliveRouteNames = computed(() => {
11
+ return useRouteCache().routeCaches as string[]
12
12
  })
13
-
14
13
  const routeTransitionNameStore = useRouteTransitionNameStore()
15
14
  const { routeTransitionName } = storeToRefs(routeTransitionNameStore)
16
15
 
@@ -32,7 +31,7 @@ const routeState = useRoute()
32
31
  <!-- transition 包裹 router-view 控制台会有警告,router-view在外层会导致动画开始时会闪过一帧上一级页面。先忽略警告这样写 -->
33
32
  <transition :name="routeTransitionName">
34
33
  <router-view v-slot="{ Component, route }">
35
- <keep-alive :include="cachedViews">
34
+ <keep-alive :include="keepAliveRouteNames">
36
35
  <div :key="route.name" class="app-wrapper">
37
36
  <component :is="Component" />
38
37
  </div>
@@ -1,13 +1,12 @@
1
1
  <script setup lang="ts">
2
- import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
2
+ import useRouteCache from '@af-mobile-client-vue3/stores/modules/routeCache'
3
3
  import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
4
4
  import { storeToRefs } from 'pinia'
5
5
  import { computed } from 'vue'
6
6
 
7
- const cachedViews = computed(() => {
8
- return useCachedViewStore().cachedViewList
7
+ const keepAliveRouteNames = computed(() => {
8
+ return useRouteCache().routeCaches as string[]
9
9
  })
10
-
11
10
  const routeTransitionNameStore = useRouteTransitionNameStore()
12
11
  const { routeTransitionName } = storeToRefs(routeTransitionNameStore)
13
12
  </script>
@@ -16,7 +15,7 @@ const { routeTransitionName } = storeToRefs(routeTransitionNameStore)
16
15
  <div class="pageLayout">
17
16
  <router-view v-slot="{ Component, route }">
18
17
  <transition :name="routeTransitionName">
19
- <keep-alive :include="cachedViews">
18
+ <keep-alive :include="keepAliveRouteNames">
20
19
  <div :key="route.name" class="app-wrapper">
21
20
  <component :is="Component" />
22
21
  </div>
@@ -1,11 +1,11 @@
1
1
  import type { RouteLocationNormalized } from 'vue-router'
2
2
  import routes from '@af-mobile-client-vue3/router/routes'
3
- import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
4
3
  import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
5
4
  import setPageTitle from '@af-mobile-client-vue3/utils/set-page-title'
6
5
  // https://router.vuejs.org/zh/
7
6
  import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
8
7
  import 'nprogress/nprogress.css'
8
+ import useRouteCache from "@af-mobile-client-vue3/stores/modules/routeCache";
9
9
 
10
10
  const baseUrl = import.meta.env.VITE_APP_PUBLIC_PATH
11
11
  // 创建路由实例并传递 `routes` 配置
@@ -49,7 +49,7 @@ router.beforeEach((to: toRouteType, _from: toRouteType, next) => {
49
49
  }
50
50
  routeTransitionNameStore.setName(name)
51
51
  // 路由缓存
52
- useCachedViewStore().addCachedView(to)
52
+ useRouteCache.addRoute(to)
53
53
  // 页面 title
54
54
  setPageTitle(to.meta.title)
55
55
  next()
@@ -0,0 +1,22 @@
1
+ import { defineStore } from 'pinia'
2
+ import type { RouteRecordName } from 'vue-router'
3
+ import type { EnhancedRouteLocation } from '@/router/types'
4
+
5
+ const useRouteCacheStore = defineStore('route-cache', () => {
6
+ const routeCaches = ref<RouteRecordName[]>([])
7
+
8
+ const addRoute = (route: EnhancedRouteLocation) => {
9
+ if (routeCaches.value.includes(route.name))
10
+ return
11
+
12
+ if (route?.meta?.keepAlive)
13
+ routeCaches.value.push(route.name)
14
+ }
15
+
16
+ return {
17
+ routeCaches,
18
+ addRoute,
19
+ }
20
+ })
21
+
22
+ export default useRouteCacheStore
@@ -1,11 +1,92 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { ref } from 'vue'
4
+ import { defineEmits, ref } from 'vue'
5
+ import { useRouter } from 'vue-router'
6
+
7
+ // 定义事件
8
+ const emit = defineEmits(['deleteRow'])
9
+ // 访问路由
10
+ const router = useRouter()
11
+ // 获取默认值
12
+ const idKey = ref('o_id')
5
13
 
6
14
  // 简易crud表单测试
7
- const configName = ref('defectDispatchPhoneCRUD')
8
- const serviceName = ref('af-linepatrol')
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
+ // }
47
+
48
+ // 跳转到表单——以表单组来渲染纯表单
49
+ function toDetail(item) {
50
+ router.push({
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
+ }
9
90
  </script>
10
91
 
11
92
  <template>
@@ -14,6 +95,10 @@ const serviceName = ref('af-linepatrol')
14
95
  <XCellList
15
96
  :config-name="configName"
16
97
  :service-name="serviceName"
98
+ :fix-query-form="{ o_f_oper_name: 'edu_test' }"
99
+ :id-key="idKey"
100
+ @to-detail="toDetail"
101
+ @delete-row="deleteRow"
17
102
  />
18
103
  </template>
19
104
  </NormalDataLayout>
@@ -9,6 +9,13 @@ import { useRoute } from 'vue-router'
9
9
  const configName = ref('form_check_test')
10
10
  const serviceName = ref('af-system')
11
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')
18
+
12
19
  const formData = ref({})
13
20
  const formGroup = ref(null)
14
21
  const route = useRoute()
@@ -18,6 +25,36 @@ function submit(_result) {
18
25
  history.back()
19
26
  })
20
27
  }
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
+ // })
21
58
  </script>
22
59
 
23
60
  <template>
@@ -1,44 +1,133 @@
1
1
  <script setup lang="ts">
2
- import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
2
+ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { ref } from 'vue'
5
-
6
- const configName = ref('PointBindingForm')
7
- const serviceName = ref('af-linepatrol')
8
-
9
- const formData = ref({
10
- t1_f_number: '点位编号>>',
11
- t2_f_name: '所属区域>>',
12
- t1_f_address: '地址信息>>',
13
- t1_f_address_lon_lat: '118.842054,39.246094',
14
- t1_f_describe: '点位描述>>',
15
- t1_f_state: '点位状态>>',
4
+ import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
5
+ import { post } from '@af-mobile-client-vue3/services/restTools'
6
+ import {
7
+ showDialog,
8
+ NavBar as VanNavBar,
9
+ Space as VanSpace,
10
+ } from 'vant'
11
+ import { defineEmits, getCurrentInstance, onBeforeMount, ref } from 'vue'
12
+ import { useRoute } from 'vue-router'
13
+
14
+ const emit = defineEmits(['onSumbit'])
15
+ const xForm = ref(null)
16
+ const id = ref(-1)
17
+ const openid = ref('')
18
+ const instance = getCurrentInstance()
19
+ const xFormInit = ref(false)
20
+ const route = useRoute()
21
+ const configName = route.query.configName as string
22
+ const serviceName = route.query.serviceName as string
23
+ const mode = route.query.mode as string
24
+ const updateData = ref({})
25
+ const title = ref('')
26
+ const groupFormItems = ref({})
27
+ const api = ref('/af-system/logic/commonQuery')
28
+ const updateId = {
29
+ queryParamsName: 'crud_oper_log_manage',
30
+ pageNo: 1,
31
+ pageSize: 20,
32
+ conditionParams: { o_id: route.params.id as string },
33
+ }
34
+ const loadUpdate = ref(false)
35
+ // const serviceName = ref('af-revenue')
36
+ const _currentEvaluate = {
37
+ id: null,
38
+ f_business_name: '',
39
+ f_evaluate_state: '',
40
+ }
41
+
42
+ // 组件挂载前获取数据
43
+ onBeforeMount(async () => {
44
+ if (instance) {
45
+ id.value = route.params.id as unknown as number
46
+ openid.value = route.params.openid as string
47
+ formInit()
48
+ }
16
49
  })
17
- const formGroup = ref(null)
18
- function submit(result) {
19
- console.log('>>>> result: ', result)
20
- // showDialog({ message: '提交成功' }).then(() => {
21
- // history.back()
50
+
51
+ // 组件初始化前的判断
52
+ async function formInit() {
53
+ getConfigByName(configName, (result) => {
54
+ groupFormItems.value = result
55
+ title.value = result.title
56
+ if (mode === '修改')
57
+ getUpdateData()
58
+ xFormInit.value = true
59
+ }, serviceName)
60
+ }
61
+
62
+ // 获取配置信息
63
+ function queryData() {
64
+
65
+ }
66
+
67
+ // 提交操作
68
+ function onSubmit(params) {
69
+ // const data = {
70
+ // id: currentEvaluate.id,
71
+ // f_json: params,
72
+ // f_evaluate_date: formatDate(new Date()),
73
+ // f_evaluate_state: '已评价',
74
+ // f_evaluate_type: '用户评价',
75
+ // f_evaluate_userid: openid.value,
76
+ // }
77
+ // openApiLogic(data, 'saveEvaluate', formServiveName).then((_res: any) => {
78
+ // showDialog({ message: '评价成功了' }).then(() => {history.back()})
79
+ // }).catch(() => {
80
+ // showDialog({ message: '评价失败了' })
22
81
  // })
82
+ if (params) {
83
+ emit('onSumbit', params)
84
+ showDialog({ message: '评价成功了' }).then(() => {
85
+ history.back()
86
+ })
87
+ }
88
+ else {
89
+ showDialog({ message: '评价失败了' }).then(() => {
90
+ history.back()
91
+ })
92
+ }
93
+ }
94
+
95
+ // 查询需要修改的数据
96
+ async function getUpdateData() {
97
+ if (api.value && updateId) {
98
+ const res = await post(api.value, updateId)
99
+ updateData.value = res.data[0]
100
+ }
23
101
  }
24
102
  </script>
25
103
 
26
104
  <template>
27
- <NormalDataLayout id="XFormGroupView" title="纯表单">
105
+ <NormalDataLayout id="XFormView" title="XForm表单">
28
106
  <template #layout_content>
29
- <!-- v-if="isInit" -->
30
- <XFormGroup
31
- ref="formGroup"
32
- :config-name="configName"
33
- :service-name="serviceName"
34
- :group-form-data="formData"
35
- mode="新增"
36
- @submit="submit"
37
- />
107
+ <VanSpace direction="vertical" fill>
108
+ <VanNavBar :title="title ? mode.concat(title) : null" />
109
+ <XForm
110
+ v-if="xFormInit"
111
+ ref="xForm"
112
+ :group-form-items="JSON.parse(JSON.stringify(groupFormItems))"
113
+ :service-name="serviceName"
114
+ :form-data="updateData"
115
+ :mode="mode"
116
+ style="margin-bottom: 14px;"
117
+ @on-submit="onSubmit"
118
+ />
119
+ </VanSpace>
38
120
  </template>
39
121
  </NormalDataLayout>
40
122
  </template>
41
123
 
42
- <style scoped lang="less">
43
-
124
+ <style scoped>
125
+ .van-doc-demo-block__title {
126
+ margin: 0;
127
+ padding: 32px 16px 16px;
128
+ color: black;
129
+ font-weight: 400;
130
+ font-size: 14px;
131
+ line-height: 16px;
132
+ }
44
133
  </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,31 +0,0 @@
1
- import type { toRouteType } from '@af-mobile-client-vue3/router'
2
- import { defineStore } from 'pinia'
3
- import { ref } from 'vue'
4
-
5
- const useCachedViewStore = defineStore('cached-view', () => {
6
- // 缓存页面 keepAlive
7
- const cachedViewList = ref([] as string[])
8
- const addCachedView = (view: toRouteType) => {
9
- // 不重复添加
10
- if (cachedViewList.value.includes(view.name as string))
11
- return
12
- if (!view?.meta?.noCache)
13
- cachedViewList.value.push(view.name as string)
14
- }
15
- const delCachedView = (view: toRouteType) => {
16
- const index = cachedViewList.value.indexOf(view.name as string)
17
- index > -1 && cachedViewList.value.splice(index, 1)
18
- }
19
- const delAllCachedViews = () => {
20
- cachedViewList.value = [] as string[]
21
- }
22
-
23
- return {
24
- cachedViewList,
25
- addCachedView,
26
- delCachedView,
27
- delAllCachedViews,
28
- }
29
- })
30
-
31
- export default useCachedViewStore
@@ -1,50 +0,0 @@
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 { nextTick, onMounted, ref } from 'vue'
6
-
7
- const xForm = ref(null)
8
- const serviceName = 'af-linepatrol'
9
-
10
- onMounted(() => {
11
- const modifyModelData = {
12
- t1_f_number: '点位编号',
13
- t2_f_name: '所属区域',
14
- t1_f_address: '116.450355,40.057394',
15
- t1_f_describe: '点位描述',
16
- t1_f_state: '点位状态',
17
- }
18
- getConfigByName('PointBindingForm', async (res) => {
19
- const initData = {
20
- formItems: res, // 琉璃配置
21
- serviceName, // 服务名称
22
- formData: JSON.stringify(modifyModelData), // 数据
23
- mode: '修改', // 修改
24
- }
25
- console.log('>>>> initData: ', JSON.stringify(initData))
26
- await nextTick()
27
- xForm.value.init(initData)
28
- }, 'af-linepatrol')
29
- })
30
-
31
- // 提交操作
32
- function onSubmit(params) {
33
- console.log('>>>> params: ', JSON.stringify(params))
34
- }
35
- </script>
36
-
37
- <template>
38
- <NormalDataLayout id="XFormView" title="XForm表单">
39
- <template #layout_content>
40
- <XForm
41
- ref="xForm"
42
- service-name="af-linepatrol"
43
- @on-submit="onSubmit"
44
- />
45
- </template>
46
- </NormalDataLayout>
47
- </template>
48
-
49
- <style scoped>
50
- </style>