<!--
  @description: 终止公告内容预览-提交公告
  @Modifier: haoFx
  @routerPath: /bidding/projectDrive/changeBulletin/submitChangeBulletin
  @date: 2020/1/7-16:18
-->
<template>
  <div>
    <!--终止公告内容预览-->
    <make-stopbiddingRecord-pdf-detail ref="bulletinPdf" />
    <!--保存按钮-->
    <div class="but_footer">
      <div class="but_footer-h" />
      <div class="but_footer-but">
        <el-button @click="editBulletin">
          编辑
        </el-button>
        <el-button type="primary" @click="submitBulletin">
          提交
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
/* api*/
import { sumitStopbiddingBulletin } from '@api/bidding/stopbiddingRecord'
/* 组件*/
import makeStopbiddingRecordPdfDetail from './makeStopbiddingRecordPdf-detail'
export default {
  name: 'BidBulletinContentPreview',
  components: {
    'make-stopbiddingRecord-pdf-detail': makeStopbiddingRecordPdfDetail
  },
  data() {
    return {
    }
  },
  created() {
  },
  methods: {
    getBulletinPdf() {
      this.$refs.bulletinPdf.getBulletinContentPdf() // 调用子组件获取pdf方法
    },
    // 编辑
    editBulletin() {
      this.$router.push({
        path: '/bidding/projectDrive/stopbiddingRecord/stopbiddingRecordAdd', // 路径动态变更
        query: {
          ...this.$route.query
        }
      })
    },
    // 提交公告
    submitBulletin() {
      this.$confirm('确认提交?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.submit()
      }).catch(() => {
      })
    },
    // 终止公告保存提交
    submit() {
      const bizId = sessionStorage.getItem('bizId')
      sumitStopbiddingBulletin(bizId).then(response => {
        this.$message({
          message: '提交成功',
          type: 'success'
        })
        this.$router.push({
          path: '/bidding/projectDrive/stopbiddingRecord/stopbiddingRecordList',
          query: {
            ...this.$route.query
          }
        })
        this.confirmLoading = false
      }).catch(() => {
        this.confirmLoading = false
      })
    }
  }
}
</script>

<style scoped>

</style>
