<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-icon_personalcenter"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="form-content">
      <div class="company-information">
        <el-form
          ref="formInfo"
          :model="parameter"
          label-position="right"
          label-width="auto"
        >
          <div class="rows">
            <div class="rows-left">
              <div class="rows-hr"></div>
            </div>
            <div class="rows-title">
              <div class="text-overflow">基本信息</div>
            </div>
          </div>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="编制公司">
                <el-input
                  readonly
                  clearable
                  v-model="parameter.preparedOrgName"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="编制人">
                <el-input
                  readonly
                  clearable
                  v-model="parameter.preparedUserName"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="业务日期">
                <el-input
                  readonly
                  clearable
                  v-model="parameter.applicationDate"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申请类型">
                <el-input
                  readonly
                  clearable
                  v-model="parameter.applicationType"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="计划类型">
                <el-input
                  readonly
                  clearable
                  v-model="parameter.planType"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="来源类型">
                <el-input
                  readonly
                  clearable
                  v-model="parameter.applicationSource"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="备注">
                <el-input
                  type="areatext"
                  readonly
                  clearable
                  v-model="parameter.remarks"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="rows">
            <div class="rows-left">
              <div class="rows-hr"></div>
            </div>
            <div class="rows-title">
              <div class="text-overflow">物料信息</div>
            </div>
          </div>
          <el-table
            ref="singleTable"
            :data="parameter.projectInfoList"
            style="width: 100%"
            highlight-current-row
            :cell-style="{'text-align': 'center'}"
            :header-cell-style="{'text-align': 'center'}"
          >
            <el-table-column fixed type="index" width="55" label="序号" />
            <el-table-column
              label="物料编号"
              min-width="150"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matCode"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="物料ID" min-width="150" prop="unloadAddress">
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matId"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="企业物料编号" min-width="150">
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matCompanyCode"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="物料名称"
              min-width="170"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matName"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="物料牌号"
              min-width="170"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matMaterial"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="规格型号"
              min-width="170"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matSpec"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="数量" min-width="150" prop="unloadAddress">
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matNum"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="单位" min-width="150" prop="unloadAddress">
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matUnit"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="采购方式"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  :value="procurementMethodName(scope.row.procurementMethod)"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="品牌 (厂家)"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matBrand"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="需求日期"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.demandDate"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="基础扩展"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matBaseExt"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="其他扩展"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.matOtherExt"
                ></el-input>
              </template>
            </el-table-column>
            <!-- <el-table-column
              label="交货地点"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.unloadAddress"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="计划编号"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.unloadAddress"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="停用时间"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-date-picker
                  readonly
                  v-model="scope.row.unloadAddress"
                  type="date"
                  value-format="yyyy-MM-dd"
                  style="width:100%;"
                />
              </template>
            </el-table-column>
            <el-table-column
              label="合同是否重复参照控制"
              min-width="220"
              prop="type"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  clearable
                  v-model="scope.row.type"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="企业补充说明"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  v-model="scope.row.checkContent"
                  :rows="2"
                  maxlength="500"
                  show-word-limit
                  type="textarea"
                  style="width:100%;"
                />
              </template>
            </el-table-column> -->
          </el-table>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import procurementManagement from '@/api/procurementManagement'
export default {
  name: 'domesticDialog',
  components: {Breadcrumb},
  data() {
    return {
      breadcrumbOpt: [{breadcrumbName: '采购申请'}, {breadcrumbName: '详情'}],
      parameter: {},
      applicationTypeList: [
        {
          label: '标准采购申请',
          value: '1'
        }
      ],
      applicationSourceList: [
        {
          label: '手工录入',
          value: '1'
        }
      ],
      procurementMethodList: [
        {
          label: '平台招标',
          value: '1'
        },
        {
          label: '企业招标',
          value: '2'
        },
        {
          label: '企业线下定价',
          value: '3'
        }
      ]
    }
  },
  created() {
    this.parameter = this.$route.query.detailRows
    this.detail(this.parameter.id)
  },
  mounted() {},
  methods: {
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'projectPurchaseRequisition',
        params: {
          pageBean: this.$route.query.pageBean
        }
      })
      this.parameter = {}
    },
    //详情
    detail(val) {
      procurementManagement
        .projectApprovalProDetailsSelectOne(val)
        .then(res => {
          res.value.applicationType = this.applicationTypeList.filter(
            item => item.value == res.value.applicationType
          )[0].label
          res.value.applicationSource = this.applicationSourceList.filter(
            item => item.value == res.value.applicationSource
          )[0].label
          this.parameter = res.value
        })
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__label {
  width: 120px;
  font-size: 14px;
  color: #828282;
  font-weight: 500;
}

::v-deep .el-form-item__content span {
  font-size: 14px;
  color: #000;
  font-weight: 500;
}

::v-deep .el-form-item {
  margin-bottom: 10px;
}
.rows {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 16px;
  padding: 10px 0;

  .rows-left {
    margin-right: 10px;

    .rows-hr {
      width: 3px;
      height: 18px;
      background-color: #0e6eff;
      border-radius: 2px;
    }
  }

  .rows-title {
    .text-overflow {
      width: 100%;
      font-size: 16px;
    }
  }
}
</style>
