You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
6.7 KiB
JavaScript
2 lines
6.7 KiB
JavaScript
import{o as ee,r as i,c as te,d as u,e as m,f as o,w as d,k,q as E,h as le,i as n,j as y,F as I,t as C,x as M,v as A,aM as ae,l as ne,g as p,W as oe,E as D,aN as re,aO as de}from"./index-beddc4e2.js";const ue={key:0,style:{"margin-top":"16px"}},se={style:{"font-weight":"bold","margin-bottom":"8px"}},ie={class:"dialog-footer"},pe={__name:"DepartmentResourcesSave",props:{departmentId:{},resourceInfo:{type:Object}},emits:["closeAddResources"],setup(N,{emit:F}){let f=p(!1),g=p(!0),L=p([]),b=p(null),h=p(!0),l=p({id:null,department_id:null,department_resources_name:"",department_resources_status:1,department_resources_addr:"",time_mode:0,time_range:[],appointment_enabled:1,execute_department_id:null});const _=p([{type:"1",type_name:"夏季排班",periods:[["",""]]},{type:"2",type_name:"冬季排班",periods:[["",""]]}]),G=a=>{const e=_.value.find(s=>s.type===a);e&&e.periods.push(["",""])},T=(a,e)=>{const s=_.value.find(v=>v.type===a);s&&s.periods.length>1&&s.periods.splice(e,1)},$=a=>a.map(e=>({start:e[0],end:e[1]})),P=a=>a.map(e=>[e.start,e.end]),q=a=>{a==1&&_.value.length===0&&(_.value=[{type:"1",type_name:"夏季排班",periods:[["",""]]},{type:"2",type_name:"冬季排班",periods:[["",""]]}])},r=N;let S=p([]);const W=()=>{f.value=!0,oe({}).then(a=>{f.value=!1,a.status?S.value=a.data.list:D.error(a.msg)})},H=()=>{if(!(O(l.value.department_id)&&O(l.value.department_resources_name)))return D.error("请填写完整内容"),!1;l.value.time_range=_.value.map(a=>({type:a.type,type_name:a.type_name,periods:$(a.periods)})),l.value.execute_department_id===null&&(l.value.execute_department_id=0),f.value=!0,re({info:l.value}).then(a=>{f.value=!1,a.status?(D({message:"保存成功",type:"success"}),w()):D.error(a.msg)})},J=F,w=()=>{J("closeAddResources")},B=a=>{a&&de({department_id:a}).then(e=>{if(e.status){if(L.value=e.data.list,!e.data.list||e.data.list.length===0){h.value=!1,l.value.execute_department_id=null;return}h.value=!0,b.value!==null&&e.data.list.some(v=>v.id===b.value)?l.value.execute_department_id=b.value:l.value.execute_department_id=null}})},K=a=>{B(a)},O=a=>a!==null&&a!=="";return ee(()=>{console.log(r.departmentId),console.log(r.resourceInfo);let a=r.departmentId;r.resourceInfo!=null&&r.resourceInfo.id!=null&&(a=r.resourceInfo.department_id,l.value.id=r.resourceInfo.id,l.value.department_resources_name=r.resourceInfo.department_resources_name,l.value.department_resources_addr=r.resourceInfo.department_resources_addr,l.value.department_resources_status=r.resourceInfo.department_resources_status,l.value.appointment_enabled=r.resourceInfo.appointment_enabled??1,l.value.execute_department_id=r.resourceInfo.execute_department_id,b.value=r.resourceInfo.execute_department_id,l.value.time_mode=r.resourceInfo.time_mode||0,r.resourceInfo.time_range&&r.resourceInfo.time_range.length>0&&(_.value=r.resourceInfo.time_range.map(e=>({type:e.type,type_name:e.type_name,periods:P(e.periods)})))),l.value.department_id=a,B(a),W()}),(a,e)=>{const s=i("el-option"),v=i("el-select"),c=i("el-form-item"),j=i("el-input"),U=i("el-switch"),Q=i("el-date-picker"),V=i("el-button"),X=i("el-form"),Y=i("el-dialog"),Z=te("loading");return u(),m("div",null,[o(Y,{modelValue:n(g),"onUpdate:modelValue":e[8]||(e[8]=t=>ne(g)?g.value=t:g=t),title:"排班信息",width:"calc(40% + 80px)",onClose:e[9]||(e[9]=t=>w())},{footer:d(()=>[k("span",ie,[o(V,{onClick:e[7]||(e[7]=t=>w())},{default:d(()=>[...e[11]||(e[11]=[E("取消",-1)])]),_:1}),o(V,{type:"primary",onClick:H},{default:d(()=>[...e[12]||(e[12]=[E(" 确定 ",-1)])]),_:1})])]),default:d(()=>[le((u(),y(X,{model:n(l),"label-width":"110px",style:{"padding-right":"40px"}},{default:d(()=>[N.departmentId?M("",!0):(u(),y(c,{key:0,label:"所属科室:"},{default:d(()=>[o(v,{filterable:!0,clearable:"",modelValue:n(l).department_id,"onUpdate:modelValue":e[0]||(e[0]=t=>n(l).department_id=t),placeholder:"选择科室",onChange:K},{default:d(()=>[(u(!0),m(I,null,C(n(S),(t,R)=>(u(),y(s,{key:R,label:t.department_name,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})),o(c,{label:"排班名称:"},{default:d(()=>[o(j,{modelValue:n(l).department_resources_name,"onUpdate:modelValue":e[1]||(e[1]=t=>n(l).department_resources_name=t)},null,8,["modelValue"])]),_:1}),o(c,{label:"资源位置:"},{default:d(()=>[o(j,{modelValue:n(l).department_resources_addr,"onUpdate:modelValue":e[2]||(e[2]=t=>n(l).department_resources_addr=t)},null,8,["modelValue"])]),_:1}),o(c,{label:"状态:"},{default:d(()=>[o(U,{modelValue:n(l).department_resources_status,"onUpdate:modelValue":e[3]||(e[3]=t=>n(l).department_resources_status=t),"active-text":"可用","inactive-text":"关闭","active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1}),o(c,{label:"参与预约:"},{default:d(()=>[o(U,{modelValue:n(l).appointment_enabled,"onUpdate:modelValue":e[4]||(e[4]=t=>n(l).appointment_enabled=t),"active-text":"是","inactive-text":"否","active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1}),o(c,{label:"时令:"},{default:d(()=>[k("div",null,[o(U,{modelValue:n(l).time_mode,"onUpdate:modelValue":e[5]||(e[5]=t=>n(l).time_mode=t),size:"large","active-text":"开启","inactive-text":"关闭","active-value":1,"inactive-value":0,onChange:q},null,8,["modelValue"])]),n(l).time_mode==1?(u(),m("div",ue,[(u(!0),m(I,null,C(_.value,t=>(u(),m("div",{key:t.type,style:{"margin-bottom":"16px"}},[k("div",se,A(t.type_name),1),(u(!0),m(I,null,C(t.periods,(R,x)=>(u(),m("div",{key:x,style:{display:"flex","align-items":"center","margin-bottom":"8px"}},[o(Q,{modelValue:t.periods[x],"onUpdate:modelValue":z=>t.periods[x]=z,type:"daterange",format:"MM-DD","value-format":"MM-DD","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期",style:{width:"400px"}},null,8,["modelValue","onUpdate:modelValue"]),o(V,{type:"danger",icon:n(ae),onClick:z=>T(t.type,x),disabled:t.periods.length<=1,size:"small",plain:"",circle:"",style:{"margin-left":"8px"}},null,8,["icon","onClick","disabled"])]))),128)),o(V,{type:"primary",onClick:R=>G(t.type),size:"small"},{default:d(()=>[E(" 新增"+A(t.type_name)+"周期 ",1)]),_:2},1032,["onClick"])]))),128))])):M("",!0),e[10]||(e[10]=k("div",{style:{"margin-left":"18px",color:"#ff8b7c"}}," 注意:调整时令,会影响该资源下全部模板 ",-1))]),_:1}),n(h)?(u(),y(c,{key:1,label:"执行诊室:"},{default:d(()=>[o(v,{modelValue:n(l).execute_department_id,"onUpdate:modelValue":e[6]||(e[6]=t=>n(l).execute_department_id=t),clearable:"",filterable:"",placeholder:"请选择执行诊室",style:{width:"100%"}},{default:d(()=>[(u(!0),m(I,null,C(n(L),t=>(u(),y(s,{key:t.id,label:t.department_name,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):M("",!0)]),_:1},8,["model"])),[[Z,n(f)]])]),_:1},8,["modelValue"])])}}};export{pe as _};
|