李志伟 2 vuotta sitten
vanhempi
commit
65f4ddeef9

+ 25
- 8
src/components/OrgPicker/index.vue Näytä tiedosto

@@ -1,12 +1,29 @@
1 1
 <template>
2 2
   <div class="org-picker">
3 3
     <div class="picker-search">
4
-      <van-search v-model="searchValue" placeholder="请输入公司名称" @search="onSearch" />
4
+      <van-search
5
+        v-model="searchValue"
6
+        placeholder="请输入公司名称"
7
+        @search="onSearch"
8
+      />
5 9
     </div>
6 10
     <div class="picker-list">
7
-      <van-list v-model:loading="loading" :finished="finished" finished-text="我们是有底线的" @load="onLoad">
8
-        <van-cell v-for="org in orgList" :key="org.invoiceOrgId" :title="org.name" @click="onClick(org)">
9
-          <template #right-icon v-if="org.invoiceOrgId === orgSelected.invoiceOrgId">
11
+      <van-list
12
+        v-model:loading="loading"
13
+        :finished="finished"
14
+        finished-text="我们是有底线的"
15
+        @load="onLoad"
16
+      >
17
+        <van-cell
18
+          v-for="org in orgList"
19
+          :key="org.invoiceOrgId"
20
+          :title="org.name"
21
+          @click="onClick(org)"
22
+        >
23
+          <template
24
+            #right-icon
25
+            v-if="org.invoiceOrgId === orgSelected.invoiceOrgId"
26
+          >
10 27
             <van-icon name="success" />
11 28
           </template>
12 29
         </van-cell>
@@ -32,7 +49,7 @@ const pageSize = 20
32 49
 
33 50
 const props = defineProps({
34 51
   modelValue: String,
35
-  invoiceId:String
52
+  invoiceId: String
36 53
 })
37 54
 const emit = defineEmits(['update:modelValue', 'change'])
38 55
 
@@ -41,7 +58,7 @@ watch(props.modelValue, (val) => {
41 58
   orgSelected.value = { invoiceOrgId: val }
42 59
 })
43 60
 
44
-const queryData = (params) => {  
61
+const queryData = (params) => {
45 62
   getOrgList({ ...params })
46 63
     .then((res) => {
47 64
       //是否为第一页
@@ -65,7 +82,7 @@ const queryData = (params) => {
65 82
 }
66 83
 
67 84
 const onSearch = (val) => {
68
-  queryData({ pageNum: 1, pageSize, name: val,invoiceId:props.invoiceId })
85
+  queryData({ pageNum: 1, pageSize, name: val, invoiceId: props.invoiceId })
69 86
 }
70 87
 
71 88
 const onCancel = () => {
@@ -76,7 +93,7 @@ const onCancel = () => {
76 93
 // 所以 onMounted 里面不需要初始化执行了
77 94
 const onLoad = () => {
78 95
   const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
79
-  queryData({ pageNum, pageSize, name: searchValue.value,invoiceId:props.invoiceId })
96
+  queryData({ pageNum, pageSize, name: searchValue.value, invoiceId: props.invoiceId })
80 97
 }
81 98
 
82 99
 const onClick = (org) => {

+ 18
- 18
src/components/PersonPicker/index.vue Näytä tiedosto

@@ -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
   }

+ 0
- 1
src/pages/invoice/history.vue Näytä tiedosto

@@ -42,7 +42,6 @@ const pagenavi = reactive({ pageNum: 1, pageSize: 10, total: 0 })
42 42
 const finished = computed(() => pagenavi.pageNum * pagenavi.pageSize > pagenavi.total)
43 43
 
44 44
 const queryData = (params = {}) => {
45
-  console.log('-------------', user.personId)
46 45
   getList(invoiceId, { ...params, personId: user.personId }).then(res => {
47 46
     const { records, ...pageInfo } = res;
48 47
     if (pageInfo.current === 1) {