<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">
      <el-form
        ref="formInfo"
        :model="parameter"
        label-width="auto"
        label-position="right"
      >
        <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="编制公司" prop="preparedOrgName">
              <el-input
                clearable
                v-model="parameter.preparedOrgName"
                placeholder="请输入编制公司"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="模板名称" prop="name">
              <el-input
                clearable
                v-model="parameter.name"
                placeholder="请输入模板名称"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="项目类型" prop="targetType">
              <dict-select
                dictCode="bdlx"
                :hasDefaultOption="true"
                clearable
                style="width:100%"
                v-model="parameter.targetType"
                placeholder="请选择项目类型"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报价方式" prop="quotationMethod">
              <dict-select
                dictCode="cglx-fkfs"
                :hasDefaultOption="true"
                clearable
                style="width:100%"
                v-model="parameter.quotationMethod"
                placeholder="请选择报价方式"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="是否含税价" prop="isTax">
              <dict-select
                dictCode="cglx-jjfs"
                :hasDefaultOption="true"
                clearable
                style="width:100%"
                v-model="parameter.isTax"
                placeholder="请选择是否含税价"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否启用" prop="isEnable">
              <dict-select
                dictCode="sfqy"
                :hasDefaultOption="true"
                clearable
                style="width:100%"
                v-model="parameter.isEnable"
                placeholder="请选择是否启用"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="24">
            <el-form-item label="备注" prop="remarks">
              <el-input
                clearable
                type="areatext"
                v-model="parameter.remarks"
                placeholder="请输入备注"
              ></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.detailList"
          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="170" prop="quoArrange">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.quoArrange"
                placeholder="报价列名称"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="来源类型" min-width="150" prop="sourceType">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.sourceType"
                placeholder="来源类型"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="是否必填" min-width="170" prop="isRequired">
            <template slot-scope="scope">
              <el-checkbox v-model="scope.row.isRequired"></el-checkbox>
            </template>
          </el-table-column>
          <el-table-column
            label="招标录入项"
            min-width="170"
            prop="beckonEntry"
          >
            <template slot-scope="scope">
              <el-checkbox v-model="scope.row.beckonEntry"></el-checkbox>
            </template>
          </el-table-column>
          <el-table-column label="投标录入项" min-width="150" prop="throwEntry">
            <template slot-scope="scope">
              <el-checkbox v-model="scope.row.throwEntry"></el-checkbox>
            </template>
          </el-table-column>
          <el-table-column label="投标显示项" min-width="150" prop="throwShow">
            <template slot-scope="scope">
              <el-checkbox v-model="scope.row.throwShow"></el-checkbox>
            </template>
          </el-table-column>
          <el-table-column
            label="评标显示项"
            min-width="180"
            prop="procurementMethod"
          >
            <template slot-scope="scope">
              <el-checkbox v-model="scope.row.evaluationShow"></el-checkbox>
            </template>
          </el-table-column>
          <el-table-column label="价格录入项" min-width="180" prop="priceEntry">
            <template slot-scope="scope">
              <el-checkbox v-model="scope.row.priceEntry"></el-checkbox>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </div>
    <div slot="footer" class="footer">
      <el-button @click="handleClose">{{ $t('domestic.cancel') }}</el-button>
    </div>
  </div>
</template>

<script>
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import procurementManagement from '@/api/procurementManagement'
export default {
  name: 'quoteTemplateAddDialog',
  components: {Breadcrumb},
  props: {
    editData: Object
  },
  data() {
    return {
      breadcrumbOpt: [{breadcrumbName: '报价模板'}, {breadcrumbName: '详情'}],
      methodUnitsList: [],
      parameter: {}
    }
  },
  created() {
    console.log(this.$route.query.editRows,'this.$route.query.editRows');
    let id = this.$route.query.editRows.id
    this.detail(id)
  },
  mounted() {},
  methods: {
    //获取详情
    detail(id) {
      this.$http.post('${portal}/quotationTemplate/v1/dataById?id=' + id).then(res => {
        this.parameter = res.data.value
      })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'quoteTemplate'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
// /deep/.el-row {
//   padding: 0 100px;
// }
.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>
