<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-model"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="form-content">
      <div class="company-information">
        <el-form
          ref="formInfo"
          :model="parameter"
          label-width="auto"
          label-position="right"
          :rules="rules"
        >
          <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="matCompanyCode">
                <el-input
                  readonly
                  v-model="parameter.matCompanyCode"
                  placeholder="请输入企业编号"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="企业物料编号" prop="matCode">
                <el-input
                  readonly
                  v-model="parameter.matCode"
                  placeholder="请输入企业物料编号"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="平台物料编号" prop="matPlatcode">
                <el-input
                  readonly
                  v-model="parameter.matPlatcode"
                  placeholder="请输入平台物料编号"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="物料分类" prop="matCategory">
                <el-cascader
                  v-model="parameter.matCategory"
                  :options="options"
                  :props="{
                    value: 'code',
                    label: 'name',
                    checkStrictly: true,
                    emitPath: false
                  }"
                  readonly
                  style="width:100%"
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="物料牌号" prop="matMaterial">
                <el-input
                  readonly
                  v-model="parameter.matMaterial"
                  placeholder="请输入物料牌号"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="物料名称" prop="matName">
                <el-input
                  readonly
                  v-model="parameter.matName"
                  placeholder="请输入物料名称"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="规格型号" prop="matSpec">
                <el-input
                  readonly
                  v-model="parameter.matSpec"
                  placeholder="请输入规格型号"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="计量单位" prop="matUnit">
                <el-input
                  readonly
                  v-model="parameter.matUnit"
                  placeholder="请输入计量单位"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="税率" prop="matTaxrate">
                <el-input
                  readonly
                  v-model="parameter.matTaxrate"
                  placeholder="请输入税率"
                ></el-input>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="品牌" prop="matBrand">
                <el-input
                  readonly
                  v-model="parameter.matBrand"
                  placeholder="请输入品牌"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="基础扩展" prop="matBaseExt">
                <el-input
                  readonly
                  v-model="parameter.matBaseExt"
                  placeholder="请输入基础扩展"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="其他扩展" prop="matOtherExt">
                <el-input
                  readonly
                  v-model="parameter.matOtherExt"
                  placeholder="请输入其他扩展"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="是否集中采购" prop="matIfPlat">
                <dict-select
                  dictCode="wllx"
                  :hasDefaultOption="true"
                  readonly
                  style="width:100%"
                  v-model="parameter.matIfPlat"
                  placeholder="请选择是否集中采购"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="启用状态" prop="matStatus">
                <dict-select
                  dictCode="sfqy"
                  :hasDefaultOption="true"
                  readonly
                  style="width:100%"
                  v-model="parameter.matStatus"
                  placeholder="请选择是否集中采购"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </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 basicData from '@/api/basicData'
export default {
  name: 'domesticDialog',
  components: {Breadcrumb},
  data() {
    return {
      breadcrumbOpt: [{breadcrumbName: '物料数据'}, {breadcrumbName: '详情'}],
      parameter: {},
      options: []
    }
  },
  created() {
    this.parameter = this.$route.query.detailRows
    this.detail(this.parameter.id)
    this.selectTree()
  },
  mounted() {},
  methods: {
    //查询物料分类树结构
    selectTree() {
      basicData.bizMaterialCategorySelectTree().then(res => {
        this.options = res.value
      })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'materialManagement',
        params: {
          tabsActiveName: 'itemData',
          pageBean: this.$route.query.pageBean
        }
      })
      this.parameter = {}
    },
    //详情
    detail(val) {
      basicData.bizMaterialId(val).then(res => {
        this.parameter = res
      })
    }
  }
}
</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>
