af-mobile-client-vue3 1.1.32 → 1.1.33

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,184 +1,184 @@
1
- // print.js
2
-
3
- export function printElement(elementToPrint) {
4
- // 创建一个新的浏览器窗口
5
- const printWindow = window.open('', '_blank', 'height=1024,width=768')
6
- // 设置新窗口的文档内容
7
- printWindow.document.write(`
8
- <html>
9
- <head>
10
- <title>Print</title>
11
- <style>
12
- @page {
13
- size: auto;
14
- margin: 0mm;
15
- }
16
- html, body {
17
- margin: 0;
18
- padding: 0;
19
- width: 100%;
20
- height: 100%;
21
- }
22
- #print-container {
23
- display: none
24
- }
25
- .img{
26
- width: 95%;
27
- height: 180px;
28
- object-fit: cover;
29
- }
30
- .reportMain {
31
- text-align: center;
32
- margin: 0 auto;
33
- font-size: 16px;
34
- color: #000;
35
- background-color: #fff;
36
- border-radius: 8px;
37
-
38
- .reportTitle {
39
- font-weight: bold;
40
- }
41
-
42
- .subTitle {
43
- display: flex;
44
- justify-content: space-between;
45
- margin-bottom: 1%;
46
-
47
- .subTitleItems {
48
- max-width: 30%;
49
- }
50
- }
51
-
52
- .inputsDiv {
53
- display: flex;
54
- justify-content: space-between;
55
- .inputsDivItem {
56
- display: flex;
57
- align-items: center;
58
- padding: 0 4px;
59
- white-space: nowrap;
60
- .inputsDivItemLabel {
61
- padding: 0 4px;
62
- }
63
- }
64
- }
65
-
66
- .reportTable {
67
- width: 100%;
68
- border-collapse: collapse;
69
- table-layout:fixed;
70
- word-break:break-all;
71
- text-align: center;
72
- }
73
- }
74
- .reportMainForDisplay {
75
- text-align: center;
76
- margin: 10% auto;
77
- font-size: 16px;
78
- color: #000;
79
- background-color: #fff;
80
- border-radius: 8px;
81
-
82
- .reportTitle {
83
- font-weight: bold;
84
- }
85
-
86
- .subTitle {
87
- display: flex;
88
- justify-content: space-between;
89
-
90
- .subTitleItems {
91
- max-width: 30%;
92
- }
93
- }
94
-
95
- .inputsDiv {
96
- display: flex;
97
- justify-content: space-around;
98
- .inputsDivItem {
99
- display: flex;
100
- align-items: center;
101
- padding: 0 4px;
102
- white-space: nowrap;
103
- .inputsDivItemLabel {
104
- padding: 0 4px;
105
- }
106
- }
107
- }
108
-
109
- .reportTable {
110
- width: 100%;
111
- border-collapse: collapse;
112
- table-layout:fixed;
113
- word-break:break-all;
114
- }
115
- }
116
- .reportMainNoPadding {
117
- text-align: center;
118
- margin: 0 auto;
119
- font-size: 16px;
120
- color: #000;
121
- background-color: #fff;
122
- border-radius: 8px;
123
-
124
- .reportTitle {
125
- font-weight: bold;
126
- }
127
-
128
- .subTitle {
129
- display: flex;
130
- justify-content: space-between;
131
-
132
- .subTitleItems {
133
- max-width: 30%;
134
- }
135
- }
136
-
137
- .inputsDiv {
138
- display: flex;
139
- justify-content: space-between;
140
- .inputsDivItem {
141
- display: flex;
142
- align-items: center;
143
- padding: 0 4px;
144
- white-space: nowrap;
145
- .inputsDivItemLabel {
146
- padding: 0 4px;
147
- }
148
- }
149
- }
150
-
151
- .reportTable {
152
- width: 100%;
153
- border-collapse: collapse;
154
- table-layout:fixed;
155
- word-break:break-all;
156
- }
157
- }
158
- .tools{
159
- position: fixed;
160
- right: 2%;
161
- text-align: right;
162
- width: 60%;
163
- cursor: pointer;
164
- .toolsItem{
165
- width: 15%;
166
- margin-right: 3%;
167
- display: inline-block;
168
- }
169
- }
170
- </style>
171
- </head>
172
- <body>
173
- <!-- 将需要打印的元素内容复制到新窗口中 -->
174
- ${elementToPrint.innerHTML}
175
- </body>
176
- </html>
177
- `)
178
- // 延迟执行打印,以确保新窗口的内容已加载完成
179
- printWindow.document.close() // 关闭文档流,确保内容完全加载
180
- setTimeout(() => {
181
- printWindow.print() // 调用打印方法
182
- printWindow.close()
183
- }, 500) // 延迟500毫秒后执行打印
184
- }
1
+ // print.js
2
+
3
+ export function printElement(elementToPrint) {
4
+ // 创建一个新的浏览器窗口
5
+ const printWindow = window.open('', '_blank', 'height=1024,width=768')
6
+ // 设置新窗口的文档内容
7
+ printWindow.document.write(`
8
+ <html>
9
+ <head>
10
+ <title>Print</title>
11
+ <style>
12
+ @page {
13
+ size: auto;
14
+ margin: 0mm;
15
+ }
16
+ html, body {
17
+ margin: 0;
18
+ padding: 0;
19
+ width: 100%;
20
+ height: 100%;
21
+ }
22
+ #print-container {
23
+ display: none
24
+ }
25
+ .img{
26
+ width: 95%;
27
+ height: 180px;
28
+ object-fit: cover;
29
+ }
30
+ .reportMain {
31
+ text-align: center;
32
+ margin: 0 auto;
33
+ font-size: 16px;
34
+ color: #000;
35
+ background-color: #fff;
36
+ border-radius: 8px;
37
+
38
+ .reportTitle {
39
+ font-weight: bold;
40
+ }
41
+
42
+ .subTitle {
43
+ display: flex;
44
+ justify-content: space-between;
45
+ margin-bottom: 1%;
46
+
47
+ .subTitleItems {
48
+ max-width: 30%;
49
+ }
50
+ }
51
+
52
+ .inputsDiv {
53
+ display: flex;
54
+ justify-content: space-between;
55
+ .inputsDivItem {
56
+ display: flex;
57
+ align-items: center;
58
+ padding: 0 4px;
59
+ white-space: nowrap;
60
+ .inputsDivItemLabel {
61
+ padding: 0 4px;
62
+ }
63
+ }
64
+ }
65
+
66
+ .reportTable {
67
+ width: 100%;
68
+ border-collapse: collapse;
69
+ table-layout:fixed;
70
+ word-break:break-all;
71
+ text-align: center;
72
+ }
73
+ }
74
+ .reportMainForDisplay {
75
+ text-align: center;
76
+ margin: 10% auto;
77
+ font-size: 16px;
78
+ color: #000;
79
+ background-color: #fff;
80
+ border-radius: 8px;
81
+
82
+ .reportTitle {
83
+ font-weight: bold;
84
+ }
85
+
86
+ .subTitle {
87
+ display: flex;
88
+ justify-content: space-between;
89
+
90
+ .subTitleItems {
91
+ max-width: 30%;
92
+ }
93
+ }
94
+
95
+ .inputsDiv {
96
+ display: flex;
97
+ justify-content: space-around;
98
+ .inputsDivItem {
99
+ display: flex;
100
+ align-items: center;
101
+ padding: 0 4px;
102
+ white-space: nowrap;
103
+ .inputsDivItemLabel {
104
+ padding: 0 4px;
105
+ }
106
+ }
107
+ }
108
+
109
+ .reportTable {
110
+ width: 100%;
111
+ border-collapse: collapse;
112
+ table-layout:fixed;
113
+ word-break:break-all;
114
+ }
115
+ }
116
+ .reportMainNoPadding {
117
+ text-align: center;
118
+ margin: 0 auto;
119
+ font-size: 16px;
120
+ color: #000;
121
+ background-color: #fff;
122
+ border-radius: 8px;
123
+
124
+ .reportTitle {
125
+ font-weight: bold;
126
+ }
127
+
128
+ .subTitle {
129
+ display: flex;
130
+ justify-content: space-between;
131
+
132
+ .subTitleItems {
133
+ max-width: 30%;
134
+ }
135
+ }
136
+
137
+ .inputsDiv {
138
+ display: flex;
139
+ justify-content: space-between;
140
+ .inputsDivItem {
141
+ display: flex;
142
+ align-items: center;
143
+ padding: 0 4px;
144
+ white-space: nowrap;
145
+ .inputsDivItemLabel {
146
+ padding: 0 4px;
147
+ }
148
+ }
149
+ }
150
+
151
+ .reportTable {
152
+ width: 100%;
153
+ border-collapse: collapse;
154
+ table-layout:fixed;
155
+ word-break:break-all;
156
+ }
157
+ }
158
+ .tools{
159
+ position: fixed;
160
+ right: 2%;
161
+ text-align: right;
162
+ width: 60%;
163
+ cursor: pointer;
164
+ .toolsItem{
165
+ width: 15%;
166
+ margin-right: 3%;
167
+ display: inline-block;
168
+ }
169
+ }
170
+ </style>
171
+ </head>
172
+ <body>
173
+ <!-- 将需要打印的元素内容复制到新窗口中 -->
174
+ ${elementToPrint.innerHTML}
175
+ </body>
176
+ </html>
177
+ `)
178
+ // 延迟执行打印,以确保新窗口的内容已加载完成
179
+ printWindow.document.close() // 关闭文档流,确保内容完全加载
180
+ setTimeout(() => {
181
+ printWindow.print() // 调用打印方法
182
+ printWindow.close()
183
+ }, 500) // 延迟500毫秒后执行打印
184
+ }
@@ -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>