af-mobile-client-vue3 1.0.54

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.
Files changed (156) hide show
  1. package/.editorconfig +38 -0
  2. package/.env +7 -0
  3. package/.env.development +4 -0
  4. package/.env.envoiceShow +7 -0
  5. package/.env.production +7 -0
  6. package/.husky/commit-msg +1 -0
  7. package/.husky/pre-commit +1 -0
  8. package/.vscode/extensions.json +7 -0
  9. package/.vscode/settings.json +61 -0
  10. package/LICENSE +21 -0
  11. package/README.md +181 -0
  12. package/af-example-mobile-vue-web.iml +9 -0
  13. package/build/vite/index.ts +91 -0
  14. package/build/vite/vconsole.ts +44 -0
  15. package/eslint.config.js +7 -0
  16. package/index.html +17 -0
  17. package/mock/data.ts +20 -0
  18. package/mock/index.ts +5 -0
  19. package/mock/modules/prose.mock.ts +16 -0
  20. package/mock/modules/user.mock.ts +152 -0
  21. package/netlify.toml +12 -0
  22. package/package.json +107 -0
  23. package/public/favicon-dark.svg +4 -0
  24. package/public/favicon.ico +0 -0
  25. package/public/favicon.svg +4 -0
  26. package/public/pwa-192x192.png +0 -0
  27. package/public/pwa-512x512.png +0 -0
  28. package/public/safari-pinned-tab.svg +32 -0
  29. package/scripts/verifyCommit.js +19 -0
  30. package/src/App.vue +43 -0
  31. package/src/api/mock/index.ts +30 -0
  32. package/src/api/user/index.ts +40 -0
  33. package/src/assets/common/default-user-profile.png +0 -0
  34. package/src/assets/img/apps/apply-web.png +0 -0
  35. package/src/assets/img/apps/example-web.png +0 -0
  36. package/src/assets/img/apps/iot-web.png +0 -0
  37. package/src/assets/img/apps/linepatrol-web.png +0 -0
  38. package/src/assets/img/apps/monitor-web.png +0 -0
  39. package/src/assets/img/apps/oa-web.png +0 -0
  40. package/src/assets/img/apps/revenue-web.png +0 -0
  41. package/src/assets/img/apps/safe-check-web.png +0 -0
  42. package/src/assets/img/component/logo.png +0 -0
  43. package/src/assets/img/home/banner1.png +0 -0
  44. package/src/assets/img/home/banner2.png +0 -0
  45. package/src/assets/img/home/banner3.png +0 -0
  46. package/src/assets/img/home/banner4.png +0 -0
  47. package/src/assets/img/home/notice/icon.png +0 -0
  48. package/src/assets/img/user/login/background-shadow-1.svg +20 -0
  49. package/src/assets/img/user/login/logo-background.svg +20 -0
  50. package/src/assets/img/user/login/logo.png +0 -0
  51. package/src/assets/img/user/my/exit-login.png +0 -0
  52. package/src/assets/img/user/my/setting-arrow.png +0 -0
  53. package/src/assets/img/user/my/setting.png +0 -0
  54. package/src/bootstrap.ts +32 -0
  55. package/src/components/core/App/MicroAppView.vue +59 -0
  56. package/src/components/core/BeautifulLoading/index.vue +47 -0
  57. package/src/components/core/NavBar/index.vue +12 -0
  58. package/src/components/core/SvgIcon/index.vue +61 -0
  59. package/src/components/core/Tabbar/index.vue +38 -0
  60. package/src/components/core/Uploader/index.vue +104 -0
  61. package/src/components/core/XMultiSelect/index.vue +196 -0
  62. package/src/components/core/XSelect/index.vue +130 -0
  63. package/src/components/data/XBadge/index.vue +85 -0
  64. package/src/components/data/XCellDetail/index.vue +106 -0
  65. package/src/components/data/XCellList/index.vue +358 -0
  66. package/src/components/data/XCellListFilter/index.vue +392 -0
  67. package/src/components/data/XForm/index.vue +127 -0
  68. package/src/components/data/XFormItem/index.vue +472 -0
  69. package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -0
  70. package/src/components/data/XReportForm/index.vue +1058 -0
  71. package/src/components/layout/NormalDataLayout/index.vue +70 -0
  72. package/src/components/layout/TabBarLayout/index.vue +40 -0
  73. package/src/components.d.ts +53 -0
  74. package/src/enums/requestEnum.ts +25 -0
  75. package/src/env.d.ts +16 -0
  76. package/src/font-style/PingFangSC-Regular.woff2 +0 -0
  77. package/src/font-style/font.css +4 -0
  78. package/src/hooks/useCommon.ts +9 -0
  79. package/src/hooks/useLogin.ts +97 -0
  80. package/src/icons/svg/bird.svg +1 -0
  81. package/src/icons/svg/check-in.svg +33 -0
  82. package/src/icons/svg/dark.svg +5 -0
  83. package/src/icons/svg/github.svg +5 -0
  84. package/src/icons/svg/light.svg +5 -0
  85. package/src/icons/svg/link.svg +5 -0
  86. package/src/icons/svg/loadError.svg +1 -0
  87. package/src/icons/svg/notFound.svg +1 -0
  88. package/src/icons/svgo.yml +22 -0
  89. package/src/layout/PageLayout.vue +51 -0
  90. package/src/layout/SingleLayout.vue +35 -0
  91. package/src/locales/en-US.json +25 -0
  92. package/src/locales/zh-CN.json +25 -0
  93. package/src/main.ts +48 -0
  94. package/src/plugins/AppData.ts +38 -0
  95. package/src/plugins/GetLoginInfoService.ts +10 -0
  96. package/src/plugins/index.ts +11 -0
  97. package/src/router/README.md +8 -0
  98. package/src/router/guards.ts +60 -0
  99. package/src/router/index.ts +60 -0
  100. package/src/router/invoiceRoutes.ts +33 -0
  101. package/src/router/routes.ts +84 -0
  102. package/src/services/api/Login.ts +6 -0
  103. package/src/services/api/common.ts +98 -0
  104. package/src/services/api/index.ts +7 -0
  105. package/src/services/api/manage.ts +8 -0
  106. package/src/services/restTools.ts +37 -0
  107. package/src/settings.ts +1 -0
  108. package/src/stores/index.ts +7 -0
  109. package/src/stores/modules/cachedView.ts +31 -0
  110. package/src/stores/modules/counter.ts +19 -0
  111. package/src/stores/modules/routeTransitionName.ts +26 -0
  112. package/src/stores/modules/setting.ts +28 -0
  113. package/src/stores/modules/user.ts +180 -0
  114. package/src/stores/mutation-type.ts +7 -0
  115. package/src/styles/app.less +67 -0
  116. package/src/styles/login.less +81 -0
  117. package/src/typing.ts +3 -0
  118. package/src/utils/Storage.ts +124 -0
  119. package/src/utils/authority-utils.ts +87 -0
  120. package/src/utils/common.ts +41 -0
  121. package/src/utils/crypto.ts +39 -0
  122. package/src/utils/dataUtil.ts +42 -0
  123. package/src/utils/dictUtil.ts +51 -0
  124. package/src/utils/http/index.ts +158 -0
  125. package/src/utils/i18n.ts +41 -0
  126. package/src/utils/indexedDB.ts +180 -0
  127. package/src/utils/local-storage.ts +9 -0
  128. package/src/utils/mobileUtil.ts +26 -0
  129. package/src/utils/progress.ts +19 -0
  130. package/src/utils/routerUtil.ts +271 -0
  131. package/src/utils/set-page-title.ts +7 -0
  132. package/src/utils/validate.ts +6 -0
  133. package/src/views/chat/index.vue +153 -0
  134. package/src/views/common/LoadError.vue +64 -0
  135. package/src/views/common/NotFound.vue +68 -0
  136. package/src/views/component/EvaluateRecordView/index.vue +40 -0
  137. package/src/views/component/XCellDetailView/index.vue +216 -0
  138. package/src/views/component/XCellListView/index.vue +36 -0
  139. package/src/views/component/XFormView/index.vue +478 -0
  140. package/src/views/component/XReportFormIframeView/index.vue +45 -0
  141. package/src/views/component/XReportFormView/index.vue +295 -0
  142. package/src/views/component/index.vue +111 -0
  143. package/src/views/component/menu.vue +117 -0
  144. package/src/views/component/notice.vue +46 -0
  145. package/src/views/component/topNav.vue +36 -0
  146. package/src/views/invoiceShow/index.vue +62 -0
  147. package/src/views/user/login/ForgetPasswordForm.vue +93 -0
  148. package/src/views/user/login/LoginForm.vue +145 -0
  149. package/src/views/user/login/LoginTitle.vue +68 -0
  150. package/src/views/user/login/LoginWave.vue +109 -0
  151. package/src/views/user/login/index.vue +22 -0
  152. package/src/views/user/my/index.vue +230 -0
  153. package/src/vue-router.d.ts +9 -0
  154. package/tsconfig.json +43 -0
  155. package/uno.config.ts +32 -0
  156. package/vite.config.ts +110 -0
@@ -0,0 +1,392 @@
1
+ <script setup lang="ts">
2
+ import { defineEmits, defineProps, onMounted, ref, watch } from 'vue'
3
+ import {
4
+ Button as VanButton,
5
+ Calendar as VanCalendar,
6
+ Col as VanCol,
7
+ Dialog as VanDialog,
8
+ DropdownItem as VanDropdownItem,
9
+ DropdownMenu as VanDropdownMenu,
10
+ Icon as VanIcon,
11
+ Radio as VanRadio,
12
+ RadioGroup as VanRadioGroup,
13
+ Row as VanRow,
14
+ showFailToast,
15
+ } from 'vant'
16
+
17
+ const { orderList, orderVal, sortordVal, formQuery } = defineProps<{
18
+ orderVal?: string
19
+ sortordVal?: string
20
+ orderList?: any[]
21
+ formQuery?: any[]
22
+ }>()
23
+
24
+ const emit = defineEmits([
25
+ 'update:orderVal',
26
+ 'update:sortordVal',
27
+ 'update:conditionParams',
28
+ 'onRefresh',
29
+ ])
30
+
31
+ // 下拉菜单元素
32
+ const listFilterMenu = ref(null)
33
+
34
+ // 排序字段
35
+ const currentOrderVal = ref('')
36
+ // 排序规则
37
+ const currentSortordVal = ref('')
38
+ // 排序规则列表
39
+ const sortordList = ref([
40
+ { title: '正序', value: 'ascend' },
41
+ { title: '倒序', value: 'descend' },
42
+ ])
43
+
44
+ // 查询条件参数 !!!!!建议最后点击确认的时候完成这个的整理
45
+ const conditionParams = ref({})
46
+
47
+ // 日期选择集合
48
+ const rangePickerList = ref([])
49
+ // 日期区间值
50
+ const calendarVal = ref([])
51
+ // 展示日历选择器
52
+ const calendarShow = ref(false)
53
+ // 当前选择的日期选择器下标
54
+ const rangePickerIndex = ref(0)
55
+ // 最小日期
56
+ const minDate = ref(new Date(2020, 0, 1))
57
+ // 最大日期
58
+ const maxDate = ref(null)
59
+
60
+ // 格式化日期
61
+ function formatCalendarVal(valList) {
62
+ const res = []
63
+ valList.forEach((val) => {
64
+ const date = new Date(val)
65
+ const yyyy = date.getFullYear()
66
+ const mm = (`0${date.getMonth() + 1}`).slice(-2)
67
+ const dd = (`0${date.getDate()}`).slice(-2)
68
+ const hh = (`0${date.getHours()}`).slice(-2)
69
+ const min = (`0${date.getMinutes()}`).slice(-2)
70
+ const ss = (`0${date.getSeconds()}`).slice(-2)
71
+ res.push(`${yyyy}-${mm}-${dd} ${hh}:${min}:${ss}`)
72
+ })
73
+ return res
74
+ }
75
+
76
+ // 打开日期选择器并获取值
77
+ function getRangePickerValue(item, index) {
78
+ if (item.value)
79
+ calendarVal.value = item.calendar
80
+ calendarShow.value = true
81
+ rangePickerIndex.value = index
82
+ }
83
+
84
+ // 选择日期
85
+ function calendarValueOnConfirm(value) {
86
+ calendarVal.value = value
87
+ }
88
+
89
+ // 取消选择日期
90
+ function calendarValueOnCancel() {
91
+ calendarVal.value = rangePickerList.value[rangePickerIndex.value].calendar
92
+ calendarShow.value = false
93
+ }
94
+
95
+ // 更新日期值
96
+ function updateRangePickerValue() {
97
+ rangePickerList.value[rangePickerIndex.value].value = formatCalendarVal(calendarVal.value)
98
+ rangePickerList.value[rangePickerIndex.value].calendar = calendarVal.value
99
+ // 给条件参数赋值
100
+ const key = rangePickerList.value[rangePickerIndex.value].model
101
+ conditionParams.value[key] = formatCalendarVal(calendarVal.value)
102
+ }
103
+
104
+ // 重置某个选项
105
+ function resetOptionItem(type, item) {
106
+ switch (type) {
107
+ case 'rangePicker':
108
+ item.value = undefined
109
+ item.calendar = undefined
110
+ break
111
+ }
112
+ }
113
+
114
+ // 重置所有选项
115
+ function resetOption() {
116
+ currentOrderVal.value = undefined
117
+ currentSortordVal.value = undefined
118
+ // 条件参数
119
+ conditionParams.value = {}
120
+ // 日期选择器
121
+ calendarVal.value = []
122
+ rangePickerList.value.forEach((item) => {
123
+ item.value = undefined
124
+ item.calendar = undefined
125
+ })
126
+ }
127
+
128
+ function checkOrderOption() {
129
+ let isCheck = true
130
+ if (currentOrderVal.value) {
131
+ if (!currentSortordVal.value) {
132
+ showFailToast('排序规则不能为空')
133
+ isCheck = false
134
+ }
135
+ }
136
+ else if (currentSortordVal.value) {
137
+ if (!currentOrderVal.value) {
138
+ showFailToast('排序字段不能为空')
139
+ isCheck = false
140
+ }
141
+ }
142
+ return isCheck
143
+ }
144
+
145
+ // 确认筛选条件
146
+ function confirmOption() {
147
+ const isCheck = checkOrderOption()
148
+ if (isCheck) {
149
+ const isEmptyObject = Object.keys(conditionParams.value).length === 0
150
+ emit('update:conditionParams', isEmptyObject ? undefined : conditionParams.value)
151
+ emit('onRefresh', {})
152
+ listFilterMenu.value.toggle(false)
153
+ }
154
+ }
155
+
156
+ onMounted(() => {
157
+ currentOrderVal.value = orderVal
158
+ currentSortordVal.value = sortordVal
159
+ disposalData()
160
+ // 处理最大日期 —— 6个月之后
161
+ const now = new Date()
162
+ now.setMonth(now.getMonth() + 6)
163
+ maxDate.value = now
164
+ })
165
+
166
+ watch(() => currentOrderVal.value, (val) => {
167
+ emit('update:orderVal', val)
168
+ })
169
+
170
+ watch(() => currentSortordVal.value, (val) => {
171
+ emit('update:sortordVal', val)
172
+ })
173
+
174
+ // 整理数据formQuery
175
+ function disposalData() {
176
+ rangePickerList.value = formQuery.filter((item) => {
177
+ return item.type === 'rangePicker'
178
+ })
179
+ }
180
+ </script>
181
+
182
+ <template>
183
+ <div id="XCellListFilter">
184
+ <VanDropdownMenu :close-on-click-outside="false">
185
+ <VanDropdownItem ref="listFilterMenu">
186
+ <template #title>
187
+ <VanIcon name="filter-o" size="20" />
188
+ </template>
189
+ <div class="order-condition">
190
+ <VanRow justify="space-between" class="filter-title">
191
+ <VanCol span="10">
192
+ 排序字段
193
+ </VanCol>
194
+ <VanCol span="2">
195
+ <div class="reset-item" @click.stop="currentOrderVal = undefined">
196
+ 重置
197
+ </div>
198
+ </VanCol>
199
+ </VanRow>
200
+ <VanRadioGroup v-model="currentOrderVal">
201
+ <VanRadio
202
+ v-for="(item) in orderList"
203
+ :key="item.value"
204
+ :name="item.value"
205
+ @click="currentOrderVal = item.value"
206
+ >
207
+ <VanButton type="default">
208
+ <span :class="currentOrderVal === item.value ? 'filter-active' : ''">{{ item.title }}</span>
209
+ </VanButton>
210
+ </VanRadio>
211
+ </VanRadioGroup>
212
+ <VanRow justify="space-between" class="filter-title">
213
+ <VanCol span="10">
214
+ 排序规则
215
+ </VanCol>
216
+ <VanCol span="2">
217
+ <div class="reset-item" @click.stop="currentSortordVal = undefined">
218
+ 重置
219
+ </div>
220
+ </VanCol>
221
+ </VanRow>
222
+ <VanRadioGroup v-model="currentSortordVal">
223
+ <VanRadio
224
+ v-for="(item) in sortordList"
225
+ :key="item.value"
226
+ :name="item.value"
227
+ @click="currentSortordVal = item.value"
228
+ >
229
+ <VanButton type="default">
230
+ <span :class="currentSortordVal === item.value ? 'filter-active' : ''">{{ item.title }}</span>
231
+ </VanButton>
232
+ </VanRadio>
233
+ </VanRadioGroup>
234
+ <div v-for="(item, index) in rangePickerList" :key="item.model" class="range-picker-list" @click="getRangePickerValue(item, index)">
235
+ <VanRow justify="space-between" class="range-picker-title">
236
+ <VanCol span="10">
237
+ {{ item.name }}
238
+ </VanCol>
239
+ <VanCol span="2">
240
+ <div class="reset-item" @click.stop="resetOptionItem('rangePicker', item)">
241
+ 重置
242
+ </div>
243
+ </VanCol>
244
+ </VanRow>
245
+ <div :class="item.value ? 'active-picker-time range-picker-time' : 'range-picker-time'">
246
+ {{ item.value ? item.value[0].substr(0, 10) : '开始时间' }}
247
+ </div>
248
+ <span>~</span>
249
+ <div :class="item.value ? 'active-picker-time range-picker-time' : 'range-picker-time'">
250
+ {{ item.value ? item.value[1].substr(0, 10) : '结束时间' }}
251
+ </div>
252
+ </div>
253
+ </div>
254
+ <div class="operations-panel">
255
+ <VanButton type="default" @click="resetOption">
256
+ 重置
257
+ </VanButton>
258
+ <VanButton type="primary" @click="confirmOption">
259
+ 确认
260
+ </VanButton>
261
+ </div>
262
+ </VanDropdownItem>
263
+ </VanDropdownMenu>
264
+ <!-- 日期选择器 —— 日历 -->
265
+ <div class="rangePicker-comp-box">
266
+ <VanDialog
267
+ v-model:show="calendarShow"
268
+ show-cancel-button
269
+ @confirm="updateRangePickerValue"
270
+ >
271
+ <VanCalendar
272
+ :poppable="false"
273
+ :show-confirm="false"
274
+ switch-mode="year-month"
275
+ :min-date="minDate"
276
+ :max-date="maxDate"
277
+ :default-date="calendarVal"
278
+ type="range"
279
+ @confirm="calendarValueOnConfirm"
280
+ @cancel="calendarValueOnCancel"
281
+ />
282
+ </VanDialog>
283
+ </div>
284
+ </div>
285
+ </template>
286
+
287
+ <style scoped lang="less">
288
+ #XCellListFilter {
289
+ .order-condition {
290
+ padding-bottom: 10px;
291
+ max-height: calc(var(--van-picker-toolbar-height) + var(--van-padding-base) + var(--van-tabs-line-height) + 35vh);
292
+ overflow-y: auto;
293
+ width: 100%;
294
+ background-color: white;
295
+ .filter-title {
296
+ height: 2rem;
297
+ font-size: 13px;
298
+ font-weight: 600;
299
+ line-height: 2rem;
300
+ margin: 5px 1rem 1px 1rem;
301
+ color: black;
302
+ }
303
+ :deep(.van-radio__icon) {
304
+ display: none;
305
+ }
306
+ :deep(.van-radio) {
307
+ display: inline;
308
+ }
309
+ :deep(.van-button--default) {
310
+ background: #f8f8f8;
311
+ border-color: #f8f8f8;
312
+ }
313
+ .filter-active {
314
+ color: #1989fa;
315
+ font-weight: 600;
316
+ }
317
+ :deep(.van-button) {
318
+ display: inline-block;
319
+ height: 2rem;
320
+ font-size: 13px;
321
+ font-weight: 500;
322
+ }
323
+ :deep(.van-cell) {
324
+ padding: 0 0 1rem 0;
325
+ }
326
+ :deep(.van-icon) {
327
+ display: none;
328
+ }
329
+ .range-picker-list {
330
+ .range-picker-title {
331
+ height: 2rem;
332
+ font-size: 13px;
333
+ font-weight: 600;
334
+ line-height: 2rem;
335
+ margin: 5px 1rem 1px 1rem;
336
+ color: black;
337
+ }
338
+ .range-picker-time {
339
+ display: inline-block;
340
+ background: #f8f8f8;
341
+ border-radius: 8px;
342
+ font-size: 13px;
343
+ margin: 0 1rem;
344
+ height: 2rem;
345
+ line-height: 2rem;
346
+ width: 40vw;
347
+ text-align: center;
348
+ }
349
+ /* 已完成选择的时间 */
350
+ .active-picker-time {
351
+ color: #1989fa;
352
+ font-weight: 600;
353
+ }
354
+ }
355
+ /* 重置元素按钮 */
356
+ .reset-item {
357
+ font-weight: 500;
358
+ color: #1989fa;
359
+ }
360
+ }
361
+ /* 下拉菜单的操作面板 */
362
+ .operations-panel {
363
+ display: flex;
364
+ overflow: hidden;
365
+ user-select: none;
366
+ padding: 10px;
367
+
368
+ & > .van-button {
369
+ flex: 1;
370
+ margin: 0;
371
+
372
+ &:first-child {
373
+ margin-right: 12px;
374
+ }
375
+ }
376
+ }
377
+ /* 时间范围组件 */
378
+ .rangePicker-comp-box {
379
+ :deep(.van-calendar) {
380
+ height: 58vh;
381
+ }
382
+ :deep(.van-calendar__header-title) {
383
+ background-color: rgba(25, 137, 250, 0.1);
384
+ height: 8vh;
385
+ line-height: 8vh;
386
+ }
387
+ :deep(.van-calendar__month-mark) {
388
+ color: rgba(25, 137, 250, 0.1);
389
+ }
390
+ }
391
+ }
392
+ </style>
@@ -0,0 +1,127 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ Button as VanButton,
4
+ CellGroup as VanCellGroup,
5
+ Form as VanForm
6
+ } from 'vant'
7
+ import {ref,reactive,computed} from 'vue'
8
+ import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
9
+
10
+ let visible = ref(true)
11
+ let myFormItems = reactive<[{isOnlyAddOrEdit?: boolean, formType?: string, key?: string}]>([
12
+ ])
13
+ let rules = reactive({})
14
+ let form = reactive({})
15
+ let myServiceName = ref('')
16
+ let loaded = ref(false)
17
+ let myGetDataParams = reactive({})
18
+ const emits = defineEmits(['onSubmit'])
19
+
20
+ const realJsonData = computed(()=>{
21
+ // return myFormItems.filter(item => item.isOnlyAddOrEdit)
22
+ return myFormItems
23
+ })
24
+
25
+ const groupJsonData = computed(() => {
26
+ return myFormItems.filter(item => {
27
+ return item.formType === 'group'
28
+ }).map((item)=>{
29
+ return item
30
+ })
31
+ })
32
+ function init (params) {
33
+ const {
34
+ formItems, serviceName, getDataParams = {}
35
+ } = params
36
+ loaded.value = false
37
+ Object.assign(myFormItems,JSON.parse(JSON.stringify(formItems.column)))
38
+ myServiceName.value = serviceName
39
+ const formData = {}
40
+ for (let i = 0; i < realJsonData.value.length; i++) {
41
+ const item = realJsonData.value[i]
42
+ setFormProps(formData, item)
43
+ }
44
+ // 处理分组数据表单
45
+ // for (let i = 0; i < groupJsonData.value.length; i++) {
46
+ // const groupItem = groupJsonData.value[i]
47
+ // for (let j = 0; j < groupItem.groupItems.length; j++) {
48
+ // const item = groupItem.groupItems[j]
49
+ // setFormProps(formData, item)
50
+ // }
51
+ // }
52
+ form = formData
53
+ myGetDataParams = getDataParams
54
+ loaded.value = true
55
+ }
56
+ function setFormProps (formData, item) {
57
+ formData[item.key] = undefined
58
+ if (item.rule) {
59
+ rules[item.key] = []
60
+ switch (item.rule.type) {
61
+ case 'number':
62
+ case 'integer':
63
+ case 'float':
64
+ let defaultValue
65
+ let message
66
+ switch (item.rule.type) {
67
+ case 'number':
68
+ message = '数字'
69
+ defaultValue = 0
70
+ break
71
+ case 'integer':
72
+ message = '整数'
73
+ defaultValue = 0
74
+ break
75
+ case 'float':
76
+ message = '小数'
77
+ defaultValue = 0.0
78
+ break
79
+ }
80
+ rules[item.key].push({
81
+ type: item.rule.type,
82
+ message: item.title + '必须为' + message,
83
+ transform: (value) => {
84
+ if (value && value.length !== 0) {
85
+ return Number(value)
86
+ } else {
87
+ return defaultValue
88
+ }
89
+ },
90
+ trigger: 'blur'
91
+ })
92
+ break
93
+ }
94
+ }
95
+ }
96
+ function onSubmit() {
97
+ emits('onSubmit', form)
98
+ }
99
+ defineExpose({init})
100
+ </script>
101
+
102
+ <template>
103
+ <div v-show="visible">
104
+ <van-form @submit="onSubmit">
105
+ <van-cell-group inset>
106
+ <x-form-item
107
+ v-for="(item, index) in realJsonData"
108
+ :key="index"
109
+ :attr="item"
110
+ v-model="form[item.key]"
111
+ :service-name="myServiceName"
112
+ :get-data-params="myGetDataParams"
113
+ />
114
+ </van-cell-group>
115
+ <div style="margin: 16px;">
116
+ <van-button round block type="primary" native-type="submit">
117
+ 提交
118
+ </van-button>
119
+ <slot></slot>
120
+ </div>
121
+ </van-form>
122
+ </div>
123
+ </template>
124
+
125
+ <style scoped>
126
+
127
+ </style>