|
@@ -3,7 +3,7 @@
|
3
|
3
|
<div class="picker-search">
|
4
|
4
|
<van-search
|
5
|
5
|
v-model="searchValue"
|
6
|
|
- placeholder="请输入公司名称"
|
|
6
|
+ placeholder="请输入报销人姓名"
|
7
|
7
|
@search="onSearch"
|
8
|
8
|
/>
|
9
|
9
|
</div>
|
|
@@ -15,12 +15,12 @@
|
15
|
15
|
@load="onLoad"
|
16
|
16
|
>
|
17
|
17
|
<van-cell
|
18
|
|
- v-for="org in orgList"
|
19
|
|
- :key="org.invoiceOrgId"
|
20
|
|
- :title="org.name"
|
21
|
|
- @click="onClick(org)"
|
|
18
|
+ v-for="item in personList"
|
|
19
|
+ :key="item.invoicePersonId"
|
|
20
|
+ :title="item.name"
|
|
21
|
+ @click="onClick(item)"
|
22
|
22
|
>
|
23
|
|
- <template #right-icon v-if="org.invoiceOrgId === orgSelected.invoiceOrgId">
|
|
23
|
+ <template #right-icon v-if="item.invoicePersonId === personSelected.invoicePersonId">
|
24
|
24
|
<van-icon name="success" />
|
25
|
25
|
</template>
|
26
|
26
|
</van-cell>
|
|
@@ -38,8 +38,8 @@ import { getPersonList } from '@/services/person'
|
38
|
38
|
|
39
|
39
|
|
40
|
40
|
const searchValue = ref('')
|
41
|
|
-const orgSelected = ref({})
|
42
|
|
-const orgResult = ref({})
|
|
41
|
+const personSelected = ref({})
|
|
42
|
+const personResult = ref({})
|
43
|
43
|
const loading = ref(false)
|
44
|
44
|
const finished = ref(false)
|
45
|
45
|
const pageSize = 20
|
|
@@ -51,9 +51,9 @@ const props = defineProps({
|
51
|
51
|
})
|
52
|
52
|
const emit = defineEmits(['update:modelValue', 'change'])
|
53
|
53
|
|
54
|
|
-const orgList = computed(() => orgResult.value.records || [])
|
|
54
|
+const personList = computed(() => personResult.value.records || [])
|
55
|
55
|
watch(props.modelValue, (val) => {
|
56
|
|
- orgSelected.value = { invoiceOrgId: val }
|
|
56
|
+ personSelected.value = { invoicePersonId: val }
|
57
|
57
|
})
|
58
|
58
|
watch(()=>props.orgId,(val)=>{
|
59
|
59
|
const pageNum = 1
|
|
@@ -65,11 +65,11 @@ const queryData = (params) => {
|
65
|
65
|
.then((res) => {
|
66
|
66
|
const first = res.current === 1
|
67
|
67
|
if (first) {
|
68
|
|
- orgResult.value = res
|
|
68
|
+ personResult.value = res
|
69
|
69
|
} else {
|
70
|
|
- orgResult.value = {
|
|
70
|
+ personResult.value = {
|
71
|
71
|
...res,
|
72
|
|
- records: orgResult.value.records.concat(res.records)
|
|
72
|
+ records: personResult.value.records.concat(res.records)
|
73
|
73
|
}
|
74
|
74
|
}
|
75
|
75
|
loading.value = false
|
|
@@ -92,18 +92,18 @@ const onCancel = () => {
|
92
|
92
|
// 组件加载, onLoad 就会执行一次
|
93
|
93
|
// 所以 onMounted 里面不需要初始化执行了
|
94
|
94
|
const onLoad = () => {
|
95
|
|
- const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
|
|
95
|
+ const pageNum = personResult.value.current ? personResult.value.current + 1 : 1
|
96
|
96
|
queryData({ pageNum, pageSize, name: searchValue.value, invoiceId: props.invoiceId, invoiceOrgId: props.orgId })
|
97
|
97
|
}
|
98
|
98
|
|
99
|
99
|
const onClick = (org) => {
|
100
|
|
- orgSelected.value = org
|
|
100
|
+ personSelected.value = org
|
101
|
101
|
}
|
102
|
102
|
|
103
|
103
|
const onSubmit = () => {
|
104
|
|
- emit('update:modelValue', orgSelected.value.invoicePersonId)
|
105
|
|
- if (orgSelected.value.invoicePersonId && orgSelected.value.name) {
|
106
|
|
- emit('change', orgSelected.value)
|
|
104
|
+ emit('update:modelValue', personSelected.value.invoicePersonId)
|
|
105
|
+ if (personSelected.value.invoicePersonId && personSelected.value.name) {
|
|
106
|
+ emit('change', personSelected.value)
|
107
|
107
|
} else {
|
108
|
108
|
emit('change')
|
109
|
109
|
}
|