import e from"./stop_s-gO1dx3DD.js";import{u as t}from"./consumables-CTmb_gxU.js";import{u as s}from"./settingTestTube-DKc4MTR2.js";import{a,e as o}from"./socket-BAyDdojS.js";import{_ as u,r as l,u as r,w as c,al as p,V as n,o as b,a as d,t as i,d as m,b as y,l as h,s as j}from"./index-C1tQD-C0.js";const v={key:0,class:"order"},I={key:1,class:"tube-circle"},g={key:0,class:"tube-circle-empty"},f={key:1,class:"add-symbol"},k={class:"text-layer"},T={class:"blood-text"},M={key:4,class:"user-id"},N=u({__name:"Tube",props:{tube:{type:Object},showNum:{type:Boolean,default:!0},showUserId:{type:Boolean,default:!0},tubeNo:{type:Number},type:{type:String}},emits:["clickTubeItem"],setup(u,{emit:N}){const w=u,x=s(),_=t(),B=l(x.selectedBloodTypeKey),C=e=>e&&(e.projId||e.projIds)||[],P=r("canvas"),F=l();return c((()=>w.tube),(e=>{F.value=w.tube;const t=C(w.tube);t.length>0&&p((()=>{if(P.value){const e=t.map(((e,t)=>({value:1,color:_.projIdColorMap[e]||w.tube.projInfo[t].color||"#FFF"})));!function(e,t){let s=t.reduce(((e,t)=>e+t.value),0),a=2===t.length?0:-.5*Math.PI;const o=P.value.getBoundingClientRect();t.forEach((t=>{const u=t.value/s*2*Math.PI;e.beginPath(),e.moveTo(o.width/2,o.height/2),e.arc(o.width/2,o.height/2,o.width/2,a,a+u,!1),e.closePath(),e.fillStyle=t.color,e.fill(),e.strokeStyle="#dcdcdc",e.stroke(),a+=u}))}(P.value.getContext("2d"),e)}}))}),{immediate:!0}),n((()=>{B.value=x.selectedBloodTypeKey})),(t,s)=>{var l;return b(),d("div",{class:"tube-item",onClick:s[1]||(s[1]=e=>t.$emit("clickTubeItem",u.tubeNo||u.tube&&u.tube.tubeIndex))},[u.showNum?(b(),d("span",v,i(u.tubeNo?u.tubeNo:u.tube.tubeIndex+1),1)):m("",!0),0===C(u.tube).length?(b(),d("div",I,["running"===u.type?(b(),d("div",g,s[2]||(s[2]=[y("img",{src:e,alt:"empty"},null,-1)]))):(b(),d("span",f,"+"))])):(b(),d("div",{key:2,class:"tube-project",onClick:s[0]||(s[0]=e=>{u.tube})},[y("canvas",{class:"canvas",ref_key:"canvas",ref:P,width:"58",height:"58"},null,512),y("div",k,[y("span",null,i(1===C(u.tube).length?h(x).projectIdMap[C(u.tube)[0]]?h(x).projectIdMap[C(u.tube)[0]].projName:"":2===C(u.tube).length&&h(x).projectIdMap[C(u.tube)[1]]?h(x).projectIdMap[C(u.tube)[1]].projName:""),1),y("span",T,i(u.tube&&u.tube.bloodType?null==(l=h(x).bloodTypeKeyMap[u.tube.bloodType])?void 0:l.name:""),1),y("span",null,i(2===C(u.tube).length&&h(x).projectIdMap[C(u.tube)[0]]?h(x).projectIdMap[C(u.tube)[0]].projName:""),1)])])),"running"===u.type?(b(),d("span",{key:3,class:"user-id",style:j(`color:${u.tube&&h(a)[u.tube.state]}`)},i(u.tube&&u.tube.projIds&&u.tube.projIds.length&&h(o)[u.tube.state]||"空"),5)):(b(),d("span",M,i(u.tube&&u.tube.userid||"-"),1))])}}},[["__scopeId","data-v-c2b511ba"]]);export{N as T};
