Browse Source

Merge remote-tracking branch 'origin/master'

lizhenhao 2 years ago
parent
commit
31781c6e27
1 changed files with 28 additions and 11 deletions
  1. 28 11
      src/views/modules/reimbursement/info/ReimbursementForm.vue

+ 28 - 11
src/views/modules/reimbursement/info/ReimbursementForm.vue

@@ -180,6 +180,8 @@
 </template>
 
 <script>
+  import CommonApi from '@/api/cw/common/CommonApi'
+  import ReimbursementApprovalTypeService from '@/api/cw/reimbursementApproval/ReimbursementApprovalTypeService'
   import ReimbursementService from '@/api/sys/ReimbursementService'
   import ReimbursementTypeService from '@/api/sys/ReimbursementTypeService'
   import UpLoadComponent from '@/views/common/UpLoadComponent'
@@ -199,6 +201,7 @@
         loading: false,
         indexRow: '',
         inputForm: {
+          procInsId: '',
           userId: '',
           userName: '',
           no: '',
@@ -211,16 +214,20 @@
         }
       }
     },
+    reimbursementApprovalTypeService: null,
     reimbursementService: null,
     reimbursementTypeService: null,
     userService: null,
+    commonApi: null,
     created () {
+      this.reimbursementApprovalTypeService = new ReimbursementApprovalTypeService()
       this.reimbursementService = new ReimbursementService()
       this.inputForm.userId = this.userId
       this.inputForm.userName = this.name
       this.inputForm.reimDate = new Date()
       this.inputForm.department = this.officeName
       this.userService = new UserService()
+      this.commonApi = new CommonApi()
       this.reimbursementTypeService = new ReimbursementTypeService()
     },
     props: {
@@ -270,6 +277,7 @@
       init (method, id) {
         this.method = method
         this.inputForm = {
+          procInsId: '',
           userName: '',
           no: '',
           department: '',
@@ -458,16 +466,23 @@
               this.inputForm.files = []
             }
             this.inputForm.files = this.$refs.uploadComponent.getDataList()
-            await this.userService.is().then(({data}) => {
-              if (data) {
-                this.inputForm.type = '5'
+            // await this.userService.is().then(({data}) => {
+            //   if (data) {
+            //     this.inputForm.type = '5'
+            //   }
+            // })
+            this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then(({data}) => {
+              if (this.commonJS.isNotEmpty(data)) {
+                if (data === '公司领导审批') {
+                  this.inputForm.type = '5'
+                }
               }
-            })
-            this.reimbursementService.save(this.inputForm).then(({data}) => {
-              callback(data.businessTable, data.businessId, this.inputForm)
-              this.loading = false
-            }).catch(() => {
-              this.loading = false
+              this.reimbursementService.save(this.inputForm).then(({data}) => {
+                callback(data.businessTable, data.businessId, this.inputForm)
+                this.loading = false
+              }).catch(() => {
+                this.loading = false
+              })
             })
           }
         })
@@ -546,12 +561,14 @@
       },
       openProgramPageForm (rowIndex, row) {
         if (this.commonJS.isEmpty(row.typeName)) {
-          this.$message.error('请选择报销项目')
+          this.$message.error('请选择报销类型')
           return
         }
+        console.log('row', row)
         this.indexRow = rowIndex
-        this.reimbursementTypeService.findById(row.typeId).then(({data}) => {
+        this.reimbursementApprovalTypeService.findById(row.typeId).then(({data}) => {
           console.log('typeInfo', data.sort)
+          console.log('data', data)
           let i = data.sort.toString()
           i = i.substring(0, 1)
           // 非业务报销