李志伟 hace 2 años
padre
commit
4edb1bbc45

+ 8
- 8
src/components/OrgPicker/index.vue Ver fichero

@@ -5,8 +5,8 @@
5 5
     </div>
6 6
     <div class="picker-list">
7 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 10
             <van-icon name="success" />
11 11
           </template>
12 12
         </van-cell>
@@ -38,10 +38,10 @@ const emit = defineEmits(['update:modelValue', 'change'])
38 38
 
39 39
 const orgList = computed(() => orgResult.value.records || [])
40 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 45
   getOrgList({ ...params, isSystem: true })
46 46
     .then((res) => {
47 47
       const first = res.current === 1
@@ -64,7 +64,7 @@ const queryData = (params) => {
64 64
 }
65 65
 
66 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 70
 const onCancel = () => {
@@ -76,7 +76,7 @@ const onCancel = () => {
76 76
 const onLoad = () => {
77 77
   console.info('----------invoiceId-------->',props.invoiceId)
78 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 82
 const onClick = (org) => {
@@ -85,8 +85,8 @@ const onClick = (org) => {
85 85
 
86 86
 const onSubmit = () => {
87 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 90
     emit('change', orgSelected.value)
91 91
   } else {
92 92
     emit('change')

+ 40
- 13
src/components/PersonPicker/index.vue Ver fichero

@@ -1,11 +1,25 @@
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.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 23
           <template #right-icon v-if="org.orgId === orgSelected.orgId">
10 24
             <van-icon name="success" />
11 25
           </template>
@@ -20,7 +34,7 @@
20 34
 
21 35
 <script setup>
22 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 40
 const searchValue = ref('')
@@ -32,8 +46,8 @@ const pageSize = 20
32 46
 
33 47
 const props = defineProps({
34 48
   modelValue: String,
35
-  invoiceId:String,
36
-  orgId:String
49
+  invoiceId: String,
50
+  orgId: String
37 51
 })
38 52
 const emit = defineEmits(['update:modelValue', 'change'])
39 53
 
@@ -41,9 +55,16 @@ const orgList = computed(() => orgResult.value.records || [])
41 55
 watch(props.modelValue, (val) => {
42 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 66
 const queryData = (params) => {
46
-  getOrgList({ ...params, isSystem: true })
67
+  getPersonList({ ...params, isSystem: true })
47 68
     .then((res) => {
48 69
       const first = res.current === 1
49 70
       if (first) {
@@ -65,7 +86,11 @@ const queryData = (params) => {
65 86
 }
66 87
 
67 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 96
 const onCancel = () => {
@@ -75,10 +100,12 @@ const onCancel = () => {
75 100
 // 组件加载, onLoad 就会执行一次
76 101
 // 所以 onMounted 里面不需要初始化执行了
77 102
 const onLoad = () => {
78
-  console.info('----------invoiceId-------->',props.invoiceId)
79
-  console.info('----------orgId-------->',props.orgId)
80 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 111
 const onClick = (org) => {
@@ -87,8 +114,8 @@ const onClick = (org) => {
87 114
 
88 115
 const onSubmit = () => {
89 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 119
     emit('change', orgSelected.value)
93 120
   } else {
94 121
     emit('change')

+ 75
- 6
src/pages/index.vue Ver fichero

@@ -1,11 +1,80 @@
1 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 36
 </template>
8 37
 
9 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 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 Ver fichero

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

+ 6
- 0
src/services/invoice.js Ver fichero

@@ -0,0 +1,6 @@
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 Ver fichero

@@ -2,5 +2,5 @@ import request from "@/utils/request";
2 2
 
3 3
 // 获取组织列表
4 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 Ver fichero

@@ -0,0 +1,6 @@
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 Ver fichero

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