@studio-west/employees 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),V=require("./index-CHGzf-XH.cjs"),W=require("vue-i18n"),Z=require("file-saver"),Q=require("exceljs"),d=require("element-plus"),O=require("@imengyu/vue3-context-menu");function ee(D){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const n in D)if(n!=="default"){const g=Object.getOwnPropertyDescriptor(D,n);Object.defineProperty(x,n,g.get?g:{enumerable:!0,get:()=>D[n]})}}return x.default=D,Object.freeze(x)}const te=ee(Q),le=(D,x)=>{const n=D.__vccOpts||D;for(const[g,u]of x)n[g]=u;return n},ae={class:"wrapper"},ne={class:"month_year"},oe={class:"text"},ue={class:"week"},re={class:"month"},ie=["onClick"],de={key:0},ce={class:"month_year"},se={class:"text"},ve={class:"week"},me={class:"month"},fe=["onClick"],ge={__name:"DataPicker",props:{data:Object,limitation:{type:[Boolean,Object],default:()=>!1},range:{type:String,default:()=>"solid"}},emits:["init"],setup(D,{emit:x}){var L,U,P,z;const n=e.ref(new Date),g=e.ref(new Date),u=D,F=x,h=e.ref(new Date().getFullYear()),B=e.ref(new Date().getMonth()),Y=e.ref(new Date().getFullYear()),m=e.ref(new Date().getMonth()),c=e.ref([]),T=e.ref(0),M=e.ref(0),p=e.ref(-1),k=e.ref(-1),{locale:A}=W.useI18n(),b=/en|zh|ja|he/.test(A.value)?0:1,N=u.range==="range"?2:1,$=s=>{const r=s.split(s.match(/\D.*?\D?/));return r[0].length>2?r.join("-")+"T00:00:01":r.reverse().join("-")+"T00:00:01"};typeof((L=u.data)==null?void 0:L.startDate)<"u"&&(n.value=new Date($(u.data.startDate)),h.value=n.value.getFullYear(),m.value=n.value.getMonth()),typeof((U=u.data)==null?void 0:U.endDate)<"u"&&(g.value=new Date($(u.data.endDate)),Y.value=g.value.getFullYear(),B.value=g.value.getMonth());const v=()=>{let s=new Date(h.value,m.value,0);for(let a=s.getDate()-s.getDay()+b;a<=s.getDate()&&s.getDay()!==6+b;a++)T.value++,c.value.push({day:a,month:s.getMonth(),year:s.getFullYear(),class:[]});for(let a=1;a<=new Date(h.value,m.value+1,0).getDate();a++)T.value++,c.value.push({day:a,month:m.value,year:h.value,class:[]});if(u.range==="range"){M.value=new Date(h.value,m.value+2,0);for(let a=1;a<=M.value.getDate();a++)c.value.push({day:a,month:M.value.getMonth(),year:M.value.getFullYear(),class:[]})}let r=new Date(h.value,m.value+N,1);for(let a=1;a<=(7-r.getDay()+b)%7&&r.getDay()!==b;a++)c.value.push({day:a,month:r.getMonth(),year:r.getFullYear(),class:[]});u.data.holiday.length!==0&&(u.data.holiday.preholidays.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="preholiday")}),u.data.holiday.holidays.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="weekend")}),u.data.holiday.holiday.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="holiday")}),u.data.holiday.nowork.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="nowork")}))},q=(s,r)=>{let a=s-r+1;for(let i=0;i<=s-r;i++)c.value[i+r].class[0]==="holiday"&&a--;return a},E=(s,r)=>{const a=V.parseTime(new Date(s.year,s.month,s.day),"{dd}.{m}.{Y}");if(u.range==="range")if(console.log(p.value),k.value!==-1){if(k.value<=p.value)for(let i=k.value;i<=p.value;i++)c.value[i].class[1]="";else for(let i=p.value;i<=k.value;i++)c.value[i].class[1]="";p.value=r,k.value=-1,c.value[r].class[1]="active"}else if(p.value!==-1){if(k.value=r,k.value>=p.value)for(let y=p.value+1;y<r;y++)c.value[y].class[1]="select";else for(let y=r+1;y<p.value;y++)c.value[y].class[1]="select";c.value[r].class[1]="active";let i=V.parseTime(new Date(c.value[p.value].year,c.value[p.value].month,c.value[p.value].day),"{dd}.{m}.{Y}");p.value>r?F("input",{dateStart:a,dateEnd:i,count:q(p.value,r)}):F("input",{dateStart:i,dateEnd:a,count:q(r,p.value)})}else p.value=r,c.value[r].class[1]="active";else c.value[p.value].class[1]="",p.value=r,c.value[r].class[1]="active",F("input",{dateStart:a,count:1})};if(v(),typeof((P=u.data)==null?void 0:P.startDate)<"u"&&(p.value=c.value.findIndex(s=>s.day===n.value.getDate()&&s.month===m.value&&s.year===h.value),c.value[p.value].class[1]="active"),typeof((z=u.data)==null?void 0:z.endDate)<"u"&&u.range==="range"){k.value=c.value.findIndex(s=>s.day===g.value.getDate()&&s.month===B.value&&s.year===Y.value),c.value[k.value].class[1]="active";for(let s=p.value+1;s<k.value;s++)c.value[s].class[1]="select"}const I=(s,r)=>{j(s,r)&&(c.value=[],T.value=0,n.value=new Date(s,r,1),h.value=n.value.getFullYear(),m.value=n.value.getMonth(),v())},j=(s,r)=>{if(!u.limitation)return!0;if(u.limitation.dateStart){console.log(u.limitation.dateStart);let a=u.limitation.dateStart.split(u.limitation.dateStart.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])>s||parseInt(a[2])===s&&parseInt(a[1])>r+1)return!1}if(u.limitation.dateEnd){console.log(u.limitation.dateEnd);let a=u.limitation.dateEnd.split(u.limitation.dateEnd.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])<s||parseInt(a[2])===s&&parseInt(a[1])<r+N)return!1}return!0};return(s,r)=>(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",null,[e.createElementVNode("p",ne,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[0]||(r[0]=a=>I(h.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[1]||(r[1]=a=>I(h.value,m.value-1))},"‹")]),e.createElementVNode("span",oe,[e.createElementVNode("button",null,e.toDisplayString(h.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[2]||(r[2]=a=>I(h.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[3]||(r[3]=a=>I(h.value+1,m.value))},"»")])]),e.createElementVNode("div",ue,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i<T.value+(7-new Date(h.value,m.value+1,1).getDay()+e.unref(b))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===m.value&&(!u.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date($(u.limitation.dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date($(u.limitation.dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===m.value&&E(a,i)}},e.toDisplayString(a.day),11,ie)):e.createCommentVNode("",!0)],64))),128))])]),u.range==="range"?(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("p",ce,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[4]||(r[4]=a=>I(h.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[5]||(r[5]=a=>I(h.value,m.value-1))},"‹")]),e.createElementVNode("span",se,[e.createElementVNode("button",null,e.toDisplayString(new Date(h.value,m.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[6]||(r[6]=a=>I(h.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[7]||(r[7]=a=>I(h.value+1,m.value))},"»")])]),e.createElementVNode("div",ve,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i>=T.value-new Date(h.value,m.value+1,1).getDay()+e.unref(b)?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===M.value.getMonth()&&(!u.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date($(u.limitation.dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date($(u.limitation.dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===M.value.getMonth()&&E(a,i)}},e.toDisplayString(a.day),11,fe)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}},pe=le(ge,[["__scopeId","data-v-531eb182"]]),he={key:1,class:"controls-container",style:{"margin-top":".5rem"}},Ce={key:0},ye={key:1,style:{padding:"0 1rem .5rem"}},ke={__name:"VacationTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,query:String,fullName:{type:String,default:"Вы"}},setup(D){const x=D,{t:n}=W.useI18n(),g=e.ref([]);e.ref([]);const u=e.ref(new Date().getFullYear()),F=e.ref(!1),h=e.ref(!1),B=e.ref(!1),Y=e.ref({zIndex:3,minWidth:230,x:500,y:200}),m=e.ref(!1),c=e.ref(!1),T=e.ref({participants:[]}),M=e.ref([]),p=e.ref([]),k=e.ref("all"),A=e.ref([{value:"all",label:n("vacationSchedule.all"),key:"all"}]),b=e.ref(!1),N=e.ref([]),$=e.ref(!1),v=e.ref({name:"",length:0,code:""}),q=new Date().getMonth()>11?[{value:u.value,label:u.value},{value:u.value+1,label:u.value+1}]:[{value:u.value-1,label:u.value-1},{value:u.value,label:u.value}];e.watch(k,async(o,t)=>{o!==t&&(N.value=[],F.value=!1,x.odata.personalManagerData.forEach(f=>{(f.Status!=="Увольнение"&&f.Group===o||o==="all")&&(N.value.some(l=>(l==null?void 0:l.activeText)===f.Role)||N.value.push({val:!0,activeText:f.Role}))}),j())});const E=e.computed(()=>g.value.flatMap((o,t)=>!o.days||o.days.length===0?[{...o,key:0,ids:t}]:o.days.map((f,l)=>({ids:t,key:l,...o,...f})))),I=async()=>{x.odata.getPersonalManagerData({}).then(o=>{var t;k.value=(t=o.find(f=>f.Status!=="Увольнение"&&f.Description===x.fullName))==null?void 0:t.Group,o.forEach(f=>{f.Status!=="Увольнение"&&(A.value.some(l=>(l==null?void 0:l.value)===f.Group)||A.value.push({value:f.Group,label:f.Group,key:f.Group}),f.Group===k.value&&!N.value.some(l=>(l==null?void 0:l.activeText)===f.Role)&&N.value.push({val:!0,activeText:f.Role}))}),j(),h.value=!1})},j=()=>{g.value=[];let o=[];x.odata.personalManagerData.forEach(t=>{t.Status!=="Увольнение"&&(t.Group===k.value||k.value==="all")&&N.value.some(f=>f.val&&f.activeText===t.Role)&&(o.push(t.Code),g.value.push({name:t.Description,days:[{note:""}],jobTitle:t.Role,code:t.Code}))}),L(o),m.value=!1},L=o=>{x.workSchedule.getAllVacations({year:u.value}).then(t=>{o.forEach((f,l)=>{g.value[l].days=[{note:""}],t.forEach(C=>{f===C.code&&(typeof g.value[l].days[0].dateStart>"u"?g.value[l].days[0]={dateStart:V.parseTime(C.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(C.dateEnd,"{dd}.{m}.{Y}"),note:C.note,count:C.count}:g.value[l].days.push({dateStart:V.parseTime(C.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(C.dateEnd,"{dd}.{m}.{Y}"),note:C.note,count:C.count}))})})})},U=o=>{if(o.columnIndex<3&&E.value[o.rowIndex].key<E.value[o.rowIndex].days.length)return E.value[o.rowIndex].key===0?{rowspan:E.value[o.rowIndex].days.length,colspan:1}:{rowspan:0,colspan:0}},P=(o,t,f,l)=>{v.value.ids=o.ids,v.value.key=o.key,v.value.startDate=o.dateStart,v.value.endDate=o.dateEnd,v.value.name=o.name,v.value.count=o.count,v.value.length=o.days.length,v.value.add=o.days.length>0&&o.days[o.days.length-1].count,v.value.level=t.level,v.value.holiday=p.value,Y.value.y=l.clientY,Y.value.x=l.clientX,t.level===2&&t.no<4&&(v.value.add||o.days.length>1)&&(B.value=!0),t.level===3&&(B.value=!0)},z=o=>{let t=g.value[v.value.ids];switch(o){case"add":t.days.push({note:""}),console.log(t.days.length);break;case"delete":delete t.days.pop(),a(v.value.ids);break}B.value=!1},s=o=>{$.value=o,v.value.count=o.count},r=()=>{$.value&&(g.value[v.value.ids].days[v.value.key]={...$.value,note:""},a(v.value.ids)),B.value=!1},a=o=>{x.workSchedule.rewriteFull({year:u.value,code:g.value[o].code,data:g.value[o].days.map(t=>({dateStart:t.dateStart.split(".").reverse().join("-"),dateEnd:t.dateEnd.split(".").reverse().join("-"),note:t.note,count:t.count}))})},i=o=>{x.workSchedule.sendConfirmMessage({fullname:x.fullName,confirm:o}),x.query=""},y=()=>{x.workSchedule.sendAgreementMessage({users:T.value.participants}),c.value=!1};x.workSchedule.getBoss().then(o=>{M.value=o[0].users}),V.holidays().then(o=>{p.value=o,I()});const S=async()=>{b.value=!0;const o=new te.Workbook,t=o.addWorksheet(u.value.toString(),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),f={vertical:"middle",horizontal:"center"},l={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},C={vertical:"middle",horizontal:"center",wrapText:!0},R={vertical:"middle",horizontal:"right",wrapText:!0};t.mergeCells("D1:G1"),t.mergeCells("D2:G2"),t.mergeCells("D3:G3"),t.mergeCells("D4:G4"),t.mergeCells("A5:G5"),t.mergeCells("A6:G6"),t.mergeCells("A9:G9"),t.mergeCells("A10:A11"),t.mergeCells("B10:B11"),t.mergeCells("C10:C11"),t.mergeCells("D10:F10"),t.mergeCells("G10:G11"),t.getCell("D1").value=n("vacationSchedule.approve"),t.getCell("D2").value=n("vacationSchedule.dateApprove",{year:u.value-1}),t.getCell("D3").value=n("workSchedule.printPlace"),t.getCell("D4").value=n("vacationSchedule.dateApprove",{year:u.value-1}),t.getCell("A5").value=n("workSchedule.firm"),t.getCell("B7").value=n("vacationSchedule.vacationSchedule"),t.getCell("C7").value=n("vacationSchedule.numberDocs"),t.getCell("D7").value=n("vacationSchedule.compilation"),t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("C8").value="",t.getCell("D8").value="",t.getCell("E8").value=u.value,t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("A10").value=n("vacationSchedule.jobTitle"),t.getCell("B10").value=n("vacationSchedule.fullName"),t.getCell("C10").value=n("vacationSchedule.personnelNumber"),t.getCell("D10").value=n("vacationSchedule.vacation"),t.getCell("D11").value=n("vacationSchedule.days"),t.getCell("E11").value=n("vacationSchedule.date"),t.getCell("F11").value=n("vacationSchedule.endDate"),t.getCell("G11").value=n("vacationSchedule.note"),t.getRow(1).height=80,t.getColumn(1).width=28,t.getColumn(2).width=28,t.getColumn(3).width=18,t.getColumn(4).width=18,t.getColumn(5).width=14,t.getColumn(6).width=14,t.getColumn(7).width=14,t.getColumn(1).alignment=C,t.getColumn(2).alignment=C,t.getColumn(3).alignment=C,t.getColumn(4).alignment=C,t.getColumn(5).alignment=C,t.getColumn(6).alignment=C,t.getColumn(7).alignment=C,t.getCell("D1").alignment=R,t.getCell("D2").alignment=R,t.getCell("D4").alignment=R,t.getCell("A5").alignment=f,t.getCell("C7").border=l,t.getCell("D7").border=l,t.getCell("E7").border=l,t.getCell("C8").border=l,t.getCell("D8").border=l,t.getCell("E8").border=l,t.getCell("A10").border=l,t.getCell("B10").border=l,t.getCell("C10").border=l,t.getCell("D10").border=l,t.getCell("G10").border=l,t.getCell("D11").border=l,t.getCell("E11").border=l,t.getCell("F11").border=l;let _=11;for(const w of g.value)if(w.days.length>1)w.days.forEach(G=>{let J=[w.jobTitle,w.name,w.code,G.count,G.dateStart,G.dateEnd,G.note];const K=t.addRow(J);K.border=l,_++}),t.mergeCells(`A${_-w.days.length+1}:A${_}`),t.mergeCells(`B${_-w.days.length+1}:B${_}`),t.mergeCells(`C${_-w.days.length+1}:C${_}`);else{let G=[w.jobTitle,w.name,w.code,w.days[0].count,w.days[0].dateStart,w.days[0].dateEnd,w.days[0].note];const J=t.addRow(G);J.border=l,_++}const X="export_"+V.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",H=await o.xlsx.writeBuffer();Z.saveAs(new Blob([H]),X),b.value=!1};return(o,t)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",null,[D.checkEdit?(e.openBlock(),e.createBlock(e.unref(d.ElSelect),{key:0,modelValue:k.value,"onUpdate:modelValue":t[0]||(t[0]=l=>k.value=l),placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(d.ElButton),{plain:"",onClick:t[1]||(t[1]=l=>m.value=!0),style:{"margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.jobTitle")),1)]),_:1}),e.createVNode(e.unref(d.ElSelect),{modelValue:u.value,"onUpdate:modelValue":t[2]||(t[2]=l=>u.value=l),onChange:j,placeholder:"Year",style:{width:"80px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(q),l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),e.createVNode(e.unref(d.ElSkeleton),{style:{width:"100%"},loading:h.value,animated:""},{template:e.withCtx(()=>[e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"100%",height:"2rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"4rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"4rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"8rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"8rem"}})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTable),{id:"printTable",data:E.value,"span-method":U,onCellClick:P,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(n)("vacationSchedule.emptyText")},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:k.value!=="all"?e.unref(n)("vacationSchedule.title",{name:k.value}):e.unref(n)("vacationSchedule.enterprise")+` ${u.value}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.jobTitle"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].jobTitle),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.fullName"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.personnelNumber"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.vacation"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.days"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].count),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.date"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.endDate"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateEnd),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.note"),align:"center"},{default:e.withCtx(l=>[e.createVNode(e.unref(d.ElInput),{modelValue:g.value[E.value[l.$index].ids].days[E.value[l.$index].key].note,"onUpdate:modelValue":C=>g.value[E.value[l.$index].ids].days[E.value[l.$index].key].note=C,style:{width:"100%"},placeholder:" ",class:"noBorder",onBlur:C=>a(E.value[l.$index].ids)},null,8,["modelValue","onUpdate:modelValue","onBlur"])]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])]),_:1},8,["loading"]),D.checkEdit?(e.openBlock(),e.createElementBlock("div",he,[F.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,type:"primary",onClick:t[3]||(t[3]=l=>c.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.sendInformation")),1)]),_:1})),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:1,type:"primary",onClick:t[4]||(t[4]=l=>i(!0))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.agreeOn")),1)]),_:1})):e.createCommentVNode("",!0),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:2,type:"primary",onClick:t[5]||(t[5]=l=>i(!1))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.reject")),1)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(d.ElButton),{disabled:b.value,plain:"",onClick:S,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[f,b.value]]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("workSchedule.jobTitle"),modelValue:m.value,"onUpdate:modelValue":t[7]||(t[7]=l=>m.value=l),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[6]||(t[6]=l=>m.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:j},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:N.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSwitch),{modelValue:l.val,"onUpdate:modelValue":C=>l.val=C,"active-text":l.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("vacationSchedule.pleaseCoordinate"),modelValue:c.value,"onUpdate:modelValue":t[10]||(t[10]=l=>c.value=l),width:"500px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[9]||(t[9]=l=>c.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:y},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.send")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:T.value,autocomplete:"on"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSelect),{modelValue:T.value.participants,"onUpdate:modelValue":t[8]||(t[8]=l=>T.value.participants=l),placeholder:e.unref(n)("vacationSchedule.fullName"),multiple:"",size:"default"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l,label:l,value:l},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(O.ContextMenu),{show:B.value,"onUpdate:show":t[14]||(t[14]=l=>B.value=l),options:Y.value},{default:e.withCtx(()=>[e.createVNode(e.unref(O.ContextMenuItem),{label:v.value.level===3&&typeof v.value.count<"u"?v.value.name+" "+v.value.count+" "+e.unref(n)("vacationSchedule.day",v.value.count):v.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(O.ContextMenuSeparator)),v.value.level===2?(e.openBlock(),e.createElementBlock("div",Ce,[v.value.length>1?(e.openBlock(),e.createBlock(e.unref(O.ContextMenuItem),{key:0,label:e.unref(n)("vacationSchedule.deleteLast"),onClick:t[11]||(t[11]=l=>z("delete"))},null,8,["label"])):e.createCommentVNode("",!0),v.value.add?(e.openBlock(),e.createBlock(e.unref(O.ContextMenuItem),{key:1,label:e.unref(n)("vacationSchedule.addVacation"),onClick:t[12]||(t[12]=l=>z("add"))},null,8,["label"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(pe,{data:v.value,range:"range",limitation:{dateStart:"12.01."+u.value,dateEnd:"12.12."+u.value},onInput:s},null,8,["data","limitation"]),e.createElementVNode("div",null,[e.createVNode(e.unref(d.ElButton),{onClick:t[13]||(t[13]=l=>B.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.save")),1)]),_:1})])]))]),_:1},8,["show","options"])])}}};module.exports=ke;
1
+ "use strict";const e=require("vue"),V=require("./index-CHGzf-XH.cjs"),W=require("vue-i18n"),Z=require("file-saver"),Q=require("exceljs"),d=require("element-plus"),O=require("@imengyu/vue3-context-menu");function ee(D){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const n in D)if(n!=="default"){const g=Object.getOwnPropertyDescriptor(D,n);Object.defineProperty(x,n,g.get?g:{enumerable:!0,get:()=>D[n]})}}return x.default=D,Object.freeze(x)}const te=ee(Q),le=(D,x)=>{const n=D.__vccOpts||D;for(const[g,u]of x)n[g]=u;return n},ae={class:"wrapper"},ne={class:"month_year"},oe={class:"text"},ue={class:"week"},re={class:"month"},ie=["onClick"],de={key:0},ce={class:"month_year"},se={class:"text"},ve={class:"week"},me={class:"month"},fe=["onClick"],ge={__name:"DataPicker",props:{data:Object,limitation:{type:[Boolean,Object],default:()=>!1},range:{type:String,default:()=>"solid"}},emits:["init"],setup(D,{emit:x}){var L,U,P,z;const n=e.ref(new Date),g=e.ref(new Date),u=D,F=x,h=e.ref(new Date().getFullYear()),B=e.ref(new Date().getMonth()),Y=e.ref(new Date().getFullYear()),m=e.ref(new Date().getMonth()),c=e.ref([]),T=e.ref(0),M=e.ref(0),p=e.ref(-1),k=e.ref(-1),{locale:A}=W.useI18n(),b=/en|zh|ja|he/.test(A.value)?0:1,N=u.range==="range"?2:1,$=s=>{const r=s.split(s.match(/\D.*?\D?/));return r[0].length>2?r.join("-")+"T00:00:01":r.reverse().join("-")+"T00:00:01"};typeof((L=u.data)==null?void 0:L.startDate)<"u"&&(n.value=new Date($(u.data.startDate)),h.value=n.value.getFullYear(),m.value=n.value.getMonth()),typeof((U=u.data)==null?void 0:U.endDate)<"u"&&(g.value=new Date($(u.data.endDate)),Y.value=g.value.getFullYear(),B.value=g.value.getMonth());const v=()=>{let s=new Date(h.value,m.value,0);for(let a=s.getDate()-s.getDay()+b;a<=s.getDate()&&s.getDay()!==6+b;a++)T.value++,c.value.push({day:a,month:s.getMonth(),year:s.getFullYear(),class:[]});for(let a=1;a<=new Date(h.value,m.value+1,0).getDate();a++)T.value++,c.value.push({day:a,month:m.value,year:h.value,class:[]});if(u.range==="range"){M.value=new Date(h.value,m.value+2,0);for(let a=1;a<=M.value.getDate();a++)c.value.push({day:a,month:M.value.getMonth(),year:M.value.getFullYear(),class:[]})}let r=new Date(h.value,m.value+N,1);for(let a=1;a<=(7-r.getDay()+b)%7&&r.getDay()!==b;a++)c.value.push({day:a,month:r.getMonth(),year:r.getFullYear(),class:[]});u.data.holiday.length!==0&&(u.data.holiday.preholidays.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="preholiday")}),u.data.holiday.holidays.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="weekend")}),u.data.holiday.holiday.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="holiday")}),u.data.holiday.nowork.forEach(a=>{let i=a.split("-");const y=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);y!==-1&&(c.value[y].class[0]="nowork")}))},q=(s,r)=>{let a=s-r+1;for(let i=0;i<=s-r;i++)c.value[i+r].class[0]==="holiday"&&a--;return a},E=(s,r)=>{const a=V.parseTime(new Date(s.year,s.month,s.day),"{dd}.{m}.{Y}");if(u.range==="range")if(console.log(p.value),k.value!==-1){if(k.value<=p.value)for(let i=k.value;i<=p.value;i++)c.value[i].class[1]="";else for(let i=p.value;i<=k.value;i++)c.value[i].class[1]="";p.value=r,k.value=-1,c.value[r].class[1]="active"}else if(p.value!==-1){if(k.value=r,k.value>=p.value)for(let y=p.value+1;y<r;y++)c.value[y].class[1]="select";else for(let y=r+1;y<p.value;y++)c.value[y].class[1]="select";c.value[r].class[1]="active";let i=V.parseTime(new Date(c.value[p.value].year,c.value[p.value].month,c.value[p.value].day),"{dd}.{m}.{Y}");p.value>r?F("input",{dateStart:a,dateEnd:i,count:q(p.value,r)}):F("input",{dateStart:i,dateEnd:a,count:q(r,p.value)})}else p.value=r,c.value[r].class[1]="active";else c.value[p.value].class[1]="",p.value=r,c.value[r].class[1]="active",F("input",{dateStart:a,count:1})};if(v(),typeof((P=u.data)==null?void 0:P.startDate)<"u"&&(p.value=c.value.findIndex(s=>s.day===n.value.getDate()&&s.month===m.value&&s.year===h.value),c.value[p.value].class[1]="active"),typeof((z=u.data)==null?void 0:z.endDate)<"u"&&u.range==="range"){k.value=c.value.findIndex(s=>s.day===g.value.getDate()&&s.month===B.value&&s.year===Y.value),c.value[k.value].class[1]="active";for(let s=p.value+1;s<k.value;s++)c.value[s].class[1]="select"}const I=(s,r)=>{j(s,r)&&(c.value=[],T.value=0,n.value=new Date(s,r,1),h.value=n.value.getFullYear(),m.value=n.value.getMonth(),v())},j=(s,r)=>{if(!u.limitation)return!0;if(u.limitation.dateStart){console.log(u.limitation.dateStart);let a=u.limitation.dateStart.split(u.limitation.dateStart.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])>s||parseInt(a[2])===s&&parseInt(a[1])>r+1)return!1}if(u.limitation.dateEnd){console.log(u.limitation.dateEnd);let a=u.limitation.dateEnd.split(u.limitation.dateEnd.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])<s||parseInt(a[2])===s&&parseInt(a[1])<r+N)return!1}return!0};return(s,r)=>(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",null,[e.createElementVNode("p",ne,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[0]||(r[0]=a=>I(h.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[1]||(r[1]=a=>I(h.value,m.value-1))},"‹")]),e.createElementVNode("span",oe,[e.createElementVNode("button",null,e.toDisplayString(h.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[2]||(r[2]=a=>I(h.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[3]||(r[3]=a=>I(h.value+1,m.value))},"»")])]),e.createElementVNode("div",ue,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i<T.value+(7-new Date(h.value,m.value+1,1).getDay()+e.unref(b))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===m.value&&(!u.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date($(u.limitation.dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date($(u.limitation.dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===m.value&&E(a,i)}},e.toDisplayString(a.day),11,ie)):e.createCommentVNode("",!0)],64))),128))])]),u.range==="range"?(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("p",ce,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[4]||(r[4]=a=>I(h.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[5]||(r[5]=a=>I(h.value,m.value-1))},"‹")]),e.createElementVNode("span",se,[e.createElementVNode("button",null,e.toDisplayString(new Date(h.value,m.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[6]||(r[6]=a=>I(h.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[7]||(r[7]=a=>I(h.value+1,m.value))},"»")])]),e.createElementVNode("div",ve,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i>=T.value-new Date(h.value,m.value+1,1).getDay()+e.unref(b)?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===M.value.getMonth()&&(!u.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date($(u.limitation.dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date($(u.limitation.dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===M.value.getMonth()&&E(a,i)}},e.toDisplayString(a.day),11,fe)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}},pe=le(ge,[["__scopeId","data-v-531eb182"]]),he={key:1,class:"controls-container",style:{"margin-top":".5rem"}},Ce={key:0},ye={key:1,style:{padding:"0 1rem .5rem"}},ke={__name:"VacationTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,query:String,fullName:{type:String,default:"Вы"}},setup(D){const x=D,{t:n}=W.useI18n(),g=e.ref([]);e.ref([]);const u=e.ref(new Date().getFullYear()),F=e.ref(!1),h=e.ref(!1),B=e.ref(!1),Y=e.ref({zIndex:3,minWidth:230,x:500,y:200}),m=e.ref(!1),c=e.ref(!1),T=e.ref({participants:[]}),M=e.ref([]),p=e.ref([]),k=e.ref("all"),A=e.ref([{value:"all",label:n("vacationSchedule.all"),key:"all"}]),b=e.ref(!1),N=e.ref([]),$=e.ref(!1),v=e.ref({name:"",length:0,code:""}),q=new Date().getMonth()>11?[{value:u.value,label:u.value},{value:u.value+1,label:u.value+1}]:[{value:u.value-1,label:u.value-1},{value:u.value,label:u.value}];e.watch(k,async(o,t)=>{o!==t&&(N.value=[],F.value=!1,x.odata.personalManagerData.forEach(f=>{(f.Status!=="Увольнение"&&f.Group===o||o==="all")&&(N.value.some(l=>(l==null?void 0:l.activeText)===f.Role)||N.value.push({val:!0,activeText:f.Role}))}),j())});const E=e.computed(()=>g.value.flatMap((o,t)=>!o.days||o.days.length===0?[{...o,key:0,ids:t}]:o.days.map((f,l)=>({ids:t,key:l,...o,...f})))),I=async()=>{x.odata.getPersonalManagerData({}).then(o=>{var t;k.value=(t=o.find(f=>f.Status!=="Увольнение"&&f.Description===x.fullName))==null?void 0:t.Group,o.forEach(f=>{f.Status!=="Увольнение"&&(A.value.some(l=>(l==null?void 0:l.value)===f.Group)||A.value.push({value:f.Group,label:f.Group,key:f.Group}),f.Group===k.value&&!N.value.some(l=>(l==null?void 0:l.activeText)===f.Role)&&N.value.push({val:!0,activeText:f.Role}))}),j(),h.value=!1})},j=()=>{g.value=[];let o=[];x.odata.personalManagerData.forEach(t=>{t.Status!=="Увольнение"&&(t.Group===k.value||k.value==="all")&&N.value.some(f=>f.val&&f.activeText===t.Role)&&(o.push(t.Code),g.value.push({name:t.Description,days:[{note:""}],jobTitle:t.Role,code:t.Code}))}),L(o),m.value=!1},L=o=>{x.workSchedule.getAllVacations({year:u.value}).then(t=>{o.forEach((f,l)=>{g.value[l].days=[{note:""}],t.forEach(C=>{f===C.code&&(typeof g.value[l].days[0].dateStart>"u"?g.value[l].days[0]={dateStart:V.parseTime(C.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(C.dateEnd,"{dd}.{m}.{Y}"),note:C.note,count:C.count}:g.value[l].days.push({dateStart:V.parseTime(C.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(C.dateEnd,"{dd}.{m}.{Y}"),note:C.note,count:C.count}))})})})},U=o=>{if(o.columnIndex<3&&E.value[o.rowIndex].key<E.value[o.rowIndex].days.length)return E.value[o.rowIndex].key===0?{rowspan:E.value[o.rowIndex].days.length,colspan:1}:{rowspan:0,colspan:0}},P=(o,t,f,l)=>{v.value.ids=o.ids,v.value.key=o.key,v.value.startDate=o.dateStart,v.value.endDate=o.dateEnd,v.value.name=o.name,v.value.count=o.count,v.value.length=o.days.length,v.value.add=o.days.length>0&&o.days[o.days.length-1].count,v.value.level=t.level,v.value.holiday=p.value,Y.value.y=l.clientY,Y.value.x=l.clientX,t.level===2&&t.no<4&&(v.value.add||o.days.length>1)&&(B.value=!0),t.level===3&&(B.value=!0)},z=o=>{let t=g.value[v.value.ids];switch(o){case"add":t.days.push({note:""}),console.log(t.days.length);break;case"delete":delete t.days.pop(),a(v.value.ids);break}B.value=!1},s=o=>{$.value=o,v.value.count=o.count},r=()=>{$.value&&(g.value[v.value.ids].days[v.value.key]={...$.value,note:""},a(v.value.ids)),B.value=!1},a=o=>{x.workSchedule.rewriteFull({year:u.value,code:g.value[o].code,data:g.value[o].days.map(t=>({dateStart:t.dateStart.split(".").reverse().join("-"),dateEnd:t.dateEnd.split(".").reverse().join("-"),note:t.note,count:t.count}))})},i=o=>{x.workSchedule.sendConfirmMessage({fullname:x.fullName,confirm:o}),x.query=""},y=()=>{x.workSchedule.sendAgreementMessage({users:T.value.participants}),c.value=!1};x.workSchedule.getBoss().then(o=>{M.value=o[0].users}),V.holidays().then(o=>{p.value=o,I()});const S=async()=>{b.value=!0;const o=new te.Workbook,t=o.addWorksheet(u.value.toString(),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),f={vertical:"middle",horizontal:"center"},l={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},C={vertical:"middle",horizontal:"center",wrapText:!0},R={vertical:"middle",horizontal:"right",wrapText:!0};t.mergeCells("D1:G1"),t.mergeCells("D2:G2"),t.mergeCells("D3:G3"),t.mergeCells("D4:G4"),t.mergeCells("A5:G5"),t.mergeCells("A6:G6"),t.mergeCells("A9:G9"),t.mergeCells("A10:A11"),t.mergeCells("B10:B11"),t.mergeCells("C10:C11"),t.mergeCells("D10:F10"),t.mergeCells("G10:G11"),t.getCell("D1").value=n("vacationSchedule.approve"),t.getCell("D2").value=n("vacationSchedule.dateApprove",{year:u.value-1}),t.getCell("D3").value=n("workSchedule.printPlace"),t.getCell("D4").value=n("vacationSchedule.dateApprove",{year:u.value-1}),t.getCell("A5").value=n("workSchedule.firm"),t.getCell("B7").value=n("vacationSchedule.vacationSchedule"),t.getCell("C7").value=n("vacationSchedule.numberDocs"),t.getCell("D7").value=n("vacationSchedule.compilation"),t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("C8").value="",t.getCell("D8").value="",t.getCell("E8").value=u.value,t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("A10").value=n("vacationSchedule.jobTitle"),t.getCell("B10").value=n("vacationSchedule.fullName"),t.getCell("C10").value=n("vacationSchedule.personnelNumber"),t.getCell("D10").value=n("vacationSchedule.vacation"),t.getCell("D11").value=n("vacationSchedule.days"),t.getCell("E11").value=n("vacationSchedule.date"),t.getCell("F11").value=n("vacationSchedule.endDate"),t.getCell("G11").value=n("vacationSchedule.note"),t.getRow(1).height=80,t.getColumn(1).width=28,t.getColumn(2).width=28,t.getColumn(3).width=18,t.getColumn(4).width=18,t.getColumn(5).width=14,t.getColumn(6).width=14,t.getColumn(7).width=14,t.getColumn(1).alignment=C,t.getColumn(2).alignment=C,t.getColumn(3).alignment=C,t.getColumn(4).alignment=C,t.getColumn(5).alignment=C,t.getColumn(6).alignment=C,t.getColumn(7).alignment=C,t.getCell("D1").alignment=R,t.getCell("D2").alignment=R,t.getCell("D4").alignment=R,t.getCell("A5").alignment=f,t.getCell("C7").border=l,t.getCell("D7").border=l,t.getCell("E7").border=l,t.getCell("C8").border=l,t.getCell("D8").border=l,t.getCell("E8").border=l,t.getCell("A10").border=l,t.getCell("B10").border=l,t.getCell("C10").border=l,t.getCell("D10").border=l,t.getCell("G10").border=l,t.getCell("D11").border=l,t.getCell("E11").border=l,t.getCell("F11").border=l;let _=11;for(const w of g.value)if(w.days.length>1)w.days.forEach(G=>{let J=[w.jobTitle,w.name,w.code,G.count,G.dateStart,G.dateEnd,G.note];const K=t.addRow(J);K.border=l,_++}),t.mergeCells(`A${_-w.days.length+1}:A${_}`),t.mergeCells(`B${_-w.days.length+1}:B${_}`),t.mergeCells(`C${_-w.days.length+1}:C${_}`);else{let G=[w.jobTitle,w.name,w.code,w.days[0].count,w.days[0].dateStart,w.days[0].dateEnd,w.days[0].note];const J=t.addRow(G);J.border=l,_++}const X="export_"+V.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",H=await o.xlsx.writeBuffer();Z.saveAs(new Blob([H]),X),b.value=!1};return(o,t)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",null,[D.checkEdit?(e.openBlock(),e.createBlock(e.unref(d.ElSelect),{key:0,modelValue:k.value,"onUpdate:modelValue":t[0]||(t[0]=l=>k.value=l),placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(d.ElButton),{plain:"",onClick:t[1]||(t[1]=l=>m.value=!0),style:{"margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.jobTitle")),1)]),_:1}),e.createVNode(e.unref(d.ElSelect),{modelValue:u.value,"onUpdate:modelValue":t[2]||(t[2]=l=>u.value=l),onChange:j,placeholder:"Year",style:{width:"80px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(q),l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),e.createVNode(e.unref(d.ElSkeleton),{style:{width:"100%"},loading:h.value,animated:""},{template:e.withCtx(()=>[e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"100%",height:"2rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"4rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"4rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"8rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"8rem"}})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTable),{id:"printTable",data:E.value,"span-method":U,onCellClick:P,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(n)("vacationSchedule.emptyText")},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:k.value!=="all"?e.unref(n)("vacationSchedule.title",{name:k.value}):e.unref(n)("vacationSchedule.enterprise")+` ${u.value}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.jobTitle"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].jobTitle),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.fullName"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.personnelNumber"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.vacation"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.days"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].count),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.date"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.endDate"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateEnd),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.note"),align:"center"},{default:e.withCtx(l=>[e.createVNode(e.unref(d.ElInput),{modelValue:g.value[E.value[l.$index].ids].days[E.value[l.$index].key].note,"onUpdate:modelValue":C=>g.value[E.value[l.$index].ids].days[E.value[l.$index].key].note=C,style:{width:"100%"},placeholder:" ",class:"noBorder",onBlur:C=>a(E.value[l.$index].ids)},null,8,["modelValue","onUpdate:modelValue","onBlur"])]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])]),_:1},8,["loading"]),D.checkEdit?(e.openBlock(),e.createElementBlock("div",he,[F.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,type:"primary",onClick:t[3]||(t[3]=l=>c.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.sendInformation")),1)]),_:1})),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:1,type:"primary",onClick:t[4]||(t[4]=l=>i(!0))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.agreeOn")),1)]),_:1})):e.createCommentVNode("",!0),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:2,type:"primary",onClick:t[5]||(t[5]=l=>i(!1))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.reject")),1)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(d.ElButton),{disabled:b.value,plain:"",onClick:S,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[f,b.value]]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("workSchedule.jobTitle"),modelValue:m.value,"onUpdate:modelValue":t[7]||(t[7]=l=>m.value=l),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[6]||(t[6]=l=>m.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:j},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:N.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSwitch),{modelValue:l.val,"onUpdate:modelValue":C=>l.val=C,"active-text":l.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("vacationSchedule.pleaseCoordinate"),modelValue:c.value,"onUpdate:modelValue":t[10]||(t[10]=l=>c.value=l),width:"500px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[9]||(t[9]=l=>c.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:y},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.send")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:T.value,autocomplete:"on"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSelect),{modelValue:T.value.participants,"onUpdate:modelValue":t[8]||(t[8]=l=>T.value.participants=l),placeholder:e.unref(n)("vacationSchedule.fullName"),multiple:"",size:"default"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l,label:l,value:l},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(O.ContextMenu),{show:B.value,"onUpdate:show":t[14]||(t[14]=l=>B.value=l),options:Y.value},{default:e.withCtx(()=>[e.createVNode(e.unref(O.ContextMenuItem),{label:v.value.level===3&&typeof v.value.count<"u"?v.value.name+" "+v.value.count+" "+e.unref(n)("vacationSchedule.day",v.value.count):v.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(O.ContextMenuSeparator)),v.value.level===2?(e.openBlock(),e.createElementBlock("div",Ce,[v.value.length>1?(e.openBlock(),e.createBlock(e.unref(O.ContextMenuItem),{key:0,label:e.unref(n)("vacationSchedule.deleteLast"),onClick:t[11]||(t[11]=l=>z("delete"))},null,8,["label"])):e.createCommentVNode("",!0),v.value.add?(e.openBlock(),e.createBlock(e.unref(O.ContextMenuItem),{key:1,label:e.unref(n)("vacationSchedule.addVacation"),onClick:t[12]||(t[12]=l=>z("add"))},null,8,["label"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(pe,{data:v.value,range:"range",limitation:{dateStart:"1.01."+u.value,dateEnd:"31.12."+u.value},onInput:s},null,8,["data","limitation"]),e.createElementVNode("div",null,[e.createVNode(e.unref(d.ElButton),{onClick:t[13]||(t[13]=l=>B.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.save")),1)]),_:1})])]))]),_:1},8,["show","options"])])}}};module.exports=ke;
@@ -695,7 +695,7 @@ const Ie = (A, M) => {
695
695
  v(qe, {
696
696
  data: m.value,
697
697
  range: "range",
698
- limitation: { dateStart: "12.01." + u.value, dateEnd: "12.12." + u.value },
698
+ limitation: { dateStart: "1.01." + u.value, dateEnd: "31.12." + u.value },
699
699
  onInput: r
700
700
  }, null, 8, ["data", "limitation"]),
701
701
  y("div", null, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studio-west/employees",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],