// import { getAction } from '@/api/flowable/manage';

import store from '@/store';

export function formatDictText(dicts, values) {
  if (!(Array.isArray(dicts) && dicts.length > 0)) {
    return values;
  }
  if (!values) {
    return '';
  }
  let valueArr = values.split(',');
  let contentArr = [];
  dicts.forEach((dict) => {
    for (let i = 0; i < valueArr.length; i++) {
      if (valueArr[i] === dict.value) {
        contentArr.push(dict.content);
        break;
      }
    }
  });
  return contentArr.toString();
}

export function randomString(len) {
  len = len || 32;
  const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
  /** **默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
  const maxPos = $chars.length;
  let pwd = '';
  for (let i = 0; i < len; i++) {
    pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
  }
  return pwd;
}
//不合格品台账状态
export function unacceptedProductStatus(v) {
  let status = '';
  switch (v) {
    case 0:
      status = '待处理';
      break;
    case 1:
      status = '处理中';
      break;
    case 2:
      status = '已处理';
      break;
    case 3:
      status = '已完结';
      break;
  }
  return status;
}
//返工返修状态
export function reworkStatus(v) {
  let status = '';
  switch (v) {
    case 1:
      status = '待处理';
      break;
    case 2:
      status = '处理中';
      break;
    case 3:
      status = '已完成';
      break;
   
  }
  return status;
}
export function hangingStatus(v) {
  let status = '';
  switch (v) {
    case 0:
      status = '未发布';
      break;
    case 1:
      status = '待生产';
      break;
    case 2:
      status = '生产中';
      break;
    case 10:
      status = '已完结';
      break;
  }
  return status;
}
