Browse Source

移动端补充提交 费用报销

yurk 2 years ago
parent
commit
35a5a4f5fe
1 changed files with 30 additions and 5 deletions
  1. 30 5
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/index.vue

+ 30 - 5
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/index.vue

@@ -49,8 +49,8 @@
                     </template>
                 </van-field>
                 <!-- 费用类型 -->
-                <van-field v-model="editForm.type" label="费用类型" @click="typeShow = true" readonly clickable>
-                    <template #input>{{typeList[editForm.type]}}</template>
+                <van-field v-model="editForm.type" label="费用类型" @click="typeShow = true" readonly clickable>
+                    <template #input>{{expenseMainType.text}}</template>
                 </van-field>
                 <van-popup v-model="typeShow" position="bottom">
                     <van-picker
@@ -259,7 +259,7 @@ export default {
             ownerIdShow: false,
             createDateShow: false,
             typeShow: false,
-            typeList: ['一般','差旅','外包'],
+            typeList: [],
 
             invoiceIndex: 0,
             invoiceList: [
@@ -303,6 +303,9 @@ export default {
             denyParm: {
                 id: '',
                 denyReason: ''
+            },
+            expenseMainType:{
+                text:''
             }
 
         }
@@ -346,6 +349,7 @@ export default {
         }
         this.getProjectList()
         this.getExTypeList()
+        this.getExpensMainTypes()
     },
     methods: {
         back(){
@@ -383,8 +387,12 @@ export default {
             this.createDateShow = false
         },
         typeChange(value,key){
-            this.editForm.type = key
+            this.editForm.type =value.id
+            this.expenseMainType.text=value.name
             this.typeShow = false
+            for(let i in this.invoiceList){
+                    this.invoiceList[i].expenseType=''
+                }
             this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == this.editForm.type)
         },
         ticNumChange(value){
@@ -648,7 +656,24 @@ export default {
             .then(res => {
                 if(res.code == "ok") {
                     this.allexTypeList = res.data
-                    this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == 0)
+                    this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == this.editForm.type)
+                } else {
+                    this.$toast.fail('获取失败');
+                }
+            }).catch(err=> {this.$toast.clear();console.log(err)});
+        },
+
+        getExpensMainTypes(){
+            this.$axios.post("/expense-main-type/list", {})
+            .then(res => {
+                if(res.code == "ok") {
+                    for(var i in res.data) {
+                        res.data[i].text = res.data[i].name
+                    }
+                    this.typeList=res.data
+                    this.expenseMainType.text=res.data[0].name
+                    this.editForm.type=res.data[0].id
+                    this.getExTypeList
                 } else {
                     this.$toast.fail('获取失败');
                 }