<template>
  <div class="apprive-review">
    <cy-up-down-drag>
      <div slot="top">
        <divide-accounts-view-content></divide-accounts-view-content>
      </div>
      <div slot="bar">
        <div>
          分账审批
        </div>
      </div>
      <div slot="bottom">
        <div>
          <approval-content ref="approvalContent" />
          <div class="submit-btn">
            <el-button style="width: 150px;" @click="() => { $router.go(-1) }">取消</el-button>
            <el-button style="width: 150px;" type="primary" @click="onSubmit">确定</el-button>

          </div>
        </div>
      </div>
    </cy-up-down-drag>
  </div>
</template>

<script>
import { approvalSubmit } from '@/api/divideAccountsManage/divideAccountsManage.js'
export default {
  name: 'Approval',
  components: {
    ApprovalContent: () => import('./components/ApprovalContent'),
    DivideAccountsViewContent: () => import('./components/DivideAccountsViewContent.vue')
  },
  data() {
    return {

    }
  },
  methods: {
    async onSubmit() {
      const data = await this.$refs.approvalContent.getParams()
      const { taskId } = this.$route.query
      const { id } = this.$route.params
      const params = {
        Loading: true,
        ...data,
        ledgerAccountBasicInfoId: id,
        taskId,
        visible: true
      }
      approvalSubmit(params).then(() => {
        this.$message.success('分账审核成功')
        this.$router.go(-1)
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
