<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-apartment"
        @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>
          <div class="row-box">
            <el-row :gutter="24">
              <el-col :span="12">
                <el-form-item label="分类编码">
                  <el-input
                    readonly
                    clearable
                    v-model="parameter.code"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="分类名称">
                  <el-input
                    readonly
                    clearable
                    v-model="parameter.name"
                  ></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
                    :value="getDictName('gysgl-fljb', parameter.level)"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="分类" prop="remarks">
                  <el-input
                    readonly
                    clearable
                    type="textarea"
                    :autosize="{minRows: 2, maxRows: 4}"
                    v-model="parameter.remarks"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <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.bizSupplierTypeEvaluationLists"
            style="width: 100%"
            highlight-current-row
            :cell-style="{'text-align': 'center'}"
            :header-cell-style="{'text-align': 'center'}"
          >
            <el-table-column
              label="评分方"
              min-width="150"
              prop="evaluationDimension"
            >
              <template slot-scope="scope">{{
                scope.row.evaluationDimension == 1 ? '企业方' : '运营方'
              }}</template>
            </el-table-column>
            <el-table-column
              label="评分项目"
              min-width="170"
              prop="evaluationItem"
            >
            </el-table-column>
            <el-table-column
              label="分值"
              min-width="170"
              prop="evaluationScore"
            >
            </el-table-column>
            <el-table-column
              label="评分标准"
              min-width="170"
              prop="evaluationStandard"
            >
            </el-table-column>
            <el-table-column
              label="评分类型"
              min-width="170"
              prop="evaluationType"
            >
              <template slot-scope="scope">{{
                getDictName('pflx', scope.row.evaluationType)
              }}</template>
            </el-table-column>
            <el-table-column label="备注" min-width="170" prop="remarks">
            </el-table-column>
            <el-table-column label="排序号" min-width="170" prop="sn">
            </el-table-column>
          </el-table>
        </el-form>
      </div>
    </div>
    <div slot="footer" class="footer">
      <el-button @click="handleClose">{{ $t('domestic.cancel') }}</el-button>
    </div>
  </div>
</template>

<script>
import supplierManger from '@/api/supplierManger.js'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import utils from '@/utils.js'
export default {
  name: 'domesticDialog',
  components: {Breadcrumb},
  data() {
    return {
      breadcrumbOpt: [
        {breadcrumbName: '供应商分类分级'},
        {breadcrumbName: '详情'},
      ],
      parameter: {},
    }
  },
  created() {
    let {id} = this.$route.params
    this.getByIdData(id)
  },
  mounted() {},
  methods: {
    getDictName(code, value) {
      return utils.getDictName(code, value)
    },
    getByIdData(id) {
      let formData = new FormData()
      formData.append('id', id)
      supplierManger.getByIdClassification(formData).then((res) => {
        this.parameter = res.data.value || {}
      })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'classificationSupplier',
        params: {
          pageBean: this.$route.query.pageBean,
        },
      })
      this.parameter = {}
    },
  },
}
</script>
<style lang="scss"
  scoped>
.row-box {
  margin: 0 10%;
}

::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>
