var a=(v,i,s)=>new Promise((b,d)=>{var g=o=>{try{m(s.next(o))}catch(c){d(c)}},f=o=>{try{m(s.throw(o))}catch(c){d(c)}},m=o=>o.done?b(o.value):Promise.resolve(o.value).then(g,f);m((s=s.apply(v,i)).next())});import{B as M}from"./TableImg.0cd3291c.js";import{T as S}from"./BasicForm.d58d202f.js";import{u as j}from"./useTable.578ae310.js";import{u as I}from"./index.3ccc18ac.js";import{a as G,bR as K,r as N,O as P,a8 as U,o as w,e as V,i as h,x as C,h as p,w as $,Q as q,y as z,G as L}from"./index.ae52ebae.js";import{c as Q,a as H,_ as J}from"./FormModal.a28242db.js";import{f as W,e as y,r as X}from"./busConstantApi.27f88676.js";import{C as F}from"./data.f02cf73e.js";import"./index.beed4ab5.js";import{C as Y}from"./index.52c33256.js";import"./index.e3129508.js";import"./eagerComputed.94e91cab.js";import"./css.bcd121de.js";import"./index.adbf62a5.js";import"./index.0321d0be.js";import"./Checkbox.919eb32a.js";import"./scrollTo.d4c332b7.js";import"./useForm.e55162bc.js";import"./index.11cb8430.js";import"./index.c4be8493.js";import"./index.ddcc0e35.js";import"./useSize.9b10dc05.js";import"./onMountedOrActivated.c176aad3.js";import"./useWindowSizeFn.d176b3a5.js";import"./useContentViewHeight.2a59a8a3.js";import"./ArrowLeftOutlined.0f7d1b9e.js";import"./index.a995b471.js";import"./index.14e14872.js";import"./index.4040b11d.js";import"./index.0c29338b.js";import"./index.0fe57a5b.js";import"./_baseIteratee.432be787.js";import"./get.0b1c6ac7.js";import"./DeleteOutlined.707204c0.js";import"./index.87b4cc3a.js";import"./useRefs.fe3bdf15.js";import"./Form.1cc72784.js";import"./Col.605699c9.js";import"./useFlexGapSupport.3240d255.js";import"./index.c1d6a1f9.js";import"./sortable.esm.c20789c1.js";import"./RedoOutlined.80b8c01a.js";import"./FullscreenOutlined.b9fd5be6.js";import"./index.5d87e81e.js";import"./index.95f887db.js";import"./index.9e0f8a6b.js";/* empty css */import"./index.37fc506d.js";import"./index.5c0d538f.js";import"./uniqBy.7b5fdd96.js";import"./index.3eedf359.js";import"./index.3b88ad02.js";import"./useContextMenu.6088df26.js";import"./index.5e5e8ba1.js";import"./params.cdcdde57.js";const ot=G({__name:"index",setup(v){const{createMessage:i}=L(),{hasPermission:s}=K(),[b,{openModal:d}]=I(),[g,{reload:f,getRawDataSource:m}]=j({title:"\u4EBA\u5458\u5217\u8868 ",api:W,rowKey:"id",columns:Q,showIndexColumn:!0,bordered:!0,pagination:!1,beforeFetch:c,afterFetch:T,actionColumn:{auth:["bus:constant:remove"],width:120,title:"\u64CD\u4F5C",dataIndex:"action",slots:{customRender:"action"}}}),o=N("");function c(e){return Object.assign(e,{type:F.DOCTOR,size:500})}function T(e){return e.map(t=>{let r=[];return t.reviewer&&r.push("reviewer"),t.surgeon&&r.push("surgeon"),t.anesthetists&&r.push("anesthetists"),t.personType=r,t})}function _(e){return a(this,null,function*(){if(!s(["bus:constant:edit"])){i.warning("\u8BF7\u6C42\u672A\u6388\u6743\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458");return}let t={id:e.id,name:e.name,remark:e.remark,anesthetists:e.personType.includes("anesthetists"),reviewer:e.personType.includes("reviewer"),surgeon:e.personType.includes("surgeon")};yield y(F.DOCTOR,t),i.success({content:"\u8BB0\u5F55\u5DF2\u4FDD\u5B58",duration:2})})}function D(l){return a(this,arguments,function*({record:e,value:t,key:r,index:n}){var B;if(!s(["bus:constant:edit"])){i.warning("\u8BF7\u6C42\u672A\u6388\u6743\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458");return}e[r]=t;let u=m().records||[],E={id:o.value||((B=u[n])==null?void 0:B.id),name:e.name,remark:e.remark,anesthetists:u[n].personType.includes("anesthetists"),reviewer:u[n].personType.includes("reviewer"),surgeon:u[n].personType.includes("surgeon")};return(yield y(F.DOCTOR,E))?(i.success({content:"\u8BB0\u5F55\u5DF2\u4FDD\u5B58",duration:2}),!0):!1})}function O(l){return a(this,arguments,function*({record:e,index:t,key:r,value:n}){return e.id=o.value,yield D({record:e,value:n,key:r,index:t})})}function k({record:e}){o.value=e.id}function R(){d(!0)}function x(e){return a(this,null,function*(){yield X(F.DOCTOR,{id:e.id}),i.success("\u5220\u9664\u6210\u529F\uFF01"),yield f()})}function A(){return a(this,null,function*(){yield f()})}return(e,t)=>{const r=P("a-button"),n=U("auth");return w(),V("div",null,[h(p(M),{onRegister:p(g),onEditChange:k,beforeEditSubmit:O},{type:C(({record:l})=>[h(p(Y),{value:l.personType,"onUpdate:value":u=>l.personType=u,options:p(H),onChange:u=>_(l)},null,8,["value","onUpdate:value","options","onChange"])]),toolbar:C(()=>[$((w(),q(r,{type:"primary",onClick:R,preIcon:"ant-design:plus-outlined"},{default:C(()=>[z("\u65B0\u589E")]),_:1})),[[n,["bus:constant:add"]]])]),action:C(({record:l})=>[h(p(S),{actions:[{auth:["bus:constant:remove"],tooltip:"\u5220\u9664",label:"\u5220\u9664",color:"error",popConfirm:{title:"\u662F\u5426\u786E\u8BA4\u5220\u9664",confirm:x.bind(null,l)}}]},null,8,["actions"])]),_:1},8,["onRegister"]),h(J,{onRegister:p(b),onSuccess:A},null,8,["onRegister"])])}}});export{ot as default};