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