var d=(a,t,e)=>new Promise((i,n)=>{var c=l=>{try{r(e.next(l))}catch(s){n(s)}},m=l=>{try{r(e.throw(l))}catch(s){n(s)}},r=l=>l.done?i(l.value):Promise.resolve(l.value).then(c,m);r((e=e.apply(a,t)).next())});import{j as h,a as v,bR as C,p as b,r as y,o as E,e as w,i as A,h as B,G as I,X as D}from"./index.ae52ebae.js";import{B as _}from"./BasicForm.d58d202f.js";import{u as T}from"./useForm.e55162bc.js";import{d as p}from"./busConstantApi.27f88676.js";import{k as P,l as S}from"./busPatientApi.88d3ef24.js";import{f as k}from"./busHospitalConfigApi.7ecc8807.js";const V=[{title:"\u4F4F\u9662\u53F7",dataIndex:"code",width:120,fixed:!0},{title:"\u59D3\u540D",dataIndex:"name"},{title:"\u6027\u522B",dataIndex:"gender",slots:{customRender:"gender"},width:50},{title:"\u5E74\u9F84",dataIndex:"age",width:50},{title:"\u75C5\u533A",dataIndex:"ward",width:150},{title:"\u5E8A\u53F7",dataIndex:"bedNo",width:50},{title:"\u624B\u672F\u540D\u79F0",dataIndex:"surgeryName",width:120},{title:"\u9EBB\u9189\u533B\u751F",dataIndex:"anaDoctor",width:100}],L=[{label:"\u59D3\u540D",value:"\u65E0",field:"name",lg:8,xxl:8},{label:"\u6027\u522B",value:{text:"\u672A\u77E5"},field:"gender",lg:8,xxl:8,isObject:!0},{label:"\u5E74\u9F84",value:"0",field:"age",lg:8,xxl:8,suffix:"\u5C81"},{label:"\u4F4F\u9662\u53F7",value:"0",field:"code",lg:8,xxl:8},{label:"\u75C5\u533A",value:"0",field:"ward",lg:8,xxl:8},{label:"\u5E8A\u53F7",value:"0",field:"bedNo",lg:8,xxl:8},{label:"\u4F53\u91CD",value:"0",field:"weight",lg:8,xxl:8,suffix:"kg"},{label:"\u8EAB\u9AD8",value:"0",field:"height",lg:8,xxl:8,suffix:"cm"}],G=[{label:"\u9EBB\u9189\u533B\u751F",value:"\u65E0",field:"anaDoctor",lg:8,xxl:8},{label:"\u9EBB\u9189\u65B9\u5F0F",value:"\u65E0",field:"anaType",lg:8,xxl:8},{label:"\u9547\u75DB\u65B9\u5F0F",value:"\u65E0",field:"analType",lg:8,xxl:8},{label:"ASA",value:"\u65E0",field:"asa",lg:8,xxl:8},{label:"\u624B\u672F\u533B\u5E08",value:"\u65E0",field:"surgeryDoctor",lg:8,xxl:8},{label:"\u624B\u672F\u540D\u79F0",value:"\u65E0",field:"surgeryName",lg:24,xxl:24},{label:"\u914D\u65B9",value:"\u65E0",field:"formula",lg:24,xxl:24,slot:"formula",isSlot:!0}],R=[{field:"undoBy",label:"\u64A4\u6CF5\u4EBA\uFF1A",component:"ApiSelect",componentProps:({formModel:a})=>({placeholder:"\u8BF7\u9009\u62E9\u64A4\u6CF5\u4EBA\u5458",showSearch:!0,notFoundContent:null,filterOption:!0,onSearch:t=>{t&&(a.undoBy=t)},api:p,params:{size:500,includes:["id","name"],wheres:[{column:"reviewer",termType:"eq",type:"and",value:!0}]},labelField:"name",valueField:"name",resultField:"records",getPopupContainer:()=>document.body}),itemProps:{validateTrigger:"blur"}},{field:"destroyer",label:"\u9500\u6BC1\u4EBA\uFF1A",component:"ApiSelect",componentProps:({formModel:a})=>({placeholder:"\u8BF7\u9009\u62E9\u9500\u6BC1\u4EBA\u5458",showSearch:!0,notFoundContent:null,filterOption:!0,onSearch:t=>{t&&(a.destroyer=t)},api:p,params:{size:500,includes:["id","name"],wheres:[{column:"reviewer",termType:"eq",type:"and",value:!0}]},labelField:"name",valueField:"name",resultField:"records",getPopupContainer:()=>document.body}),itemProps:{validateTrigger:"blur"}},{field:"witnesses",label:"\u89C1\u8BC1\u4EBA\uFF1A",component:"ApiSelect",componentProps:({formModel:a})=>({placeholder:"\u8BF7\u9009\u62E9\u89C1\u8BC1\u4EBA\u5458",showSearch:!0,notFoundContent:null,filterOption:!0,onSearch:t=>{t&&(a.witnesses=t)},api:p,params:{size:500,includes:["id","name"],wheres:[{column:"reviewer",termType:"eq",type:"and",value:!0}]},labelField:"name",valueField:"name",resultField:"records",getPopupContainer:()=>document.body}),itemProps:{validateTrigger:"blur"}},{field:"undoTime",label:"\u64A4\u6CF5\u65F6\u95F4\uFF1A",component:"DatePicker",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u64A4\u6CF5\u65F6\u95F4",trigger:"blur"}],componentProps:{placeholder:"\u8BF7\u8F93\u5165\u521B\u5EFA\u65F6\u95F4",format:"YYYY-MM-DD HH:mm:ss",showTime:{format:"HH:mm:ss"},getPopupContainer:()=>document.body},defaultValue:new Date}];const q=v({__name:"EndRunHead",props:{data:{type:Object,default:()=>{}},isUndo:{type:Boolean,default:!1},deviceIds:{type:Array,default:()=>[]}},emits:["success"],setup(a,{emit:t}){const e=a,{hasPermission:i}=C(),{createMessage:n}=I(),[c,{validate:m,updateSchema:r,setFieldsValue:l}]=T({labelWidth:100,schemas:R,showResetButton:!1,submitButtonOptions:{text:"\u786E\u8BA4\u63D0\u4EA4"},submitFunc:x,actionColOptions:{span:23}});b(()=>d(this,null,function*(){e.data,yield g()}));let s=y({enable:0,destroyerCheck:0,undoByCheck:0,witnessesCheck:0});function g(){return d(this,null,function*(){var F;let u=yield k({size:1,wheres:[{column:"type",value:"undo",termType:"eq"}]});if(u&&u.records.length){const f=(F=u.records[0].config)==null?void 0:F.manual;s.value=f,l({undoBy:null,destroyer:null,witnesses:null,undoTime:new Date}),yield r([{field:"undoBy",rules:[{required:s.value.undoByCheck===1,message:"\u8BF7\u9009\u62E9\u6216\u8005\u8F93\u5165\u89C1\u8BC1\u4EBA",trigger:"blur"}]},{field:"destroyer",rules:[{required:s.value.destroyerCheck===1,message:"\u8BF7\u9009\u62E9\u6216\u8005\u8F93\u5165\u89C1\u8BC1\u4EBA",trigger:"blur"}]},{field:"witnesses",rules:[{required:s.value.witnessesCheck===1,message:"\u8BF7\u9009\u62E9\u6216\u8005\u8F93\u5165\u89C1\u8BC1\u4EBA",trigger:"blur"}]}])}})}function x(){return d(this,null,function*(){e.deviceIds;const o=yield m();let u={undo:{destroyer:o.destroyer,undoBy:o.undoBy,undoTime:o.undoTime,witnesses:o.witnesses}};if(e.isUndo){if(u.deviceIds=e.deviceIds,u.monitorType=!0,u.patientCode=e.data.code,u.patientId=e.data.patientId,!i(["bus:clinic:edit"])){n.warning("\u8BF7\u6C42\u672A\u6388\u6743\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458");return}yield P(u),n.success("\u64A4\u6CF5\u6210\u529F")}else{if(u.clinicIds=[e.data.clinicId],u.patientCodes=[e.data.code],u.patientIds=[e.data.patientId],!i(["patient:finished:1"])){n.warning("\u8BF7\u6C42\u672A\u6388\u6743\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458");return}yield S(!0,u),n.success("\u7ED3\u675F\u6210\u529F")}t("success")})}return(o,u)=>(E(),w("div",null,[A(B(_),{onRegister:B(c)},null,8,["onRegister"])]))}});var H=h(q,[["__scopeId","data-v-417c04fe"]]);const W=D(H);export{W as E,V as c,L as p,G as s};