/*
  @description:集约化评标-字典信息
  @Modifier:肖文龙
  @routerPath:
  @date:2020年3月5日10:58:08
*/
import { queryTenderProjectInitInfo } from '@/api/bidding/biddingProject'// 获取信息 字典信息
import { queryAllDepartPage } from '@/api/intensiveeval/intensiveeval'// 查询集约化所有部门
import { filterDictText } from '@assets/js/utils'// 常用方法
export const groupMixin = {
  data() {
    return {
      /* 组建评标委员会-start*/
      /* ========================基本信息部分========================*/
      // 分组状态
      groupingStateList: [
        { typename: '全选', typecode: '' },
        { typename: '未分组', typecode: '00' },
        { typename: '评标分组待编辑', typecode: '01' },
        { typename: '评标分组已保存', typecode: '02' },
        { typename: '评标分组待审批', typecode: '03' },
        { typename: '评标分组审批通过', typecode: '04' },
        { typename: '评标分组审批驳回', typecode: '05' },
        { typename: '已指定牵头人', typecode: '06' },
        { typename: '已创建评委会申请', typecode: '07' },
        { typename: '已抽取完成', typecode: '08' }
      ],
      // 评委会状态
      judgesStatusList: [
        { typename: '全选', typecode: '' },
        { typename: '待申请', typecode: '00' },
        { typename: '抽取中', typecode: '01' },
        { typename: '抽取失败', typecode: '02' },
        { typename: '抽取成功', typecode: '03' },
        { typename: '待指定', typecode: '04' },
        { typename: '已生效', typecode: '05' },
        { typename: '重新抽取', typecode: '07' }
      ],
      /* 抽取类型*/
      extractionTypeList: [
        { typename: '资格审查委员会', typecode: '00' },
        { typename: '评标委员会', typecode: '01' }
      ],
      /* 通知方式*/
      informWayList: [
        { typename: '语音通知', typecode: '00' },
        { typename: '人工通知', typecode: '01' }
      ],
      /* 评委会组建方式(评标委员会组建方式)*/
      juryOrganizeWayList: [
        { typename: '全选', typecode: '' },
        { typename: '随机抽取', typecode: '00' },
        { typename: '直接指定', typecode: '01' }
      ],
      /* 限制65岁以上的专家*/
      limitTheExpertList: [
        { typename: '是', typecode: '01' },
        { typename: '否', typecode: '00' }
      ],
      /* ========================抽取条件部分========================*/
      /* 集团内/外*/
      systemSourceList: [
        { typename: '全部', typecode: '02' },
        { typename: '系统内', typecode: '00' },
        { typename: '系统外', typecode: '01' }
      ],
      /* 技术职称*/
      titleList: [
        { typename: '全部', typecode: '03' },
        { typename: '中级', typecode: '00' },
        { typename: '高级', typecode: '01' },
        { typename: '正高级', typecode: '02' }
      ],
      /* 专家星级*/
      expertsSarList: [
        { typename: '全部', typecode: '05' },
        { typename: '1星', typecode: '00' },
        { typename: '2星', typecode: '01' },
        { typename: '3星', typecode: '02' },
        { typename: '4星', typecode: '03' },
        { typename: '5星', typecode: '04' }
      ],
      // 专家分组
      expertGroupList: [
        { typename: '商务组', typecode: '00' },
        { typename: '技术组', typecode: '01' }
      ],
      /* ========================屏蔽单位部分========================*/
      /* 屏蔽类型*/
      shieldingTypeList: [
        { typename: '自动屏蔽', typecode: '00' },
        { typename: '手动屏蔽', typecode: '01' }
      ],
      /* 招标人代理部分*/
      agentTendererList: [
        { typename: '是', typecode: '01' },
        { typename: '否', typecode: '00' }
      ],
      /* ========================抽取结果部分========================*/
      // 专家状态
      expertStatusLiat: [
        { typename: '正常', typecode: '01' },
        { typename: '废弃', typecode: '00' }
      ],
      /* ========================招标人代表======================== */
      // 证件类型
      cardTypeList: [
        { typename: '身份证', typecode: '00' }
      ],
      /* 组建评标委员会-end*/
      /* ========================集约化评标明细/集约化评标分组部分/集约化评标记录部分========================*/
      /* 超过法定限额*/
      exceedingLegalLimitList: [
        { typename: '全选', typecode: '' },
        { typename: '否', typecode: '00' },
        { typename: '是', typecode: '01' }
      ],
      /* 资格预审项目*/
      prequalificationProgramList: [
        { typename: '全选', typecode: '' },
        { typename: '否', typecode: '00' },
        { typename: '是', typecode: '01' }
      ],
      /* 评标办法*/
      evaluationTypeList: [
        { typename: '全选', typecode: '' },
        { typename: '经评审的有效最低法', typecode: '01' },
        { typename: '综合评估法', typecode: '00' }
      ],
      // 开评标计划状态
      openingScheduleStatusList: [
        { typename: '减少', typecode: '00' },
        { typename: '正常', typecode: '01' },
        { typename: '增加', typecode: '02' }
      ],

      // 变更原因
      changeResonList: [
        { typename: '招标终止', typecode: '00' },
        { typename: '新增', typecode: '01' },
        { typename: '重新招标', typecode: '02' }
      ],
      /* 评委会是否分组*/
      judgingPanelTypeList: [
        { typename: '分组', typecode: '01' },
        { typename: '不分组', typecode: '00' }
      ],
      /* 部门分工*/
      businessList: [],
      projectIndustryList: [{ typename: '全选', typecode: '' }], // 项目行业
      projectClassificationList: [{ typename: '全选', typecode: '' }], // 项目分类
      purchaseLevelList: [{ typename: '全选', typecode: '' }], // 采购级别
      projectNatureList: [], // 项目性质
      currenciesList: [], // 币种
      bidTypeList: [], // 招标方式
      orgMethodList: [], // 组织形式
      purchaseTypeList: [], // 采购类别
      purchaseClassificationList: [], // 采购分类
      purchaseContentClassList: [], // 采购内容分类
      phaseTypeList: [] // 资审方式
    }
  },
  methods: {
    filterDictText, // 字典值替换文本通用方法
    /* ===========================集约化评标计划部分===========================*/
    // 集约化评标计划-集约化评标明细(立项-字典信息)
    initWebTypeGroup() {
      queryTenderProjectInitInfo().then(res => {
        // 遍历key存储相应的数据
        for (const key in res.data) {
        /* 是否有数据*/
          if (res.data[key] && res.data[key].typeList) {
            this[key + 'List'].push(...res.data[key].typeList)
          }
        }
      })
    },
    // 查询集约化评标所有的部门
    getQueryAllDepartPage() {
      const data = { pageNo: 1, pageSize: 9999 }
      queryAllDepartPage(data).then(res => {
        res.data.records.map(item => {
          this.businessList.push({
            typename: item.departname, // 名称
            id: item.id, // id
            typecode: item.orgCode// 编号
          })
        })
      })
    },
    // 表格字典值替换文本-专家星级
    formatExpertLevel(row, column, cellValue) {
      return filterDictText(this.expertsSarList, cellValue)
    },
    // 表格字典值替换文本-技术职称
    formatterTechnicalTitle(row, column, cellValue) {
      return filterDictText(this.titleList, cellValue)
    },
    // 表格字典值替换文本-集团内/外
    formatterSystemSourceList(row, column, cellValue) {
      return filterDictText(this.systemSourceList, cellValue)
    },
    // 表格字典值替换文本-分组
    formatterExpertGroupList(row, column, cellValue) {
      return filterDictText(this.expertGroupList, cellValue)
    }
  }
}
