zhangwei
2025-01-17 2af6a1003a5a6870c5ad14c7b2b74994c136ca88
src/pages/reimbursement/payment.vue
@@ -22,13 +22,14 @@
                  <up-input v-model="state.publicJob.planMoney" border="none" placeholder="请填写金额"
                     type="digit"></up-input>
               </up-form-item>
               <up-form-item label="科目" prop="rewardContent" :borderBottom='false' ref="item1">
               <up-form-item label="科目" prop="rewardContent" required :borderBottom='false' ref="item1"
                  @click='openKemuPicker'>
                  <up-input v-model="state.publicJob.rewardContent" border="none" placeholder="请点击选择科目"
                     readonly></up-input>
               </up-form-item>
               <up-form-item label="摘要" prop="planContent" :borderBottom='false' ref="item1">
               <up-form-item label="摘要" prop="planContent" required :borderBottom='false' ref="item1">
                  <view class="c-p-b-20">
                     <up-textarea v-model="state.publicJob.planContent" border="none" readonly
                     <up-textarea v-model="state.publicJob.planContent" border="none"
                        placeholder="请填写摘要"></up-textarea>
                  </view>
               </up-form-item>
@@ -52,6 +53,11 @@
                     未上传附件
                  </view>
               </up-form-item>
               <up-form-item label="账户类型" prop="firmAccountId" required :borderBottom='false' ref="item1"
                  @click='openzhanghuPickerType'>
                  <up-input v-model="state.publicJob.accountType" border="none" placeholder="请点击选择账户类型"
                     readonly></up-input>
               </up-form-item>
               <up-form-item label="账户" prop="firmAccountId" required :borderBottom='false' ref="item1"
                  @click='openzhanghuPicker'>
                  <up-input v-model="state.publicJob.firmAccountName" border="none" placeholder="请点击选择账户"
@@ -70,7 +76,14 @@
      </view>
      <u-picker :show="zhanghuPicker" :columns="zhanghuList" keyName="accountName" @cancel='openzhanghuPicker'
         :defaultIndex='defaultIndex' @confirm='confirmzhanghuPicker'></u-picker>
         :defaultIndex='defaultIndexAccount' @confirm='confirmzhanghuPicker'></u-picker>
      <u-picker :show="zhanghuPickerType" :columns="state.zhanghuListType" @cancel='openzhanghuPickerType'
         @confirm='confirmzhanghuPickerType'></u-picker>
      <u-picker :show="kemuPicker" :columns="kemuList" keyName="subjectName" @cancel='openKemuPicker'
         :defaultIndex='defaultIndex' @confirm='confirmKemuPicker'></u-picker>
   </view>
</template>
@@ -103,6 +116,12 @@
   let leibie = '费用报销'
   let zhanghuPicker = ref(false)
   let zhanghuList = ref()
   let allZhanghuList = ref()
   let zhanghuPickerType = ref(false)
   let kemuList = ref()
   let kemuPicker = ref(false)
   let defaultIndex = ref([6])
   let defaultIndexAccount = ref([0])
   let state = reactive({
      publicJob: {
         departmentId: '', //部门Id
@@ -115,17 +134,34 @@
         planContent: '', //摘要
         houbufapiaoStatus: 'You', //有无发票
         workPlanAttachments: [], //附件&发票
         firmAccountId: ''
         firmAccountId: '',
         accountType: ''
      },
      invoice: [],
      file: []
      file: [],
      zhanghuListType: []
   })
   let rules = {
      accountType: {
         required: true,
         message: '账户类型不能为空',
         trigger: ['blur', 'change']
      },
      firmAccountId: {
         required: true,
         message: '账户不能为空',
         trigger: ['blur', 'change']
      },
      planContent: {
         required: true,
         message: '摘要不能为空',
         trigger: ['blur', 'change']
      },
      rewardContent:{
         required: true,
         message: '科目不能为空',
         trigger: ['blur', 'change']
      }
   }
   onLoad((options) => {
      let data = $db.get('userInfo').userCompany
@@ -133,8 +169,18 @@
      detailId.value = options.detailId
      getRolePlaneList()
      $api.GetFirmAccountList().then(res => {
         zhanghuList = [res.data]
         res.data.forEach(item => {
            state.zhanghuListType.push(item.accountType)
         })
         state.zhanghuListType = [Array.from(new Set(state.zhanghuListType))]
         allZhanghuList = res.data
      })
      $api.getKeMuList().then(res => {
         kemuList = [res.data]
      })
   })
   const formRef = ref(null);
@@ -164,12 +210,31 @@
   }
   const confirmzhanghuPicker = (arr) => {
      defaultIndexAccount = arr.indexs
      state.publicJob.firmAccountId = String(arr.value[0].keyid)
      state.publicJob.firmAccountName = arr.value[0].accountName
      openzhanghuPicker()
   }
   const confirmzhanghuPickerType = (arr) => {
      defaultIndexAccount = [0]
      state.publicJob.accountType = arr.value[0]
      openzhanghuPickerType()
   }
   const openzhanghuPicker = () => {
      if (!state.publicJob.accountType) {
         return $util.showToast({
            title: '请先选择账户类型!'
         })
      }
      zhanghuList = allZhanghuList.filter(item => {
         return item.accountType == state.publicJob.accountType
      })
      zhanghuList = [zhanghuList]
      console.log(zhanghuList);
      zhanghuPicker.value = !zhanghuPicker.value
   }
   const openzhanghuPickerType = () => {
      zhanghuPickerType.value = !zhanghuPickerType.value
   }
   const getRolePlaneList = () => {
      let getList = null
@@ -181,6 +246,10 @@
      $api.caiWuGetPlanInfo(detailId.value).then(res => {
         state.publicJob = res.data
         state.publicJob.planStartTime = $util.formatDate(state.publicJob.planStartTime)
         let index = kemuList[0].findIndex(item => {
            return item.keyid == state.publicJob.rewardResult
         })
         defaultIndex = [index]
         state.publicJob.workPlanAttachments.forEach(item => {
            if (item.attachmentType == 1) {
               state.invoice.push(item.planAttachment)
@@ -189,6 +258,15 @@
            }
         })
      })
   }
   const confirmKemuPicker = (arr) => {
      console.log('----', arr);
      state.publicJob.rewardResult = String(arr.value[0].keyid)
      state.publicJob.rewardContent = arr.value[0].subjectName
      openKemuPicker()
   }
   const openKemuPicker = () => {
      kemuPicker.value = !kemuPicker.value
   }
   const saveOrder = (approvalStatus) => {
      isLoading.value = true
@@ -199,8 +277,10 @@
      //    functionOrder = $api.BaoxiaoPlan
      // }
      let obj = {
         oA_WorkPlanId: state.publicJob.keyid,
         firmAccountId: state.publicJob.firmAccountId
         keyid: state.publicJob.keyid,
         firmAccountId: state.publicJob.firmAccountId,
         planContent: state.publicJob.planContent,
         accountType: state.publicJob.accountType
      }
      formRef.value.validate().then(res => {
         $api.caiWuApprovalPlan(obj).then(res => {