af-mobile-client-vue3 1.0.70 → 1.0.71
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/.cursorrules +61 -0
- package/package.json +1 -1
- package/src/components/core/XGridDropOption/index.vue +151 -132
- package/src/components/core/XMultiSelect/index.vue +183 -185
- package/src/components/core/XSelect/index.vue +122 -122
- package/src/components/data/XCellList/index.vue +116 -57
- package/src/components/data/XCellListFilter/index.vue +240 -230
- package/src/components/data/XForm/index.vue +27 -21
- package/src/components/data/XFormGroup/index.vue +96 -78
- package/src/components/data/XFormItem/index.vue +638 -595
- package/src/components/data/XReportForm/index.vue +19 -0
- package/src/components/data/XSignature/index.vue +285 -0
- package/src/router/routes.ts +12 -0
- package/src/utils/authority-utils.ts +0 -1
- package/src/utils/runEvalFunction.ts +13 -0
- package/src/views/component/XCellListView/index.vue +96 -57
- package/src/views/component/XFormGroupView/index.vue +54 -0
- package/src/views/component/XFormView/index.vue +170 -55
- package/src/views/component/XReportFormView/index.vue +2 -284
- package/src/views/component/XSignatureView/index.vue +50 -0
- package/src/views/component/index.vue +9 -1
- package/vite.config.ts +1 -1
|
@@ -1,185 +1,183 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
Cell as VanCell,
|
|
4
|
-
CellGroup as VanCellGroup,
|
|
5
|
-
Checkbox as VanCheckbox,
|
|
6
|
-
CheckboxGroup as VanCheckboxGroup,
|
|
7
|
-
Field as VanField,
|
|
8
|
-
Popup as VanPopup,
|
|
9
|
-
Search as VanSearch
|
|
10
|
-
} from 'vant'
|
|
11
|
-
import {computed,
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
columns: {
|
|
15
|
-
type: Array,
|
|
16
|
-
default() {
|
|
17
|
-
return []
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
selectValue: {
|
|
21
|
-
type: Array,
|
|
22
|
-
default() {
|
|
23
|
-
return []
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
option: {
|
|
27
|
-
type: Object,
|
|
28
|
-
default() {
|
|
29
|
-
return { text: 'label', value: 'value' }
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
// 是否支持搜索
|
|
33
|
-
isSearch: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: true
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
const emits = defineEmits(['input', 'confirm', 'change', 'cancel'])
|
|
39
|
-
const show = ref(false)
|
|
40
|
-
const searchVal = ref('')
|
|
41
|
-
const columnsData = ref([])
|
|
42
|
-
const checkboxValue = ref(JSON.parse(JSON.stringify(props.selectValue)))
|
|
43
|
-
const checkedAll = ref(false)
|
|
44
|
-
const resultValue = defineModel()
|
|
45
|
-
const checkboxGroup = ref()
|
|
46
|
-
const checkboxes = ref()
|
|
47
|
-
function search(val) {
|
|
48
|
-
if (val) {
|
|
49
|
-
columnsData.value = props.columns.filter((item) => {
|
|
50
|
-
return item[props.option.text].includes(val)
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function getData(val) {
|
|
58
|
-
const res = props.columns.filter((item) => {
|
|
59
|
-
return val.includes(item[props.option.value])
|
|
60
|
-
})
|
|
61
|
-
return res
|
|
62
|
-
}
|
|
63
|
-
function onConfirm() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Cell as VanCell,
|
|
4
|
+
CellGroup as VanCellGroup,
|
|
5
|
+
Checkbox as VanCheckbox,
|
|
6
|
+
CheckboxGroup as VanCheckboxGroup,
|
|
7
|
+
Field as VanField,
|
|
8
|
+
Popup as VanPopup,
|
|
9
|
+
Search as VanSearch,
|
|
10
|
+
} from 'vant'
|
|
11
|
+
import { computed, defineEmits, defineModel, defineProps, ref, watch } from 'vue'
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
columns: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default() {
|
|
17
|
+
return []
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
selectValue: {
|
|
21
|
+
type: Array,
|
|
22
|
+
default() {
|
|
23
|
+
return []
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
option: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default() {
|
|
29
|
+
return { text: 'label', value: 'value' }
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
// 是否支持搜索
|
|
33
|
+
isSearch: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
const emits = defineEmits(['input', 'confirm', 'change', 'cancel'])
|
|
39
|
+
const show = ref(false)
|
|
40
|
+
const searchVal = ref('')
|
|
41
|
+
const columnsData = ref([])
|
|
42
|
+
const checkboxValue = ref(JSON.parse(JSON.stringify(props.selectValue)))
|
|
43
|
+
const checkedAll = ref(false)
|
|
44
|
+
const resultValue = defineModel()
|
|
45
|
+
const checkboxGroup = ref()
|
|
46
|
+
const checkboxes = ref()
|
|
47
|
+
function search(val) {
|
|
48
|
+
if (val) {
|
|
49
|
+
columnsData.value = props.columns.filter((item) => {
|
|
50
|
+
return item[props.option.text].includes(val)
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function getData(val) {
|
|
58
|
+
const res = props.columns.filter((item) => {
|
|
59
|
+
return val.includes(item[props.option.value])
|
|
60
|
+
})
|
|
61
|
+
return res
|
|
62
|
+
}
|
|
63
|
+
function onConfirm() {
|
|
64
|
+
resultValue.value = checkboxValue.value
|
|
65
|
+
show.value = !show.value
|
|
66
|
+
emits('confirm', resultValue.value, getData(resultValue.value))
|
|
67
|
+
}
|
|
68
|
+
function change(val) {
|
|
69
|
+
emits('change', val, getData(resultValue.value))
|
|
70
|
+
}
|
|
71
|
+
function cancel() {
|
|
72
|
+
show.value = !show.value
|
|
73
|
+
emits('cancel', resultValue.value)
|
|
74
|
+
}
|
|
75
|
+
function toggle(item, _index) {
|
|
76
|
+
// 假设 checkboxValue 是一个对象,我们通过 index 来切换对应 checkbox 的值
|
|
77
|
+
const idx = checkboxValue.value.indexOf(item[props.option.value])
|
|
78
|
+
if (idx !== -1)
|
|
79
|
+
checkboxValue.value.splice(idx, 1)
|
|
80
|
+
else
|
|
81
|
+
checkboxValue.value.push(item[props.option.value])
|
|
82
|
+
}
|
|
83
|
+
function toggleAll() {
|
|
84
|
+
// 遍历 checkboxValue 并设置所有 checkbox 的值为 checkedAll 的值
|
|
85
|
+
if (checkedAll.value)
|
|
86
|
+
checkboxValue.value = columnsData.value.map(item => item[props.option.value])
|
|
87
|
+
|
|
88
|
+
else
|
|
89
|
+
checkboxValue.value = []
|
|
90
|
+
}
|
|
91
|
+
function showPopu(disabled) {
|
|
92
|
+
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
93
|
+
if (disabled !== undefined && disabled !== false)
|
|
94
|
+
return false
|
|
95
|
+
else
|
|
96
|
+
show.value = !show.value
|
|
97
|
+
}
|
|
98
|
+
watch(() => columnsData.value, (newVal, _oldVal) => {
|
|
99
|
+
checkedAll.value = newVal.length && newVal.length === checkboxValue.value.length
|
|
100
|
+
})
|
|
101
|
+
watch(() => checkboxValue.value.length, (newVal, _oldVal) => {
|
|
102
|
+
checkedAll.value = newVal && newVal === columnsData.value.length
|
|
103
|
+
})
|
|
104
|
+
const resultLabel = computed(() => {
|
|
105
|
+
const res = props.columns.filter((item) => {
|
|
106
|
+
return (resultValue.value as unknown as string[]).includes(item[props.option.value])
|
|
107
|
+
}).map(item => item[props.option.text])
|
|
108
|
+
return res.join(',')
|
|
109
|
+
})
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<template>
|
|
113
|
+
<div class="dh-field">
|
|
114
|
+
<VanField
|
|
115
|
+
v-model="resultLabel"
|
|
116
|
+
v-bind="$attrs"
|
|
117
|
+
readonly
|
|
118
|
+
:border="false"
|
|
119
|
+
:is-link="$attrs.disabled === undefined"
|
|
120
|
+
error-message-align="right"
|
|
121
|
+
@click="showPopu($attrs.readonly)"
|
|
122
|
+
/>
|
|
123
|
+
<VanPopup v-model:show="show" position="bottom">
|
|
124
|
+
<div class="van-picker__toolbar">
|
|
125
|
+
<button type="button" class="van-picker__cancel" @click="cancel">
|
|
126
|
+
取消
|
|
127
|
+
</button>
|
|
128
|
+
<div class="van-ellipsis van-picker__title">
|
|
129
|
+
{{ $attrs.label }}
|
|
130
|
+
</div>
|
|
131
|
+
<button type="button" class="van-picker__confirm" @click="onConfirm">
|
|
132
|
+
确认
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
<div style="max-height:264px; overflow-y:auto;">
|
|
136
|
+
<VanSearch
|
|
137
|
+
v-if="props.isSearch"
|
|
138
|
+
v-model="searchVal"
|
|
139
|
+
placeholder="搜索"
|
|
140
|
+
@update:model-value="search"
|
|
141
|
+
@cancel="search"
|
|
142
|
+
/>
|
|
143
|
+
<VanCell title="全选">
|
|
144
|
+
<template #right-icon>
|
|
145
|
+
<VanCheckbox v-model="checkedAll" name="all" @click="toggleAll" />
|
|
146
|
+
</template>
|
|
147
|
+
</VanCell>
|
|
148
|
+
<VanCheckboxGroup ref="checkboxGroup" v-model="checkboxValue" @change="change">
|
|
149
|
+
<VanCellGroup>
|
|
150
|
+
<VanCell
|
|
151
|
+
v-for="(item, index) in columnsData"
|
|
152
|
+
:key="item[props.option.value]"
|
|
153
|
+
:title="item[props.option.text]"
|
|
154
|
+
clickable
|
|
155
|
+
@click="toggle(item, index)"
|
|
156
|
+
>
|
|
157
|
+
<template #right-icon>
|
|
158
|
+
<VanCheckbox ref="checkboxes" :name="item[props.option.value]" @click.stop />
|
|
159
|
+
</template>
|
|
160
|
+
</VanCell>
|
|
161
|
+
</VanCellGroup>
|
|
162
|
+
</VanCheckboxGroup>
|
|
163
|
+
</div>
|
|
164
|
+
</VanPopup>
|
|
165
|
+
</div>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<style lang="less" scoped>
|
|
169
|
+
.dh-field {
|
|
170
|
+
width: 100%;
|
|
171
|
+
padding: 0;
|
|
172
|
+
background:#fff;
|
|
173
|
+
.dh-cell.van-cell {
|
|
174
|
+
padding: 10px 0;
|
|
175
|
+
}
|
|
176
|
+
.dh-cell.van-cell--required::before {
|
|
177
|
+
left: -8px;
|
|
178
|
+
}
|
|
179
|
+
.van-popup {
|
|
180
|
+
border-radius: 20px 20px 0 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
Field as VanField,
|
|
4
|
-
Picker as VanPicker,
|
|
5
|
-
Popup as VanPopup,
|
|
6
|
-
} from 'vant'
|
|
7
|
-
import {computed,
|
|
8
|
-
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
columns: {
|
|
11
|
-
type: Array,
|
|
12
|
-
default() {
|
|
13
|
-
return []
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
option: {
|
|
17
|
-
type: Object,
|
|
18
|
-
default() {
|
|
19
|
-
return { text: 'label', value: 'value', children: 'children' }
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
isSearch: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false,
|
|
25
|
-
},
|
|
26
|
-
offOption: { // 关闭option配置key-value;当数据是非集合的数组的时候,开启
|
|
27
|
-
type: Boolean,
|
|
28
|
-
default: false,
|
|
29
|
-
},
|
|
30
|
-
border:{ // 是否展示边框
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: false,
|
|
33
|
-
},
|
|
34
|
-
})
|
|
35
|
-
const emits = defineEmits(['confirm', 'change', 'cancel', 'input'])
|
|
36
|
-
const show = ref(false)
|
|
37
|
-
const searchVal = ref('')
|
|
38
|
-
const resultValue = defineModel()
|
|
39
|
-
const columnsData = ref([])
|
|
40
|
-
|
|
41
|
-
const resultLabel = computed({
|
|
42
|
-
get() {
|
|
43
|
-
const res = props.columns.filter((item) => {
|
|
44
|
-
const data = props.offOption ? item : item[props.option.value]
|
|
45
|
-
return data === resultValue.value
|
|
46
|
-
})
|
|
47
|
-
return res.length ? (props.offOption ? res[0] : res[0][props.option.text]) : ''
|
|
48
|
-
},
|
|
49
|
-
set() {
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
function search(val) {
|
|
54
|
-
if (val) {
|
|
55
|
-
columnsData.value = columnsData.value.filter((item) => {
|
|
56
|
-
const data = props.offOption ? item : item[props.option.text]
|
|
57
|
-
|
|
58
|
-
return data.includes(val)
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function onConfirm(value,
|
|
66
|
-
resultValue.value = props.offOption ? value.selectedValues : value.selectedValues[0]
|
|
67
|
-
show.value = !show.value
|
|
68
|
-
emits('confirm', value.selectedValues[0], value.selectedOptions)
|
|
69
|
-
}
|
|
70
|
-
function change(val, index) {
|
|
71
|
-
emits('change', val, index, resultValue.value)
|
|
72
|
-
}
|
|
73
|
-
function cancel(val, index) {
|
|
74
|
-
show.value = !show.value
|
|
75
|
-
emits('cancel', val, index, resultValue.value)
|
|
76
|
-
}
|
|
77
|
-
function showPopu(disabled) {
|
|
78
|
-
// resultValue.value = `${selectValue}`
|
|
79
|
-
if (disabled !== undefined && disabled !== false)
|
|
80
|
-
return false
|
|
81
|
-
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
82
|
-
show.value = !show.value
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// watch(() => selectValue, (newVal, _oldVal) => {
|
|
86
|
-
// resultValue.value = `${newVal}`
|
|
87
|
-
// })
|
|
88
|
-
watch(() => resultValue, (newVal, _oldVal) => {
|
|
89
|
-
searchVal.value = ''
|
|
90
|
-
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
91
|
-
emits('input', newVal)
|
|
92
|
-
})
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<template>
|
|
96
|
-
<VanField
|
|
97
|
-
v-model="resultLabel"
|
|
98
|
-
v-bind="$attrs"
|
|
99
|
-
readonly
|
|
100
|
-
:is-link="true"
|
|
101
|
-
:border="props.border"
|
|
102
|
-
error-message-align="right"
|
|
103
|
-
@click="showPopu($attrs.readonly)"
|
|
104
|
-
/>
|
|
105
|
-
<VanPopup v-model:show="show" position="bottom">
|
|
106
|
-
<VanField v-if="props.isSearch" v-model="searchVal" input-align="left" placeholder="搜索" @input="search" />
|
|
107
|
-
<VanPicker
|
|
108
|
-
v-bind="$attrs"
|
|
109
|
-
:columns="columnsData"
|
|
110
|
-
:columns-field-names="props.option"
|
|
111
|
-
show-toolbar
|
|
112
|
-
:value-key="props.option.text"
|
|
113
|
-
@cancel="cancel"
|
|
114
|
-
@confirm="onConfirm"
|
|
115
|
-
@change="change"
|
|
116
|
-
/>
|
|
117
|
-
</VanPopup>
|
|
118
|
-
</template>
|
|
119
|
-
|
|
120
|
-
<style lang="scss" scoped>
|
|
121
|
-
|
|
122
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Field as VanField,
|
|
4
|
+
Picker as VanPicker,
|
|
5
|
+
Popup as VanPopup,
|
|
6
|
+
} from 'vant'
|
|
7
|
+
import { computed, defineEmits, defineModel, defineProps, ref, watch } from 'vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
columns: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default() {
|
|
13
|
+
return []
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
option: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default() {
|
|
19
|
+
return { text: 'label', value: 'value', children: 'children' }
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
isSearch: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
offOption: { // 关闭option配置key-value;当数据是非集合的数组的时候,开启
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
border: { // 是否展示边框
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
const emits = defineEmits(['confirm', 'change', 'cancel', 'input'])
|
|
36
|
+
const show = ref(false)
|
|
37
|
+
const searchVal = ref('')
|
|
38
|
+
const resultValue = defineModel()
|
|
39
|
+
const columnsData = ref([])
|
|
40
|
+
|
|
41
|
+
const resultLabel = computed({
|
|
42
|
+
get() {
|
|
43
|
+
const res = props.columns.filter((item) => {
|
|
44
|
+
const data = props.offOption ? item : item[props.option.value]
|
|
45
|
+
return data === resultValue.value
|
|
46
|
+
})
|
|
47
|
+
return res.length ? (props.offOption ? res[0] : res[0][props.option.text]) : ''
|
|
48
|
+
},
|
|
49
|
+
set() {
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
function search(val) {
|
|
54
|
+
if (val) {
|
|
55
|
+
columnsData.value = columnsData.value.filter((item) => {
|
|
56
|
+
const data = props.offOption ? item : item[props.option.text]
|
|
57
|
+
|
|
58
|
+
return data.includes(val)
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function onConfirm(value, _index) {
|
|
66
|
+
resultValue.value = props.offOption ? value.selectedValues : value.selectedValues[0]
|
|
67
|
+
show.value = !show.value
|
|
68
|
+
emits('confirm', value.selectedValues[0], value.selectedOptions)
|
|
69
|
+
}
|
|
70
|
+
function change(val, index) {
|
|
71
|
+
emits('change', val, index, resultValue.value)
|
|
72
|
+
}
|
|
73
|
+
function cancel(val, index) {
|
|
74
|
+
show.value = !show.value
|
|
75
|
+
emits('cancel', val, index, resultValue.value)
|
|
76
|
+
}
|
|
77
|
+
function showPopu(disabled) {
|
|
78
|
+
// resultValue.value = `${selectValue}`
|
|
79
|
+
if (disabled !== undefined && disabled !== false)
|
|
80
|
+
return false
|
|
81
|
+
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
82
|
+
show.value = !show.value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// watch(() => selectValue, (newVal, _oldVal) => {
|
|
86
|
+
// resultValue.value = `${newVal}`
|
|
87
|
+
// })
|
|
88
|
+
watch(() => resultValue, (newVal, _oldVal) => {
|
|
89
|
+
searchVal.value = ''
|
|
90
|
+
columnsData.value = JSON.parse(JSON.stringify(props.columns))
|
|
91
|
+
emits('input', newVal)
|
|
92
|
+
})
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<template>
|
|
96
|
+
<VanField
|
|
97
|
+
v-model="resultLabel"
|
|
98
|
+
v-bind="$attrs"
|
|
99
|
+
readonly
|
|
100
|
+
:is-link="true"
|
|
101
|
+
:border="props.border"
|
|
102
|
+
error-message-align="right"
|
|
103
|
+
@click="showPopu($attrs.readonly)"
|
|
104
|
+
/>
|
|
105
|
+
<VanPopup v-model:show="show" position="bottom">
|
|
106
|
+
<VanField v-if="props.isSearch" v-model="searchVal" input-align="left" placeholder="搜索" @input="search" />
|
|
107
|
+
<VanPicker
|
|
108
|
+
v-bind="$attrs"
|
|
109
|
+
:columns="columnsData"
|
|
110
|
+
:columns-field-names="props.option"
|
|
111
|
+
show-toolbar
|
|
112
|
+
:value-key="props.option.text"
|
|
113
|
+
@cancel="cancel"
|
|
114
|
+
@confirm="onConfirm"
|
|
115
|
+
@change="change"
|
|
116
|
+
/>
|
|
117
|
+
</VanPopup>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<style lang="scss" scoped>
|
|
121
|
+
|
|
122
|
+
</style>
|