<!--
  @description: 报表统计-招标异常
  @Modifier：杨胜国
  @routerPath:
  @date：  2021/01/29
-->
<template>
  <!-- :style="{'height':height}" -->
  <dl
    class="reportChart_crud"
  >
    <dt>
      采购异常
    </dt>
    <dd>
      <tableChart
        :height="height"
        class="echart-dom"
        :option="option"
      />
    </dd>
    <!-- 报表统计-招标异常-更多弹框 -->
    <abnormalProcurementListDialog ref="abnormalProcurementList" />
  </dl>
</template>

<script>
/* api */
import { getBiddingAndPurchaseException } from '@api/statisticalAnalysis/reportChart.js'
/* 混合开发方法-参数字段*/
import { purchaseExceptionStatusGroupMixin } from './../../mixins/reportChartGroup.js'
/* 組件 */
import tableChart from './../../components/tableChart'// table列表渲染组件
import abnormalProcurementListDialog from './abnormalProcurementList-dialog' // 报表统计-招标异常-更多弹框
import { filterDictText } from '@/assets/js/utils'// 过滤空的key

export default {
  name: 'AbnormalBid',
  components: {
    tableChart, // table列表渲染组件
    abnormalProcurementListDialog // 报表统计-招标异常-更多弹框

  },
  mixins: [purchaseExceptionStatusGroupMixin],
  props: {
    height: {
      type: String,
      default: '100%'
    }
  },
  data() {
    return {
      /* 字典信息-start */
      // ...purchaseExceptionStatusGroupMixin,
      /* 字典信息-end */
      // 查询条件
      searchData: {
      },
      option: {
        // 底部-操作类
        footer: [
          {
            text: '更多',
            click: this.more
          }
        ],
        // 标题
        thead: [
          { lable: '项目名称', prop: 'tenderName', align: 'center' },
          { lable: '项目编号', prop: 'tenderNo', align: 'center', width: 125 },
          { lable: '项目经理', prop: 'managerName', align: 'center', width: 60 },
          { lable: '采购单位', prop: 'buyersName', align: 'center', width: 180 },
          { lable: '发布时间', prop: 'sendTime', align: 'center', width: 120 },
          { lable: '开标时间', prop: 'bidTime', align: 'center', width: 120 },
          { lable: '投标家数', prop: 'supplierBidNum', align: 'center' },
          { lable: '异常原因', prop: 'status', align: 'center', width: 120 }
        ],
        // 渲染数据
        data: []
      }
    }
  },
  created() {
    // 获取字典项
    this.initTpList()
  },
  methods: {

    /**
     * 获取数据
     *  @param {searchData} Object 查询条件
    */
    initChart(searchData) {
      this.option.data = []
      const data = {
        ...searchData
      }
      this.searchData = data
      getBiddingAndPurchaseException(data).then(res => {
        // 00采购异常
        res.data['00'].forEach(item => {
          this.option.data.push({
            ...item,
            sendTime: this.$Moment(item.sendTime).format(this.momentDate),
            bidTime: this.$Moment(item.bidTime).format(this.momentDate),
            status: filterDictText(this.purchaseExceptionStatus, item.status)
          })
        })
      })
    },
    // 查看
    detail() {

    },
    // 更多
    more() {
      this.$refs.abnormalProcurementList.open(this.searchData)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
