import{u as x}from"./useInstance.233fbdde.js";import{e as h,a as N,d as R}from"./shift.e85f39e5.js";import{d as j,s as I,r as E,b as c,p as L,c as n,e as V,k as M,i as s,h as l,u as o,f as T,j as $,F as q,a2 as z,m as D,E as B}from"./index.0308b213.js";const G=D("\u63D0\u4EA4"),J=D("\u53D6\u6D88"),Q=j({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(b,{emit:p}){const m=b,{global:v}=x(),y=[{label:"\u5DE5\u4F5C",value:"working"},{label:"\u4F11\u606F",value:"rest"}];let C=I(()=>Number(m.id)>0);const _=E(!1),F=E(),e=c({id:"",title:"",type:"working",start_time:"",end_time:"",rest_start_time:"",rest_end_time:""}),g=()=>{e.id>0?h(e).then(u=>{B({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),i()}):N(e).then(u=>{B({message:"\u65B0\u589E\u6210\u529F",type:"success"}),i()})};L(()=>m.modelValue,u=>{_.value=u,u&&m.id&&(e.id=m.id,k())}),c({list:[]});const k=()=>{R({id:m.id}).then(u=>{u=u.data,e.id=u.id,e.title=u.title,e.type=u.type,e.start_time=u.start_time,e.end_time=u.end_time,e.rest_start_time=u.rest_start_time,e.rest_end_time=u.rest_end_time})},i=()=>{p("update:modelValue",!1),p("onClose"),v.$resetForm(F.value,e)};return(u,a)=>{const H=n("el-input"),d=n("el-form-item"),U=n("el-option"),w=n("el-select"),r=n("el-time-picker"),f=n("el-button"),A=n("el-dialog");return V(),M(A,{modelValue:_.value,"onUpdate:modelValue":a[6]||(a[6]=t=>_.value=t),title:o(C)?"\u67E5\u770B\u73ED\u6B21(\u4F11\u606F\u73ED\u6B21\u65F6\u95F4\u53EF\u4EE5\u90FD\u4E0D\u586B\u5199)":"\u65B0\u589E\u73ED\u6B21(\u4F11\u606F\u73ED\u6B21\u65F6\u95F4\u53EF\u4EE5\u90FD\u4E0D\u586B\u5199)",width:"70%","destroy-on-close":"",onClose:i},{default:s(()=>[l(o(z),{ref_key:"formRef",ref:F,model:o(e),"inline-message":!0,"label-width":"160px"},{default:s(()=>[l(d,{label:"\u73ED\u6B21\u6807\u9898"},{default:s(()=>[l(H,{modelValue:o(e).title,"onUpdate:modelValue":a[0]||(a[0]=t=>o(e).title=t),placeholder:"\u73ED\u6B21\u6807\u9898"},null,8,["modelValue"])]),_:1}),l(d,{label:"\u7C7B\u578B"},{default:s(()=>[l(w,{modelValue:o(e).type,"onUpdate:modelValue":a[1]||(a[1]=t=>o(e).type=t),placeholder:"\u8BF7\u9009\u62E9\u7C7B\u578B"},{default:s(()=>[(V(),T(q,null,$(y,t=>l(U,{key:t.value,label:t.label,value:t.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1}),l(d,{label:"\u4E0A\u73ED\u65F6\u95F4"},{default:s(()=>[l(r,{modelValue:o(e).start_time,"onUpdate:modelValue":a[2]||(a[2]=t=>o(e).start_time=t),placeholder:"\u4E0A\u73ED\u65F6\u95F4","value-format":"HH:mm:ss"},null,8,["modelValue"])]),_:1}),l(d,{label:"\u4E0B\u73ED\u65F6\u95F4"},{default:s(()=>[l(r,{modelValue:o(e).end_time,"onUpdate:modelValue":a[3]||(a[3]=t=>o(e).end_time=t),placeholder:"\u4E0B\u73ED\u65F6\u95F4","value-format":"HH:mm:ss"},null,8,["modelValue"])]),_:1}),l(d,{label:"\u4F11\u606F\u5F00\u59CB\u65F6\u95F4"},{default:s(()=>[l(r,{modelValue:o(e).rest_start_time,"onUpdate:modelValue":a[4]||(a[4]=t=>o(e).rest_start_time=t),placeholder:"\u4F11\u606F\u5F00\u59CB\u65F6\u95F4","value-format":"HH:mm:ss"},null,8,["modelValue"])]),_:1}),l(d,{label:"\u4F11\u606F\u7ED3\u675F\u65F6\u95F4"},{default:s(()=>[l(r,{modelValue:o(e).rest_end_time,"onUpdate:modelValue":a[5]||(a[5]=t=>o(e).rest_end_time=t),placeholder:"\u4F11\u606F\u7ED3\u675F\u65F6\u95F4","value-format":"HH:mm:ss"},null,8,["modelValue"])]),_:1}),l(d,null,{default:s(()=>[l(f,{type:"primary",onClick:g},{default:s(()=>[G]),_:1}),l(f,{onClick:i},{default:s(()=>[J]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{Q as _};
