<!--
  @description:行项目明细报表
  @Modifier: zhangyawen
  @routerPath: /statisticalManagement/rowProjectDetailReport-list
  @date: 2021-4-8-14:06
-->
<template>
  <table-crud
    :menu="true"
    :search-form="searchForm"
    search-label-width="auto"
    @on-load="loadData"
  >
    <template v-slot:header>
      行项目明细报表
    </template>
    <template v-slot:search="search">
      <rowProjectDetailReportSearchComp
        :search="search"
        :search-form="searchForm"
      />
    </template>
    <template slot="menuLeft">
      <div class="mb10">
        <el-button type="primary" @click="exportCurrentPage">
          导出
        </el-button>
      </div>
    </template>
    <template v-slot:GXTable>
      <el-table ref="smallTable" v-loading="loading" :data="tableData">
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          prop="purchaseNo"
          label="行项目编号"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseCode"
          label="物资编号"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseName"
          label="物资名称"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseClassificationParent"
          label="一级专业分类"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseClassification"
          label="二级专业分类"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseDesc"
          label="物资描述"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseNum"
          label="数量"
          width="90"
          align="right"
        />
        <el-table-column
          :formatter="formatterPurchaseUnit"
          header-align="center"
          prop="purchaseUnit"
          label="计量单位"
          align="center"
        />
        <el-table-column
          header-align="center"
          prop="purchaseBudget"
          label="预算净单价(元)"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseTotalBudget"
          label="预算净总价(元)"
          align="right"
          width="170"
        />
        <el-table-column
          :formatter="formatterPurchaseTaxRate"
          header-align="center"
          prop="purchaseTaxRate"
          label="税率"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="deliveryTime"
          label="交货时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.deliveryTime&&
              $Moment(scope.row.deliveryTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="deliveryAddress"
          label="交货地点"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseDepartName"
          label="采购单位"
          min-width="170"
        />
        <el-table-column
          :formatter="formatterBelongBk"
          header-align="center"
          prop="belongBk"
          label="所属板块"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="purchaseUserRealName"
          label="上报人"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="planManagerName"
          label="技术联系人/电话"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="ykNo"
          label="预算编号"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="ykYear"
          label="预算年度"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="ykPlanno"
          label="计划编号"
          align="center"
          width="170"
        />
<!--        <el-table-column
          header-align="center"
          prop="ykBookid"
          label="BOOK ID"
          align="center"
          width="170"
        />-->
        <el-table-column
          header-align="center"
          prop="ykPlannoT"
          label="计划名称"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="post1"
          label="预算编号描述"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="remark"
          label="备注"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="createTime"
          label="计划创建时间"
          align="center"
          width="170"
        >
          <!-- <template slot-scope="scope">
            <span>{{scope.row.createTime&&
              $Moment(scope.row.createTime).format(momentDateTime)
            }}</span>
          </template> -->
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="approvalTime"
          label="计划上报审批时间"
          align="center"
          width="170"
        >
          <!-- <template slot-scope="scope">
            <span>{{scope.row.approvalTime&&
              $Moment(scope.row.approvalTime).format(momentDateTime)
            }}</span>
          </template> -->
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="tenderNo"
          label="采购单编号"
          align="center"
          width="170"
        />
        <el-table-column
          :formatter="formatterTenderMethod"
          header-align="center"
          prop="tenderMethod"
          label="采购方式"
          min-width="170"
        />
        <el-table-column
          :formatter="formatterTenderType"
          header-align="center"
          prop="tenderType"
          label="公开/邀请"
          min-width="170"
        />
        <el-table-column
          header-align="center"
          prop="supplierCategory"
          label="供应商分类"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="supplierAttribute"
          label="供应商属性"
          width="170"
        />
        <el-table-column
          :formatter="formatterReviewMethod"
          header-align="center"
          prop="reviewMethod"
          label="评审办法"
          width="120"
        />
        <el-table-column
          header-align="center"
          prop="budgetTotalMoney"
          label="采购单净预算(元)"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="planDetailPackUser"
          label="打包人员"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="packSubmitTime"
          label="打包提交时间"
          align="center"
          width="170"
        >
          <!-- <template slot-scope="scope">
            <span>{{scope.row.packSubmitTime&&
              $Moment(scope.row.packSubmitTime).format(momentDateTime)
            }}</span>
          </template> -->
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="packAuditPassTime"
          label="打包完成时间"
          align="center"
          width="170"
        >
          <!-- <template slot-scope="scope">
            <span>{{scope.row.packAuditPassTime&&
              $Moment(scope.row.packAuditPassTime).format(momentDateTime)
            }}</span>
          </template> -->
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="sourcingUserRealName"
          label="采购员"
          width="120"
        />
        <el-table-column
          header-align="center"
          prop="tenderExplainInfo"
          label="说明信息"
          width="170"
        />
        <el-table-column
          :formatter="formatterIsEmergencyProcurement"
          header-align="center"
          prop="isEmergencyProcurement"
          label="紧急采购"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="quoteEndTime"
          label="报价截止时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.quoteEndTime&&
              $Moment(scope.row.quoteEndTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="quoteValidity"
          label="报价有效期"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.quoteValidity&&
              $Moment(scope.row.quoteValidity).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          :formatter="formatterIsUploadReplyFile"
          header-align="center"
          prop="isUploadReplyFile"
          label="强制上传应答文件"

          width="170"
        />
        <el-table-column
          :formatter="formatterPayType"
          header-align="center"
          prop="payType"
          label="付款方式"
          width="170"
        />
        <el-table-column
          :formatter="formatterQuoteType"
          header-align="center"
          prop="quoteType"
          label="报价要求"
          width="170"
        />
        <el-table-column
          :formatter="formatterQuoteMethod"
          header-align="center"
          prop="quoteMethod"
          label="询价方式"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="remark2"
          label="公告备注"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="packAssignTime"
          label="采购单分配时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.packAssignTime&&
              $Moment(scope.row.packAssignTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="projectSubmitTime"
          label="公告提交时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.projectSubmitTime&&
              $Moment(scope.row.projectSubmitTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="publishTime"
          label="公告审批完成时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.publishTime&&
              $Moment(scope.row.publishTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="suppliersName"
          label="中选供应商"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="partnerNo"
          label="供应商sap编码"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="transactionBudget"
          label="报价净单价(元)"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="distributionTotalMoney"
          label="报价净总价(元)"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="offerRemarks"
          label="品牌/生产厂商"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="distributionTotalTaxMoney"
          label="中选行项目含税总价(元)"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="negRecordCode"
          label="报价单号"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="winningSubmitDate"
          label="中选结果提交时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.winningSubmitDate&&
              $Moment(scope.row.winningSubmitDate).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="winningPassTime"
          label="中选审批完成时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.winningPassTime&&
              $Moment(scope.row.winningPassTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="orderCode"
          label="订单编号"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="ebeln"
          label="sap订单编号"
          align="center"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="orderName"
          label="订单名称"

          width="170"
        />
        <el-table-column
          header-align="center"
          prop="orderTotalMoney"
          label="订单净总额(元)"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="orderCreateTime"
          label="订单生成时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.orderCreateTime&&
              $Moment(scope.row.orderCreateTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          prop="activeTime"
          label="订单生效时间"
          align="center"
          width="170"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.activeTime&&
              $Moment(scope.row.activeTime).format(momentDateTime)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          :formatter="formatterOrderStatus"
          header-align="center"
          prop="orderStatus"
          label="订单状态"
          width="170"
        />
        <el-table-column
          :formatter="formatterDataStatus"
          header-align="center"
          prop="dataStatus"
          label="行项目状态"
          min-width="120"
        />
        <el-table-column
          header-align="center"
          prop="durationDate"
          label="打包完成时效"
          align="right"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="planToSubmitDurationDate"
          label="打包完成时间（天）"
          min-width="170"
          align="right"
        />
        <el-table-column
          header-align="center"
          prop="orderCreateDurationDate"
          label="成单天数"
          min-width="120"
          align="right"
        />
        <el-table-column
          :formatter="formatterPlanType"
          header-align="center"
          prop="planType"
          label="是否框架协议"
          min-width="120"
        />
      </el-table>
    </template>
  </table-crud>
</template>

<script>
/* api */
import {
  getPlanPurchaseDetailStatisticsList,
  purchasePlanDetailStatisticsReport
} from '@api/procurement/statisticalManagement'
/* 公用方法*/
import { download } from '@/assets/js/utils' // 常用方法
import rowProjectDetailReportSearchComp from './rowProjectDetailReportSearchComp.vue' // 搜索条件组件
import { rowProjectDetailReportMixins } from './mixins/rowProjectDetailReportMixins' // 表单字段
import { statisticalMixins } from '../../mixins/statisticalMixins'// 字典信息
export default {
  name: 'RowProjectDetailReportList',
  components: {
    rowProjectDetailReportSearchComp
  },
  mixins: [rowProjectDetailReportMixins, statisticalMixins],
  data() {
    return {
      loading: true,
      tableData: [],
      queryObj: {} // 查询条件
    }
  },
  methods: {
    // 导出
    exportCurrentPage() {
      purchasePlanDetailStatisticsReport(this.queryObj).then(res => {
        download(res, '行项目明细报表.xls')
      })
    },
    // 获取数据
    loadData(params, callback) {
      this.queryObj = params
      for (const key in this.queryObj) {
        if (this.queryObj[key] instanceof Array) {
          delete this.queryObj[key]
        }
      }
      getPlanPurchaseDetailStatisticsList(this.queryObj).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {
        this.loading = false
      })
    }
  }
}
</script>

<style lang="less" scoped>
</style>
