import{_ as e}from"./SimpleKeyboard-DXsrlXvA.js";import{Y as a,e as s,r as l,f as o,g as r,a as t,b as d,q as n,s as p,J as u,L as c,m as i,ad as m,ar as v,U as y,D as j,o as f,v as g,t as b,n as I,F as _,d as k,as as h,_ as x}from"./index-D8tPjwDN.js";import C from"./left-9QZPf6PC.js";import{u as F}from"./consumables-MurZLn2q.js";import{u as T}from"./emergency-yY56qK8M.js";import{u as B}from"./device-Dgp0NsXI.js";import{u as S}from"./settingTestTube-DJHgdVw6.js";import{e as w}from"./index-DGBKTRr-.js";import"./SimpleKeyboard.vue_vue_type_style_index_0_scoped_f4a16455_lang-DZfZa1Aw.js";import"./reduce-C-cHtDxk.js";import"./_curry1-D3PJq_hl.js";import"./_curry2-Ngzhmcdp.js";import"./equals-cwY-6C0z.js";import"./_has-CZhjUFgV.js";const E={id:"add-emergency-container"},D={class:"emergency-userid"},O=["value"],P=["value"],q={class:"emergency-project"},K={class:"project-list"},M=["onClick"],A={class:"proj-name"},J={class:"type-list"},L=["onClick"],N={class:"emergency-btns",style:{padding:"50px 0"}},U={key:0,class:"keyboard"},G=x(s({name:"EmergencyForm",__name:"Emergency",setup(s){const x=F(),G=T(),H=B(),R=S(),V=e=>{const a=(e=>Y.value.projIds.includes(e.projId))(e);return a?{border:"solid 1px transparent",backgroundColor:x.projIdColorMap[e.projId],color:"#FFF"}:{border:`solid 1px ${x.projIdColorMap[e.projId]}`,backgroundColor:"#FFF",color:x.projIdColorMap[e.projId]}},Y=l({sampleBarcode:"",userid:"",projIds:[],bloodType:""}),$=j(),z=()=>{$.go(-1)},Q=async()=>{const e=Y.value;if(0===e.projIds.length)return void w.error("请选择项目");if(!e.bloodType)return void w.error("请选择血液类型");const s=await(async e=>{try{return(await a.post("/api/v1/app/emergencyTube/addNew",e)).data}catch(s){}})(Y.value);s&&s.success?z():s&&s.data&&s.data.info&&w.error(s.data.info)};o((()=>{G.emergencyInfo&&("IDLE"===H.deviceState.workState||"PAUSE"===H.deviceState.workState&&"TO_BE_PROCESSED"===G.emergencyInfo.state)&&(Y.value={sampleBarcode:G.emergencyInfo.sampleBarcode,userid:G.emergencyInfo.userid,projIds:G.emergencyInfo.projIds,bloodType:G.emergencyInfo.bloodType})}));const W=l(!1),X=l(""),Z=l(""),ee=e=>{"sampleBarcode"==e&&(X.value=Y.value.sampleBarcode),"userid"==e&&(X.value=Y.value.userid),Z.value=e,W.value=!0},ae=e=>{Z.value&&(X.value=e,"sampleBarcode"===Z.value?Y.value.sampleBarcode=e:Y.value.userid=e)},se=e=>{if("{enter}"===e)le();else if("{bksp}"===e){const e=X.value;if(e.length>0){const a=e.slice(0,-1);ae(a)}}},le=()=>{W.value=!1,Z.value="",X.value=""};return r((()=>{le()})),(a,s)=>{const l=h,o=v,r=y,j=e;return f(),t("div",E,[d("div",{class:"page-header",onClick:z},s[2]||(s[2]=[d("img",{class:"page-header-icon",src:C},null,-1),d("div",{class:"page-header-title"},"添加急诊",-1)])),d("div",D,[n(o,null,{default:p((()=>[n(l,{span:5},{default:p((()=>s[3]||(s[3]=[d("label",null,"样本条形码",-1)]))),_:1}),n(l,{span:12,style:{"padding-left":"20px"}},{default:p((()=>[d("input",{type:"text",placeholder:"请输入样本条形码信息",onFocus:s[0]||(s[0]=e=>ee("sampleBarcode")),style:{width:"400px"},value:Y.value.sampleBarcode,readonly:""},null,40,O)])),_:1})])),_:1}),n(o,null,{default:p((()=>[n(l,{span:5},{default:p((()=>s[4]||(s[4]=[d("label",null,"用户ID",-1)]))),_:1}),n(l,{span:12,style:{"padding-left":"20px"}},{default:p((()=>[d("input",{type:"text",placeholder:"请输入用户ID信息",onFocus:s[1]||(s[1]=e=>ee("userid")),value:Y.value.userid,style:{width:"400px"},readonly:""},null,40,P)])),_:1})])),_:1})]),s[9]||(s[9]=d("hr",{style:{height:"1px",border:"none"}},null,-1)),d("div",q,[s[5]||(s[5]=d("div",{class:"project-title"},[d("span",null,"项目选择")],-1)),d("div",K,[(f(!0),t(u,null,c(i(x).projectsAvailable,(e=>(f(),t("div",{key:e.projId,class:"project-item",style:g(V(e)),onClick:a=>(e=>{const a=Y.value.projIds.findIndex((a=>a===e.projId));a>-1?Y.value.projIds.splice(a,1):Y.value.projIds.push(e.projId)})(e)},[d("span",A,b(e.projName),1),d("span",null,b(e.num),1)],12,M)))),128))]),s[6]||(s[6]=d("div",{class:"project-title"},[d("span",null,"血液类型")],-1)),d("div",J,[(f(!0),t(u,null,c(i(R).bloodTypes,(e=>(f(),t("div",{key:e.key,onClick:a=>(e=>{Y.value.bloodType=e.key})(e),class:I(["blood-button",{active:Y.value.bloodType===e.key}])},b(e.name),11,L)))),128))])]),s[10]||(s[10]=d("hr",{style:{height:"1px",border:"none"}},null,-1)),d("div",N,[n(r,{class:"cancel-button",onClick:z},{default:p((()=>s[7]||(s[7]=[_("取消")]))),_:1}),n(r,{class:"ok-button",onClick:Q},{default:p((()=>s[8]||(s[8]=[_("确定")]))),_:1})]),n(m,{name:"slide-up"},{default:p((()=>[W.value?(f(),t("div",U,[n(j,{input:X.value,onOnChange:ae,onOnKeyPress:se},null,8,["input"])])):k("",!0)])),_:1})])}}}),[["__scopeId","data-v-6c7abfd4"]]);export{G as default};
