/*
  @description:供应商-公用字典
  @Modifier:肖文龙
  @routerPath:
  @date:2020-1-3 17:49
*/
import { getBlacklistDictionaries } from '@/api/supplier/supplierUnqualified'
import { getDeclarationDictionaries } from '@/api/supplier/declaraTionrecord'
import { getTaskDictionaries } from '@/api/supplier/wareHousingApprovalaudit'
export const supplierGroupMixin = {
  data() {
    return {
      // 审核状态
      auditStatusList: [
        { typename: '待审核', typecode: '00', useStatus: '01' },
        { typename: '审核通过', typecode: '01', useStatus: '01' },
        { typename: '审核不通过', typecode: '02', useStatus: '00' },
        { typename: '已保存', typecode: '03', useStatus: '00' },
        { typename: '已撤销', typecode: '04', useStatus: '00' }
      ],
      // 调查方式
      nvestigationMethodList: [
        { typecode: '00', typename: '实地考察' },
        { typecode: '01', typename: '问卷调查' },
        { typecode: '02', typename: '综合' },
        { typecode: '03', typename: '其他' }
      ],
      // 淘汰原因
      freezingReasonsList: [
        { typecode: '00', typename: '违反投标承诺或合同约定，提高价格、降低质量、拖延工期或供货时间的不诚信行为' },
        { typecode: '01', typename: '在履行投标承诺或合同过程中，出现工程、设备质量问题或给招标方造成经济损失、不良社会影响的' },
        { typecode: '02', typename: '不遵守招投标规定，在招标采购过程中有诽谤、诋毁其他竞争对手的不良行为的' },
        { typecode: '03', typename: '三年内被两次约谈的' }
      ],
      supplierBizTypeGroupList: [], // 审批类型-字典
      /* ==============================获取黑名单所有字典==========================*/
      supplierPunishIdeaGroup: [], // 处罚意见
      supplierBelowGradeWeedOutReasonGroup: [], // 不合格供应商淘汰原因
      supplierBlackWeedOutReasonGroup: [], // 纳入黑名单淘汰原因
      supplierPunishTimeTermGroup: [], // 处罚时间期限
      /* ==============================申报材料供货记录部分-接口回显==============================*/
      supplierQualificationsTypeGroup: [] // 入库方式
    }
  },
  methods: {
    /* ==============================获取黑名单所有字典==========================*/
    initGetBlacklistDictionaries() {
      getBlacklistDictionaries().then(res => {
        const { data: {
          supplierPunishIdeaGroup, // 处罚意见
          supplierBelowGradeWeedOutReasonGroup, // 不合格供应商淘汰原因
          supplierBlackWeedOutReasonGroup, // 纳入黑名单淘汰原因
          supplierPunishTimeTermGroup // 处罚时间期限
        }} = res
        this.supplierPunishIdeaGroup = supplierPunishIdeaGroup.typeList
        this.supplierPunishIdeaGroup = supplierPunishIdeaGroup.typeList
        this.supplierBelowGradeWeedOutReasonGroup = supplierBelowGradeWeedOutReasonGroup.typeList
        this.supplierBlackWeedOutReasonGroup = supplierBlackWeedOutReasonGroup.typeList
        this.supplierPunishTimeTermGroup = supplierPunishTimeTermGroup.typeList
      })
    },
    /* ==============================申报记录部分-接口回显==============================*/
    // 获取字典-申报记录部分
    getDeclarationDictionariesGroup() {
      getDeclarationDictionaries().then(res => {
        // 遍历key存储相应的数据
        for (const key in res.data) {
          /* 是否有数据*/
          if (res.data[key]) {
            this[key] = res.data[key].typeList
          }
        }
      })
    },
    /* ==============================审批类型字典==============================*/
    // 获取字典--审批类型
    initGetTaskDictionaries() {
      getTaskDictionaries().then(res => {
        this.supplierBizTypeGroupList = res.data.supplierBizTypeGroup.typeList
      })
    }
  }
}
