李志伟 2 years ago
parent
commit
65f4ddeef9

+ 25
- 8
src/components/OrgPicker/index.vue View File

1
 <template>
1
 <template>
2
   <div class="org-picker">
2
   <div class="org-picker">
3
     <div class="picker-search">
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
     </div>
9
     </div>
6
     <div class="picker-list">
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
             <van-icon name="success" />
27
             <van-icon name="success" />
11
           </template>
28
           </template>
12
         </van-cell>
29
         </van-cell>
32
 
49
 
33
 const props = defineProps({
50
 const props = defineProps({
34
   modelValue: String,
51
   modelValue: String,
35
-  invoiceId:String
52
+  invoiceId: String
36
 })
53
 })
37
 const emit = defineEmits(['update:modelValue', 'change'])
54
 const emit = defineEmits(['update:modelValue', 'change'])
38
 
55
 
41
   orgSelected.value = { invoiceOrgId: val }
58
   orgSelected.value = { invoiceOrgId: val }
42
 })
59
 })
43
 
60
 
44
-const queryData = (params) => {  
61
+const queryData = (params) => {
45
   getOrgList({ ...params })
62
   getOrgList({ ...params })
46
     .then((res) => {
63
     .then((res) => {
47
       //是否为第一页
64
       //是否为第一页
65
 }
82
 }
66
 
83
 
67
 const onSearch = (val) => {
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
 const onCancel = () => {
88
 const onCancel = () => {
76
 // 所以 onMounted 里面不需要初始化执行了
93
 // 所以 onMounted 里面不需要初始化执行了
77
 const onLoad = () => {
94
 const onLoad = () => {
78
   const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
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
 const onClick = (org) => {
99
 const onClick = (org) => {

+ 18
- 18
src/components/PersonPicker/index.vue View File

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

+ 0
- 1
src/pages/invoice/history.vue View File

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