<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-wodeqingqiu"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="form-content">
      <el-form
        ref="formInfo"
        :model="parameter"
        label-width="auto"
        label-position="right"
        v-loading="loading"
      >
        <template>
          <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="24">
              <el-form-item label="企业名称" prop="enterpriseName">
                <el-input readonly v-model="parameter.enterpriseName" placeholder=""></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="供应商名称" prop="supplierName">
                <el-input readonly v-model="parameter.supplierName" placeholder=""></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="供应商分类" prop="categoryName">
                <el-input
                  v-model="parameter.categoryName"
                  readonly
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="供应商分级" prop="level">
                <el-input
                  readonly
                  v-model="parameter.level"
                  placeholder=""
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item
                label="是否需要供应商上传资质"
                prop="needProvideQualifications"
              >
              <el-input readonly v-model="parameter.needProvideQualifications" placeholder=""></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </template>
      </el-form>
    </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 dictUtils from '@/components/dict/DictSelectUtils.js'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import utils from '@/utils.js'
import multipleInput from '../../blacklistSupplier/component/multipleInput.vue'
export default {
  name: 'domesticDialog',
  components: {
    Breadcrumb,
    dictUtils,
    multipleInput,
  },
  props: {
    editData: Object,
  },
  data() {
    return {
      saveing: false,
      breadcrumbOpt: [{breadcrumbName: '供应商管理'}, {breadcrumbName: '详情'}],
      enterpriseList: [],
      supplierList: [],
      loading: false,
      parameter:{}
    }
  },
  created() {
    let id = this.$route.params.id
    this.getByIdData(id)
  },
  methods: {
    getByIdData(id) {
      this.loading = true
      supplierManger.getByIdManage(id).then((res) => {
        this.loading = false
        let data = res.data
        this.parameter = data
        let lev = dictUtils.getDictItemsFromCache('gysfj')
        lev.forEach((item) => {
          if (item.value == this.parameter.level) {
            this.parameter.level = item.name
          }
        })
        let Provide = dictUtils.getDictItemsFromCache('sfsczz')
        Provide.forEach((item) => {
          if (item.value == this.parameter.needProvideQualifications) {
            this.parameter.needProvideQualifications = item.name
          }
        })
      })
    },
    // 关闭//面包屑点击
    handleClose() {
      if (this.breadcrumbOpt[1].breadcrumbName === '编辑') {
        this.$router.push({
          name: 'onboardingSupplier',
          params: {
            pageBean: this.$route.query.pageBean,
          },
        })
      } else {
        this.$router.push({
          name: 'onboardingSupplier',
        })
      }
      this.active = 0
      this.parameter = {}
    },
  },
}
</script>

<style lang="scss"
  scoped>
/deep/ .el-row {
  padding: 0 240px;
}

// 步骤条
.theSteps {
  background-color: white;
  padding: 10px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  margin-top: 10px;

  /deep/.el-steps {
    width: 50%;
  }

  /deep/.el-steps--simple {
    background-color: rgba($color: #000000, $alpha: 0);
  }
}

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