<!--
  @description: 创建采购单-查看行项目信息弹框
  @author: gmy
  @date： 2020-10-5 10:09:12
-->
<template>
  <el-dialog
    :visible.sync="dialogData.dialog"
    :lock-scroll="false"
    append-to-body
    title="查看行项目信息"
    width="1160px"
    custom-class="el-dialog__body-p8 el-dialog_table"
  >
    <div class="p0-16">
      <table class="tableData">
        <tr>
          <td>采购计划编号</td>
          <td>{{ formData.purchasePlanNo }}</td>
          <td>采购计划名称</td>
          <td>{{ formData.purchasePlanName }}</td>
        </tr>
        <!-- purchaseOrganization采购类型00 自采 01 委托 -->
        <tr>
          <td>采购组织形式</td>
          <td colspan="3">
            <span>{{ filterDictText(organization, formData.purchaseOrganization) }}</span>
          </td>
          <!-- <td>类型</td>
          <td>
            <span>{{ filterDictText(plan_purchase_typeList, formData.purchaseType) }}</span>
          </td> -->
        </tr>
        <!-- <tr v-if="formData.purchaseOrganization==='01'">
          <td>代理机构</td>
          <td colspan="3">
            {{ formData.agentDepartName }}
          </td>
        </tr> -->
        <!-- <tr v-if="formData.purchaseOrganization==='01'">
          <td>项目经理</td>
          <td>{{ formData.agentRealName }}</td>
          <td>联系方式</td>
          <td>{{ formData.contactNumber }}</td>
        </tr> -->
        <tr>
          <td>一级专业分类</td>
          <td>{{ formData.purchaseClassificationParent }}</td>
          <td>二级专业分类</td>
          <td>{{ formData.purchaseClassification }}</td>
        </tr>
        <tr>
          <td>行项目编码</td>
          <td>{{ formData.purchaseNo }}</td>
          <td>物资编码</td>
          <td>{{ formData.purchaseCode }}</td>
        </tr>
        <tr>
          <td>物资描述</td>
          <td colspan="3">
            {{ formData.purchaseDesc }}
          </td>
        </tr>
        <tr>
          <td>数量</td>
          <td>{{ formData.purchaseNum }}</td>
          <td>计量单位</td>
          <td>
            <span>{{ filterDictText(measuringUnitList, formData.purchaseUnit) }}</span>
          </td>
        </tr>
        <tr>
          <td>税率</td>
          <td>{{ filterDictText(taxRate, `${formData.purchaseTaxRate}`) }}</td>
          <td>预算单价（元）</td>
          <td>
            {{ formData.purchaseBudget }}
          </td>
        </tr>
        <tr>
          <td>预算总价（元）</td>
          <td>
            {{ formData.purchaseTotalBudget }}
          </td>
          <td>交货时间</td>
          <td>{{ formData.deliveryTime }}</td>
        </tr>
        <tr>
          <td>交货地点</td>
          <td colspan="3">
            <!-- formData.deliveryAreaName +  -->
            {{ formData.deliveryAddress }}
          </td>
        </tr>
        <!-- purchaseOrganization采购组织形式 00 自采 01委托采购  委托采购显示采购单位 采购员 联系电话 邮箱 -->
        <tr v-if="formData.purchaseOrganization==='01'">
          <td>采购单位</td>
          <td>
            {{ formData.purchaseDepartName }}
          </td>
          <td>采购员</td>
          <td>
            {{ formData.purchaseUserRealName }}
          </td>
        </tr>
        <tr v-if="formData.purchaseOrganization==='01'">
          <td>联系电话</td>
          <td>
            {{ formData.purchaseUserTel }}
          </td>
          <td>邮箱</td>
          <td>
            {{ formData.purchaseUserEmail }}
          </td>
        </tr>
        <tr>
          <td>备注</td>
          <td colspan="3">
            {{ formData.remark }}
          </td>
        </tr>
        <tr>
          <td>附件</td>
          <td colspan="3">
            <downloadFile v-if="lineItemFileType.bizId" :data="lineItemFileType" />
          </td>
        </tr>
        <tr>
          <td>状态</td>
          <td colspan="3">
            <span>{{ filterDictText(plan_data_statusList, formData.dataStatus) }}</span>
          </td>
        </tr>
      </table>
    </div>
  </el-dialog>
</template>

<script>
/* api接口*/
import { queryPurchasePlanDetailInfo } from '@/api/procurement/purchasplan'
/** 公共方法 */
import { procurementPlanGrounpMixins } from '@/views/procurement/procurementPlan/mixins/procurementPlanGroupMixins'// 字典信息
import { procurementProjectGroupMixin } from '@/views/procurement/procurementProject/mixins/procurementProjectGroupMixin'// 字典信息
import { procurementMixins } from '@/views/procurement/mixins/procurementMixins'// 公共数据
import { moneyFormat, filterDictText } from '@/assets/js/utils' // 转千分位 数据字典方法
/* 公共组件*/
import downloadFile from '@comp/common/updownload/downloadFile' // 文件回显
export default {
  name: 'ProcurementProjectLineItemLookDialogVue',
  components: {
    downloadFile // 文件回显组件
  },
  mixins: [procurementPlanGrounpMixins, procurementMixins, procurementProjectGroupMixin],
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return
      }
    }
  },
  data() {
    return {
      formData: {} // 项目基本信息
    }
  },
  watch: {
    'dialogData.dialog'(val) {
      if (val) {
        // alert(val)
      }
    }
  },
  created() {
    // 字典接口数据方法
    // this.initWebTypeGroup()
    // 获取采购计划单条信息
    this.getConstructionProject()
    this.initWebTypeGroup()
    this.inCodes()
  },
  methods: {
    filterDictText, // 数据字典方法
    // 获取采购计划单条信息
    getConstructionProject() {
      // 获取行项目详情id
      const planDetailId = this.dialogData.planDetailId
      if (planDetailId) {
        queryPurchasePlanDetailInfo(planDetailId).then(res => {
          this.formData = {
            ...res.data,
            purchaseBudget: moneyFormat(res.data.purchaseBudget), // 单价转千分位
            purchaseTotalBudget: moneyFormat(res.data.purchaseTotalBudget) // 总价转千分位
          }
          this.lineItemFileType.bizId = planDetailId
        }).catch(() => {
        })
        return
      }
      this.$message.warning('缺少参数')
    }
  }
}
</script>
<style lang="less" scoped>
</style>
