<!--
  @description: 归档-项目归档详情
  @Modifier：肖文龙
  @routerPath:/bidArchived/tenderArchived-detail
  @date：  2019/12/03
-->
<template>
  <div>
    <section class="title p0-16 clearfix">
      <template>
        <div class="title-back pointer" @click="back">
          <i class="iconfont icon-fanhui mr10" />项目归档详情
        </div>
      </template>
    </section>
    <div class="p0-16">
      <archivedCompDetail :pack-id="packId" :row="row" @call-back="callBack" />
      <!-- archiveStatus 00 未归档时展示 -->
      <template v-if="archiveStatus==='00'&&isUpdateOtherFile">
      <!-- 底部按钮 -->
      <!-- <div class="but_footer">
          <div class="but_footer-h" />
          <div class="but_footer-but">
            <el-button :loading="confirmLoading" type="primary" @click="archived()">
              一键归档
            </el-button>
          </div>
        </div>
      </template> -->
      </template>
    </div>
  </div>
</template>
<script>
/* api */
import { archive } from '@/api/bidding/bidArchive.js'
/* 混入-字典信息 */
import { bidArchived } from '../mixins/bidArchivedMixin'// 公共方法
/* 组件 */
import archivedCompDetail from './archivedComp-detail'// 查看归档详情
export default {
  name: 'TenderArchivedDetail',
  components: {
    archivedCompDetail
  },
  data() {
    return {
      ...bidArchived, // 公共方法
      archiveId: '', // 归档id
      archiveStatus: '', // 归档状态 00 未归档 01 已归档
      isUpdateOtherFile: '', // 是否修改了其他附件 00:否 01:是
      confirmLoading: false, // 按钮loading
      fromData: {
        packName: '' // 标段名称
      },
      packId: this.$route.params.packId, // 标段id
      row: this.$route.params.row
    }
  },
  methods: {
    // 返回
    back() {
      this.$router.push('/bidArchived/archivedInformation-list')
    },
    // 回调函数
    callBack(data) {
      this.archiveId = data.archiveId // 归档id
      this.archiveStatus = data.archiveStatus// 归档状态
      this.isUpdateOtherFile = data.isUpdateOtherFile// 是否修改了其他附件 00:否 01:是
    },
    // 一键归档
    archived() {
      this.$confirm('确认一键归档吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.confirmLoading = true
        const data = {
          archiveId: this.archiveId, // 归档id
          isUpdateOtherFile: this.isUpdateOtherFile// 是否修改了其他附件
        }
        archive(data).then(res => {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.back()// 返回
          this.confirmLoading = false
        }).catch(() => {
          this.confirmLoading = false
        })
      })
    }
  }
}
</script>
<style lang="less" scoped>

</style>
