import store from "./store";
//扩展window函数
window.recCodes =  function recCodes(codes) {
  if(codes){
    if (!Array.isArray(codes) || codes.some(item => typeof item!== 'string')) {
      throw new Error('codes 参数必须是一个字符串数组');
    }
    // console.log("菜单触发事件",store.state.tabActive.menuActive);
    //触发自定义事件
    let menuActive = store.state.tabActive.menuActive;
    if(menuActive == 0){//处理单据
      window.dispatchEvent(new CustomEvent('djcl', {
        detail: {
          menuNumber:menuActive,
          menuName:"处理单据",
          tyepEvent:'djcl',
          recCodes: codes
        }
      }));
    }else if(menuActive == 1){//工位上货
      window.dispatchEvent(new CustomEvent('gwsh', {
        detail: {
          menuNumber:menuActive,
          menuName:"工位上货",
          tyepEvent:'gwsh',
          recCodes: codes
        }
      }));
    }else{

    }
  }else{
    alert("收到空数据");
  }

}

export default {


}
