<template>
  <el-form label-width="150px" class="el-form-box" ref="formRef" :model="form">
    <el-row>
      <el-col :span="8">
        <el-form-item label="客户分类：" prop="categoryId">
          <el-input v-model="form.categoryName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="分管部门：" prop="fgDeptId">
          <el-input v-model="form.fgDeptName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="销售员：" prop="salesmanId">
          <el-input v-model="form.salesmanName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="客户名称：" prop="name">
          <el-input v-model="form.name" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item
          class="form_item_label"
          label="统一信用代码"
          prop="unifiedSocialCreditCode"
        >
          <el-input v-model="form.unifiedSocialCreditCode" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="客户代号：" prop="serialNo">
          <el-input v-model="form.serialNo" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="客户简称：" prop="simpleName">
          <el-input v-model="form.simpleName" disabled></el-input>
        </el-form-item>
      </el-col>

      <el-col :span="8">
        <el-form-item label="法定代表人：" prop="legalPerson">
          <el-input v-model="form.legalPerson" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="所属行业：" prop="industry">
          <el-input v-model="form.industryFullName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="企业类型：" prop="companyCategoryId">
          <el-input v-model="form.companyCategoryName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="企业性质：" prop="companyCategoryId">
          <el-input v-model="form.enterpriseTypeName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="上级单位：" prop="hasParentGroup">
          <el-input v-model="form.parentName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="注册资本：" prop="registeredCapital">
          <el-input v-model="form.registeredCapital" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="授信额度：" prop="authorizationLimit">
          <el-input v-model="form.authorizationLimit" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="单位电话：" prop="phone">
          <el-input v-model="form.phone" disabled></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-col :span="8">
      <el-form-item label="成立日期：" prop="registerDate">
        <el-input v-model="form.registerDate" disabled></el-input>
      </el-form-item>
    </el-col>
    <el-row>
      <el-col :span="8">
        <el-form-item label="级别：">
          <DictSelection
            dictName="供应商级别"
            disabled
            clearable
            v-model="form.level"
          >
          </DictSelection>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="企业规模" prop="enterpriseScale">
          <DictSelection
            dictName="企业规模"
            clearable
            v-model="form.enterpriseScale"
            disabled
          >
          </DictSelection>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="员工人数" prop="staffCount">
          <el-input
            placeholder="请输入"
            v-model="form.staffCount"
            disabled
            maxlength="20"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="英文名称" prop="englishName">
          <el-input
            placeholder="请输入"
            v-model="form.englishName"
            disabled
            maxlength="20"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="纳税人资质" prop="taxpayerQualification">
          <DictSelection
            dictName="纳税人资质"
            clearable
            v-model="form.taxpayerQualification"
            disabled
          >
          </DictSelection>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="企业荣誉" prop="enterpriseHonor">
          <DictSelection
            dictName="企业荣誉"
            clearable
            v-model="form.enterpriseHonor"
            disabled
          >
          </DictSelection>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="注册地址:" prop="addressId">
          <el-input v-model="form.addressName" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="详细地址：" prop="address">
          <el-input v-model="form.address" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="联系地址：" prop="addressId">
          <el-input v-model="otherForm.addressName" disabled> </el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item
          label="详细地址："
          class="form_item_label"
          prop="address"
        >
          <el-input v-model="otherForm.address" disabled> </el-input>
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item label="主营产品" prop="mainProduct">
          <el-input
            placeholder="请输入"
            v-model="form.mainProduct"
            type="textarea"
            maxlength="500"
            disabled
          ></el-input>
        </el-form-item>
      </el-col>

      <el-col :span="24">
        <el-form-item label="经营范围" prop="businessScope">
          <el-input
            type="textarea"
            maxlength="500"
            v-model="form.businessScope"
            disabled
          ></el-input>
        </el-form-item>
      </el-col>

      <el-col :span="24">
        <el-form-item label="企业简介" prop="enterpriseProfile">
          <el-input
            disabled
            v-model="form.enterpriseProfile"
            type="textarea"
            maxlength="500"
          ></el-input>
        </el-form-item>
      </el-col>

      <el-col :span="24">
        <el-form-item label="备注" prop="remark">
          <el-input
            type="textarea"
            resize="none"
            v-model="form.remark"
            :rows="2"
            disabled
            size="small"
            maxlength="200"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="创建人：" prop="createUsername">
          <el-input v-model="form.createUsername" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="创建时间：" prop="createTime">
          <el-input v-model="form.createTime" disabled></el-input>
        </el-form-item>
      </el-col>

    </el-row>
  </el-form>
</template>

<script>
import { getFile } from '@/api/system/file';
import {
  getInfoById as getCategoryInfo,
  getInfoByIds
} from '@/api/classifyManage/index';
import dictMixins from '@/mixins/dictMixins';
export default {
  mixins: [dictMixins],
  components: {},
  data() {
    return {
      form: {
        address: '',
        addressId: 0,
        addressName: '',
        authorizationLimit: 0,
        businessLicenseFile: {},
        businessScope: '',
        categoryId: '',
        categoryName: '',
        companyCategoryId: '',
        companyCategoryName: '',
        enterpriseTypeName: '',
        enterpriseTypeId: '',
        hasParentGroup: 0,
        industry: '',
        industryCode: '',
        industryFullName: '',
        mainProduct: '',
        name: '',
        officialIndustry: '',
        phone: '',
        registerDate: '',
        remark: '',
        serialNo: '',
        simpleName: '',
        legalPerson: '',
        registeredCapital: '',
        type: 1,
        unifiedSocialCreditCode: ''
      },
      otherForm:{
        addressName:'',address:''
      }
    };
  },
  methods: {
    async init(row) {
      this.form = row.base;
      this.otherForm=row.other
      if (this.form.level) {
        this.form.level = this.form.level + '';
      }
      await getInfoByIds(this.form.categoryId).then((res) => {
        let categoryName = res.data.map((item) => item.name)?.join(',');
        this.$set(this.form, 'categoryName', categoryName);
      });
    },

    downloadFile(file) {
      getFile({ objectName: file.storePath }, file.name);
    }
  }
};
</script>
