af-mobile-client-vue3 1.2.18 → 1.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/core/ImageUploader/index.vue +159 -159
- package/src/components/data/XCellList/index.vue +51 -11
- package/src/components/data/XCellListFilter/index.vue +87 -16
- package/src/components/data/XForm/index.vue +75 -30
- package/src/components/data/XFormItem/index.vue +303 -215
- package/src/components/data/XOlMap/index.vue +4 -3
- package/src/components/data/XOlMap/types.ts +2 -0
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/views/component/XCellListView/index.vue +21 -56
- package/src/views/component/XFormGroupView/index.vue +2 -42
- package/src/views/component/XFormView/index.vue +14 -0
- package/src/views/component/XFormView/oldindex.vue +70 -0
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
|
@@ -12,14 +12,15 @@ import { post } from '@af-mobile-client-vue3/services/restTools'
|
|
|
12
12
|
import { searchToListOption, searchToOption } from '@af-mobile-client-vue3/services/v3Api'
|
|
13
13
|
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
14
14
|
import { getDict } from '@af-mobile-client-vue3/utils/dictUtil'
|
|
15
|
-
import { getRangeByType } from '@af-mobile-client-vue3/utils/queryFormDefaultRangePicker'
|
|
16
15
|
import { executeStrFunctionByContext } from '@af-mobile-client-vue3/utils/runEvalFunction'
|
|
17
16
|
import { areaList } from '@vant/area-data'
|
|
18
17
|
import dayjs from 'dayjs/esm/index'
|
|
19
18
|
import { debounce } from 'lodash-es'
|
|
20
19
|
import {
|
|
21
20
|
Area as VanArea,
|
|
21
|
+
Button as VanButton,
|
|
22
22
|
Calendar as VanCalendar,
|
|
23
|
+
Cascader as VanCascader,
|
|
23
24
|
Checkbox as VanCheckbox,
|
|
24
25
|
CheckboxGroup as vanCheckboxGroup,
|
|
25
26
|
DatePicker as VanDatePicker,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
Switch as VanSwitch,
|
|
36
37
|
TimePicker as VanTimePicker,
|
|
37
38
|
} from 'vant'
|
|
38
|
-
import { computed, defineEmits, defineProps, getCurrentInstance, onBeforeMount, ref, watch } from 'vue'
|
|
39
|
+
import { computed, defineEmits, defineModel, defineProps, getCurrentInstance, onBeforeMount, ref, watch } from 'vue'
|
|
39
40
|
|
|
40
41
|
const props = defineProps({
|
|
41
42
|
attr: {
|
|
@@ -73,6 +74,7 @@ const props = defineProps({
|
|
|
73
74
|
type: Object,
|
|
74
75
|
default: () => {},
|
|
75
76
|
},
|
|
77
|
+
// 用 defineModel 替代 modelValue/emit
|
|
76
78
|
modelValue: {
|
|
77
79
|
type: [String, Number, Boolean, Array, Object],
|
|
78
80
|
default: undefined,
|
|
@@ -91,7 +93,18 @@ const props = defineProps({
|
|
|
91
93
|
|
|
92
94
|
})
|
|
93
95
|
|
|
94
|
-
const emits = defineEmits(['
|
|
96
|
+
const emits = defineEmits(['setForm', 'xFormItemEmitFunc'])
|
|
97
|
+
|
|
98
|
+
// 用 defineModel 替代 modelValue/emit
|
|
99
|
+
const modelData = defineModel<string | number | boolean | any[] | Record<string, any>>()
|
|
100
|
+
|
|
101
|
+
// 获取字典
|
|
102
|
+
interface OptionItem {
|
|
103
|
+
label: string
|
|
104
|
+
value: any
|
|
105
|
+
children?: OptionItem[]
|
|
106
|
+
}
|
|
107
|
+
|
|
95
108
|
// 判断并初始化防抖函数
|
|
96
109
|
let debouncedUserLinkFunc: (() => void) | null = null
|
|
97
110
|
let debouncedDepLinkFunc: (() => void) | null = null
|
|
@@ -101,7 +114,6 @@ const { attr, form, mode, serviceName, getDataParams, columnsField } = props
|
|
|
101
114
|
const calendarShow = ref(false)
|
|
102
115
|
const option = ref([])
|
|
103
116
|
const pickerValue = ref(undefined)
|
|
104
|
-
const datePickerValue = ref(undefined)
|
|
105
117
|
const timePickerValue = ref(undefined)
|
|
106
118
|
const area = ref<any>(undefined)
|
|
107
119
|
const showPicker = ref(false)
|
|
@@ -109,16 +121,8 @@ const showDatePicker = ref(false)
|
|
|
109
121
|
const showTimePicker = ref(false)
|
|
110
122
|
const showArea = ref(false)
|
|
111
123
|
const errorMessage = ref('')
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// 输入-非查询
|
|
115
|
-
const formInputDefaultValue = ref('')
|
|
116
|
-
// 输入-查询
|
|
117
|
-
const queryInputDefaultValue = ref('')
|
|
118
|
-
// 选择-非查询
|
|
119
|
-
const formSelectDefaultValue = ref([])
|
|
120
|
-
// 选择-查询
|
|
121
|
-
const querySelectDefaultValue = ref([])
|
|
124
|
+
const showTreeSelect = ref(false)
|
|
125
|
+
const treeValue = ref('')
|
|
122
126
|
|
|
123
127
|
// 登录信息 (可以在配置的动态函数中使用 this.setupState 获取到当前组件内的全部函数和变量 例:this.setupState.userState)
|
|
124
128
|
const userState = useUserStore().getLogin()
|
|
@@ -136,9 +140,9 @@ const currInst = getCurrentInstance()
|
|
|
136
140
|
|
|
137
141
|
// 配置中心->表单项变更触发函数
|
|
138
142
|
const dataChangeFunc = debounce(async () => {
|
|
139
|
-
if (attr.dataChangeFunc)
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
if (attr.dataChangeFunc) {
|
|
144
|
+
await executeStrFunctionByContext(currInst, attr.dataChangeFunc, [form, val => modelData.value = val, attr, null, mode])
|
|
145
|
+
}
|
|
142
146
|
}, 500)
|
|
143
147
|
|
|
144
148
|
// 配置中心->表单项展示函数
|
|
@@ -156,58 +160,120 @@ const showFormItemFunc = debounce(async () => {
|
|
|
156
160
|
}
|
|
157
161
|
}, 500)
|
|
158
162
|
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
case 'area':
|
|
178
|
-
case 'citySelect':
|
|
179
|
-
case 'calendar':
|
|
180
|
-
case 'textarea':
|
|
181
|
-
case 'intervalPicker':
|
|
182
|
-
case 'input':
|
|
183
|
-
case 'select':
|
|
184
|
-
if (mode === '查询')
|
|
185
|
-
return props.modelValue !== undefined ? props.modelValue : queryInputDefaultValue.value
|
|
186
|
-
else
|
|
187
|
-
return props.modelValue !== undefined ? props.modelValue : formInputDefaultValue.value
|
|
188
|
-
case 'stepper':
|
|
189
|
-
return props.modelValue !== undefined ? props.modelValue : 1
|
|
190
|
-
case 'rangePicker':
|
|
191
|
-
if (props.modelValue && Array.isArray(props.modelValue) && props.modelValue.length > 1)
|
|
192
|
-
return `${props.modelValue[0]} ~ ${props.modelValue[1]}`
|
|
163
|
+
// 监听 props.modelValue 的变化
|
|
164
|
+
// watch(() => props.modelValue, (newVal) => {
|
|
165
|
+
// console.log('props.modelValue===', props.modelValue)
|
|
166
|
+
// })
|
|
167
|
+
|
|
168
|
+
/* function getDeafultValue(){
|
|
169
|
+
console.log('attr===', attr)
|
|
170
|
+
if (attr.type === 'radio' || attr.type === 'rate' || attr.type === 'slider' || attr.type === 'area' || attr.type === 'citySelect' || attr.type === 'calendar' || attr.type === 'textarea' || attr.type === 'intervalPicker' || attr.type === 'input' || attr.type === 'select') {
|
|
171
|
+
if (attr.formDefault)
|
|
172
|
+
localValue.value = attr.formDefault
|
|
173
|
+
if (attr.queryFormDefault)
|
|
174
|
+
localValue.value = attr.queryFormDefault
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (attr.type === 'checkbox' || attr.type === 'uploader' || attr.type === 'file' || attr.type === 'image' || attr.type === 'datePicker' || attr.type === 'timePicker') {
|
|
178
|
+
if (attr.formDefault) {
|
|
179
|
+
if (attr.type === 'checkbox' || attr.type === 'image' || attr.type === 'file')
|
|
180
|
+
formSelectDefaultValue.value = attr.formDefault
|
|
193
181
|
else
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
182
|
+
formSelectDefaultValue.value.push(attr.formDefault)
|
|
183
|
+
}
|
|
184
|
+
if (attr.queryFormDefault) {
|
|
185
|
+
// console.log(querySelectDefaultValue.value)
|
|
186
|
+
querySelectDefaultValue.value.push(...attr.queryFormDefault)
|
|
187
|
+
// querySelectDefaultValue.value = attr.queryFormDefault
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (attr.type === 'rangePicker') {
|
|
192
|
+
if (attr.formDefault)
|
|
193
|
+
formSelectDefaultValue.value = attr.formDefault
|
|
194
|
+
if (attr.queryFormDefault) {
|
|
195
|
+
const dateArray = getRangeByType(attr.queryFormDefault, true)
|
|
196
|
+
pickerValue.value = `${dateArray[0]} ~ ${dateArray[1]}`
|
|
197
|
+
querySelectDefaultValue.value = pickerValue.value
|
|
198
|
+
}
|
|
199
199
|
}
|
|
200
|
+
} */
|
|
201
|
+
/**
|
|
202
|
+
* 检测是否传入了有效的值
|
|
203
|
+
* @returns any
|
|
204
|
+
*/
|
|
205
|
+
function checkModel(val = props.modelValue) {
|
|
206
|
+
if (val === null || val === undefined || val === '')
|
|
207
|
+
return false
|
|
208
|
+
if (Array.isArray(val))
|
|
209
|
+
return val.length > 0
|
|
210
|
+
return true
|
|
200
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* 获取表单项的默认值
|
|
214
|
+
* @returns any
|
|
215
|
+
*/
|
|
216
|
+
function getDefaultValue() {
|
|
217
|
+
const val = props.modelValue
|
|
218
|
+
|
|
219
|
+
// 如果有有效值,直接返回
|
|
220
|
+
if (checkModel(val)) {
|
|
221
|
+
return val
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// 根据类型获取默认值
|
|
225
|
+
const getDefaultByType = () => {
|
|
226
|
+
const def = mode !== '查询' ? attr.formDefault : attr.queryFormDefault
|
|
227
|
+
|
|
228
|
+
// 数组类型默认值
|
|
229
|
+
const arrayTypes = ['uploader', 'checkbox', 'file', 'area', 'image', 'treeSelect']
|
|
230
|
+
if (arrayTypes.includes(attr.type)) {
|
|
231
|
+
return def !== undefined ? def : []
|
|
232
|
+
}
|
|
201
233
|
|
|
234
|
+
// 特殊类型默认值
|
|
235
|
+
const specialDefaults = {
|
|
236
|
+
switch: false,
|
|
237
|
+
stepper: 1,
|
|
238
|
+
addressSearch: val,
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (specialDefaults[attr.type] !== undefined) {
|
|
242
|
+
return specialDefaults[attr.type]
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 日期时间类型
|
|
246
|
+
const dateTypes = ['rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker', 'datePicker', 'timePicker']
|
|
247
|
+
if (dateTypes.includes(attr.type)) {
|
|
248
|
+
return getDateRange({
|
|
249
|
+
type: attr.type,
|
|
250
|
+
formDefault: attr.formDefault ?? '',
|
|
251
|
+
queryFormDefault: attr.queryFormDefault ?? '',
|
|
252
|
+
queryType: attr.queryType,
|
|
253
|
+
queryValueFormat: attr.queryValueFormat,
|
|
254
|
+
name: attr.name ?? '',
|
|
255
|
+
}) ?? []
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// 其他类型(字符串、数字等)
|
|
259
|
+
return def ?? ''
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return getDefaultByType()
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// 初始化日期组件初始值,组件自定义格式显示值和实际值(日期相关初始化都在此函数中操作)
|
|
202
266
|
function getDateRange({
|
|
203
267
|
type,
|
|
204
268
|
formDefault: defaultValue,
|
|
269
|
+
queryFormDefault,
|
|
205
270
|
queryType,
|
|
206
271
|
queryValueFormat: defaultFormat,
|
|
207
272
|
name,
|
|
208
273
|
}: {
|
|
209
274
|
type: string
|
|
210
275
|
formDefault: string
|
|
276
|
+
queryFormDefault: string
|
|
211
277
|
queryType?: string
|
|
212
278
|
queryValueFormat?: string
|
|
213
279
|
name: string
|
|
@@ -220,87 +286,58 @@ function getDateRange({
|
|
|
220
286
|
datePicker: 'YYYY-MM-DD HH:mm:ss',
|
|
221
287
|
rangePicker: 'YYYY-MM-DD HH:mm:ss',
|
|
222
288
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return undefined
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (['monthPicker', 'yearPicker', 'datePicker'].includes(type)) {
|
|
250
|
-
if (queryType === 'BETWEEN') {
|
|
251
|
-
return [start, end]
|
|
289
|
+
if (mode) {
|
|
290
|
+
const format = defaultFormat || formatMap[type]
|
|
291
|
+
const val = mode === '查询' ? queryFormDefault : defaultValue
|
|
292
|
+
let start: string, end: string
|
|
293
|
+
switch (val) {
|
|
294
|
+
case 'curYear':
|
|
295
|
+
start = dayjs().startOf('year').format(format)
|
|
296
|
+
end = dayjs().endOf('year').format(format)
|
|
297
|
+
break
|
|
298
|
+
case 'curMonth':
|
|
299
|
+
start = dayjs().startOf('month').format(format)
|
|
300
|
+
end = dayjs().endOf('month').format(format)
|
|
301
|
+
break
|
|
302
|
+
case 'curDay':
|
|
303
|
+
start = dayjs().startOf('day').format(format)
|
|
304
|
+
end = dayjs().endOf('day').format(format)
|
|
305
|
+
break
|
|
306
|
+
case 'curTime':
|
|
307
|
+
start = dayjs().format(format)
|
|
308
|
+
end = dayjs().format(format)
|
|
309
|
+
break
|
|
310
|
+
default:
|
|
311
|
+
return undefined
|
|
252
312
|
}
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const localValue = ref(getDefaultValue())
|
|
269
|
-
|
|
270
|
-
// 监听 props.modelValue 的变化
|
|
271
|
-
watch(() => props.modelValue, (newVal) => {
|
|
272
|
-
// 如果是文件上传类型,需要特殊处理
|
|
273
|
-
if (attr.type === 'image' || attr.type === 'file') {
|
|
274
|
-
localValue.value = Array.isArray(newVal) ? newVal : []
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
if (attr.type === 'rangePicker') {
|
|
278
|
-
console.log('newVal', newVal)
|
|
279
|
-
pickerValue.value = newVal !== undefined ? `${newVal[0]} ~ ${newVal[1]}` : getDefaultValue()
|
|
280
|
-
}
|
|
281
|
-
else if (['datePicker', 'rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker'].includes(attr.type)) {
|
|
282
|
-
localValue.value = getDateRange(attr)
|
|
313
|
+
if (['monthPicker', 'yearPicker', 'datePicker'].includes(type)) {
|
|
314
|
+
if (mode !== '查询') {
|
|
315
|
+
if (queryType === 'BETWEEN') {
|
|
316
|
+
return [start, end]
|
|
317
|
+
}
|
|
318
|
+
if (name.includes('开始') || name.includes('起始')) {
|
|
319
|
+
return start
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
return end
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
return start
|
|
327
|
+
}
|
|
283
328
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
329
|
+
// rangePicker组件表单显示的值
|
|
330
|
+
if (mode === '查询' && type === 'rangePicker') {
|
|
331
|
+
pickerValue.value = `${start} ~ ${end}`
|
|
287
332
|
}
|
|
288
|
-
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
// 监听 localValue 的变化
|
|
292
|
-
watch(localValue, (newVal) => {
|
|
293
|
-
if (attr.type === 'image' || attr.type === 'file') {
|
|
294
|
-
// 确保上传组件的值始终是数组
|
|
295
|
-
const value = Array.isArray(newVal) ? newVal : []
|
|
296
|
-
emits('update:modelValue', value)
|
|
333
|
+
return mode !== '查询' ? start : [start, end]
|
|
297
334
|
}
|
|
298
335
|
else {
|
|
299
|
-
|
|
336
|
+
return undefined
|
|
300
337
|
}
|
|
301
|
-
|
|
302
|
-
})
|
|
338
|
+
}
|
|
303
339
|
|
|
340
|
+
// 删除 localValue 相关
|
|
304
341
|
// 监听 props.form 的变化
|
|
305
342
|
watch(
|
|
306
343
|
() => props.form,
|
|
@@ -316,7 +353,7 @@ watch(
|
|
|
316
353
|
function updateFile(files, _index) {
|
|
317
354
|
// 处理文件数据
|
|
318
355
|
// 更新本地值
|
|
319
|
-
|
|
356
|
+
modelData.value = files.map((file) => {
|
|
320
357
|
const newFile = { ...file }
|
|
321
358
|
if (newFile.content)
|
|
322
359
|
delete newFile.content
|
|
@@ -452,6 +489,7 @@ function formTypeCheck(attr, value) {
|
|
|
452
489
|
|
|
453
490
|
onBeforeMount(() => {
|
|
454
491
|
init()
|
|
492
|
+
modelData.value = getDefaultValue()
|
|
455
493
|
showFormItemFunc()
|
|
456
494
|
dataChangeFunc()
|
|
457
495
|
if (attr?.keyName?.toString()?.startsWith('search@根据表单项[') && attr?.keyName?.toString().endsWith(']联动人员'))
|
|
@@ -487,7 +525,7 @@ const placeholder = computed(() => {
|
|
|
487
525
|
const formatDate = date => `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
|
|
488
526
|
|
|
489
527
|
function onCalendarConfirm(values) {
|
|
490
|
-
|
|
528
|
+
modelData.value = [formatDate(values[0]), formatDate(values[1])]
|
|
491
529
|
pickerValue.value = `${formatDate(values[0])} ~ ${formatDate(values[1])}`
|
|
492
530
|
calendarShow.value = false
|
|
493
531
|
}
|
|
@@ -541,36 +579,6 @@ function init() {
|
|
|
541
579
|
initRadioValue()
|
|
542
580
|
}
|
|
543
581
|
}
|
|
544
|
-
if (attr.type === 'radio' || attr.type === 'rate' || attr.type === 'slider' || attr.type === 'area' || attr.type === 'citySelect' || attr.type === 'calendar' || attr.type === 'textarea' || attr.type === 'intervalPicker' || attr.type === 'input' || attr.type === 'select') {
|
|
545
|
-
if (attr.formDefault)
|
|
546
|
-
formInputDefaultValue.value = attr.formDefault
|
|
547
|
-
if (attr.queryFormDefault)
|
|
548
|
-
queryInputDefaultValue.value = attr.queryFormDefault
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
if (attr.type === 'checkbox' || attr.type === 'uploader' || attr.type === 'file' || attr.type === 'image' || attr.type === 'datePicker' || attr.type === 'timePicker') {
|
|
552
|
-
if (attr.formDefault) {
|
|
553
|
-
if (attr.type === 'checkbox' || attr.type === 'image' || attr.type === 'file')
|
|
554
|
-
formSelectDefaultValue.value = attr.formDefault
|
|
555
|
-
else
|
|
556
|
-
formSelectDefaultValue.value.push(attr.formDefault)
|
|
557
|
-
}
|
|
558
|
-
if (attr.queryFormDefault) {
|
|
559
|
-
// console.log(querySelectDefaultValue.value)
|
|
560
|
-
querySelectDefaultValue.value.push(...attr.queryFormDefault)
|
|
561
|
-
// querySelectDefaultValue.value = attr.queryFormDefault
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
if (attr.type === 'rangePicker') {
|
|
566
|
-
if (attr.formDefault)
|
|
567
|
-
formSelectDefaultValue.value = attr.formDefault
|
|
568
|
-
if (attr.queryFormDefault) {
|
|
569
|
-
const dateArray = getRangeByType(attr.queryFormDefault, true)
|
|
570
|
-
pickerValue.value = `${dateArray[0]} ~ ${dateArray[1]}`
|
|
571
|
-
querySelectDefaultValue.value = pickerValue.value
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
582
|
}
|
|
575
583
|
|
|
576
584
|
function getDataCallback(res) {
|
|
@@ -608,11 +616,11 @@ async function updateResOptions(type) {
|
|
|
608
616
|
}
|
|
609
617
|
|
|
610
618
|
function initRadioValue() {
|
|
611
|
-
if ((mode === '新增' || mode === '修改') && attr.type === 'radio' && !
|
|
619
|
+
if ((mode === '新增' || mode === '修改') && attr.type === 'radio' && !props.modelValue) {
|
|
612
620
|
if (attr.keys && attr.keys.length > 0)
|
|
613
|
-
|
|
621
|
+
modelData.value = attr.keys[0].value
|
|
614
622
|
else if (option.value && option.value.length > 0)
|
|
615
|
-
|
|
623
|
+
modelData.value = option.value[0].value
|
|
616
624
|
}
|
|
617
625
|
}
|
|
618
626
|
|
|
@@ -630,16 +638,16 @@ function getData(value, callback) {
|
|
|
630
638
|
}
|
|
631
639
|
}
|
|
632
640
|
|
|
641
|
+
// 已废弃 不进行维护
|
|
633
642
|
function onPickerConfirm({ selectedOptions }) {
|
|
634
643
|
showPicker.value = false
|
|
635
|
-
|
|
636
|
-
emits('update:modelValue', [selectedOptions[0].text])
|
|
644
|
+
modelData.value = selectedOptions[0].text
|
|
637
645
|
}
|
|
638
646
|
|
|
639
647
|
// 日期时间选择数据
|
|
640
|
-
const dateTimePickerValue = ref(
|
|
648
|
+
const dateTimePickerValue = ref<any>({})
|
|
641
649
|
function showDataTimePicker() {
|
|
642
|
-
if (props.modelValue
|
|
650
|
+
if (props.modelValue && typeof props.modelValue === 'string') {
|
|
643
651
|
// 拆分日期和时间
|
|
644
652
|
const [dateStr, timeStr] = props.modelValue.split(' ')
|
|
645
653
|
// 拆分日期部分
|
|
@@ -654,7 +662,7 @@ function showDataTimePicker() {
|
|
|
654
662
|
}
|
|
655
663
|
else {
|
|
656
664
|
dateTimePickerValue.value = {
|
|
657
|
-
date:
|
|
665
|
+
date: formatDate(new Date()).split('-'),
|
|
658
666
|
time: ['00', '00', '00'],
|
|
659
667
|
}
|
|
660
668
|
}
|
|
@@ -663,30 +671,32 @@ function showDataTimePicker() {
|
|
|
663
671
|
|
|
664
672
|
function onDatePickerConfirm({ selectedValues }) {
|
|
665
673
|
showDatePicker.value = false
|
|
666
|
-
|
|
674
|
+
modelData.value = selectedValues.join('-')
|
|
667
675
|
}
|
|
668
676
|
|
|
677
|
+
// 已废弃 不进行维护
|
|
669
678
|
function onTimePickerConfirm({ selectedValues }) {
|
|
670
679
|
showTimePicker.value = false
|
|
671
680
|
timePickerValue.value = selectedValues.join(':')
|
|
672
|
-
|
|
681
|
+
modelData.value = timePickerValue.value
|
|
673
682
|
}
|
|
674
683
|
|
|
684
|
+
// 没人用到本次先不动。后续需要看这个组件需要怎么使用
|
|
675
685
|
function onAreaConfirm({ selectedOptions }) {
|
|
676
686
|
area.value = `${selectedOptions[0].text}-${selectedOptions[1].text}-${selectedOptions[2].text}`
|
|
677
687
|
showArea.value = false
|
|
678
|
-
|
|
688
|
+
modelData.value = [{
|
|
679
689
|
province: selectedOptions[0].text,
|
|
680
690
|
city: selectedOptions[1].text,
|
|
681
691
|
district: selectedOptions[2].text,
|
|
682
|
-
}]
|
|
692
|
+
}]
|
|
683
693
|
}
|
|
684
694
|
|
|
685
695
|
function onDateTimePickerConfirm() {
|
|
686
696
|
showDatePicker.value = false
|
|
687
697
|
const dateStr = dateTimePickerValue.value.date.join('-')
|
|
688
698
|
const timeStr = dateTimePickerValue.value.time.join(':')
|
|
689
|
-
|
|
699
|
+
modelData.value = `${dateStr} ${timeStr}`
|
|
690
700
|
}
|
|
691
701
|
|
|
692
702
|
function onPickerCancel() {
|
|
@@ -716,10 +726,33 @@ function handleAddressConfirm(location) {
|
|
|
716
726
|
[attr.model]: location.address,
|
|
717
727
|
}
|
|
718
728
|
// 更新表单数据
|
|
719
|
-
|
|
720
|
-
emits('set-form', formData)
|
|
729
|
+
emits('setForm', formData)
|
|
721
730
|
showAddressPicker.value = false
|
|
722
731
|
}
|
|
732
|
+
|
|
733
|
+
// 重置方法,供父组件调用
|
|
734
|
+
function reset() {
|
|
735
|
+
modelData.value = null
|
|
736
|
+
errorMessage.value = ''
|
|
737
|
+
treeValue.value = null
|
|
738
|
+
area.value = null
|
|
739
|
+
pickerValue.value = null
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
defineExpose({
|
|
743
|
+
reset,
|
|
744
|
+
})
|
|
745
|
+
|
|
746
|
+
// 级联选择完成事件
|
|
747
|
+
function onTreeSelectFinish(value) {
|
|
748
|
+
treeValue.value = value.value
|
|
749
|
+
modelData.value = [value.value]
|
|
750
|
+
showTreeSelect.value = false
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
function emitFunc(func, data) {
|
|
754
|
+
emits('xFormItemEmitFunc', func, data, data?.model ? this.form[data.model] : this.form)
|
|
755
|
+
}
|
|
723
756
|
</script>
|
|
724
757
|
|
|
725
758
|
<template>
|
|
@@ -731,10 +764,10 @@ function handleAddressConfirm(location) {
|
|
|
731
764
|
:label="labelData"
|
|
732
765
|
:label-align="labelAlign"
|
|
733
766
|
:input-align="attr.inputAlign ? attr.inputAlign : 'right'"
|
|
734
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
767
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
735
768
|
>
|
|
736
769
|
<template #input>
|
|
737
|
-
<VanSwitch v-model="
|
|
770
|
+
<VanSwitch v-model="modelData" />
|
|
738
771
|
</template>
|
|
739
772
|
</VanField>
|
|
740
773
|
|
|
@@ -745,7 +778,7 @@ function handleAddressConfirm(location) {
|
|
|
745
778
|
:label="labelData"
|
|
746
779
|
>
|
|
747
780
|
<template #input>
|
|
748
|
-
<VanCheckbox v-model="
|
|
781
|
+
<VanCheckbox v-model="modelData" shape="square" />
|
|
749
782
|
</template>
|
|
750
783
|
</VanField> -->
|
|
751
784
|
|
|
@@ -761,7 +794,7 @@ function handleAddressConfirm(location) {
|
|
|
761
794
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
762
795
|
>
|
|
763
796
|
<template #input>
|
|
764
|
-
<van-checkbox-group v-model="
|
|
797
|
+
<van-checkbox-group v-model="modelData as any[]" direction="horizontal" shape="square" :disabled="readonly">
|
|
765
798
|
<VanCheckbox v-for="(item, index) in option" :key="index" style="padding: 2px" :name="item[columnsField.value]" :shape="rules?.[attr.model].shape" :value="item[columnsField.value]">
|
|
766
799
|
{{ item[columnsField.text] }}
|
|
767
800
|
</VanCheckbox>
|
|
@@ -778,7 +811,7 @@ function handleAddressConfirm(location) {
|
|
|
778
811
|
>
|
|
779
812
|
<template #input>
|
|
780
813
|
<XGridDropOption
|
|
781
|
-
v-model="(
|
|
814
|
+
v-model="(modelData as string[])"
|
|
782
815
|
:column-num="labelData ? 3 : 4"
|
|
783
816
|
:multiple="true"
|
|
784
817
|
:columns="option"
|
|
@@ -787,8 +820,8 @@ function handleAddressConfirm(location) {
|
|
|
787
820
|
</VanField>
|
|
788
821
|
<!-- 下拉 -->
|
|
789
822
|
<XMultiSelect
|
|
790
|
-
v-
|
|
791
|
-
v-model="
|
|
823
|
+
v-if="attr.showMode === 'select' && mode === '查询'"
|
|
824
|
+
v-model="modelData"
|
|
792
825
|
:label="labelData"
|
|
793
826
|
:readonly="readonly"
|
|
794
827
|
:placeholder="placeholder"
|
|
@@ -809,7 +842,7 @@ function handleAddressConfirm(location) {
|
|
|
809
842
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
810
843
|
>
|
|
811
844
|
<template #input>
|
|
812
|
-
<VanRadioGroup v-model="
|
|
845
|
+
<VanRadioGroup v-model="modelData" direction="horizontal" :disabled="readonly">
|
|
813
846
|
<VanRadio v-for="(item, index) in option" :key="index" style="padding: 2px" :name="item[columnsField.value]" :value="item[columnsField.value]">
|
|
814
847
|
{{ item[columnsField.text] }}
|
|
815
848
|
</VanRadio>
|
|
@@ -829,7 +862,7 @@ function handleAddressConfirm(location) {
|
|
|
829
862
|
>
|
|
830
863
|
<template #input>
|
|
831
864
|
<XGridDropOption
|
|
832
|
-
v-model="(
|
|
865
|
+
v-model="(modelData as string)"
|
|
833
866
|
:column-num="labelData ? 3 : 4"
|
|
834
867
|
:columns="option"
|
|
835
868
|
/>
|
|
@@ -843,10 +876,10 @@ function handleAddressConfirm(location) {
|
|
|
843
876
|
:label="labelData"
|
|
844
877
|
:label-align="labelAlign"
|
|
845
878
|
:input-align="attr.inputAlign ? attr.inputAlign : 'center'"
|
|
846
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
879
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
847
880
|
>
|
|
848
881
|
<template #input>
|
|
849
|
-
<VanStepper v-model="
|
|
882
|
+
<VanStepper v-model="modelData as any" :disabled="readonly" />
|
|
850
883
|
</template>
|
|
851
884
|
</VanField>
|
|
852
885
|
|
|
@@ -857,10 +890,10 @@ function handleAddressConfirm(location) {
|
|
|
857
890
|
:label="labelData"
|
|
858
891
|
:label-align="labelAlign"
|
|
859
892
|
:input-align="attr.inputAlign ? attr.inputAlign : 'center'"
|
|
860
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
893
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
861
894
|
>
|
|
862
895
|
<template #input>
|
|
863
|
-
<VanRate v-model="
|
|
896
|
+
<VanRate v-model="modelData as number" :size="25" :readonly="readonly" void-color="#eee" void-icon="star" color="#ffd21e" />
|
|
864
897
|
</template>
|
|
865
898
|
</VanField>
|
|
866
899
|
|
|
@@ -871,10 +904,10 @@ function handleAddressConfirm(location) {
|
|
|
871
904
|
:label="labelData"
|
|
872
905
|
:label-align="labelAlign"
|
|
873
906
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
874
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
907
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
875
908
|
>
|
|
876
909
|
<template #input>
|
|
877
|
-
<VanSlider v-model="
|
|
910
|
+
<VanSlider v-model="modelData as number" :readonly="readonly" />
|
|
878
911
|
</template>
|
|
879
912
|
</VanField>
|
|
880
913
|
|
|
@@ -885,13 +918,13 @@ function handleAddressConfirm(location) {
|
|
|
885
918
|
:label="labelData"
|
|
886
919
|
:label-align="labelAlign"
|
|
887
920
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
888
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
921
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
889
922
|
>
|
|
890
923
|
<template #input>
|
|
891
924
|
<!-- <van-uploader v-model="localValue" /> -->
|
|
892
925
|
<Uploader
|
|
893
926
|
upload-mode="server"
|
|
894
|
-
:image-list="(
|
|
927
|
+
:image-list="(modelData as any[])"
|
|
895
928
|
authority="admin"
|
|
896
929
|
@update-file-list="updateFile"
|
|
897
930
|
/>
|
|
@@ -905,12 +938,12 @@ function handleAddressConfirm(location) {
|
|
|
905
938
|
:label="labelData"
|
|
906
939
|
:label-align="labelAlign"
|
|
907
940
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
908
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
941
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
909
942
|
>
|
|
910
943
|
<template #input>
|
|
911
944
|
<ImageUploader
|
|
912
945
|
upload-mode="server"
|
|
913
|
-
:image-list="(
|
|
946
|
+
:image-list="(modelData as any[])"
|
|
914
947
|
authority="admin"
|
|
915
948
|
:attr="attr"
|
|
916
949
|
@update-file-list="updateFile"
|
|
@@ -918,7 +951,7 @@ function handleAddressConfirm(location) {
|
|
|
918
951
|
</template>
|
|
919
952
|
</VanField>
|
|
920
953
|
|
|
921
|
-
<!-- 选择器 -->
|
|
954
|
+
<!-- 选择器 琉璃中不存在,不进行维护后续将删除 -->
|
|
922
955
|
<VanField
|
|
923
956
|
v-if="attr.type === 'picker' && showItem"
|
|
924
957
|
v-model="pickerValue"
|
|
@@ -929,12 +962,12 @@ function handleAddressConfirm(location) {
|
|
|
929
962
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
930
963
|
readonly
|
|
931
964
|
is-link
|
|
932
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
965
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
933
966
|
@click="readonly ? null : showPicker = true"
|
|
934
967
|
/>
|
|
935
968
|
<VanPopup v-model:show="showPicker" round position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
936
969
|
<VanPicker
|
|
937
|
-
v-model="(
|
|
970
|
+
v-model="(modelData as Numeric[])"
|
|
938
971
|
:title="attr.name"
|
|
939
972
|
:columns="attr.selectKey"
|
|
940
973
|
:readonly="readonly"
|
|
@@ -957,7 +990,7 @@ function handleAddressConfirm(location) {
|
|
|
957
990
|
:label-align="labelAlign"
|
|
958
991
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
959
992
|
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
960
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
993
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
961
994
|
@click="calendarShow = true"
|
|
962
995
|
/>
|
|
963
996
|
<VanCalendar
|
|
@@ -973,7 +1006,7 @@ function handleAddressConfirm(location) {
|
|
|
973
1006
|
<!-- 日期选择-非查询 -->
|
|
974
1007
|
<VanField
|
|
975
1008
|
v-if="(attr.type === 'datePicker' || attr.type === 'rangePicker') && mode !== '查询' && showItem"
|
|
976
|
-
v-model="(
|
|
1009
|
+
v-model="(modelData as string | number)"
|
|
977
1010
|
name="datePicker"
|
|
978
1011
|
:label="labelData"
|
|
979
1012
|
:label-align="labelAlign"
|
|
@@ -981,7 +1014,7 @@ function handleAddressConfirm(location) {
|
|
|
981
1014
|
readonly
|
|
982
1015
|
:is-link="true"
|
|
983
1016
|
:placeholder="placeholder"
|
|
984
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
1017
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
985
1018
|
@click="readonly ? null : showDataTimePicker()"
|
|
986
1019
|
/>
|
|
987
1020
|
<VanPopup v-model:show="showDatePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
@@ -1010,7 +1043,7 @@ function handleAddressConfirm(location) {
|
|
|
1010
1043
|
<!-- 日期选择-查询 -->
|
|
1011
1044
|
<VanField
|
|
1012
1045
|
v-if="attr.type === 'datePicker' && mode === '查询' && showItem"
|
|
1013
|
-
v-model="(
|
|
1046
|
+
v-model="(modelData as string | number)"
|
|
1014
1047
|
name="datePicker"
|
|
1015
1048
|
:label="labelData"
|
|
1016
1049
|
:label-align="labelAlign"
|
|
@@ -1018,7 +1051,7 @@ function handleAddressConfirm(location) {
|
|
|
1018
1051
|
readonly
|
|
1019
1052
|
:is-link="true"
|
|
1020
1053
|
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1021
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
1054
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1022
1055
|
@click="showDatePicker = true"
|
|
1023
1056
|
/>
|
|
1024
1057
|
<VanPopup v-model:show="showDatePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
@@ -1044,7 +1077,7 @@ function handleAddressConfirm(location) {
|
|
|
1044
1077
|
</VanPickerGroup>
|
|
1045
1078
|
</VanPopup>
|
|
1046
1079
|
|
|
1047
|
-
<!-- 时间选择 -->
|
|
1080
|
+
<!-- 时间选择 --该配置未在pc找到不进行维护 后续将删除 -->
|
|
1048
1081
|
<VanField
|
|
1049
1082
|
v-if="attr.type === 'timePicker' && showItem"
|
|
1050
1083
|
v-model="timePickerValue"
|
|
@@ -1060,7 +1093,7 @@ function handleAddressConfirm(location) {
|
|
|
1060
1093
|
/>
|
|
1061
1094
|
<VanPopup v-model:show="showTimePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1062
1095
|
<VanTimePicker
|
|
1063
|
-
v-model="
|
|
1096
|
+
v-model="modelData as string[]"
|
|
1064
1097
|
:title="attr.name"
|
|
1065
1098
|
:columns-type="attr.columnsType ? attr.columnsType : ['hour', 'minute', 'second']"
|
|
1066
1099
|
:min-time="attr.minTime ? attr.minTime : '00:00:00'"
|
|
@@ -1087,7 +1120,7 @@ function handleAddressConfirm(location) {
|
|
|
1087
1120
|
/>
|
|
1088
1121
|
<VanPopup v-model:show="showArea" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1089
1122
|
<VanArea
|
|
1090
|
-
v-model="
|
|
1123
|
+
v-model="modelData as string" :title="attr.name" :area-list="areaList"
|
|
1091
1124
|
@confirm="onAreaConfirm"
|
|
1092
1125
|
@cancel="showArea = false"
|
|
1093
1126
|
/>
|
|
@@ -1096,20 +1129,20 @@ function handleAddressConfirm(location) {
|
|
|
1096
1129
|
<!-- 单选下拉列表 -->
|
|
1097
1130
|
<XSelect
|
|
1098
1131
|
v-if="attr.type === 'select' && showItem"
|
|
1099
|
-
v-model="
|
|
1132
|
+
v-model="modelData"
|
|
1100
1133
|
:label="labelData"
|
|
1101
1134
|
:readonly="readonly"
|
|
1102
1135
|
clearable
|
|
1103
1136
|
:placeholder="placeholder"
|
|
1104
1137
|
:columns="option"
|
|
1105
1138
|
:option="attr.option ? attr.option : columnsField"
|
|
1106
|
-
:rules="[{ required: attr.rule.required === 'true', message:
|
|
1139
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1107
1140
|
/>
|
|
1108
1141
|
|
|
1109
1142
|
<!-- 文本区域 -->
|
|
1110
1143
|
<VanField
|
|
1111
1144
|
v-if="attr.type === 'textarea' && showItem"
|
|
1112
|
-
v-model="(
|
|
1145
|
+
v-model="(modelData as string)"
|
|
1113
1146
|
rows="3"
|
|
1114
1147
|
autosize
|
|
1115
1148
|
:label="labelData"
|
|
@@ -1126,24 +1159,43 @@ function handleAddressConfirm(location) {
|
|
|
1126
1159
|
<!-- 文本输入框 -->
|
|
1127
1160
|
<VanField
|
|
1128
1161
|
v-if="(attr.type === 'input' || attr.type === 'intervalPicker') && showItem"
|
|
1129
|
-
v-model="(localValue as string)"
|
|
1130
1162
|
:label="labelData"
|
|
1131
1163
|
:label-align="labelAlign"
|
|
1132
1164
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1133
1165
|
:type="attr.type as FieldType"
|
|
1134
|
-
:readonly="readonly"
|
|
1166
|
+
:readonly="readonly || (attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|'))"
|
|
1135
1167
|
:disabled="attr.disabled"
|
|
1136
1168
|
:placeholder="placeholder"
|
|
1137
1169
|
:error-message="errorMessage"
|
|
1138
1170
|
:clearable="attr.clearable"
|
|
1139
1171
|
:rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
|
|
1140
|
-
@blur="() => formTypeCheck(attr,
|
|
1141
|
-
|
|
1172
|
+
@blur="() => formTypeCheck(attr, modelData as string)"
|
|
1173
|
+
>
|
|
1174
|
+
<template #input>
|
|
1175
|
+
<input
|
|
1176
|
+
v-model="modelData"
|
|
1177
|
+
:readonly="readonly || (attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|'))"
|
|
1178
|
+
class="van-field__control"
|
|
1179
|
+
:placeholder="placeholder"
|
|
1180
|
+
style="flex: 1; min-width: 0;"
|
|
1181
|
+
>
|
|
1182
|
+
<VanButton
|
|
1183
|
+
v-if="attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|')"
|
|
1184
|
+
class="action-btn"
|
|
1185
|
+
round
|
|
1186
|
+
type="primary"
|
|
1187
|
+
size="small"
|
|
1188
|
+
@click="emitFunc(attr.inputOnAfterFunc, attr)"
|
|
1189
|
+
>
|
|
1190
|
+
{{ attr.inputOnAfterName }}
|
|
1191
|
+
</VanButton>
|
|
1192
|
+
</template>
|
|
1193
|
+
</VanField>
|
|
1142
1194
|
|
|
1143
1195
|
<!-- 地址选择器 -->
|
|
1144
1196
|
<VanField
|
|
1145
1197
|
v-if="attr.type === 'addressSearch' && showItem"
|
|
1146
|
-
v-model="
|
|
1198
|
+
v-model="modelData as string"
|
|
1147
1199
|
name="addressSearch"
|
|
1148
1200
|
:label="labelData"
|
|
1149
1201
|
:label-align="labelAlign"
|
|
@@ -1167,6 +1219,36 @@ function handleAddressConfirm(location) {
|
|
|
1167
1219
|
@confirm="handleAddressConfirm"
|
|
1168
1220
|
/>
|
|
1169
1221
|
</VanPopup>
|
|
1222
|
+
|
|
1223
|
+
<!-- pc的树形选择框————》 手机端采用 Cascader 级联选择 -->
|
|
1224
|
+
<VanField
|
|
1225
|
+
v-if="attr.type === 'treeSelect' && showItem"
|
|
1226
|
+
v-model="treeValue"
|
|
1227
|
+
name="treeSelect"
|
|
1228
|
+
:label="labelData"
|
|
1229
|
+
:label-align="labelAlign"
|
|
1230
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1231
|
+
readonly
|
|
1232
|
+
is-link
|
|
1233
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1234
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1235
|
+
@click="readonly ? null : showTreeSelect = true"
|
|
1236
|
+
/>
|
|
1237
|
+
<VanPopup
|
|
1238
|
+
v-model:show="showTreeSelect"
|
|
1239
|
+
position="bottom"
|
|
1240
|
+
teleport="body"
|
|
1241
|
+
overlay-class="date-picker-overlay"
|
|
1242
|
+
>
|
|
1243
|
+
<VanCascader
|
|
1244
|
+
:options="option"
|
|
1245
|
+
:field-names="attr.customFieldName ? attr.customFieldName : { text: 'label', value: 'value', children: 'children' }"
|
|
1246
|
+
:title="attr.name"
|
|
1247
|
+
:closeable="true"
|
|
1248
|
+
@close="showTreeSelect = false"
|
|
1249
|
+
@finish="onTreeSelectFinish"
|
|
1250
|
+
/>
|
|
1251
|
+
</VanPopup>
|
|
1170
1252
|
</div>
|
|
1171
1253
|
</template>
|
|
1172
1254
|
|
|
@@ -1174,4 +1256,10 @@ function handleAddressConfirm(location) {
|
|
|
1174
1256
|
.date-picker-overlay {
|
|
1175
1257
|
background-color: rgba(0, 0, 0, 0.2); /* 设置为半透明的黑色 */
|
|
1176
1258
|
}
|
|
1259
|
+
.action-btn {
|
|
1260
|
+
border-radius: 10px;
|
|
1261
|
+
margin-left: 8px;
|
|
1262
|
+
min-width: 4rem;
|
|
1263
|
+
max-width: 6rem;
|
|
1264
|
+
}
|
|
1177
1265
|
</style>
|