/*
  @description:供应商-公用字典
  @Modifier:肖文龙
  @routerPath:
  @date:2020-1-3 17:49
*/
/* api*/
import { getDepartInfoDictionaries } from '@/api/supplier/supplierBaseInfo'
import { getCertificateDictionaries } from '@/api/supplier/supplierCertificate'
import { getSupplyRecordDictionaries } from '@/api/supplier/supplierSupplyRecord'
/* 混合开发*/
import { initGroupMixin } from '@/mixins/initGroupMixin' // 全局公用字典
export const declareHegSupperGroupMixin = {
  data() {
    return {
      /* ==============================申报材料公用-接口回显==============================*/
      currencies: [], // 币种
      supplierTypeCodeGroup: [], // 供应商分类
      /* ==============================申报材料基本信息部分-接口回显==============================*/
      incorporationGroup: [], // 单位注册地
      incorporationGroups: [], // 国家地区/所有地区 包括境外/境内
      incorporationList: [], // 国家地区/筛选国内/境外
      unittypeGroup: [], // 机构类型
      documentMethodList: [], // 机构类型
      supplierEntPrptGroup: [], // 企业性质
      /* ==============================申报材料企业资质部分-接口回显==============================*/
      supplierCertificateTypeList: [], // 证书名称
      /* ==============================申报材料供货记录部分-接口回显==============================*/
      supplierPartnersList: [], // 合同合作方
      // 是否国内电话
      isDomesticPhoneList: [
        { typename: '是', typecode: '01' },
        { typename: '否', typecode: '00' }
      ],
      // 合作方
      partnersList: [
        { typename: '其它单位', typecode: '01' },
        { typename: '本集团', typecode: '00' }
      ]
    }
  },
  mixins: [initGroupMixin],
  methods: {
    /* ==============================申报材料基本信息部分-接口回显==============================*/
    // 获取供应商信息所有字典
    initKey() {
      getDepartInfoDictionaries().then(res => {
        this.supplierTypeCodeGroup = res.data.supplierTypeCodeGroup.typeList // 供应商分类
        this.supplierEntPrptGroup = res.data.supplierEntPrptGroup.typeList // 企业性质
        this.currencies = res.data.currencies.typeList // 注册币种
        this.incorporationGroup = res.data.incorporationGroup.typeList // 单位注册地
        this.incorporationGroups = res.data.countryCodeGroup.typeList // 国家地区
        this.documentMethodList = res.data.unittypeGroup.typeList // 机构类型
      })
    },
    /* ==============================申报材料企业资质部分-接口回显==============================*/
    // 获取证书字典
    getCertificateDictionaries() {
      getCertificateDictionaries().then(res => {
        this.supplierCertificateTypeList = res.data.supplierCertificateTypeGroup.typeList// /证书名称
      })
    },
    /* ==============================申报材料供货记录部分-接口回显==============================*/
    // 申报材料供货记录-字典信息
    getSupplyRecordDictionaries() {
      getSupplyRecordDictionaries().then(res => {
        this.supplierPartnersList = res.data.supplierPartnersGroup.typeList
        this.currencies = res.data.currencies.typeList
      })
    }
  }
}
