af-mobile-client-vue3 1.1.15 → 1.1.16

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.
@@ -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,117 +1,11 @@
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 { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
- import { defineEmits, ref } from 'vue'
6
- import { useRouter } from 'vue-router'
7
-
8
- // 定义事件
9
- const emit = defineEmits(['deleteRow'])
10
- const userInfo = useUserStore().getUserInfo()
11
- // 访问路由
12
- const router = useRouter()
13
- // 获取默认值
14
- const idKey = ref('o_id')
4
+ import { ref } from 'vue'
15
5
 
16
6
  // 简易crud表单测试
17
- // const configName = ref('orderCarInMobileCRUD')
18
- // const serviceName = ref('af-gaslink')
19
- const configName = ref('lngPriceManageMobileCRUD')
20
- const serviceName = ref('af-gaslink')
21
-
22
- // 资源权限测试
23
- // const configName = ref('crud_sources_test')
24
- // const serviceName = ref('af-system')
25
-
26
- // 实际业务测试
27
- // const configName = ref('lngChargeAuditMobileCRUD')
28
- // const serviceName = ref('af-gaslink')
29
-
30
- // 跳转到详情页面
31
- // function toDetail(item) {
32
- // router.push({
33
- // name: 'XCellDetailView',
34
- // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
35
- // query: {
36
- // operName: item[operNameKey.value],
37
- // method:item[methodKey.value],
38
- // requestMethod:item[requestMethodKey.value],
39
- // operatorType:item[operatorTypeKey.value],
40
- // operUrl:item[operUrlKey.value],
41
- // operIp:item[operIpKey.value],
42
- // costTime:item[costTimeKey.value],
43
- // operTime:item[operTimeKey.value],
44
- //
45
- // title: item[titleKey.value],
46
- // businessType: item[businessTypeKey.value],
47
- // status:item[statusKey.value]
48
- // }
49
- // })
50
- // }
51
-
52
- // 跳转到表单——以表单组来渲染纯表单
53
- function toDetail(item) {
54
- router.push({
55
- name: 'XFormGroupView',
56
- // query: {
57
- // id: item[idKey.value],
58
- // id: item.rr_id,
59
- // o_id: item.o_id,
60
- // },
61
- })
62
- }
63
-
64
- // 新增功能
65
- // function addOption(totalCount) {
66
- // router.push({
67
- // name: 'XFormView',
68
- // params: { id: totalCount, openid: totalCount },
69
- // query: {
70
- // configName: configName.value,
71
- // serviceName: serviceName.value,
72
- // mode: '新增',
73
- // },
74
- // })
75
- // }
76
- function addOption(callback) {
77
- router.push({
78
- name: 'XFormGroupView',
79
- // params: { id: totalCount.value },
80
- // query: {
81
- // configName: configName.value,
82
- // serviceName: serviceName.value,
83
- // mode: '新增',
84
- // },
85
- })
86
- // 如果存在回调函数,调用它并传递true表示已处理
87
- if (typeof callback === 'function') {
88
- callback(true)
89
- }
90
- }
91
-
92
- // 修改功能
93
- function updateRow(result, callback) {
94
- console.log('用户----', userInfo)
95
- router.push({
96
- name: 'XFormGroupView',
97
- // params: { id: result.o_id, openid: result.o_id },
98
- // query: {
99
- // configName: configName.value,
100
- // serviceName: serviceName.value,
101
- // mode: '修改',
102
- // },
103
- })
104
-
105
- // 如果存在回调函数,调用它并传递true表示已处理
106
- if (typeof callback === 'function') {
107
- callback(true)
108
- }
109
- }
110
-
111
- // 删除功能
112
- function deleteRow(result) {
113
- emit('deleteRow', result.o_id)
114
- }
7
+ const configName = ref('defectDispatchPhoneCRUD')
8
+ const serviceName = ref('af-linepatrol')
115
9
  </script>
116
10
 
117
11
  <template>
@@ -120,21 +14,7 @@ function deleteRow(result) {
120
14
  <XCellList
121
15
  :config-name="configName"
122
16
  :service-name="serviceName"
123
- :id-key="idKey"
124
- :fix-query-form="{ u_f_price_state: ['生效', '待生效'] }"
125
- @to-detail="toDetail"
126
- @delete-row="deleteRow"
127
- @update="updateRow"
128
- @add="addOption"
129
17
  />
130
- <!-- <XCellList -->
131
- <!-- :config-name="configName" -->
132
- <!-- :service-name="serviceName" -->
133
- <!-- :fix-query-form="{ o_f_oper_name: 'edu_test' }" -->
134
- <!-- :id-key="idKey" -->
135
- <!-- @to-detail="toDetail" -->
136
- <!-- @delete-row="deleteRow" -->
137
- <!-- /> -->
138
18
  </template>
139
19
  </NormalDataLayout>
140
20
  </template>
@@ -9,13 +9,6 @@ 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
-
19
12
  const formData = ref({})
20
13
  const formGroup = ref(null)
21
14
  const route = useRoute()
@@ -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>
@@ -1,133 +1,40 @@
1
1
  <script setup lang="ts">
2
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
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 { 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
- }
49
- })
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: '评价失败了' })
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
- }
4
+ import { ref, toRaw } from 'vue'
5
+
6
+ const configName = ref('AddConstructionForm')
7
+ const serviceName = ref('af-linepatrol')
8
+ const formGroup = ref(null)
9
+ function safeStringify(obj) {
10
+ const seen = new WeakSet()
11
+ return JSON.stringify(toRaw(obj), (key, val) => {
12
+ if (typeof val === 'object' && val !== null) {
13
+ if (seen.has(val))
14
+ return
15
+ seen.add(val)
16
+ }
17
+ return val
18
+ }, 2)
93
19
  }
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
- }
20
+ function submit(result) {
21
+ console.log('>>>> result: ', safeStringify(result))
101
22
  }
102
23
  </script>
103
24
 
104
25
  <template>
105
- <NormalDataLayout id="XFormView" title="XForm表单">
26
+ <NormalDataLayout id="XFormGroupView" title="纯表单">
106
27
  <template #layout_content>
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>
28
+ <XFormGroup
29
+ ref="formGroup"
30
+ :config-name="configName"
31
+ :service-name="serviceName"
32
+ mode="新增"
33
+ @submit="submit"
34
+ />
120
35
  </template>
121
36
  </NormalDataLayout>
122
37
  </template>
123
38
 
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
- }
39
+ <style scoped lang="less">
133
40
  </style>