af-mobile-client-vue3 1.0.71 → 1.0.72
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/XSelect/index.vue +39 -17
- package/src/components/data/XCellList/index.vue +540 -507
- package/src/components/data/XCellListFilter/index.vue +2 -1
- package/src/components/data/XForm/index.vue +5 -1
- package/src/components/data/XFormItem/index.vue +77 -4
- package/src/router/routes.ts +25 -0
- package/src/services/v3Api.ts +136 -0
- package/src/utils/http/index.ts +34 -0
- package/src/views/component/XCellListView/index.vue +3 -3
- package/src/views/component/XFormGroupView/index.vue +11 -9
- package/src/views/component/XFormView/index.vue +12 -48
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Picker as VanPicker,
|
|
5
5
|
Popup as VanPopup,
|
|
6
6
|
} from 'vant'
|
|
7
|
-
import { computed, defineEmits, defineModel, defineProps, ref, watch } from 'vue'
|
|
7
|
+
import { computed, defineEmits, defineModel, defineProps, onBeforeMount, ref, watch } from 'vue'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
columns: {
|
|
@@ -36,13 +36,34 @@ const emits = defineEmits(['confirm', 'change', 'cancel', 'input'])
|
|
|
36
36
|
const show = ref(false)
|
|
37
37
|
const searchVal = ref('')
|
|
38
38
|
const resultValue = defineModel()
|
|
39
|
-
|
|
39
|
+
let columnsData = ref([])
|
|
40
|
+
const selectedOption = ref([])
|
|
41
|
+
|
|
42
|
+
// 转换空children为空字符串
|
|
43
|
+
function transformColumns(data) {
|
|
44
|
+
return data.map(item => {
|
|
45
|
+
if (item.children && item.children.length === 0) {
|
|
46
|
+
return {
|
|
47
|
+
...item,
|
|
48
|
+
children: ''
|
|
49
|
+
}
|
|
50
|
+
} else if (item.children && item.children.length !== 0) {
|
|
51
|
+
return { ...item, children:transformColumns(item.children) }
|
|
52
|
+
} else {
|
|
53
|
+
return { ...item }
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onBeforeMount(() => {
|
|
59
|
+
columnsData.value = transformColumns(props.columns)
|
|
60
|
+
})
|
|
40
61
|
|
|
41
62
|
const resultLabel = computed({
|
|
42
63
|
get() {
|
|
43
64
|
const res = props.columns.filter((item) => {
|
|
44
65
|
const data = props.offOption ? item : item[props.option.value]
|
|
45
|
-
return data === resultValue.value
|
|
66
|
+
return data === resultValue.value[0]
|
|
46
67
|
})
|
|
47
68
|
return res.length ? (props.offOption ? res[0] : res[0][props.option.text]) : ''
|
|
48
69
|
},
|
|
@@ -50,44 +71,45 @@ const resultLabel = computed({
|
|
|
50
71
|
|
|
51
72
|
},
|
|
52
73
|
})
|
|
74
|
+
|
|
53
75
|
function search(val) {
|
|
54
76
|
if (val) {
|
|
55
|
-
columnsData.value = columnsData.value.filter((item) => {
|
|
77
|
+
columnsData.value = transformColumns(columnsData.value).filter((item) => {
|
|
56
78
|
const data = props.offOption ? item : item[props.option.text]
|
|
57
|
-
|
|
58
79
|
return data.includes(val)
|
|
59
80
|
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
81
|
+
} else {
|
|
82
|
+
columnsData.value = transformColumns(props.columns)
|
|
63
83
|
}
|
|
64
84
|
}
|
|
85
|
+
|
|
65
86
|
function onConfirm(value, _index) {
|
|
66
|
-
resultValue.value = props.offOption ? value.selectedValues : value.selectedValues[0]
|
|
87
|
+
// resultValue.value = props.offOption ? value.selectedValues : value.selectedValues[0]
|
|
88
|
+
resultValue.value = value.selectedValues
|
|
89
|
+
selectedOption.value = value.selectedOptions
|
|
67
90
|
show.value = !show.value
|
|
68
91
|
emits('confirm', value.selectedValues[0], value.selectedOptions)
|
|
69
92
|
}
|
|
93
|
+
|
|
70
94
|
function change(val, index) {
|
|
71
95
|
emits('change', val, index, resultValue.value)
|
|
72
96
|
}
|
|
97
|
+
|
|
73
98
|
function cancel(val, index) {
|
|
74
99
|
show.value = !show.value
|
|
75
100
|
emits('cancel', val, index, resultValue.value)
|
|
76
101
|
}
|
|
102
|
+
|
|
77
103
|
function showPopu(disabled) {
|
|
78
|
-
// resultValue.value = `${selectValue}`
|
|
79
104
|
if (disabled !== undefined && disabled !== false)
|
|
80
105
|
return false
|
|
81
|
-
columnsData.value =
|
|
106
|
+
columnsData.value = transformColumns(props.columns)
|
|
82
107
|
show.value = !show.value
|
|
83
108
|
}
|
|
84
109
|
|
|
85
|
-
// watch(() => selectValue, (newVal, _oldVal) => {
|
|
86
|
-
// resultValue.value = `${newVal}`
|
|
87
|
-
// })
|
|
88
110
|
watch(() => resultValue, (newVal, _oldVal) => {
|
|
89
111
|
searchVal.value = ''
|
|
90
|
-
columnsData.value =
|
|
112
|
+
columnsData.value = transformColumns(props.columns)
|
|
91
113
|
emits('input', newVal)
|
|
92
114
|
})
|
|
93
115
|
</script>
|
|
@@ -118,5 +140,5 @@ watch(() => resultValue, (newVal, _oldVal) => {
|
|
|
118
140
|
</template>
|
|
119
141
|
|
|
120
142
|
<style lang="scss" scoped>
|
|
121
|
-
|
|
122
|
-
</style>
|
|
143
|
+
/* 样式定义 */
|
|
144
|
+
</style>
|