Browse Source

人员弹窗

李志伟 2 years ago
parent
commit
4edb1bbc45

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

5
     </div>
5
     </div>
6
     <div class="picker-list">
6
     <div class="picker-list">
7
       <van-list v-model:loading="loading" :finished="finished" finished-text="我们是有底线的" @load="onLoad">
7
       <van-list v-model:loading="loading" :finished="finished" finished-text="我们是有底线的" @load="onLoad">
8
-        <van-cell v-for="org in orgList" :key="org.orgId" :title="org.name" @click="onClick(org)">
9
-          <template #right-icon v-if="org.orgId === orgSelected.orgId">
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">
10
             <van-icon name="success" />
10
             <van-icon name="success" />
11
           </template>
11
           </template>
12
         </van-cell>
12
         </van-cell>
38
 
38
 
39
 const orgList = computed(() => orgResult.value.records || [])
39
 const orgList = computed(() => orgResult.value.records || [])
40
 watch(props.modelValue, (val) => {
40
 watch(props.modelValue, (val) => {
41
-  orgSelected.value = { orgId: val }
41
+  orgSelected.value = { invoiceOrgId: val }
42
 })
42
 })
43
 
43
 
44
-const queryData = (params) => {
44
+const queryData = (params) => {  
45
   getOrgList({ ...params, isSystem: true })
45
   getOrgList({ ...params, isSystem: true })
46
     .then((res) => {
46
     .then((res) => {
47
       const first = res.current === 1
47
       const first = res.current === 1
64
 }
64
 }
65
 
65
 
66
 const onSearch = (val) => {
66
 const onSearch = (val) => {
67
-  queryData({ pageNum: 1, pageSize, name: val })
67
+  queryData({ pageNum: 1, pageSize, name: val,invoiceId:props.invoiceId })
68
 }
68
 }
69
 
69
 
70
 const onCancel = () => {
70
 const onCancel = () => {
76
 const onLoad = () => {
76
 const onLoad = () => {
77
   console.info('----------invoiceId-------->',props.invoiceId)
77
   console.info('----------invoiceId-------->',props.invoiceId)
78
   const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
78
   const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
79
-  queryData({ pageNum, pageSize, name: searchValue.value })
79
+  queryData({ pageNum, pageSize, name: searchValue.value,invoiceId:props.invoiceId })
80
 }
80
 }
81
 
81
 
82
 const onClick = (org) => {
82
 const onClick = (org) => {
85
 
85
 
86
 const onSubmit = () => {
86
 const onSubmit = () => {
87
   console.info(orgSelected.value)
87
   console.info(orgSelected.value)
88
-  emit('update:modelValue', orgSelected.value.orgId)
89
-  if (orgSelected.value.orgId && orgSelected.value.name) {
88
+  emit('update:modelValue', orgSelected.value.invoiceOrgId)
89
+  if (orgSelected.value.invoiceOrgId && orgSelected.value.name) {
90
     emit('change', orgSelected.value)
90
     emit('change', orgSelected.value)
91
   } else {
91
   } else {
92
     emit('change')
92
     emit('change')

+ 40
- 13
src/components/PersonPicker/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.orgId" :title="org.name" @click="onClick(org)">
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.orgId"
20
+          :title="org.name"
21
+          @click="onClick(org)"
22
+        >
9
           <template #right-icon v-if="org.orgId === orgSelected.orgId">
23
           <template #right-icon v-if="org.orgId === orgSelected.orgId">
10
             <van-icon name="success" />
24
             <van-icon name="success" />
11
           </template>
25
           </template>
20
 
34
 
21
 <script setup>
35
 <script setup>
22
 import { computed, watch, ref, onMounted } from 'vue'
36
 import { computed, watch, ref, onMounted } from 'vue'
23
-import { getOrgList } from '@/services/org'
37
+import { getPersonList } from '@/services/person'
24
 
38
 
25
 
39
 
26
 const searchValue = ref('')
40
 const searchValue = ref('')
32
 
46
 
33
 const props = defineProps({
47
 const props = defineProps({
34
   modelValue: String,
48
   modelValue: String,
35
-  invoiceId:String,
36
-  orgId:String
49
+  invoiceId: String,
50
+  orgId: String
37
 })
51
 })
38
 const emit = defineEmits(['update:modelValue', 'change'])
52
 const emit = defineEmits(['update:modelValue', 'change'])
39
 
53
 
41
 watch(props.modelValue, (val) => {
55
 watch(props.modelValue, (val) => {
42
   orgSelected.value = { orgId: val }
56
   orgSelected.value = { orgId: val }
43
 })
57
 })
58
+watch(() => props.orgId, (val) => {
59
+  if (!props.orgId) {
60
+    alert('请先选则所属公司')
61
+  } else {
62
+    queryData({ pageNum:1, pageSize, name: searchValue.value, invoiceId: props.invoiceId, invoiceOrgId: props.orgId })
63
+  }
64
+})
44
 
65
 
45
 const queryData = (params) => {
66
 const queryData = (params) => {
46
-  getOrgList({ ...params, isSystem: true })
67
+  getPersonList({ ...params, isSystem: true })
47
     .then((res) => {
68
     .then((res) => {
48
       const first = res.current === 1
69
       const first = res.current === 1
49
       if (first) {
70
       if (first) {
65
 }
86
 }
66
 
87
 
67
 const onSearch = (val) => {
88
 const onSearch = (val) => {
68
-  queryData({ pageNum: 1, pageSize, name: val })
89
+  if (!props.orgId) {
90
+    alert('请先选则所属公司')
91
+  } else {
92
+    queryData({ pageNum:1, pageSize, name: searchValue.value, invoiceId: props.invoiceId, invoiceOrgId: props.orgId })
93
+  }
69
 }
94
 }
70
 
95
 
71
 const onCancel = () => {
96
 const onCancel = () => {
75
 // 组件加载, onLoad 就会执行一次
100
 // 组件加载, onLoad 就会执行一次
76
 // 所以 onMounted 里面不需要初始化执行了
101
 // 所以 onMounted 里面不需要初始化执行了
77
 const onLoad = () => {
102
 const onLoad = () => {
78
-  console.info('----------invoiceId-------->',props.invoiceId)
79
-  console.info('----------orgId-------->',props.orgId)
80
   const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
103
   const pageNum = orgResult.value.current ? orgResult.value.current + 1 : 1
81
-  queryData({ pageNum, pageSize, name: searchValue.value })
104
+  if (!props.orgId) {
105
+    alert('请先选则所属公司')
106
+  } else {
107
+    queryData({ pageNum, pageSize, name: searchValue.value, invoiceId: props.invoiceId, invoiceOrgId: props.orgId })
108
+  }
82
 }
109
 }
83
 
110
 
84
 const onClick = (org) => {
111
 const onClick = (org) => {
87
 
114
 
88
 const onSubmit = () => {
115
 const onSubmit = () => {
89
   console.info(orgSelected.value)
116
   console.info(orgSelected.value)
90
-  emit('update:modelValue', orgSelected.value.orgId)
91
-  if (orgSelected.value.orgId && orgSelected.value.name) {
117
+  emit('update:modelValue', orgSelected.value.invoicePersonId)
118
+  if (orgSelected.value.invoicePersonId && orgSelected.value.name) {
92
     emit('change', orgSelected.value)
119
     emit('change', orgSelected.value)
93
   } else {
120
   } else {
94
     emit('change')
121
     emit('change')

+ 75
- 6
src/pages/index.vue View File

1
 <template>
1
 <template>
2
-  <!-- <OrgPicker /> -->
3
-  <h2 :style="{textAlign:'center'}">电网报销系统</h2>
4
-  <van-button round block type="primary"> 立即申请 </van-button>
5
-  <p></p>
6
-  <van-button round block type="primary"> 我的提交 </van-button>
2
+  <div class="body">
3
+    <div class="bottombox">
4
+      <van-button
5
+        round
6
+        :style="{ width: '40vw', margin: 'auto' }"
7
+        type="primary"
8
+        @click="goForm"
9
+      >
10
+        立即填写
11
+      </van-button>
12
+      <van-button
13
+        round
14
+        :style="{ width: '40vw', margin: 'auto' }"
15
+        type="primary"
16
+      >
17
+        填写记录
18
+      </van-button>
19
+      <van-button
20
+        round
21
+        class="mybutton"
22
+        :style="{ width: '40vw', margin: 'auto' }"
23
+        type="primary"
24
+      >
25
+        信息公示
26
+      </van-button>
27
+    </div>
28
+    <div>
29
+      {{
30
+        formData.data.status == 1
31
+          ? "该班次将于2022年10月5日截止"
32
+          : "该班次已截止如有问题请联系报销助理"
33
+      }}
34
+    </div>
35
+  </div>
7
 </template>
36
 </template>
8
 
37
 
9
 <script setup>
38
 <script setup>
10
-import OrgPicker from '@/components/OrgPicker/index.vue'
39
+import { onMounted, reactive, ref } from 'vue';
40
+import { useRouter } from 'vue-router'
41
+import { getInvoiceFill } from '@/services/invoice'
42
+
43
+const router = useRouter();
44
+const formData = reactive({
45
+  data: {
46
+    //班级名称
47
+    invoiceId: 'f11ab8d28fd097e7aa4877ae7068a876',
48
+    endDate: undefined,
49
+    name: undefined,
50
+    status: 1
51
+  }
52
+})
53
+
54
+const goForm = () => {
55
+  router.push({ name: 'invoice.fill', params: { id: formData.data.invoiceId } })
56
+}
57
+onMounted(() => {
58
+  getInvoiceFill(formData.data.invoiceId).then(res => {
59
+    formData.data = res.invoice
60
+  }).catch(err => {
61
+    console.log(err)
62
+  })
63
+})
11
 </script>
64
 </script>
65
+<style lang="less" scoped>
66
+.body {
67
+  display: flex;
68
+  flex-direction: column;
69
+  align-items: center;
70
+  justify-content: space-between;
71
+  height: 80vh;
72
+  padding-top: 10vh;
73
+  .bottombox {
74
+    display: flex;
75
+    flex-direction: column;
76
+    align-items: center;
77
+    height: 50vh;
78
+  }
79
+}
80
+</style>

+ 43
- 18
src/pages/invoice/fill.vue View File

1
 <template>
1
 <template>
2
   <van-form @failed="onFailed" @submit="onSubmit">
2
   <van-form @failed="onFailed" @submit="onSubmit">
3
-    <h2 :style="{textAlign:'center'}">{{formData.invoiceName}}</h2>
3
+    <h2 :style="{ textAlign: 'center' }">{{ formData.invoiceName }}</h2>
4
     <van-cell-group title="开票单位">
4
     <van-cell-group title="开票单位">
5
       <van-field
5
       <van-field
6
         label="所属公司"
6
         label="所属公司"
7
-        v-model="formData.orgName"
8
-        name="orgName"
7
+        v-model="formData.invoiceOrgName"
8
+        name="invoiceOrgName"
9
         readonly
9
         readonly
10
         @click="showOrgPicker = true"
10
         @click="showOrgPicker = true"
11
         placeholder="请输入所属公司"
11
         placeholder="请输入所属公司"
16
         position="left"
16
         position="left"
17
         :style="{ height: '100%', width: '80%' }"
17
         :style="{ height: '100%', width: '80%' }"
18
       >
18
       >
19
-        <org-picker v-model="formData.orgId" :invoiceId="formData.invoiceId" @change="onOrgConfirm" />
19
+        <org-picker
20
+          v-model="formData.orgId"
21
+          :invoiceId="formData.invoiceId"
22
+          @change="onOrgConfirm"
23
+        />
20
       </van-popup>
24
       </van-popup>
21
       <van-field
25
       <van-field
22
         label="报销人"
26
         label="报销人"
32
         position="left"
36
         position="left"
33
         :style="{ height: '100%', width: '80%' }"
37
         :style="{ height: '100%', width: '80%' }"
34
       >
38
       >
35
-        <person-picker v-model="formData.personId" :invoiceId="formData.invoiceId" :orgId="formData.orgId" @change="onPersonConfirm" />
39
+        <person-picker
40
+          v-model="formData.personId"
41
+          :invoiceId="formData.invoiceId"
42
+          :orgId="formData.orgId"
43
+          @change="onPersonConfirm"
44
+        />
36
       </van-popup>
45
       </van-popup>
37
     </van-cell-group>
46
     </van-cell-group>
38
 
47
 
39
     <van-cell-group title="开票单位">
48
     <van-cell-group title="开票单位">
40
       <van-field
49
       <van-field
41
         label="开票单位"
50
         label="开票单位"
42
-        v-model="formData.invoiceOrg"
43
-        name="invoiceOrg"
51
+        v-model="formData.orgName"
52
+        name="orgName"
44
         placeholder="请输入开票单位"
53
         placeholder="请输入开票单位"
45
         :rules="[{ required: true, message: '请输入开票单位' }]"
54
         :rules="[{ required: true, message: '请输入开票单位' }]"
46
       />
55
       />
123
 </template>
132
 </template>
124
 
133
 
125
 <script setup>
134
 <script setup>
126
-import { reactive, ref } from 'vue';
135
+import { onMounted, reactive, ref } from 'vue';
136
+import { useRouter } from 'vue-router'
137
+import {getInvoiceFill} from '@/services/invoice'
127
 
138
 
128
 const formData = reactive({
139
 const formData = reactive({
129
   //班级名称
140
   //班级名称
130
-  invoiceName: '电网一班',
141
+  invoiceName: '',
131
   detailId: undefined,
142
   detailId: undefined,
132
-  invoiceId: '好的',
143
+  invoiceId: undefined,
133
   invoicePersonId: undefined,
144
   invoicePersonId: undefined,
134
   personId: undefined,
145
   personId: undefined,
135
   personName: undefined,
146
   personName: undefined,
136
-  invoiceOrgId: undefined,
137
-  orgId: '66666',
147
+  orgNameId: undefined,
148
+  orgId: undefined,
149
+  invoiceOrgName: undefined,
138
   orgName: undefined,
150
   orgName: undefined,
139
-  invoiceOrg:undefined,
140
   taxNo: undefined,
151
   taxNo: undefined,
141
   address: undefined,
152
   address: undefined,
142
   phone: undefined,
153
   phone: undefined,
148
   charge: undefined,
159
   charge: undefined,
149
   mergeRemark: undefined,
160
   mergeRemark: undefined,
150
   stayRemark: undefined,
161
   stayRemark: undefined,
162
+  status:undefined
151
 })
163
 })
152
 const showOrgPicker = ref(false)
164
 const showOrgPicker = ref(false)
153
 const showPersonPicker = ref(false)
165
 const showPersonPicker = ref(false)
166
+const router = useRouter();
154
 
167
 
155
 // 校验函数返回 true 表示校验通过,false 表示不通过
168
 // 校验函数返回 true 表示校验通过,false 表示不通过
156
 const validator = (val) => /1\d{10}/.test(val);
169
 const validator = (val) => /1\d{10}/.test(val);
158
 // 校验函数可以直接返回一段错误提示
171
 // 校验函数可以直接返回一段错误提示
159
 const validatorMessage = (val) => `${val} 不合法,请重新输入`;
172
 const validatorMessage = (val) => `${val} 不合法,请重新输入`;
160
 
173
 
174
+onMounted(() => {
175
+  formData.invoiceId=router.currentRoute._rawValue.params.id
176
+  getInvoiceFill(formData.invoiceId).then(res=>{
177
+    formData.invoiceName=res.invoice.name;
178
+    formData.status=res.invoice.status;
179
+  }).catch(err=>{
180
+    console.log(err)
181
+  })
182
+})
183
+
161
 // 校验函数可以返回 Promise,实现异步校验
184
 // 校验函数可以返回 Promise,实现异步校验
162
 const asyncValidator = (val) =>
185
 const asyncValidator = (val) =>
163
   new Promise((resolve) => {
186
   new Promise((resolve) => {
174
 };
197
 };
175
 const onOrgConfirm = (value) => {
198
 const onOrgConfirm = (value) => {
176
   if (value) {
199
   if (value) {
177
-    formData.orgId = value.orgId
178
-    formData.orgName = value.name
200
+    formData.orgId = value.invoiceOrgId
201
+    formData.invoiceOrgName = value.name
179
   }
202
   }
180
   showOrgPicker.value = false;
203
   showOrgPicker.value = false;
181
 };
204
 };
182
-
205
+const getDetail=()=>{
206
+  
207
+}
183
 const onPersonConfirm = (value) => {
208
 const onPersonConfirm = (value) => {
184
   if (value) {
209
   if (value) {
185
-    formData.personId = value.orgId
186
     formData.personName = value.name
210
     formData.personName = value.name
211
+    getDetail()
187
   }
212
   }
188
   showPersonPicker.value = false;
213
   showPersonPicker.value = false;
189
 };
214
 };
190
-const onSubmit=(val)=>{
215
+const onSubmit = (val) => {
191
   console.info(formData)
216
   console.info(formData)
192
 }
217
 }
193
 </script>
218
 </script>

+ 6
- 0
src/services/invoice.js View File

1
+import request from "@/utils/request";
2
+
3
+// 获取班级详情
4
+export function getInvoiceFill(id) {
5
+  return request.get(`/invoice/${id}`)
6
+}

+ 1
- 1
src/services/org.js View File

2
 
2
 
3
 // 获取组织列表
3
 // 获取组织列表
4
 export function getOrgList(params) {
4
 export function getOrgList(params) {
5
-  return request.get('/org', { params } )
5
+  return request.get(`/invoice/${params.invoiceId}/org`, { params } )
6
 }
6
 }

+ 6
- 0
src/services/person.js View File

1
+import request from "@/utils/request";
2
+
3
+// 获取组织列表
4
+export function getPersonList(params) {
5
+  return request.get(`/invoice/${params.invoiceId}/person`, { params } )
6
+}

+ 1
- 1
vite.config.js View File

9
   server: {
9
   server: {
10
     proxy: {
10
     proxy: {
11
       '/api': {
11
       '/api': {
12
-        target: 'http://192.168.89.76:7081',
12
+        target: 'http://192.168.89.147:7081',
13
         changeOrigin: true,
13
         changeOrigin: true,
14
       },
14
       },
15
     },
15
     },