<template>
  <a-card class="back-card">
    <!-- 编辑 -->
    <a-button
      v-if="$api.btnPms"
      class="mr-24"
      slot="extra"
      type="primary"
      @click="doEdit()" >
      {{ $t('global-btn.edit') }}
    </a-button>
    <div class="pad-12">
      <a-form layout="inline">
        <a-row :gutter="24">
          <!-- 项目编号 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.project.number')">
              <span  class="ml8">{{ baseInfo.projectNo }}</span>
            </a-form-item>
          </a-col>
          <!-- 项目名称 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
          <a-form-item :label="$t('base.info.project.name')">
            <span  class="ml8">{{ baseInfo.projectName }}</span>
          </a-form-item>
          </a-col>
          <!-- 项目状态 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.project.status')">
              <span  class="ml8">{{ baseInfo.projectState }}</span>
            </a-form-item>
          </a-col>
          <!-- 车型 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.vehicle.model')">
              <span  class="ml8">{{ baseInfo.vehicleModel }}</span>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <!-- 产品类型 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.product.type')">
              <span  class="ml8">{{ baseInfo.productType }}</span>
            </a-form-item>
          </a-col>
          <!-- 年 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.year')">
              <span  class="ml8">{{ baseInfo.year }}</span>
            </a-form-item>
          </a-col>
          <!-- 平台 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.platform')">
              <span  class="ml8">{{ baseInfo.platform }}</span>
            </a-form-item>
          </a-col>
          <!-- 项目等级 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.project.level')">
              <span  class="ml8">{{ baseInfo.projectLevel }}</span>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <!-- 项目总监 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.project.director')">
              <span  class="ml8">{{ baseInfo.projectDirector !== "null" ? baseInfo.projectDirector : '--' }}</span>
            </a-form-item>
          </a-col>
          <!-- 项目经理 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.project.manager')">
              <span  class="ml8">{{ baseInfo.projectManager !== "null" ? baseInfo.projectManager : '--' }}</span>
            </a-form-item>
          </a-col>
          <!-- CPAC编码 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.CPAC-code')">
              <span  class="ml8">{{ baseInfo.cpacCode }}</span>
            </a-form-item>
          </a-col>
          <!-- 产品工程师 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('workbench.product-engineer')">
              <span class="ml8">{{ baseInfo.owner }}</span>
            </a-form-item>
          </a-col>
          <!-- 材料工程师 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('workbench.material-engineer')">
              <span class="ml8">{{ baseInfo.materialsEngineer }}</span>
            </a-form-item>
          </a-col>
          <!-- 试验工程师 -->
          <a-col :xl="6" :lg="8" :md="12" :sm="24" :xs="24">
            <a-form-item :label="$t('workbench.parts-engineer')">
              <span class="ml8">{{ baseInfo.testEngineer }}</span>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <!-- 开发范围 -->
          <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
            <a-form-item :label="$t('base.info.development.scope')" >
              <span class="ml8">{{ baseInfo.developRange }}</span>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
  </a-card>
</template>

<script>


export default {
  name: "baseInfo",
  components: {
  },
  data() {
    return {
      dvpId: undefined,    //dvpId
      baseInfo: {},        //基本信息
      productEngineer: undefined,   // 产品工程师
      materialEngineer: undefined,   // 材料工程师
      partsEngineer: undefined   // 零件工程师
    };
  },
  mounted() {
    this.initBaseInfo();
  },
  methods: {
    //获取基本信息
    async initBaseInfo() {
      let _that = this;
      let data = {
        dvpId: _that.$store.getters.dvpId
      }
      _that.$api.getComponentsDvpBasicInformation(data).then(res =>{
        if (res.flag){
          _that.baseInfo = res.data;
        } else{
          _that.$message.error(res.message, 1);
        }
      })
    },
    // 编辑
    doEdit() {
      let isOwner = this.baseInfo.isOwner;
      let infoUrl = '/dvp/componentsDVP/edit?dvpId='
        + this.$route.query.dvpId
        + '&lookFlag=2'
        + '&isOwner=' + isOwner;
      let backUrl = this.$api.fmUrl + '/#' + infoUrl
      window.open(backUrl, '_top')
    },
		// 下拉选项过滤
		filterOption(input, option) {
			return (option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0);
		},
  },
  computed: {},
  filters: {}
};
</script>
<style lang="less" scoped>
.ant-pro-basicLayout-content {
  margin: 10px;
}
.back-card {
  border: hidden;
  border-radius: 0px;
}
.pad-12 {
  padding: 12px;
}
.mr-24 {
  margin-right: -24px;
}
.select-width {
  width: 240px;
}
</style>
