@studio-west/employees 0.6.25 → 0.6.27

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,3 +1,3 @@
1
- "use strict";const e=require("vue"),O=require("vue-i18n"),v=require("./index-Dn3djtwj.cjs"),o=require("element-plus"),P={style:{height:"20px",width:"100%",display:"inline-block"}},U={style:{height:"20px",width:"100%",display:"inline-block"}},K={__name:"SheetTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"}},setup(N){const g=N,{t:i,d:E}=O.useI18n(),c=e.ref([]),w=e.ref("0"),h=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(w.value))),m=e.ref([]),p=e.ref("all"),k=e.ref([{value:"all",label:"Все",key:"all"}]),V=e.ref([]),D=e.ref(0),b=e.ref([]),T=e.ref([]),x=e.ref([]);e.watch(p,async(a,l)=>{a!==l&&(b.value=[],confirm.value=!1,g.odata.personal.forEach(t=>{t.divisionName===a&&(b.value.some(u=>(u==null?void 0:u.activeText)===t.roleName)||b.value.push({val:!0,activeText:t.roleName}))}),S())}),e.watch(w,a=>{h.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(a)),I()});const r=e.computed(()=>c.value.flatMap((a,l)=>[{...a,key:0,ids:l},{...a,key:1,ids:l}])),F=a=>{if(a.columnIndex<2||a.columnIndex>m.value.length+3&&a.columnIndex<m.value.length+9||a.columnIndex>m.value.length+11)return r.value[a.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},I=()=>{const a=V.value,l=new Date(h.value),t=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let u=[],y=0;for(let n=1;n<=t;n++){const s=v.parseTime(l.setDate(n),"{Y}-{m}-{dd}");y+=a.nowork.includes(s)||a.holidays.includes(s)?0:a.preholidays.includes(s)?7:8;let d=a.nowork.includes(s)?"nowork":a.holidays.includes(s)?"holiday":a.preholidays.includes(s)?"preholiday":"";u.push({day:n,holidays:d,weekday:E(new Date(l.getFullYear(),l.getMonth(),n),"day")})}D.value=y,m.value=u,g.odata.getPersonal({}).then(n=>{var s;p.value=(s=n.find(d=>d.employeeName===g.fullName))==null?void 0:s.divisionName,n.forEach(d=>{k.value.some(f=>(f==null?void 0:f.value)===d.divisionName)||k.value.push({value:d.divisionName,label:d.divisionName,key:d.divisionName}),d.divisionName===p.value&&!b.value.some(f=>(f==null?void 0:f.activeText)===d.roleName)&&b.value.push({val:!0,activeText:d.roleName})}),S()})},S=()=>{c.value=[],x.value=[],T.value=[],g.odata.personal.forEach(a=>{if(a.divisionName===p.value&&b.value.some(l=>l.val&&l.activeText===a.roleName)){let l=v.byInitials(a.employeeName);x.value.push(a.employeeKey),c.value.push({name:l+" ("+a.roleName+")",code:a.employeeKey,days:[],contHour:0,id:!1,ids:c.value.length})}}),g.workSchedule.getUsersYear({code:x.value,year:new Date(h.value).getFullYear()}).then(a=>{a.forEach(l=>{l.dateStart&&T.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),console.log(a),Y()})},Y=()=>{g.workSchedule.getWorkSchedule({code:x.value,date:v.parseTime(new Date(h.value),"{Y}-{m}-{dd}")}).then(a=>{a.forEach((l,t)=>{var u,y;if(l!==null){l.data.days.forEach(n=>n.state="Я");for(let n=1;n<=m.value.length;n++){let s=v.parseTime(new Date(h.value).setDate(n),"{Y}-{m}-{dd}");const d=(u=l.data)==null?void 0:u.days.findIndex(f=>f.day===s);d===-1?c.value[t].days.push({day:s,time:"-",state:"В"}):c.value[t].days.push((y=l.data)==null?void 0:y.days[d])}}else{c.value[t].days=[];for(let n=1;n<=m.value.length;n++)m.value[n-1].holidays===""?B(n,t,8):m.value[n-1].holidays==="preholiday"?B(n,t,7):c.value[t].days.push({day:v.parseTime(new Date(h.value).setDate(n),"{Y}-{m}-{dd}"),time:"-",state:"В"})}for(let n=1;n<=m.value.length;n++){let s=new Date(new Date(h.value).getFullYear(),new Date(h.value).getMonth(),n).getTime()+1e3;for(let d of T.value){const{dateStart:f,dateEnd:M,code:q}=d;if(f&&M&&q===l.code){const j=new Date(v.parseDate(f)).getTime(),A=new Date(v.parseDate(M)).getTime();if(s>=j&&s<=A){const C=v.parseTime(new Date(h.value).setDate(n),"{Y}-{m}-{dd}"),_=c.value[t].days.findIndex(L=>L.day===C);_!==-1?c.value[t].days[_]={day:C,time:"-",state:"О"}:c.value[t].days.push({day:C,time:"-",state:"О"})}}}}}),H()})},B=(a,l,t)=>{const u=v.parseTime(new Date(h.value).setDate(a),"{Y}-{m}-{dd}");c.value[l].days.push({day:u,time:t,state:"Я"})},H=()=>{c.value.forEach(a=>{a.hourI=0,a.hourII=0,a.halfII=0,a.halfI=0,a.weekend=0,a.weekendDays=0,a.night=0;for(let l=0;l<a.days.length;l++)l<15&&a.days[l].time!=="-"&&(a.hourI+=a.days[l].time),l<15&&a.days[l].state==="Я"&&a.halfI++,l>=15&&a.days[l].time!=="-"&&(a.hourII+=a.days[l].time),l>=15&&a.days[l].state==="Я"&&a.halfII++,a.days[l].state==="Н"&&(a.night+=a.days[l].time),a.days[l].state==="РВ"&&(a.weekend+=a.days[l].time),a.days[l].state==="В"&&a.weekendDays++;a.contDays=a.halfI+a.halfII,a.contHour=a.hourI+a.hourII,a.overtime=0,D.value<a.contHour&&(a.overtime=a.contHour-D.value),a.numberNonAppearing=0,a.appearing={code:"-",countH:"-"}})},$=(a,l)=>{var n,s;if(l===-1)return"";const t=new Date(h.value),u=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,y=r.value[l].days.findIndex(d=>d.day===u);return y===-1?"":r.value[l].key===0?(n=r.value[l].days[y])==null?void 0:n.state:(s=r.value[l].days[y])==null?void 0:s.time};return v.holidays().then(a=>{V.value=a,I()}),(a,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[N.checkEdit?(e.openBlock(),e.createBlock(e.unref(o.ElSelect),{key:0,modelValue:p.value,"onUpdate:modelValue":l[0]||(l[0]=t=>p.value=t),placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,t=>(e.openBlock(),e.createBlock(e.unref(o.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),l[2]||(l[2]=e.createElementVNode("div",{class:"expander"},null,-1)),N.checkEdit?(e.openBlock(),e.createBlock(e.unref(o.ElSwitch),{key:1,modelValue:w.value,"onUpdate:modelValue":l[1]||(l[1]=t=>w.value=t),"active-text":e.unref(i)("workSchedule.currentMonth"),"active-value":"0","inactive-value":"-1",style:{"margin-bottom":".5rem","margin-left":".5rem"}},null,8,["modelValue","active-text"])):e.createCommentVNode("",!0),e.createVNode(e.unref(o.ElTable),{id:"printTable",data:r.value,"span-method":F,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(i)("sheet.emptyText"),align:"center",onCellClick:a.coMenu},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.title",{name:p.value})+e.unref(E)(h.value,"month"),align:"center",height:"10"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.employee"),width:"180",align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.personnelNumber"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.marks"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.day},[t.day<=15?(e.openBlock(),e.createBlock(e.unref(o.ElTableColumn),{key:0,width:"30","class-name":t.holidays,align:"center",label:t.day.toString()+`
2
- `+t.weekday},{default:e.withCtx(u=>[e.createElementVNode("div",P,e.toDisplayString($(t.day,u.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.halfMonth",{half:"I"}),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].key===0?r.value[t.$index].halfI:r.value[t.$index].hourI),1)]),_:1},8,["label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.day},[t.day>15?(e.openBlock(),e.createBlock(e.unref(o.ElTableColumn),{key:0,width:"30","class-name":t.holidays,align:"center",label:t.day.toString()+`
3
- `+t.weekday},{default:e.withCtx(u=>[e.createElementVNode("div",U,e.toDisplayString($(t.day,u.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.halfMonth",{half:"II"}),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].key===0?r.value[t.$index].halfII:r.value[t.$index].hourII),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.workedMonth"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.days"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].contDays),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.hours"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.all"),align:"center","label-class-name":"turn",width:"40"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].contHour),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.overtime"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].overtime),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.night"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].night),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.weekend"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].weekend),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.numberNonAppearing"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].numberNonAppearing),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.them"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.code"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(t=>{var u;return[e.createTextVNode(e.toDisplayString((u=r.value[t.$index].appearing)==null?void 0:u.code),1)]}),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.count"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(t=>{var u;return[e.createTextVNode(e.toDisplayString((u=r.value[t.$index].appearing)==null?void 0:u.countH),1)]}),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(i)("sheet.countWeekend"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(r.value[t.$index].weekendDays),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text","onCellClick"])],64))}};module.exports=K;
1
+ "use strict";const e=require("vue"),se=require("vue-i18n"),v=require("./index-Dn3djtwj.cjs"),m=require("element-plus"),I=require("@imengyu/vue3-context-menu"),ie=require("file-saver"),de=require("exceljs");function ce($){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if($){for(const s in $)if(s!=="default"){const T=Object.getOwnPropertyDescriptor($,s);Object.defineProperty(y,s,T.get?T:{enumerable:!0,get:()=>$[s]})}}return y.default=$,Object.freeze(y)}const ve=ce(de),he={class:"nav"},ge={style:{height:"20px",width:"100%",display:"inline-block"}},me={style:{height:"20px",width:"100%",display:"inline-block"}},fe={key:0,style:{padding:"0 1rem .5rem"}},ye={key:1,style:{padding:"0 1rem .5rem"}},pe={__name:"SheetTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"},group:String,date:String},setup($){const y=$,{t:s,d:T}=se.useI18n(),U=e.ref(!1),b=e.ref([]),O=e.ref("0"),p=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(O.value))),i=e.ref([]),N=e.ref(""),H=e.ref([{value:"all",label:"Все",key:"all"}]),te=e.ref([{value:"Я",label:s("sheet.valid.1")},{value:"К",label:s("sheet.valid.2")},{value:"ОТ",label:s("sheet.valid.3")},{value:"ДО",label:s("sheet.valid.4")},{value:"Р",label:s("sheet.valid.5")},{value:"ОЖ",label:s("sheet.valid.6")},{value:"Б",label:s("sheet.valid.7")},{value:"НН",label:s("sheet.valid.8")},{value:"ПР",label:s("sheet.valid.9")},{value:"У",label:s("sheet.valid.10")},{value:"УД",label:s("sheet.valid.11")},{value:"Г",label:s("sheet.valid.12")}]),K=e.ref([]),ae=e.ref(0),D=e.ref(9),w=e.ref(8),S=e.ref(0),W=e.ref(0),A=e.ref([]),Y=e.ref(!1),R=e.ref([]),q=e.ref([]),E=e.ref(!1),P=e.ref(1),L=e.ref({zIndex:3,minWidth:230,x:500,y:200}),c=e.ref({name:"",length:0,code:""}),k=e.ref([]),f=e.computed(()=>b.value.flatMap((t,l)=>{const d=k.value.find(a=>a.code===t.code),o=new Map;t.days.forEach(a=>o.set(a.day,{...a})),d&&d.days.forEach(a=>o.set(a.day,{...a}));const n=Array.from(o.values());return[{...t,days:n,key:0,ids:l,numberNonAppearing:[0,0]},{...t,days:n,key:1,ids:l,numberNonAppearing:[0,0]}]}));e.watch(N,async(t,l)=>{t!==l&&(A.value=[],confirm.value=!1,y.odata.personal.forEach(d=>{d.divisionName===t&&(A.value.some(o=>(o==null?void 0:o.activeText)===d.roleName)||A.value.push({val:!0,activeText:d.roleName}))}),Z())}),e.watch(O,t=>{p.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(t)),X(),Z()}),e.watch(w,()=>{Y.value=E.value}),e.watch(D,()=>{Y.value=E.value}),e.watch(P,()=>{Y.value=E.value});const ne=(t,l,d,o)=>{if(l.level!==3||l.labelClassName==="turn"||l.no===15||l.no>i.value.length||!y.checkEdit)return"";c.value.ids=t.ids,c.value.key=t.key,c.value.day=l.no<15?l.no:l.no-1;const n=new Date(p.value),a=`${n.getFullYear()}-${(n.getMonth()+1).toString().padStart(2,"0")}-${(c.value.day+1).toString().padStart(2,"0")}`,r=k.value.findIndex(g=>g.code===t.code);c.value.id=r!==-1?k.value[r].days.findIndex(g=>(g==null?void 0:g.day)===a):r,c.value.rest=r!==-1&&c.value.id!==-1,D.value=typeof t.days[c.value.day].tips>"u"?9:parseInt(t.days[c.value.day].tips.match(/(\d{1,2})/)),S.value=typeof t.days[c.value.day].night>"u"?0:parseInt(t.days[c.value.day].night),W.value=typeof t.days[c.value.day].overtime>"u"?0:parseInt(t.days[c.value.day].overtime),w.value=t.days[c.value.day].time!=="-"?parseInt(t.days[c.value.day].time+S.value+W.value):8;const h=t.days.findIndex(g=>g.day===a);c.value.failure=t.days[h].state,L.value.y=o.clientY,L.value.x=o.clientX,c.value.name=s("sheet.choiceOfMode"),E.value=!0,Y.value=!1},j=t=>{const l=new Date(p.value),d=`${l.getFullYear()}-${(l.getMonth()+1).toString().padStart(2,"0")}-${(c.value.day+1).toString().padStart(2,"0")}`;let o=k.value.findIndex(C=>C.code===b.value[c.value.ids].code),n=b.value[c.value.ids].days[c.value.day].state,a=t,r="-",h,g,x;switch(t){case"Я":n==="В"&&(a="РВ"),r=8;break;case"КВ":case"К":n==="В"||n==="КВ"?a="КВ":a="К";break;case"save":let C=G.value.split('"');if(a=C[1],Y.value=!1,/^(|К|КВ|ОТ|Б|Р|ОЖ|НН|У|ДО|УД|Г)$/.test(C[1]))break;r=w.value-S.value-W.value,x="("+C[2].split("(")[1],h=S.value,g=W.value}t==="reset"?(a=n,k.value[o].days.splice(c.value.id,1)):o===-1?k.value.push({code:b.value[c.value.ids].code,days:[{day:d,state:a,time:r,night:h,overtime:g,tips:x}]}):c.value.id===-1?k.value[o].days.push({day:d,state:a,time:r,night:h,overtime:g,tips:x}):k.value[o].days[c.value.id]={day:d,state:a,time:r,night:h,overtime:g,tips:x},y.workSchedule.addWorkSheet({group:N.value,date:v.parseTime(new Date(p.value),"{Y}-{m}-{dd}"),data:[{name:b.value[c.value.ids].fio,days:k.value[o].days,code:b.value[c.value.ids].code}]}),c.value.failure=a,P.value>1&&(P.value--,c.value.day++,c.value.id=o!==-1?k.value[o].days.findIndex(C=>(C==null?void 0:C.day)===`${l.getFullYear()}-${(l.getMonth()+1).toString().padStart(2,"0")}-${(c.value.day+1).toString().padStart(2,"0")}`):o,j(c.value.failure)),Q()},G=e.computed(()=>{let t=b.value[c.value.ids].days[c.value.day],l="",d=w.value>=22?D.value+w.value+2:D.value+w.value+1,o=c.value.failure.split("/")[0];o=/^Н(?!Н$)С?$/.test(o)?t.state!=="В"?"Я":"РВ":o,(D.value<6||d>22)&&(l="Н",S.value=D.value<6?Math.min(6,d)-D.value:0,d<=6&&(S.value=w.value,o=""),d===7&&S.value>3&&S.value--,S.value+=Math.max(22,d)-22),w.value>t.time&&o!=="РВ"&&(l+="С",W.value=w.value-t.time),l.length>0&&o.length>0&&(l="/"+l);let n=typeof(t==null?void 0:t.tips)<"u"?t.tips:`(${D.value}:00 - ${w.value>=22?D.value+w.value+2:D.value+w.value+1}:00)`,a=f.value[c.value.ids*2].days[c.value.day].time!=="-"?" "+w.value+" "+n:"";return'"'+o+l+'"'+a}),ue=t=>{if(t.columnIndex<2||t.columnIndex>i.value.length+3&&t.columnIndex<i.value.length+9||t.columnIndex>i.value.length+11)return f.value[t.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},X=()=>{const t=K.value,l=new Date(p.value),d=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let o=[],n=0;for(let a=1;a<=d;a++){const r=v.parseTime(l.setDate(a),"{Y}-{m}-{dd}");n+=t.nowork.includes(r)||t.holidays.includes(r)?0:t.preholidays.includes(r)?7:8;let h=t.nowork.includes(r)?"nowork":t.holidays.includes(r)?"holiday":t.preholidays.includes(r)?"preholiday":"";o.push({day:a,holidays:h,weekday:T(new Date(l.getFullYear(),l.getMonth(),a),"day")})}ae.value=n,i.value=o,y.odata.getPersonal({}).then(a=>{var r;N.value.length===0&&(N.value=(r=a.find(h=>h.employeeName===y.fullName))==null?void 0:r.divisionName),a.forEach(h=>{H.value.some(g=>(g==null?void 0:g.value)===h.divisionName)||H.value.push({value:h.divisionName,label:h.divisionName,key:h.divisionName}),h.divisionName===N.value&&!A.value.some(g=>(g==null?void 0:g.activeText)===h.roleName)&&A.value.push({val:!0,activeText:h.roleName})})})},Z=()=>{b.value=[],q.value=[],R.value=[],y.odata.personal.forEach(t=>{if(t.divisionName===N.value&&A.value.some(l=>l.val&&l.activeText===t.roleName)){let l=v.byInitials(t.employeeName);q.value.push(t.employeeKey),b.value.push({fio:t.employeeName,name:l+" ("+t.roleName+")",code:t.employeeKey,days:[],contHour:0,id:!1,ids:b.value.length})}}),y.workSchedule.getUsersYear({code:q.value,year:new Date(p.value).getFullYear()}).then(t=>{t.forEach(l=>{l.dateStart&&R.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),oe()})},oe=()=>{y.workSchedule.getWorkSheet({code:q.value,date:v.parseTime(new Date(p.value),"{Y}-{m}-{dd}")}).then(t=>{k.value=[],t.forEach(l=>{l!==null&&k.value.push({code:l.code,days:l.data.days})}),y.workSchedule.getWorkSchedule({code:q.value,date:v.parseTime(new Date(p.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((d,o)=>{var n,a;if(d!==null){b.value[o].days=[],d.data.days.forEach(r=>r.state="Я");for(let r=1;r<=i.value.length;r++){let h=v.parseTime(new Date(p.value).setDate(r),"{Y}-{m}-{dd}");const g=(n=d.data)==null?void 0:n.days.findIndex(x=>x.day===h);g===-1?z(r,o,"-","В"):b.value[o].days.push((a=d.data)==null?void 0:a.days[g])}}else for(let r=1;r<=i.value.length;r++)i.value[r-1].holidays===""?z(r,o,8):i.value[r-1].holidays==="preholiday"?z(r,o,7):z(r,o,"-","В");for(let r=1;r<=i.value.length;r++){let h=new Date(new Date(p.value).getFullYear(),new Date(p.value).getMonth(),r).getTime()+1e3;for(let g of R.value){const{dateStart:x,dateEnd:C,code:B}=g;if(x&&C&&B===b.value[o].code){const M=new Date(v.parseDate(x)).getTime(),F=new Date(v.parseDate(C)).getTime();if(h>=M&&h<=F){const u=v.parseTime(new Date(p.value).setDate(r),"{Y}-{m}-{dd}"),_=b.value[o].days.findIndex(J=>J.day===u);_!==-1?b.value[o].days[_]={day:u,time:"-",state:"ОТ"}:b.value[o].days.push({day:u,time:"-",state:"ОТ"})}}}}}),Q()})})},z=(t,l,d,o="Я")=>{const n=v.parseTime(new Date(p.value).setDate(t),"{Y}-{m}-{dd}");b.value[l].days.push({day:n,time:d,state:o})},Q=()=>{f.value.forEach(t=>{t.hourI=0,t.hourII=0,t.halfII=0,t.halfI=0,t.weekend=0,t.weekendDays=0,t.overtime=0,t.night=0,t.appearing={code:"-",count:"-"};const l=Object.entries(t.days.reduce((a,r)=>{if(r.hasOwnProperty("state")&&/^(|К|КВ|ОТ|Б|Р|ПР|ОЖ|НН|У|ДО|УД|Г)$/.test(r.state)){const h=r.state;a[h]=(a[h]||0)+1}return a},{})).map(([a,r])=>({code:a,count:r}));t.numberNonAppearing=[l.reduce((a,r)=>a+r.count,0),0];const d=Math.ceil(l.length/2),o=l.slice(0,d),n=l.slice(d);t.key===0&&o.length>0&&(t.appearing={code:o.map(a=>a.code).join("/"),count:o.map(a=>a.count).join("/")}),t.key===1&&n.length>0&&(t.appearing={code:n.map(a=>a.code).join("/"),count:n.map(a=>a.count).join("/")});for(let a=0;a<t.days.length;a++)a<15&&t.days[a].time!=="-"&&(t.hourI+=Number(t.days[a].time),t.days[a].night&&(t.hourI+=Number(t.days[a].night)),t.days[a].overtime&&(t.hourI+=Number(t.days[a].overtime)),t.halfI++),a>=15&&t.days[a].time!=="-"&&(t.days[a].night&&(t.hourII+=Number(t.days[a].night)),t.days[a].overtime&&(t.hourII+=Number(t.days[a].overtime)),t.hourII+=Number(t.days[a].time),t.halfII++),t.days[a].night&&(t.night+=Number(t.days[a].night)),t.days[a].overtime&&(t.overtime+=Number(t.days[a].overtime)),/{|РВ|}/.test(t.days[a].state)&&(t.weekend+=Number(t.days[a].time)),t.days[a].state==="В"&&t.weekendDays++;t.contDays=t.halfI+t.halfII,t.contHour=t.hourI+t.hourII})},ee=(t,l)=>{var h,g,x,C,B,M;if(l===-1)return"";const d=f.value[l],o=new Date(p.value),n=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${t.toString().padStart(2,"0")}`,a=d.days.findIndex(F=>F.day===n);let r=0;return(h=d.days[a])!=null&&h.night&&(r+=d.days[a].night),(g=d.days[a])!=null&&g.overtime&&(r+=d.days[a].overtime),a===-1?"":d.key===0?(x=d.days[a])==null?void 0:x.state:((C=d.days[a])==null?void 0:C.time)===0?r===0?"-":r:r===0?(B=d.days[a])==null?void 0:B.time:`${(M=d.days[a])==null?void 0:M.time}/${r}`};y.group&&(N.value=y.group),y.date&&(O.value=new Date(y.date+"T00:00:01").getMonth()),v.holidays().then(t=>{K.value=t,X()});const le=t=>new Date(p.value).getMonth()===new Date().getMonth()&&t===new Date().getDate()?" today":"",re=async()=>{var C,B,M,F;U.value=!0;const t=new ve.Workbook,l=t.addWorksheet(T(p.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),d={vertical:"middle",horizontal:"center"},o={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},n={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${v.cellsDynamically("A1",i.value.length+15)}1`),l.mergeCells("A2:A4"),l.mergeCells("B2:B4"),l.mergeCells("C2:C4"),l.mergeCells("D5:R5"),l.mergeCells(`D2:${v.cellsDynamically("D2",i.value.length+2)}2`),l.mergeCells(`${v.cellsDynamically("D2",i.value.length+3)}2:${v.cellsDynamically("D2",i.value.length+8)}2`),l.mergeCells(`${v.cellsDynamically("D2",i.value.length+9)}2:${v.cellsDynamically("D2",i.value.length+9)}4`),l.mergeCells(`${v.cellsDynamically("D2",i.value.length+10)}2:${v.cellsDynamically("D2",i.value.length+11)}2`),l.mergeCells(`${v.cellsDynamically("D2",i.value.length+12)}2:${v.cellsDynamically("D2",i.value.length+12)}4`),l.mergeCells(`${v.cellsDynamically("D3",i.value.length+3)}3:${v.cellsDynamically("D3",i.value.length+3)}4`),l.mergeCells(`${v.cellsDynamically("D3",i.value.length+4)}3:${v.cellsDynamically("D3",i.value.length+8)}3`),l.mergeCells(`${v.cellsDynamically("D3",i.value.length+10)}3:${v.cellsDynamically("D3",i.value.length+10)}4`),l.mergeCells(`${v.cellsDynamically("D3",i.value.length+11)}3:${v.cellsDynamically("D3",i.value.length+11)}4`),l.mergeCells(`T5:${v.cellsDynamically("D5",i.value.length+1)}5`);for(let u=1;u<=i.value.length+2;u++)l.mergeCells(`${v.cellsDynamically("D3",u)}3:${v.cellsDynamically("D4",u)}4`),l.getColumn(u+3).width=5,l.getColumn(u+3).alignment=n,l.getCell(3,u+3).border=o,u<16&&(l.getCell(3,u+3).value=u),u>16&&(l.getCell(3,u+3).value=u-1);l.getCell("A1").value=s("sheet.title",{name:N.value})+T(p.value,"month"),l.getCell("A2").value=s("sheet.listNumber"),l.getCell("B2").value=s("sheet.employee"),l.getCell("C2").value=s("sheet.personnelNumber"),l.getCell("D2").value=s("sheet.marks"),l.getCell("S3").value=s("sheet.halfMonth",{half:"I"}),l.getCell("A5").value="1",l.getCell("B5").value="2",l.getCell("C5").value="3",l.getCell("D5").value="4",l.getCell("S5").value="5",l.getCell("T5").value="6",l.getCell(5,i.value.length+5).value="7",l.getCell(2,i.value.length+6).value=s("sheet.workedMonth"),l.getCell(2,i.value.length+12).value=s("sheet.numberNonAppearing"),l.getCell(2,i.value.length+13).value=s("sheet.them"),l.getCell(2,i.value.length+15).value=s("sheet.countWeekend"),l.getCell(3,i.value.length+5).value=s("sheet.halfMonth",{half:"II"}),l.getCell(3,i.value.length+6).value=s("sheet.days"),l.getCell(3,i.value.length+7).value=s("sheet.hours"),l.getCell(4,i.value.length+7).value=s("sheet.all"),l.getCell(4,i.value.length+8).value=s("sheet.overtime"),l.getCell(4,i.value.length+9).value=s("sheet.night"),l.getCell(4,i.value.length+10).value=s("sheet.weekend"),l.getCell(4,i.value.length+13).value=s("sheet.code"),l.getCell(4,i.value.length+14).value=s("sheet.count"),l.getRow(1).height=40,l.getRow(2).height=32,l.getRow(3).height=20,l.getRow(4).height=60,l.getColumn(1).width=6,l.getColumn(2).width=30,l.getColumn(3).width=17,l.getColumn(19).width=12,l.getColumn(i.value.length+5).width=12,l.getColumn(i.value.length+12).width=11,l.getColumn(i.value.length+15).width=11,l.getCell("A1").alignment=d,l.getColumn(1).alignment=n,l.getColumn(2).alignment=n,l.getColumn(3).alignment=n;for(let u=6;u<=15;u++)l.getCell(5,i.value.length+u).value=u+2,l.getColumn(i.value.length+u).alignment=n,l.getCell(4,i.value.length+u).border=o,l.getCell(5,i.value.length+u).border=o;l.getCell("A2").border=o,l.getCell("B2").border=o,l.getCell("C2").border=o,l.getCell("D2").border=o,l.getCell("D2").border=o,l.getCell("A5").border=o,l.getCell("B5").border=o,l.getCell("C5").border=o,l.getCell("D5").border=o,l.getCell("S5").border=o,l.getCell("T5").border=o,l.getCell(2,i.value.length+6).border=o,l.getCell(2,i.value.length+12).border=o,l.getCell(2,i.value.length+13).border=o,l.getCell(2,i.value.length+15).border=o,l.getCell(3,i.value.length+7).border=o;let a=1,r=5,h=!0;for(const u of f.value){let _=[a,u.name,u.code];for(let V=0;V<i.value.length;V++)V===15&&_.push(h?(u==null?void 0:u.halfI)||"":(u==null?void 0:u.hourI)||""),_.push(h?((C=u.days[V])==null?void 0:C.state)||"":((B=u.days[V])==null?void 0:B.time)||"");_.push(h?(u==null?void 0:u.halfII)||0:(u==null?void 0:u.hourII)||0,(u==null?void 0:u.contDays)||0,(u==null?void 0:u.contHour)||0,(u==null?void 0:u.overtime)||0,(u==null?void 0:u.night)||0,(u==null?void 0:u.weekend)||0,"",h?(u==null?void 0:u.numberNonAppearing[0])||"":(u==null?void 0:u.numberNonAppearing[1])||0,((M=u==null?void 0:u.appearing)==null?void 0:M.code)||"-",((F=u==null?void 0:u.appearing)==null?void 0:F.count)||"-",(u==null?void 0:u.weekendDays)||0);const J=l.addRow(_);if(J.border=o,!h){l.mergeCells(`A${r+a*2-1}:A${r+a*2}`),l.mergeCells(`B${r+a*2-1}:B${r+a*2}`),l.mergeCells(`C${r+a*2-1}:C${r+a*2}`);for(let V=i.value.length+3;V<=i.value.length+8;V++)l.mergeCells(`${v.cellsDynamically("D",V)}${r+a*2-1}:${v.cellsDynamically("D",V)}${r+a*2}`);l.mergeCells(`${v.cellsDynamically("D",i.value.length+12)}${r+a*2-1}:${v.cellsDynamically("D",i.value.length+12)}${r+a*2}`),a++}h=!h}y.odata.personal.forEach(u=>{u.roleName==="Начальник отдела правовой и кадровой работы"&&u.employeeName});const g="export_"+v.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",x=await t.xlsx.writeBuffer();ie.saveAs(new Blob([x]),g),U.value=!1};return(t,l)=>{const d=e.resolveComponent("el-slider"),o=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",he,[$.checkEdit?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:0,modelValue:N.value,"onUpdate:modelValue":l[0]||(l[0]=n=>N.value=n),placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.value,n=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),l[9]||(l[9]=e.createElementVNode("div",{class:"expander"},null,-1)),$.checkEdit?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),{key:1,modelValue:O.value,"onUpdate:modelValue":l[1]||(l[1]=n=>O.value=n),"active-text":e.unref(s)("workSchedule.currentMonth"),"active-value":"0","inactive-value":"-1",style:{"margin-bottom":".5rem","margin-left":".5rem"}},null,8,["modelValue","active-text"])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(m.ElTable),{id:"printTable",data:f.value,"span-method":ue,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(s)("sheet.emptyText"),align:"center",onCellClick:ne},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.title",{name:N.value})+e.unref(T)(p.value,"month"),align:"center",height:"10"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.employee"),width:"180",align:"center"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.personnelNumber"),align:"center"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.marks"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.day},[n.day<=15?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,width:"30","class-name":n.holidays+le(n.day),align:"center",label:n.day.toString()+`
2
+ `+n.weekday},{default:e.withCtx(a=>[e.createElementVNode("div",ge,e.toDisplayString(ee(n.day,a.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0),n.day===15?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:1,label:e.unref(s)("sheet.halfMonth",{half:"I"}),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(f.value[a.$index].key===0?f.value[a.$index].halfI:f.value[a.$index].hourI),1)]),_:1},8,["label"])):e.createCommentVNode("",!0),n.day>15?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:2,width:"30","class-name":n.holidays+le(n.day),align:"center",label:n.day.toString()+`
3
+ `+n.weekday},{default:e.withCtx(a=>[e.createElementVNode("div",me,e.toDisplayString(ee(n.day,a.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.halfMonth",{half:"II"}),align:"center"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].key===0?f.value[n.$index].halfII:f.value[n.$index].hourII),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.workedMonth"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.days"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].contDays),1)]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.hours"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.all"),align:"center","label-class-name":"turn",width:"40"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].contHour),1)]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.overtime"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].overtime),1)]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.night"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].night),1)]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.weekend"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].weekend),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.numberNonAppearing"),align:"center"},{default:e.withCtx(n=>{var a;return[e.createTextVNode(e.toDisplayString((a=f.value[n.$index])==null?void 0:a.numberNonAppearing[f.value[n.$index].key]),1)]}),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.them"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.code"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(n=>{var a;return[e.createTextVNode(e.toDisplayString((a=f.value[n.$index].appearing)==null?void 0:a.code),1)]}),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.count"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(n=>{var a;return[e.createTextVNode(e.toDisplayString((a=f.value[n.$index].appearing)==null?void 0:a.count),1)]}),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(m.ElTableColumn),{label:e.unref(s)("sheet.countWeekend"),align:"center"},{default:e.withCtx(n=>[e.createTextVNode(e.toDisplayString(f.value[n.$index].weekendDays),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]),e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElButton),{disabled:U.value,plain:"",onClick:re,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[o,U.value]]),e.createVNode(e.unref(I.ContextMenu),{show:E.value,"onUpdate:show":l[8]||(l[8]=n=>E.value=n),options:L.value},{default:e.withCtx(()=>[e.createVNode(e.unref(I.ContextMenuItem),{label:c.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(I.ContextMenuSeparator)),e.createElementVNode("div",null,[e.createElementVNode("div",null,[e.createVNode(e.unref(I.ContextMenuGroup),{label:G.value,style:{padding:"0 0 .5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,n=>(e.openBlock(),e.createBlock(e.unref(I.ContextMenuItem),{key:n.value,label:n.label,onClick:a=>j(n.value),clickClose:!1},null,8,["label","onClick"]))),128))]),_:1},8,["label"])]),/^(РВ|Я|Н(?![Н])).*$/.test(c.value.failure)?(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(e.unref(I.ContextMenuItem),{clickClose:!1},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("workSchedule.with"))+":",1)]),_:1}),e.createVNode(d,{modelValue:D.value,"onUpdate:modelValue":l[2]||(l[2]=n=>D.value=n),step:1,min:0,max:19,style:{width:"100%"}},null,8,["modelValue"]),e.createVNode(e.unref(I.ContextMenuItem),{clickClose:!1},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("workSchedule.duration"))+":",1)]),_:1}),e.createVNode(d,{modelValue:w.value,"onUpdate:modelValue":l[3]||(l[3]=n=>w.value=n),step:1,min:4,max:e.unref(v.clamp)(D.value!==1?23-D.value:21,4,22)},null,8,["modelValue","max"])])):e.createCommentVNode("",!0),/^(|К|КВ|ОТ|Б|Р|ОЖ|У|ДО|УД|Г)$/.test(c.value.failure)?(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(I.ContextMenuItem),{clickClose:!1},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("sheet.count"))+":",1)]),_:1}),e.createVNode(d,{modelValue:P.value,"onUpdate:modelValue":l[4]||(l[4]=n=>P.value=n),step:1,min:1,max:i.value.length-c.value.day,style:{width:"100%"}},null,8,["modelValue","max"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(I.ContextMenuItem),null,{default:e.withCtx(()=>[c.value.rest?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,onClick:l[5]||(l[5]=n=>j("reset"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("sheet.reset")),1)]),_:1})):e.createCommentVNode("",!0),Y.value?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:l[6]||(l[6]=n=>j("save"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("sheet.save")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElButton),{onClick:l[7]||(l[7]=n=>E.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("sheet.cancel")),1)]),_:1})]),_:1})])]),_:1},8,["show","options"])],64)}}};module.exports=pe;
@@ -1,383 +1,656 @@
1
- import { ref as b, watch as L, computed as le, createElementBlock as N, openBlock as w, Fragment as S, createBlock as M, createCommentVNode as T, createElementVNode as B, createVNode as r, unref as t, withCtx as s, renderList as j, createTextVNode as y, toDisplayString as v } from "vue";
2
- import { useI18n as te } from "vue-i18n";
3
- import { p as $, b as ne, a as q, h as oe } from "./index-2Mx6IUGl.js";
4
- import { ElSelect as ue, ElOption as se, ElSwitch as ie, ElTable as de, ElTableColumn as d } from "element-plus";
5
- const re = { style: { height: "20px", width: "100%", display: "inline-block" } }, ce = { style: { height: "20px", width: "100%", display: "inline-block" } }, fe = {
1
+ import { ref as p, computed as fe, watch as q, resolveComponent as xe, resolveDirective as Ie, createElementBlock as R, openBlock as $, Fragment as Z, createElementVNode as V, createVNode as m, withDirectives as Se, createBlock as A, createCommentVNode as B, unref as s, withCtx as g, renderList as ie, createTextVNode as x, toDisplayString as b } from "vue";
2
+ import { useI18n as Ne } from "vue-i18n";
3
+ import { p as F, b as Me, a as pe, h as _e, c as Ee, d as y } from "./index-2Mx6IUGl.js";
4
+ import { ElSelect as Te, ElOption as Ae, ElSwitch as Ye, ElTable as Ve, ElTableColumn as C, ElButton as te } from "element-plus";
5
+ import { ContextMenu as Be, ContextMenuItem as J, ContextMenuSeparator as Fe, ContextMenuGroup as We } from "@imengyu/vue3-context-menu";
6
+ import { saveAs as Ue } from "file-saver";
7
+ import * as He from "exceljs";
8
+ const Oe = { class: "nav" }, Re = { style: { height: "20px", width: "100%", display: "inline-block" } }, ze = { style: { height: "20px", width: "100%", display: "inline-block" } }, Pe = {
9
+ key: 0,
10
+ style: { padding: "0 1rem .5rem" }
11
+ }, je = {
12
+ key: 1,
13
+ style: { padding: "0 1rem .5rem" }
14
+ }, Ze = {
6
15
  __name: "SheetTable",
7
16
  props: {
8
17
  checkEdit: { type: Boolean, default: () => !0 },
9
18
  odata: Object,
10
19
  workSchedule: Object,
11
- fullName: { type: String, default: "Вы" }
20
+ fullName: { type: String, default: "Вы" },
21
+ group: String,
22
+ date: String
12
23
  },
13
- setup(Y) {
14
- const k = Y, { t: i, d: A } = te(), m = b([]), _ = b("0"), f = b(new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(_.value))), p = b([]), D = b("all"), V = b([{ value: "all", label: "Все", key: "all" }]), O = b([]), F = b(0), I = b([]), H = b([]), E = b([]);
15
- L(D, async (e, l) => {
16
- e !== l && (I.value = [], confirm.value = !1, k.odata.personal.forEach((a) => {
17
- a.divisionName === e && (I.value.some((u) => (u == null ? void 0 : u.activeText) === a.roleName) || I.value.push({ val: !0, activeText: a.roleName }));
18
- }), K());
19
- }), L(_, (e) => {
20
- f.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(e)), U();
24
+ setup(ne) {
25
+ const S = ne, { t: i, d: Q } = Ne(), ee = p(!1), k = p([]), K = p("0"), w = p(new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(K.value))), d = p([]), E = p(""), ue = p([{ value: "all", label: "Все", key: "all" }]), be = p([
26
+ { value: "Я", label: i("sheet.valid.1") },
27
+ { value: "К", label: i("sheet.valid.2") },
28
+ { value: "ОТ", label: i("sheet.valid.3") },
29
+ { value: "ДО", label: i("sheet.valid.4") },
30
+ { value: "Р", label: i("sheet.valid.5") },
31
+ { value: "ОЖ", label: i("sheet.valid.6") },
32
+ { value: "Б", label: i("sheet.valid.7") },
33
+ { value: "НН", label: i("sheet.valid.8") },
34
+ { value: "ПР", label: i("sheet.valid.9") },
35
+ { value: "У", label: i("sheet.valid.10") },
36
+ { value: "УД", label: i("sheet.valid.11") },
37
+ { value: "Г", label: i("sheet.valid.12") }
38
+ ]), re = p([]), Ce = p(0), N = p(9), I = p(8), Y = p(0), L = p(0), z = p([]), P = p(!1), oe = p([]), G = p([]), W = p(!1), X = p(1), se = p({
39
+ zIndex: 3,
40
+ minWidth: 230,
41
+ x: 500,
42
+ y: 200
43
+ }), v = p({ name: "", length: 0, code: "" }), _ = p([
44
+ // {code: '00ЗК-00336',
45
+ // days:[
46
+ // {
47
+ // day: '2025-09-07',
48
+ // state: 'РВ',
49
+ // time: 8
50
+ // }
51
+ // ]
52
+ // }
53
+ ]), f = fe(() => k.value.flatMap((l, e) => {
54
+ const r = _.value.find((a) => a.code === l.code), u = /* @__PURE__ */ new Map();
55
+ l.days.forEach((a) => u.set(a.day, { ...a })), r && r.days.forEach((a) => u.set(a.day, { ...a }));
56
+ const t = Array.from(u.values());
57
+ return [{ ...l, days: t, key: 0, ids: e, numberNonAppearing: [0, 0] }, { ...l, days: t, key: 1, ids: e, numberNonAppearing: [0, 0] }];
58
+ }));
59
+ q(E, async (l, e) => {
60
+ l !== e && (z.value = [], confirm.value = !1, S.odata.personal.forEach((r) => {
61
+ r.divisionName === l && (z.value.some((u) => (u == null ? void 0 : u.activeText) === r.roleName) || z.value.push({ val: !0, activeText: r.roleName }));
62
+ }), ge());
63
+ }), q(K, (l) => {
64
+ w.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(l)), he(), ge();
65
+ }), q(I, () => {
66
+ P.value = W.value;
67
+ }), q(N, () => {
68
+ P.value = W.value;
69
+ }), q(X, () => {
70
+ P.value = W.value;
21
71
  });
22
- const o = le(() => m.value.flatMap((e, l) => [{ ...e, key: 0, ids: l }, { ...e, key: 1, ids: l }])), G = (e) => {
23
- if (e.columnIndex < 2 || e.columnIndex > p.value.length + 3 && e.columnIndex < p.value.length + 9 || e.columnIndex > p.value.length + 11)
24
- return o.value[e.rowIndex].key === 0 ? {
72
+ const we = (l, e, r, u) => {
73
+ if (e.level !== 3 || e.labelClassName === "turn" || e.no === 15 || e.no > d.value.length || !S.checkEdit) return "";
74
+ v.value.ids = l.ids, v.value.key = l.key, v.value.day = e.no < 15 ? e.no : e.no - 1;
75
+ const t = new Date(w.value), a = `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${(v.value.day + 1).toString().padStart(2, "0")}`, o = _.value.findIndex((c) => c.code === l.code);
76
+ v.value.id = o !== -1 ? _.value[o].days.findIndex((c) => (c == null ? void 0 : c.day) === a) : o, v.value.rest = o !== -1 && v.value.id !== -1, N.value = typeof l.days[v.value.day].tips > "u" ? 9 : parseInt(l.days[v.value.day].tips.match(/(\d{1,2})/)), Y.value = typeof l.days[v.value.day].night > "u" ? 0 : parseInt(l.days[v.value.day].night), L.value = typeof l.days[v.value.day].overtime > "u" ? 0 : parseInt(l.days[v.value.day].overtime), I.value = l.days[v.value.day].time !== "-" ? parseInt(l.days[v.value.day].time + Y.value + L.value) : 8;
77
+ const h = l.days.findIndex((c) => c.day === a);
78
+ v.value.failure = l.days[h].state, se.value.y = u.clientY, se.value.x = u.clientX, v.value.name = i("sheet.choiceOfMode"), W.value = !0, P.value = !1;
79
+ }, le = (l) => {
80
+ const e = new Date(w.value), r = `${e.getFullYear()}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${(v.value.day + 1).toString().padStart(2, "0")}`;
81
+ let u = _.value.findIndex((D) => D.code === k.value[v.value.ids].code), t = k.value[v.value.ids].days[v.value.day].state, a = l, o = "-", h, c, M;
82
+ switch (l) {
83
+ case "Я":
84
+ t === "В" && (a = "РВ"), o = 8;
85
+ break;
86
+ case "КВ":
87
+ case "К":
88
+ t === "В" || t === "КВ" ? a = "КВ" : a = "К";
89
+ break;
90
+ case "save":
91
+ let D = ve.value.split('"');
92
+ if (a = D[1], P.value = !1, /^(|К|КВ|ОТ|Б|Р|ОЖ|НН|У|ДО|УД|Г)$/.test(D[1])) break;
93
+ o = I.value - Y.value - L.value, M = "(" + D[2].split("(")[1], h = Y.value, c = L.value;
94
+ }
95
+ l === "reset" ? (a = t, _.value[u].days.splice(v.value.id, 1)) : u === -1 ? _.value.push({ code: k.value[v.value.ids].code, days: [{ day: r, state: a, time: o, night: h, overtime: c, tips: M }] }) : v.value.id === -1 ? _.value[u].days.push({ day: r, state: a, time: o, night: h, overtime: c, tips: M }) : _.value[u].days[v.value.id] = { day: r, state: a, time: o, night: h, overtime: c, tips: M }, S.workSchedule.addWorkSheet({
96
+ group: E.value,
97
+ date: F(new Date(w.value), "{Y}-{m}-{dd}"),
98
+ data: [{
99
+ name: k.value[v.value.ids].fio,
100
+ days: _.value[u].days,
101
+ code: k.value[v.value.ids].code
102
+ }]
103
+ }), v.value.failure = a, X.value > 1 && (X.value--, v.value.day++, v.value.id = u !== -1 ? _.value[u].days.findIndex((D) => (D == null ? void 0 : D.day) === `${e.getFullYear()}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${(v.value.day + 1).toString().padStart(2, "0")}`) : u, le(v.value.failure)), ce();
104
+ }, ve = fe(() => {
105
+ let l = k.value[v.value.ids].days[v.value.day], e = "", r = I.value >= 22 ? N.value + I.value + 2 : N.value + I.value + 1, u = v.value.failure.split("/")[0];
106
+ u = /^Н(?!Н$)С?$/.test(u) ? l.state !== "В" ? "Я" : "РВ" : u, (N.value < 6 || r > 22) && (e = "Н", Y.value = N.value < 6 ? Math.min(6, r) - N.value : 0, r <= 6 && (Y.value = I.value, u = ""), r === 7 && Y.value > 3 && Y.value--, Y.value += Math.max(22, r) - 22), I.value > l.time && u !== "РВ" && (e += "С", L.value = I.value - l.time), e.length > 0 && u.length > 0 && (e = "/" + e);
107
+ let t = typeof (l == null ? void 0 : l.tips) < "u" ? l.tips : `(${N.value}:00 - ${I.value >= 22 ? N.value + I.value + 2 : N.value + I.value + 1}:00)`, a = f.value[v.value.ids * 2].days[v.value.day].time !== "-" ? " " + I.value + " " + t : "";
108
+ return '"' + u + e + '"' + a;
109
+ }), De = (l) => {
110
+ if (l.columnIndex < 2 || l.columnIndex > d.value.length + 3 && l.columnIndex < d.value.length + 9 || l.columnIndex > d.value.length + 11)
111
+ return f.value[l.rowIndex].key === 0 ? {
25
112
  rowspan: 2,
26
113
  colspan: 1
27
114
  } : {
28
115
  rowspan: 0,
29
116
  colspan: 0
30
117
  };
31
- }, U = () => {
32
- const e = O.value, l = new Date(f.value), a = new Date(l.getFullYear(), l.getMonth() + 1, 0).getDate();
33
- let u = [], x = 0;
34
- for (let n = 1; n <= a; n++) {
35
- const c = $(l.setDate(n), "{Y}-{m}-{dd}");
36
- x += e.nowork.includes(c) || e.holidays.includes(c) ? 0 : e.preholidays.includes(c) ? 7 : 8;
37
- let h = e.nowork.includes(c) ? "nowork" : e.holidays.includes(c) ? "holiday" : e.preholidays.includes(c) ? "preholiday" : "";
38
- u.push({ day: n, holidays: h, weekday: A(new Date(l.getFullYear(), l.getMonth(), n), "day") });
118
+ }, he = () => {
119
+ const l = re.value, e = new Date(w.value), r = new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
120
+ let u = [], t = 0;
121
+ for (let a = 1; a <= r; a++) {
122
+ const o = F(e.setDate(a), "{Y}-{m}-{dd}");
123
+ t += l.nowork.includes(o) || l.holidays.includes(o) ? 0 : l.preholidays.includes(o) ? 7 : 8;
124
+ let h = l.nowork.includes(o) ? "nowork" : l.holidays.includes(o) ? "holiday" : l.preholidays.includes(o) ? "preholiday" : "";
125
+ u.push({ day: a, holidays: h, weekday: Q(new Date(e.getFullYear(), e.getMonth(), a), "day") });
39
126
  }
40
- F.value = x, p.value = u, k.odata.getPersonal({}).then((n) => {
41
- var c;
42
- D.value = (c = n.find((h) => h.employeeName === k.fullName)) == null ? void 0 : c.divisionName, n.forEach((h) => {
43
- V.value.some((g) => (g == null ? void 0 : g.value) === h.divisionName) || V.value.push({ value: h.divisionName, label: h.divisionName, key: h.divisionName }), h.divisionName === D.value && !I.value.some((g) => (g == null ? void 0 : g.activeText) === h.roleName) && I.value.push({ val: !0, activeText: h.roleName });
44
- }), K();
127
+ Ce.value = t, d.value = u, S.odata.getPersonal({}).then((a) => {
128
+ var o;
129
+ E.value.length === 0 && (E.value = (o = a.find((h) => h.employeeName === S.fullName)) == null ? void 0 : o.divisionName), a.forEach((h) => {
130
+ ue.value.some((c) => (c == null ? void 0 : c.value) === h.divisionName) || ue.value.push({ value: h.divisionName, label: h.divisionName, key: h.divisionName }), h.divisionName === E.value && !z.value.some((c) => (c == null ? void 0 : c.activeText) === h.roleName) && z.value.push({ val: !0, activeText: h.roleName });
131
+ });
45
132
  });
46
- }, K = () => {
47
- m.value = [], E.value = [], H.value = [], k.odata.personal.forEach((e) => {
48
- if (e.divisionName === D.value && I.value.some((l) => l.val && l.activeText === e.roleName)) {
49
- let l = ne(e.employeeName);
50
- E.value.push(e.employeeKey), m.value.push({ name: l + " (" + e.roleName + ")", code: e.employeeKey, days: [], contHour: 0, id: !1, ids: m.value.length });
133
+ }, ge = () => {
134
+ k.value = [], G.value = [], oe.value = [], S.odata.personal.forEach((l) => {
135
+ if (l.divisionName === E.value && z.value.some((e) => e.val && e.activeText === l.roleName)) {
136
+ let e = Me(l.employeeName);
137
+ G.value.push(l.employeeKey), k.value.push({ fio: l.employeeName, name: e + " (" + l.roleName + ")", code: l.employeeKey, days: [], contHour: 0, id: !1, ids: k.value.length });
51
138
  }
52
- }), k.workSchedule.getUsersYear({ code: E.value, year: new Date(f.value).getFullYear() }).then((e) => {
53
- e.forEach((l) => {
54
- l.dateStart && H.value.push({ code: l.code, dateStart: l.dateStart, dateEnd: l.dateEnd });
55
- }), console.log(e), R();
139
+ }), S.workSchedule.getUsersYear({ code: G.value, year: new Date(w.value).getFullYear() }).then((l) => {
140
+ l.forEach((e) => {
141
+ e.dateStart && oe.value.push({ code: e.code, dateStart: e.dateStart, dateEnd: e.dateEnd });
142
+ }), ke();
56
143
  });
57
- }, R = () => {
58
- k.workSchedule.getWorkSchedule({ code: E.value, date: $(new Date(f.value), "{Y}-{m}-{dd}") }).then(
59
- (e) => {
60
- e.forEach((l, a) => {
61
- var u, x;
62
- if (l !== null) {
63
- l.data.days.forEach((n) => n.state = "Я");
64
- for (let n = 1; n <= p.value.length; n++) {
65
- let c = $(new Date(f.value).setDate(n), "{Y}-{m}-{dd}");
66
- const h = (u = l.data) == null ? void 0 : u.days.findIndex((g) => g.day === c);
67
- h === -1 ? m.value[a].days.push({
68
- day: c,
69
- time: "-",
70
- state: "В"
71
- }) : m.value[a].days.push((x = l.data) == null ? void 0 : x.days[h]);
72
- }
73
- } else {
74
- m.value[a].days = [];
75
- for (let n = 1; n <= p.value.length; n++)
76
- p.value[n - 1].holidays === "" ? P(n, a, 8) : p.value[n - 1].holidays === "preholiday" ? P(n, a, 7) : m.value[a].days.push({
77
- day: $(new Date(f.value).setDate(n), "{Y}-{m}-{dd}"),
78
- time: "-",
79
- state: "В"
80
- });
81
- }
82
- for (let n = 1; n <= p.value.length; n++) {
83
- let c = new Date(new Date(f.value).getFullYear(), new Date(f.value).getMonth(), n).getTime() + 1e3;
84
- for (let h of H.value) {
85
- const { dateStart: g, dateEnd: z, code: Z } = h;
86
- if (g && z && Z === l.code) {
87
- const Q = new Date(q(g)).getTime(), ee = new Date(q(z)).getTime();
88
- if (c >= Q && c <= ee) {
89
- const C = $(new Date(f.value).setDate(n), "{Y}-{m}-{dd}"), J = m.value[a].days.findIndex((ae) => ae.day === C);
90
- J !== -1 ? m.value[a].days[J] = { day: C, time: "-", state: "О" } : m.value[a].days.push({ day: C, time: "-", state: "О" });
144
+ }, ke = () => {
145
+ S.workSchedule.getWorkSheet({ code: G.value, date: F(new Date(w.value), "{Y}-{m}-{dd}") }).then(
146
+ (l) => {
147
+ _.value = [], l.forEach((e) => {
148
+ e !== null && _.value.push({ code: e.code, days: e.data.days });
149
+ }), S.workSchedule.getWorkSchedule({ code: G.value, date: F(new Date(w.value), "{Y}-{m}-{dd}") }).then(
150
+ (e) => {
151
+ e.forEach((r, u) => {
152
+ var t, a;
153
+ if (r !== null) {
154
+ k.value[u].days = [], r.data.days.forEach((o) => o.state = "Я");
155
+ for (let o = 1; o <= d.value.length; o++) {
156
+ let h = F(new Date(w.value).setDate(o), "{Y}-{m}-{dd}");
157
+ const c = (t = r.data) == null ? void 0 : t.days.findIndex((M) => M.day === h);
158
+ c === -1 ? ae(o, u, "-", "В") : k.value[u].days.push((a = r.data) == null ? void 0 : a.days[c]);
159
+ }
160
+ } else
161
+ for (let o = 1; o <= d.value.length; o++)
162
+ d.value[o - 1].holidays === "" ? ae(o, u, 8) : d.value[o - 1].holidays === "preholiday" ? ae(o, u, 7) : ae(o, u, "-", "В");
163
+ for (let o = 1; o <= d.value.length; o++) {
164
+ let h = new Date(new Date(w.value).getFullYear(), new Date(w.value).getMonth(), o).getTime() + 1e3;
165
+ for (let c of oe.value) {
166
+ const { dateStart: M, dateEnd: D, code: U } = c;
167
+ if (M && D && U === k.value[u].code) {
168
+ const H = new Date(pe(M)).getTime(), j = new Date(pe(D)).getTime();
169
+ if (h >= H && h <= j) {
170
+ const n = F(new Date(w.value).setDate(o), "{Y}-{m}-{dd}"), O = k.value[u].days.findIndex((de) => de.day === n);
171
+ O !== -1 ? k.value[u].days[O] = { day: n, time: "-", state: "ОТ" } : k.value[u].days.push({ day: n, time: "-", state: "ОТ" });
172
+ }
173
+ }
91
174
  }
92
175
  }
93
- }
176
+ }), ce();
94
177
  }
95
- }), X();
178
+ );
96
179
  }
97
180
  );
98
- }, P = (e, l, a) => {
99
- const u = $(new Date(f.value).setDate(e), "{Y}-{m}-{dd}");
100
- m.value[l].days.push({
101
- day: u,
102
- time: a,
103
- state: "Я"
181
+ }, ae = (l, e, r, u = "Я") => {
182
+ const t = F(new Date(w.value).setDate(l), "{Y}-{m}-{dd}");
183
+ k.value[e].days.push({
184
+ day: t,
185
+ time: r,
186
+ state: u
104
187
  });
105
- }, X = () => {
106
- m.value.forEach((e) => {
107
- e.hourI = 0, e.hourII = 0, e.halfII = 0, e.halfI = 0, e.weekend = 0, e.weekendDays = 0, e.night = 0;
108
- for (let l = 0; l < e.days.length; l++)
109
- l < 15 && e.days[l].time !== "-" && (e.hourI += e.days[l].time), l < 15 && e.days[l].state === "Я" && e.halfI++, l >= 15 && e.days[l].time !== "-" && (e.hourII += e.days[l].time), l >= 15 && e.days[l].state === "Я" && e.halfII++, e.days[l].state === "Н" && (e.night += e.days[l].time), e.days[l].state === "РВ" && (e.weekend += e.days[l].time), e.days[l].state === "В" && e.weekendDays++;
110
- e.contDays = e.halfI + e.halfII, e.contHour = e.hourI + e.hourII, e.overtime = 0, F.value < e.contHour && (e.overtime = e.contHour - F.value), e.numberNonAppearing = 0, e.appearing = {
188
+ }, ce = () => {
189
+ f.value.forEach((l) => {
190
+ l.hourI = 0, l.hourII = 0, l.halfII = 0, l.halfI = 0, l.weekend = 0, l.weekendDays = 0, l.overtime = 0, l.night = 0, l.appearing = {
111
191
  code: "-",
112
- countH: "-"
192
+ count: "-"
113
193
  };
194
+ const e = Object.entries(
195
+ l.days.reduce((a, o) => {
196
+ if (o.hasOwnProperty("state") && /^(|К|КВ|ОТ|Б|Р|ПР|ОЖ|НН|У|ДО|УД|Г)$/.test(o.state)) {
197
+ const h = o.state;
198
+ a[h] = (a[h] || 0) + 1;
199
+ }
200
+ return a;
201
+ }, {})
202
+ ).map(([a, o]) => ({ code: a, count: o }));
203
+ l.numberNonAppearing = [e.reduce((a, o) => a + o.count, 0), 0];
204
+ const r = Math.ceil(e.length / 2), u = e.slice(0, r), t = e.slice(r);
205
+ l.key === 0 && u.length > 0 && (l.appearing = {
206
+ code: u.map((a) => a.code).join("/"),
207
+ count: u.map((a) => a.count).join("/")
208
+ }), l.key === 1 && t.length > 0 && (l.appearing = {
209
+ code: t.map((a) => a.code).join("/"),
210
+ count: t.map((a) => a.count).join("/")
211
+ });
212
+ for (let a = 0; a < l.days.length; a++)
213
+ a < 15 && l.days[a].time !== "-" && (l.hourI += Number(l.days[a].time), l.days[a].night && (l.hourI += Number(l.days[a].night)), l.days[a].overtime && (l.hourI += Number(l.days[a].overtime)), l.halfI++), a >= 15 && l.days[a].time !== "-" && (l.days[a].night && (l.hourII += Number(l.days[a].night)), l.days[a].overtime && (l.hourII += Number(l.days[a].overtime)), l.hourII += Number(l.days[a].time), l.halfII++), l.days[a].night && (l.night += Number(l.days[a].night)), l.days[a].overtime && (l.overtime += Number(l.days[a].overtime)), /{|РВ|}/.test(l.days[a].state) && (l.weekend += Number(l.days[a].time)), l.days[a].state === "В" && l.weekendDays++;
214
+ l.contDays = l.halfI + l.halfII, l.contHour = l.hourI + l.hourII;
114
215
  });
115
- }, W = (e, l) => {
116
- var n, c;
117
- if (l === -1) return "";
118
- const a = new Date(f.value), u = `${a.getFullYear()}-${(a.getMonth() + 1).toString().padStart(2, "0")}-${e.toString().padStart(2, "0")}`, x = o.value[l].days.findIndex((h) => h.day === u);
119
- return x === -1 ? "" : o.value[l].key === 0 ? (n = o.value[l].days[x]) == null ? void 0 : n.state : (c = o.value[l].days[x]) == null ? void 0 : c.time;
216
+ }, me = (l, e) => {
217
+ var h, c, M, D, U, H;
218
+ if (e === -1) return "";
219
+ const r = f.value[e], u = new Date(w.value), t = `${u.getFullYear()}-${(u.getMonth() + 1).toString().padStart(2, "0")}-${l.toString().padStart(2, "0")}`, a = r.days.findIndex((j) => j.day === t);
220
+ let o = 0;
221
+ return (h = r.days[a]) != null && h.night && (o += r.days[a].night), (c = r.days[a]) != null && c.overtime && (o += r.days[a].overtime), a === -1 ? "" : r.key === 0 ? (M = r.days[a]) == null ? void 0 : M.state : ((D = r.days[a]) == null ? void 0 : D.time) === 0 ? o === 0 ? "-" : o : o === 0 ? (U = r.days[a]) == null ? void 0 : U.time : `${(H = r.days[a]) == null ? void 0 : H.time}/${o}`;
120
222
  };
121
- return oe().then((e) => {
122
- O.value = e, U();
123
- }), (e, l) => (w(), N(S, null, [
124
- Y.checkEdit ? (w(), M(t(ue), {
125
- key: 0,
126
- modelValue: D.value,
127
- "onUpdate:modelValue": l[0] || (l[0] = (a) => D.value = a),
128
- placeholder: "Select",
129
- style: { width: "240px", "margin-bottom": ".5rem", "margin-right": ".5rem" }
130
- }, {
131
- default: s(() => [
132
- (w(!0), N(S, null, j(V.value, (a) => (w(), M(t(se), {
133
- key: a.value,
134
- label: a.label,
135
- value: a.value
136
- }, null, 8, ["label", "value"]))), 128))
137
- ]),
138
- _: 1
139
- }, 8, ["modelValue"])) : T("", !0),
140
- l[2] || (l[2] = B("div", { class: "expander" }, null, -1)),
141
- Y.checkEdit ? (w(), M(t(ie), {
142
- key: 1,
143
- modelValue: _.value,
144
- "onUpdate:modelValue": l[1] || (l[1] = (a) => _.value = a),
145
- "active-text": t(i)("workSchedule.currentMonth"),
146
- "active-value": "0",
147
- "inactive-value": "-1",
148
- style: { "margin-bottom": ".5rem", "margin-left": ".5rem" }
149
- }, null, 8, ["modelValue", "active-text"])) : T("", !0),
150
- r(t(de), {
151
- id: "printTable",
152
- data: o.value,
153
- "span-method": G,
154
- border: "",
155
- style: { width: "100%" },
156
- size: "small",
157
- "empty-text": t(i)("sheet.emptyText"),
158
- align: "center",
159
- onCellClick: e.coMenu
160
- }, {
161
- default: s(() => [
162
- r(t(d), {
163
- label: t(i)("sheet.title", { name: D.value }) + t(A)(f.value, "month"),
164
- align: "center",
165
- height: "10"
223
+ S.group && (E.value = S.group), S.date && (K.value = (/* @__PURE__ */ new Date(S.date + "T00:00:01")).getMonth()), _e().then((l) => {
224
+ re.value = l, he();
225
+ });
226
+ const ye = (l) => new Date(w.value).getMonth() === (/* @__PURE__ */ new Date()).getMonth() && l === (/* @__PURE__ */ new Date()).getDate() ? " today" : "", $e = async () => {
227
+ var D, U, H, j;
228
+ ee.value = !0;
229
+ const l = new He.Workbook(), e = l.addWorksheet(Q(w.value, "month"), { pageSetup: { paperSize: 9, orientation: "landscape", fitToPage: !0 } }), r = { vertical: "middle", horizontal: "center" }, u = { top: { style: "thin" }, left: { style: "thin" }, bottom: { style: "thin" }, right: { style: "thin" } }, t = { vertical: "middle", horizontal: "center", wrapText: !0 };
230
+ e.mergeCells(`A1:${y("A1", d.value.length + 15)}1`), e.mergeCells("A2:A4"), e.mergeCells("B2:B4"), e.mergeCells("C2:C4"), e.mergeCells("D5:R5"), e.mergeCells(`D2:${y("D2", d.value.length + 2)}2`), e.mergeCells(`${y("D2", d.value.length + 3)}2:${y("D2", d.value.length + 8)}2`), e.mergeCells(`${y("D2", d.value.length + 9)}2:${y("D2", d.value.length + 9)}4`), e.mergeCells(`${y("D2", d.value.length + 10)}2:${y("D2", d.value.length + 11)}2`), e.mergeCells(`${y("D2", d.value.length + 12)}2:${y("D2", d.value.length + 12)}4`), e.mergeCells(`${y("D3", d.value.length + 3)}3:${y("D3", d.value.length + 3)}4`), e.mergeCells(`${y("D3", d.value.length + 4)}3:${y("D3", d.value.length + 8)}3`), e.mergeCells(`${y("D3", d.value.length + 10)}3:${y("D3", d.value.length + 10)}4`), e.mergeCells(`${y("D3", d.value.length + 11)}3:${y("D3", d.value.length + 11)}4`), e.mergeCells(`T5:${y("D5", d.value.length + 1)}5`);
231
+ for (let n = 1; n <= d.value.length + 2; n++)
232
+ e.mergeCells(`${y("D3", n)}3:${y("D4", n)}4`), e.getColumn(n + 3).width = 5, e.getColumn(n + 3).alignment = t, e.getCell(3, n + 3).border = u, n < 16 && (e.getCell(3, n + 3).value = n), n > 16 && (e.getCell(3, n + 3).value = n - 1);
233
+ e.getCell("A1").value = i("sheet.title", { name: E.value }) + Q(w.value, "month"), e.getCell("A2").value = i("sheet.listNumber"), e.getCell("B2").value = i("sheet.employee"), e.getCell("C2").value = i("sheet.personnelNumber"), e.getCell("D2").value = i("sheet.marks"), e.getCell("S3").value = i("sheet.halfMonth", { half: "I" }), e.getCell("A5").value = "1", e.getCell("B5").value = "2", e.getCell("C5").value = "3", e.getCell("D5").value = "4", e.getCell("S5").value = "5", e.getCell("T5").value = "6", e.getCell(5, d.value.length + 5).value = "7", e.getCell(2, d.value.length + 6).value = i("sheet.workedMonth"), e.getCell(2, d.value.length + 12).value = i("sheet.numberNonAppearing"), e.getCell(2, d.value.length + 13).value = i("sheet.them"), e.getCell(2, d.value.length + 15).value = i("sheet.countWeekend"), e.getCell(3, d.value.length + 5).value = i("sheet.halfMonth", { half: "II" }), e.getCell(3, d.value.length + 6).value = i("sheet.days"), e.getCell(3, d.value.length + 7).value = i("sheet.hours"), e.getCell(4, d.value.length + 7).value = i("sheet.all"), e.getCell(4, d.value.length + 8).value = i("sheet.overtime"), e.getCell(4, d.value.length + 9).value = i("sheet.night"), e.getCell(4, d.value.length + 10).value = i("sheet.weekend"), e.getCell(4, d.value.length + 13).value = i("sheet.code"), e.getCell(4, d.value.length + 14).value = i("sheet.count"), e.getRow(1).height = 40, e.getRow(2).height = 32, e.getRow(3).height = 20, e.getRow(4).height = 60, e.getColumn(1).width = 6, e.getColumn(2).width = 30, e.getColumn(3).width = 17, e.getColumn(19).width = 12, e.getColumn(d.value.length + 5).width = 12, e.getColumn(d.value.length + 12).width = 11, e.getColumn(d.value.length + 15).width = 11, e.getCell("A1").alignment = r, e.getColumn(1).alignment = t, e.getColumn(2).alignment = t, e.getColumn(3).alignment = t;
234
+ for (let n = 6; n <= 15; n++)
235
+ e.getCell(5, d.value.length + n).value = n + 2, e.getColumn(d.value.length + n).alignment = t, e.getCell(4, d.value.length + n).border = u, e.getCell(5, d.value.length + n).border = u;
236
+ e.getCell("A2").border = u, e.getCell("B2").border = u, e.getCell("C2").border = u, e.getCell("D2").border = u, e.getCell("D2").border = u, e.getCell("A5").border = u, e.getCell("B5").border = u, e.getCell("C5").border = u, e.getCell("D5").border = u, e.getCell("S5").border = u, e.getCell("T5").border = u, e.getCell(2, d.value.length + 6).border = u, e.getCell(2, d.value.length + 12).border = u, e.getCell(2, d.value.length + 13).border = u, e.getCell(2, d.value.length + 15).border = u, e.getCell(3, d.value.length + 7).border = u;
237
+ let a = 1, o = 5, h = !0;
238
+ for (const n of f.value) {
239
+ let O = [a, n.name, n.code];
240
+ for (let T = 0; T < d.value.length; T++)
241
+ T === 15 && O.push(h ? (n == null ? void 0 : n.halfI) || "" : (n == null ? void 0 : n.hourI) || ""), O.push(h ? ((D = n.days[T]) == null ? void 0 : D.state) || "" : ((U = n.days[T]) == null ? void 0 : U.time) || "");
242
+ O.push(
243
+ h ? (n == null ? void 0 : n.halfII) || 0 : (n == null ? void 0 : n.hourII) || 0,
244
+ (n == null ? void 0 : n.contDays) || 0,
245
+ (n == null ? void 0 : n.contHour) || 0,
246
+ (n == null ? void 0 : n.overtime) || 0,
247
+ (n == null ? void 0 : n.night) || 0,
248
+ (n == null ? void 0 : n.weekend) || 0,
249
+ "",
250
+ h ? (n == null ? void 0 : n.numberNonAppearing[0]) || "" : (n == null ? void 0 : n.numberNonAppearing[1]) || 0,
251
+ ((H = n == null ? void 0 : n.appearing) == null ? void 0 : H.code) || "-",
252
+ ((j = n == null ? void 0 : n.appearing) == null ? void 0 : j.count) || "-",
253
+ (n == null ? void 0 : n.weekendDays) || 0
254
+ );
255
+ const de = e.addRow(O);
256
+ if (de.border = u, !h) {
257
+ e.mergeCells(`A${o + a * 2 - 1}:A${o + a * 2}`), e.mergeCells(`B${o + a * 2 - 1}:B${o + a * 2}`), e.mergeCells(`C${o + a * 2 - 1}:C${o + a * 2}`);
258
+ for (let T = d.value.length + 3; T <= d.value.length + 8; T++)
259
+ e.mergeCells(`${y("D", T)}${o + a * 2 - 1}:${y("D", T)}${o + a * 2}`);
260
+ e.mergeCells(`${y("D", d.value.length + 12)}${o + a * 2 - 1}:${y("D", d.value.length + 12)}${o + a * 2}`), a++;
261
+ }
262
+ h = !h;
263
+ }
264
+ S.odata.personal.forEach((n) => {
265
+ n.roleName === "Начальник отдела правовой и кадровой работы" && n.employeeName;
266
+ });
267
+ const c = "export_" + F(Date.now(), "{dd}.{m}.{Y}") + ".xlsx", M = await l.xlsx.writeBuffer();
268
+ Ue(new Blob([M]), c), ee.value = !1;
269
+ };
270
+ return (l, e) => {
271
+ const r = xe("el-slider"), u = Ie("loading");
272
+ return $(), R(Z, null, [
273
+ V("div", Oe, [
274
+ ne.checkEdit ? ($(), A(s(Te), {
275
+ key: 0,
276
+ modelValue: E.value,
277
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => E.value = t),
278
+ placeholder: "Select",
279
+ style: { width: "240px", "margin-bottom": ".5rem", "margin-right": ".5rem" }
166
280
  }, {
167
- default: s(() => [
168
- r(t(d), {
169
- label: t(i)("sheet.employee"),
170
- width: "180",
171
- align: "center"
172
- }, {
173
- default: s((a) => [
174
- y(v(o.value[a.$index].name), 1)
175
- ]),
176
- _: 1
177
- }, 8, ["label"]),
178
- r(t(d), {
179
- label: t(i)("sheet.personnelNumber"),
180
- align: "center"
181
- }, {
182
- default: s((a) => [
183
- y(v(o.value[a.$index].code), 1)
184
- ]),
185
- _: 1
186
- }, 8, ["label"]),
187
- r(t(d), {
188
- label: t(i)("sheet.marks"),
189
- align: "center"
190
- }, {
191
- default: s(() => [
192
- (w(!0), N(S, null, j(p.value, (a) => (w(), N(S, {
193
- key: a.day
194
- }, [
195
- a.day <= 15 ? (w(), M(t(d), {
196
- key: 0,
197
- width: "30",
198
- "class-name": a.holidays,
199
- align: "center",
200
- label: a.day.toString() + `
201
- ` + a.weekday
202
- }, {
203
- default: s((u) => [
204
- B("div", re, v(W(a.day, u.$index) || " "), 1)
205
- ]),
206
- _: 2
207
- }, 1032, ["class-name", "label"])) : T("", !0)
208
- ], 64))), 128)),
209
- r(t(d), {
210
- label: t(i)("sheet.halfMonth", { half: "I" }),
211
- align: "center"
212
- }, {
213
- default: s((a) => [
214
- y(v(o.value[a.$index].key === 0 ? o.value[a.$index].halfI : o.value[a.$index].hourI), 1)
215
- ]),
216
- _: 1
217
- }, 8, ["label"]),
218
- (w(!0), N(S, null, j(p.value, (a) => (w(), N(S, {
219
- key: a.day
220
- }, [
221
- a.day > 15 ? (w(), M(t(d), {
222
- key: 0,
223
- width: "30",
224
- "class-name": a.holidays,
225
- align: "center",
226
- label: a.day.toString() + `
227
- ` + a.weekday
228
- }, {
229
- default: s((u) => [
230
- B("div", ce, v(W(a.day, u.$index) || " "), 1)
231
- ]),
232
- _: 2
233
- }, 1032, ["class-name", "label"])) : T("", !0)
234
- ], 64))), 128)),
235
- r(t(d), {
236
- label: t(i)("sheet.halfMonth", { half: "II" }),
237
- align: "center"
238
- }, {
239
- default: s((a) => [
240
- y(v(o.value[a.$index].key === 0 ? o.value[a.$index].halfII : o.value[a.$index].hourII), 1)
241
- ]),
242
- _: 1
243
- }, 8, ["label"])
244
- ]),
245
- _: 1
246
- }, 8, ["label"]),
247
- r(t(d), {
248
- label: t(i)("sheet.workedMonth"),
249
- align: "center"
250
- }, {
251
- default: s(() => [
252
- r(t(d), {
253
- label: t(i)("sheet.days"),
254
- align: "center",
255
- "label-class-name": "turn",
256
- width: "34"
257
- }, {
258
- default: s((a) => [
259
- y(v(o.value[a.$index].contDays), 1)
260
- ]),
261
- _: 1
262
- }, 8, ["label"]),
263
- r(t(d), {
264
- label: t(i)("sheet.hours"),
265
- align: "center"
266
- }, {
267
- default: s(() => [
268
- r(t(d), {
269
- label: t(i)("sheet.all"),
270
- align: "center",
271
- "label-class-name": "turn",
272
- width: "40"
273
- }, {
274
- default: s((a) => [
275
- y(v(o.value[a.$index].contHour), 1)
276
- ]),
277
- _: 1
278
- }, 8, ["label"]),
279
- r(t(d), {
280
- label: t(i)("sheet.overtime"),
281
+ default: g(() => [
282
+ ($(!0), R(Z, null, ie(ue.value, (t) => ($(), A(s(Ae), {
283
+ key: t.value,
284
+ label: t.label,
285
+ value: t.value
286
+ }, null, 8, ["label", "value"]))), 128))
287
+ ]),
288
+ _: 1
289
+ }, 8, ["modelValue"])) : B("", !0),
290
+ e[9] || (e[9] = V("div", { class: "expander" }, null, -1)),
291
+ ne.checkEdit ? ($(), A(s(Ye), {
292
+ key: 1,
293
+ modelValue: K.value,
294
+ "onUpdate:modelValue": e[1] || (e[1] = (t) => K.value = t),
295
+ "active-text": s(i)("workSchedule.currentMonth"),
296
+ "active-value": "0",
297
+ "inactive-value": "-1",
298
+ style: { "margin-bottom": ".5rem", "margin-left": ".5rem" }
299
+ }, null, 8, ["modelValue", "active-text"])) : B("", !0)
300
+ ]),
301
+ m(s(Ve), {
302
+ id: "printTable",
303
+ data: f.value,
304
+ "span-method": De,
305
+ border: "",
306
+ style: { width: "100%" },
307
+ size: "small",
308
+ "empty-text": s(i)("sheet.emptyText"),
309
+ align: "center",
310
+ onCellClick: we
311
+ }, {
312
+ default: g(() => [
313
+ m(s(C), {
314
+ label: s(i)("sheet.title", { name: E.value }) + s(Q)(w.value, "month"),
315
+ align: "center",
316
+ height: "10"
317
+ }, {
318
+ default: g(() => [
319
+ m(s(C), {
320
+ label: s(i)("sheet.employee"),
321
+ width: "180",
322
+ align: "center"
323
+ }, {
324
+ default: g((t) => [
325
+ x(b(f.value[t.$index].name), 1)
326
+ ]),
327
+ _: 1
328
+ }, 8, ["label"]),
329
+ m(s(C), {
330
+ label: s(i)("sheet.personnelNumber"),
331
+ align: "center"
332
+ }, {
333
+ default: g((t) => [
334
+ x(b(f.value[t.$index].code), 1)
335
+ ]),
336
+ _: 1
337
+ }, 8, ["label"]),
338
+ m(s(C), {
339
+ label: s(i)("sheet.marks"),
340
+ align: "center"
341
+ }, {
342
+ default: g(() => [
343
+ ($(!0), R(Z, null, ie(d.value, (t) => ($(), R(Z, {
344
+ key: t.day
345
+ }, [
346
+ t.day <= 15 ? ($(), A(s(C), {
347
+ key: 0,
348
+ width: "30",
349
+ "class-name": t.holidays + ye(t.day),
281
350
  align: "center",
282
- "label-class-name": "turn",
283
- width: "34"
351
+ label: t.day.toString() + `
352
+ ` + t.weekday
284
353
  }, {
285
- default: s((a) => [
286
- y(v(o.value[a.$index].overtime), 1)
354
+ default: g((a) => [
355
+ V("div", Re, b(me(t.day, a.$index) || " "), 1)
287
356
  ]),
288
- _: 1
289
- }, 8, ["label"]),
290
- r(t(d), {
291
- label: t(i)("sheet.night"),
292
- align: "center",
293
- "label-class-name": "turn",
294
- width: "34"
357
+ _: 2
358
+ }, 1032, ["class-name", "label"])) : B("", !0),
359
+ t.day === 15 ? ($(), A(s(C), {
360
+ key: 1,
361
+ label: s(i)("sheet.halfMonth", { half: "I" }),
362
+ align: "center"
295
363
  }, {
296
- default: s((a) => [
297
- y(v(o.value[a.$index].night), 1)
364
+ default: g((a) => [
365
+ x(b(f.value[a.$index].key === 0 ? f.value[a.$index].halfI : f.value[a.$index].hourI), 1)
298
366
  ]),
299
367
  _: 1
300
- }, 8, ["label"]),
301
- r(t(d), {
302
- label: t(i)("sheet.weekend"),
368
+ }, 8, ["label"])) : B("", !0),
369
+ t.day > 15 ? ($(), A(s(C), {
370
+ key: 2,
371
+ width: "30",
372
+ "class-name": t.holidays + ye(t.day),
303
373
  align: "center",
304
- "label-class-name": "turn",
305
- width: "34"
374
+ label: t.day.toString() + `
375
+ ` + t.weekday
306
376
  }, {
307
- default: s((a) => [
308
- y(v(o.value[a.$index].weekend), 1)
377
+ default: g((a) => [
378
+ V("div", ze, b(me(t.day, a.$index) || " "), 1)
309
379
  ]),
310
- _: 1
311
- }, 8, ["label"])
380
+ _: 2
381
+ }, 1032, ["class-name", "label"])) : B("", !0)
382
+ ], 64))), 128)),
383
+ m(s(C), {
384
+ label: s(i)("sheet.halfMonth", { half: "II" }),
385
+ align: "center"
386
+ }, {
387
+ default: g((t) => [
388
+ x(b(f.value[t.$index].key === 0 ? f.value[t.$index].halfII : f.value[t.$index].hourII), 1)
389
+ ]),
390
+ _: 1
391
+ }, 8, ["label"])
392
+ ]),
393
+ _: 1
394
+ }, 8, ["label"]),
395
+ m(s(C), {
396
+ label: s(i)("sheet.workedMonth"),
397
+ align: "center"
398
+ }, {
399
+ default: g(() => [
400
+ m(s(C), {
401
+ label: s(i)("sheet.days"),
402
+ align: "center",
403
+ "label-class-name": "turn",
404
+ width: "34"
405
+ }, {
406
+ default: g((t) => [
407
+ x(b(f.value[t.$index].contDays), 1)
408
+ ]),
409
+ _: 1
410
+ }, 8, ["label"]),
411
+ m(s(C), {
412
+ label: s(i)("sheet.hours"),
413
+ align: "center"
414
+ }, {
415
+ default: g(() => [
416
+ m(s(C), {
417
+ label: s(i)("sheet.all"),
418
+ align: "center",
419
+ "label-class-name": "turn",
420
+ width: "40"
421
+ }, {
422
+ default: g((t) => [
423
+ x(b(f.value[t.$index].contHour), 1)
424
+ ]),
425
+ _: 1
426
+ }, 8, ["label"]),
427
+ m(s(C), {
428
+ label: s(i)("sheet.overtime"),
429
+ align: "center",
430
+ "label-class-name": "turn",
431
+ width: "34"
432
+ }, {
433
+ default: g((t) => [
434
+ x(b(f.value[t.$index].overtime), 1)
435
+ ]),
436
+ _: 1
437
+ }, 8, ["label"]),
438
+ m(s(C), {
439
+ label: s(i)("sheet.night"),
440
+ align: "center",
441
+ "label-class-name": "turn",
442
+ width: "34"
443
+ }, {
444
+ default: g((t) => [
445
+ x(b(f.value[t.$index].night), 1)
446
+ ]),
447
+ _: 1
448
+ }, 8, ["label"]),
449
+ m(s(C), {
450
+ label: s(i)("sheet.weekend"),
451
+ align: "center",
452
+ "label-class-name": "turn",
453
+ width: "34"
454
+ }, {
455
+ default: g((t) => [
456
+ x(b(f.value[t.$index].weekend), 1)
457
+ ]),
458
+ _: 1
459
+ }, 8, ["label"])
460
+ ]),
461
+ _: 1
462
+ }, 8, ["label"])
463
+ ]),
464
+ _: 1
465
+ }, 8, ["label"]),
466
+ m(s(C), {
467
+ label: s(i)("sheet.numberNonAppearing"),
468
+ align: "center"
469
+ }, {
470
+ default: g((t) => {
471
+ var a;
472
+ return [
473
+ x(b((a = f.value[t.$index]) == null ? void 0 : a.numberNonAppearing[f.value[t.$index].key]), 1)
474
+ ];
475
+ }),
476
+ _: 1
477
+ }, 8, ["label"]),
478
+ m(s(C), {
479
+ label: s(i)("sheet.them"),
480
+ align: "center"
481
+ }, {
482
+ default: g(() => [
483
+ m(s(C), {
484
+ label: s(i)("sheet.code"),
485
+ align: "center",
486
+ "label-class-name": "turn",
487
+ width: "30"
488
+ }, {
489
+ default: g((t) => {
490
+ var a;
491
+ return [
492
+ x(b((a = f.value[t.$index].appearing) == null ? void 0 : a.code), 1)
493
+ ];
494
+ }),
495
+ _: 1
496
+ }, 8, ["label"]),
497
+ m(s(C), {
498
+ label: s(i)("sheet.count"),
499
+ align: "center",
500
+ "label-class-name": "turn",
501
+ width: "30"
502
+ }, {
503
+ default: g((t) => {
504
+ var a;
505
+ return [
506
+ x(b((a = f.value[t.$index].appearing) == null ? void 0 : a.count), 1)
507
+ ];
508
+ }),
509
+ _: 1
510
+ }, 8, ["label"])
511
+ ]),
512
+ _: 1
513
+ }, 8, ["label"]),
514
+ m(s(C), {
515
+ label: s(i)("sheet.countWeekend"),
516
+ align: "center"
517
+ }, {
518
+ default: g((t) => [
519
+ x(b(f.value[t.$index].weekendDays), 1)
520
+ ]),
521
+ _: 1
522
+ }, 8, ["label"])
523
+ ]),
524
+ _: 1
525
+ }, 8, ["label"])
526
+ ]),
527
+ _: 1
528
+ }, 8, ["data", "empty-text"]),
529
+ Se(($(), A(s(te), {
530
+ disabled: ee.value,
531
+ plain: "",
532
+ onClick: $e,
533
+ style: { "margin-top": ".5rem" }
534
+ }, {
535
+ default: g(() => [
536
+ x(b(s(i)("workSchedule.exportExcel")), 1)
537
+ ]),
538
+ _: 1
539
+ }, 8, ["disabled"])), [
540
+ [u, ee.value]
541
+ ]),
542
+ m(s(Be), {
543
+ show: W.value,
544
+ "onUpdate:show": e[8] || (e[8] = (t) => W.value = t),
545
+ options: se.value
546
+ }, {
547
+ default: g(() => [
548
+ m(s(J), {
549
+ label: v.value.name,
550
+ disabled: ""
551
+ }, null, 8, ["label"]),
552
+ m(s(Fe)),
553
+ V("div", null, [
554
+ V("div", null, [
555
+ m(s(We), {
556
+ label: ve.value,
557
+ style: { padding: "0 0 .5rem" }
558
+ }, {
559
+ default: g(() => [
560
+ ($(!0), R(Z, null, ie(be.value, (t) => ($(), A(s(J), {
561
+ key: t.value,
562
+ label: t.label,
563
+ onClick: (a) => le(t.value),
564
+ clickClose: !1
565
+ }, null, 8, ["label", "onClick"]))), 128))
566
+ ]),
567
+ _: 1
568
+ }, 8, ["label"])
569
+ ]),
570
+ /^(РВ|Я|Н(?![Н])).*$/.test(v.value.failure) ? ($(), R("div", Pe, [
571
+ m(s(J), { clickClose: !1 }, {
572
+ default: g(() => [
573
+ V("span", null, b(s(i)("workSchedule.with")) + ":", 1)
574
+ ]),
575
+ _: 1
576
+ }),
577
+ m(r, {
578
+ modelValue: N.value,
579
+ "onUpdate:modelValue": e[2] || (e[2] = (t) => N.value = t),
580
+ step: 1,
581
+ min: 0,
582
+ max: 19,
583
+ style: { width: "100%" }
584
+ }, null, 8, ["modelValue"]),
585
+ m(s(J), { clickClose: !1 }, {
586
+ default: g(() => [
587
+ V("span", null, b(s(i)("workSchedule.duration")) + ":", 1)
588
+ ]),
589
+ _: 1
590
+ }),
591
+ m(r, {
592
+ modelValue: I.value,
593
+ "onUpdate:modelValue": e[3] || (e[3] = (t) => I.value = t),
594
+ step: 1,
595
+ min: 4,
596
+ max: s(Ee)(N.value !== 1 ? 23 - N.value : 21, 4, 22)
597
+ }, null, 8, ["modelValue", "max"])
598
+ ])) : B("", !0),
599
+ /^(|К|КВ|ОТ|Б|Р|ОЖ|У|ДО|УД|Г)$/.test(v.value.failure) ? ($(), R("div", je, [
600
+ m(s(J), { clickClose: !1 }, {
601
+ default: g(() => [
602
+ V("span", null, b(s(i)("sheet.count")) + ":", 1)
603
+ ]),
604
+ _: 1
605
+ }),
606
+ m(r, {
607
+ modelValue: X.value,
608
+ "onUpdate:modelValue": e[4] || (e[4] = (t) => X.value = t),
609
+ step: 1,
610
+ min: 1,
611
+ max: d.value.length - v.value.day,
612
+ style: { width: "100%" }
613
+ }, null, 8, ["modelValue", "max"])
614
+ ])) : B("", !0),
615
+ m(s(J), null, {
616
+ default: g(() => [
617
+ v.value.rest ? ($(), A(s(te), {
618
+ key: 0,
619
+ onClick: e[5] || (e[5] = (t) => le("reset"))
620
+ }, {
621
+ default: g(() => [
622
+ x(b(s(i)("sheet.reset")), 1)
312
623
  ]),
313
624
  _: 1
314
- }, 8, ["label"])
315
- ]),
316
- _: 1
317
- }, 8, ["label"]),
318
- r(t(d), {
319
- label: t(i)("sheet.numberNonAppearing"),
320
- align: "center"
321
- }, {
322
- default: s((a) => [
323
- y(v(o.value[a.$index].numberNonAppearing), 1)
324
- ]),
325
- _: 1
326
- }, 8, ["label"]),
327
- r(t(d), {
328
- label: t(i)("sheet.them"),
329
- align: "center"
330
- }, {
331
- default: s(() => [
332
- r(t(d), {
333
- label: t(i)("sheet.code"),
334
- align: "center",
335
- "label-class-name": "turn",
336
- width: "30"
625
+ })) : B("", !0),
626
+ P.value ? ($(), A(s(te), {
627
+ key: 1,
628
+ onClick: e[6] || (e[6] = (t) => le("save"))
337
629
  }, {
338
- default: s((a) => {
339
- var u;
340
- return [
341
- y(v((u = o.value[a.$index].appearing) == null ? void 0 : u.code), 1)
342
- ];
343
- }),
630
+ default: g(() => [
631
+ x(b(s(i)("sheet.save")), 1)
632
+ ]),
344
633
  _: 1
345
- }, 8, ["label"]),
346
- r(t(d), {
347
- label: t(i)("sheet.count"),
348
- align: "center",
349
- "label-class-name": "turn",
350
- width: "30"
634
+ })) : B("", !0),
635
+ m(s(te), {
636
+ onClick: e[7] || (e[7] = (t) => W.value = !1)
351
637
  }, {
352
- default: s((a) => {
353
- var u;
354
- return [
355
- y(v((u = o.value[a.$index].appearing) == null ? void 0 : u.countH), 1)
356
- ];
357
- }),
638
+ default: g(() => [
639
+ x(b(s(i)("sheet.cancel")), 1)
640
+ ]),
358
641
  _: 1
359
- }, 8, ["label"])
360
- ]),
361
- _: 1
362
- }, 8, ["label"]),
363
- r(t(d), {
364
- label: t(i)("sheet.countWeekend"),
365
- align: "center"
366
- }, {
367
- default: s((a) => [
368
- y(v(o.value[a.$index].weekendDays), 1)
642
+ })
369
643
  ]),
370
644
  _: 1
371
- }, 8, ["label"])
372
- ]),
373
- _: 1
374
- }, 8, ["label"])
375
- ]),
376
- _: 1
377
- }, 8, ["data", "empty-text", "onCellClick"])
378
- ], 64));
645
+ })
646
+ ])
647
+ ]),
648
+ _: 1
649
+ }, 8, ["show", "options"])
650
+ ], 64);
651
+ };
379
652
  }
380
653
  };
381
654
  export {
382
- fe as default
655
+ Ze as default
383
656
  };
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("vue"),de=require("file-saver"),se=require("exceljs"),c=require("./index-Dn3djtwj.cjs"),ve=require("vue-i18n"),i=require("element-plus"),J=require("@imengyu/vue3-context-menu");function ce(k){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(k){for(const V in k)if(V!=="default"){const v=Object.getOwnPropertyDescriptor(k,V);Object.defineProperty(r,V,v.get?v:{enumerable:!0,get:()=>k[V]})}}return r.default=k,Object.freeze(r)}const ge=ce(se),me={class:"work"},he={class:"nav"},fe={style:{height:"100px",width:"100%",display:"inline-block"}},pe={style:{height:"100px",width:"100%",display:"inline-block"}},ye={key:0,class:"controls-container",style:{"margin-top":".5rem"}},we={key:0,style:{padding:"0.5em 1.5em"}},ke={key:1,style:{padding:"0.5em 1.5em"}},Ce={__name:"WorkTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"},group:String,date:String},setup(k){const{t:r,d:V}=ve.useI18n(),v=k,F=e.ref(!1),n=e.ref([]),R=e.ref(v.date?new Date(v.date+"T00:00:01").getMonth():new Date().getMonth()),j=e.ref(!1),$=e.ref([]),f=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1)),u=e.ref([]),B=e.ref(0),p=e.ref(9),m=e.ref(8),I=e.ref(!1),Z=e.ref(!0),T=e.ref(!1),q=e.ref("5"),M=e.ref(1),C=e.ref(""),O=e.ref([]),b=e.ref([]),Y=e.ref([]),g=e.ref({name:"Имя",length:0,code:""}),U=e.ref(!1),P=e.ref({zIndex:30,minWidth:220,x:500,y:200}),K=e.ref({}),A=e.ref("100%");e.watch(C,async(a,l)=>{a!==l&&(b.value=[],I.value=!1,v.odata.personal.forEach(o=>{o.divisionName===a&&(b.value.some(d=>(d==null?void 0:d.activeText)===o.roleName)||b.value.push({val:!0,activeText:o.roleName}))}),W())}),e.watch(R,async a=>{let l=new Date().getMonth(),o=a===null?l:a-1;o=l-1<=o?o:o+12,console.log("currentMonth",o),f.value=new Date(new Date().getFullYear(),o,1),Q()});const ee=(a,l,o,d)=>{g.value.ids=a.ids,g.value.key=a.key,g.value.add=a.days.length>0&&a.days[a.days.length-1].cont,g.value.level=l.level,g.value.day=o.cellIndex,P.value.y=d.clientY,P.value.x=d.clientX,l.level===2&&l.no===0&&v.checkEdit&&(g.value.name=r("workSchedule.autocomplete"),U.value=!0),l.level===3&&o.cellIndex-l.no===1&&v.checkEdit&&(D(o.cellIndex,a.ids),g.value.name=r("workSchedule.modeSelection"),U.value=!0)},le=({row:a,columnIndex:l})=>{if(!$.value||$.value.length===0||!j.value)return"";const o=new Date(new Date(f.value).getFullYear(),new Date(f.value).getMonth(),l).getTime()+1e3;for(let d of $.value){const{dateStart:t,dateEnd:h,code:S}=d;if(t&&h&&S===a.code&&l!==0&&l<=u.value.length){const N=new Date(c.parseDate(t)).getTime(),E=new Date(c.parseDate(h)).getTime();if(o>=N&&o<=E)return"vacation"}}return""},Q=()=>{var h,S,N,E;const a=K.value,l=new Date(f.value),o=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let d=[],t=0;for(let x=1;x<=o;x++){const s=c.parseTime(l.setDate(x),"{Y}-{m}-{dd}");t+=(h=a.nowork)!=null&&h.includes(s)||a.holidays.includes(s)?0:(S=a.preholidays)!=null&&S.includes(s)?7:8;const y=(N=a.nowork)!=null&&N.includes(s)?"nowork":a.holidays.includes(s)?"holiday":(E=a.preholidays)!=null&&E.includes(s)?"preholiday":"";d.push({day:x,holidays:y,weekday:V(new Date(l.getFullYear(),l.getMonth(),x),"day")})}B.value=t,u.value=d,v.odata.getPersonal({}).then(x=>{var s;C.value.length===0&&(C.value=(s=x.find(y=>y.employeeName===v.fullName))==null?void 0:s.divisionName),x.forEach((y,L)=>{O.value.some(w=>(w==null?void 0:w.value)===y.divisionName)||O.value.push({value:y.divisionName,label:y.divisionName,key:L}),y.divisionName===C.value&&!b.value.some(w=>(w==null?void 0:w.activeText)===y.roleName)&&b.value.push({val:!0,activeText:y.roleName})}),W(),Z.value=!1})},te=e.computed(()=>!n.value.some(a=>a.contHour!==B.value)),X=(a,l)=>{var h,S,N;const o=new Date(f.value),d=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,t=(h=n.value[l])==null?void 0:h.days.findIndex(E=>E.day===d);return l===-1||t===-1?"":((S=n.value[l].days[t])==null?void 0:S.tips)+`
1
+ "use strict";const e=require("vue"),de=require("file-saver"),se=require("exceljs"),c=require("./index-Dn3djtwj.cjs"),ve=require("vue-i18n"),i=require("element-plus"),J=require("@imengyu/vue3-context-menu");function ce(k){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(k){for(const V in k)if(V!=="default"){const v=Object.getOwnPropertyDescriptor(k,V);Object.defineProperty(r,V,v.get?v:{enumerable:!0,get:()=>k[V]})}}return r.default=k,Object.freeze(r)}const ge=ce(se),me={class:"work"},he={class:"nav"},fe={style:{height:"100px",width:"100%",display:"inline-block"}},pe={style:{height:"100px",width:"100%",display:"inline-block"}},ye={key:0,class:"controls-container",style:{"margin-top":".5rem"}},we={key:0,style:{padding:"0.5em 1.5em"}},ke={key:1,style:{padding:"0.5em 1.5em"}},Ce={__name:"WorkTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"},group:String,date:String},setup(k){const{t:r,d:V}=ve.useI18n(),v=k,F=e.ref(!1),n=e.ref([]),R=e.ref(v.date?new Date(v.date+"T00:00:01").getMonth():new Date().getMonth()),j=e.ref(!1),$=e.ref([]),f=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1)),u=e.ref([]),B=e.ref(0),p=e.ref(9),m=e.ref(8),I=e.ref(!1),Z=e.ref(!0),T=e.ref(!1),q=e.ref("5"),M=e.ref(1),C=e.ref(""),O=e.ref([]),b=e.ref([]),Y=e.ref([]),g=e.ref({name:"Имя",length:0,code:""}),U=e.ref(!1),P=e.ref({zIndex:3,minWidth:230,x:500,y:200}),K=e.ref({}),A=e.ref("100%");e.watch(C,async(a,l)=>{a!==l&&(b.value=[],I.value=!1,v.odata.personal.forEach(o=>{o.divisionName===a&&(b.value.some(d=>(d==null?void 0:d.activeText)===o.roleName)||b.value.push({val:!0,activeText:o.roleName}))}),W())}),e.watch(R,async a=>{let l=new Date().getMonth(),o=a===null?l:a-1;o=l-1<=o?o:o+12,console.log("currentMonth",o),f.value=new Date(new Date().getFullYear(),o,1),Q()});const ee=(a,l,o,d)=>{g.value.ids=a.ids,g.value.key=a.key,g.value.add=a.days.length>0&&a.days[a.days.length-1].cont,g.value.level=l.level,g.value.day=o.cellIndex,P.value.y=d.clientY,P.value.x=d.clientX,l.level===2&&l.no===0&&v.checkEdit&&(g.value.name=r("workSchedule.autocomplete"),U.value=!0),l.level===3&&o.cellIndex-l.no===1&&v.checkEdit&&(D(o.cellIndex,a.ids),g.value.name=r("workSchedule.modeSelection"),U.value=!0)},le=({row:a,columnIndex:l})=>{if(!$.value||$.value.length===0||!j.value)return"";const o=new Date(new Date(f.value).getFullYear(),new Date(f.value).getMonth(),l).getTime()+1e3;for(let d of $.value){const{dateStart:t,dateEnd:h,code:S}=d;if(t&&h&&S===a.code&&l!==0&&l<=u.value.length){const N=new Date(c.parseDate(t)).getTime(),E=new Date(c.parseDate(h)).getTime();if(o>=N&&o<=E)return"vacation"}}return""},Q=()=>{var h,S,N,E;const a=K.value,l=new Date(f.value),o=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let d=[],t=0;for(let x=1;x<=o;x++){const s=c.parseTime(l.setDate(x),"{Y}-{m}-{dd}");t+=(h=a.nowork)!=null&&h.includes(s)||a.holidays.includes(s)?0:(S=a.preholidays)!=null&&S.includes(s)?7:8;const y=(N=a.nowork)!=null&&N.includes(s)?"nowork":a.holidays.includes(s)?"holiday":(E=a.preholidays)!=null&&E.includes(s)?"preholiday":"";d.push({day:x,holidays:y,weekday:V(new Date(l.getFullYear(),l.getMonth(),x),"day")})}B.value=t,u.value=d,v.odata.getPersonal({}).then(x=>{var s;C.value.length===0&&(C.value=(s=x.find(y=>y.employeeName===v.fullName))==null?void 0:s.divisionName),x.forEach((y,L)=>{O.value.some(w=>(w==null?void 0:w.value)===y.divisionName)||O.value.push({value:y.divisionName,label:y.divisionName,key:L}),y.divisionName===C.value&&!b.value.some(w=>(w==null?void 0:w.activeText)===y.roleName)&&b.value.push({val:!0,activeText:y.roleName})}),W(),Z.value=!1})},te=e.computed(()=>!n.value.some(a=>a.contHour!==B.value)),X=(a,l)=>{var h,S,N;const o=new Date(f.value),d=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,t=(h=n.value[l])==null?void 0:h.days.findIndex(E=>E.day===d);return l===-1||t===-1?"":((S=n.value[l].days[t])==null?void 0:S.tips)+`
2
2
  `+((N=n.value[l].days[t])==null?void 0:N.time)},W=()=>{n.value=[],Y.value=[],$.value=[],v.odata.personal.forEach(a=>{if(a.divisionName===C.value&&b.value.some(l=>l.val&&l.activeText===a.roleName)){let l=c.byInitials(a.employeeName);Y.value.push(a.employeeKey),n.value.push({name:l+" ("+a.roleName+")",days:[],contHour:0,code:a.employeeKey,id:!1,ids:n.value.length})}}),v.workSchedule.getUsersYear({code:Y.value,year:new Date(f.value).getFullYear()}).then(a=>{a.forEach(l=>{l.dateStart&&$.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),console.log(a),ae(),T.value=!1})},ae=()=>{v.workSchedule.getWorkSchedule({code:Y.value,date:c.parseTime(new Date(f.value),"{Y}-{m}-{dd}")}).then(a=>{a.forEach((l,o)=>{l!==null&&(n.value[o].days=l.data.days,n.value[o].id=l.id)}),z()})},z=()=>{n.value.forEach(a=>{a.contHour=a.days.reduce((l,o)=>l+o.time,0)})},ne=a=>{n.value[a].days=[],z()},oe=a=>{switch(q.value){case"5":for(let l=M.value;l<=u.value.length;l++)u.value[l-1].holidays===""&&D(l,a,!0),u.value[l-1].holidays==="preholiday"&&(m.value-=1,D(l,a,!0),m.value+=1);break;case"2x2":for(let l=M.value;l<=u.value.length;l+=4)D(l,a,!0),l+1<=u.value.length&&D(l+1,a,!0);break;case"2x5":for(let l=M.value;l<=u.value.length;l+=7)for(let o=l;o<l+5&&o<=u.value.length;o++)u.value[o-1].holidays==="preholiday"?(m.value-=1,D(o,a,!0),m.value+=1):D(o,a,!0);break}},D=(a,l,o=!1)=>{const{date:d,ind:t}=H(a,l);t===-1?(n.value[l].days.push({day:d,time:m.value,tips:`(${p.value}:00 - ${m.value>=22?p.value+m.value+2:p.value+m.value+1}:00)`}),z()):o||(m.value=n.value[l].days[t].time,p.value=parseInt(n.value[l].days[t].tips.slice(1,-12)))},ue=(a,l)=>{const{ind:o}=H(a,l);n.value[l].days.splice(o,1),z(),document.querySelector(".app-main").click()},_=(a,l)=>{const{date:o,ind:d}=H(a,l);n.value[l].days[d]={day:o,time:m.value,tips:`(${p.value}:00 - ${m.value>=22?p.value+m.value+2:p.value+m.value+1}:00)`},z()},H=(a,l)=>{var t;const o=c.parseTime(new Date(f.value).setDate(a),"{Y}-{m}-{dd}"),d=(t=n.value[l])==null?void 0:t.days.findIndex(h=>h.day===o);return{date:o,ind:d}},re=async()=>{var x;F.value=!0;const a=new ge.Workbook,l=a.addWorksheet(V(f.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),o={vertical:"middle",horizontal:"center"},d={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},t={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${c.cellsDynamically("A1",u.value.length+5)}1`),l.mergeCells(`A2:${c.cellsDynamically("A2",u.value.length+5)}2`),l.mergeCells("A3:A4"),l.mergeCells(`B3:${c.cellsDynamically("B3",u.value.length)}3`),l.mergeCells(`${c.cellsDynamically("B3",u.value.length+1)}3:${c.cellsDynamically("B3",u.value.length+2)}3`),l.mergeCells(`${c.cellsDynamically("B3",u.value.length+3)}3:${c.cellsDynamically("B4",u.value.length+3)}4`),l.mergeCells(`${c.cellsDynamically("B3",u.value.length+4)}3:${c.cellsDynamically("B4",u.value.length+4)}4`),l.getCell("A1").value=r("workSchedule.firm"),l.getCell("A2").value=r("workSchedule.title",{name:C.value})+V(f.value,"month")+` ${new Date(f.value).getFullYear()}`,l.getCell("A3").value=r("workSchedule.month"),l.getCell("B3").value=r("workSchedule.numbersMonth"),l.getCell(3,u.value.length+2).value=r("workSchedule.onSchedule"),l.getCell(3,u.value.length+4).value=r("workSchedule.acquainted"),l.getCell(3,u.value.length+5).value=r("workSchedule.date"),l.getCell(4,u.value.length+2).value=r("workSchedule.days"),l.getCell(4,u.value.length+3).value=`${r("workSchedule.hours")} (${B.value})`;for(let s=2;s<=u.value.length+1;s++)l.getCell(4,s).value=u.value[s-2].weekday+`
3
3
  `+(s-1),l.getColumn(s).width=6,l.getColumn(s).alignment=t,l.getCell(4,s).border=d;l.getRow(1).height=40,l.getRow(2).height=30,l.getRow(3).height=20,l.getColumn(1).width=15,l.getColumn(u.value.length+2).width=5,l.getColumn(u.value.length+3).width=6,l.getColumn(u.value.length+4).width=13,l.getColumn(u.value.length+5).width=13,l.getColumn(1).alignment=t,l.getCell("A2").alignment=o,l.getCell("A3").alignment=o,l.getCell("B3").alignment=o,l.getCell(3,u.value.length+2).alignment=o,l.getColumn(u.value.length+2).alignment=t,l.getColumn(u.value.length+3).alignment=t,l.getColumn(u.value.length+4).alignment=o,l.getColumn(u.value.length+5).alignment=o,l.getCell("A3").border=d,l.getCell("B3").border=d,l.getCell(3,u.value.length+2).border=d,l.getCell(4,u.value.length+2).border=d,l.getCell(3,u.value.length+4).border=d,l.getCell(3,u.value.length+5).border=d,l.getCell(4,u.value.length+3).border=d;let h=0;for(const s of n.value){let y=[s.name];for(let w=1;w<=u.value.length;w++){const{ind:G}=H(w,h);G!==-1?y[w]=`${s.days[G].time} ${s.days[G].tips}`:y[w]=" "}y.push(((x=s.days)==null?void 0:x.length)||" ",s.contHour||0);const L=l.addRow(y);L.border=d,h++}let S="Щербина Е. В.";v.odata.personal.forEach(s=>{s.roleName==="Начальник отдела правовой и кадровой работы"&&(S=s.employeeName)}),l.mergeCells(`A${n.value.length+6}:P${n.value.length+6}`),l.mergeCells(`Q${n.value.length+6}:AG${n.value.length+6}`),l.mergeCells(`B${n.value.length+8}:E${n.value.length+8}`),l.mergeCells(`F${n.value.length+8}:L${n.value.length+8}`),l.mergeCells(`M${n.value.length+8}:P${n.value.length+8}`),l.mergeCells(`S${n.value.length+8}:V${n.value.length+8}`),l.mergeCells(`W${n.value.length+8}:AC${n.value.length+8}`),l.mergeCells(`AD${n.value.length+8}:AG${n.value.length+8}`),l.mergeCells(`Z${n.value.length+9}:AA${n.value.length+9}`),l.getCell(`A${n.value.length+6}`).value=r("workSchedule.byInitials"),l.getCell(`Q${n.value.length+6}`).value=r("workSchedule.supervisorHR"),l.getCell(`B${n.value.length+8}`).value=r("workSchedule.compiled")+":",l.getCell(`S${n.value.length+8}`).value=r("workSchedule.approved")+":",l.getCell(`M${n.value.length+8}`).value=c.byInitials(v.fullName),l.getCell(`AD${n.value.length+8}`).value=c.byInitials(S),l.getCell(`Z${n.value.length+9}`).value=r("workSchedule.printPlace"),l.getCell(`A${n.value.length+6}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`Q${n.value.length+6}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`B${n.value.length+8}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`F${n.value.length+8}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`M${n.value.length+8}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`AD${n.value.length+8}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`Z${n.value.length+9}`).alignment=o,l.getCell(`F${n.value.length+8}`).border={bottom:{style:"thin"}},l.getCell(`W${n.value.length+8}`).border={bottom:{style:"thin"}};const N="export_"+c.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",E=await a.xlsx.writeBuffer();de.saveAs(new Blob([E]),N),F.value=!1},ie=async()=>{I.value||v.workSchedule.addWorkSchedule({data:n.value,date:c.parseTime(new Date(f.value),"{Y}-{m}-{dd}"),group:C.value}).then(a=>I.value=a)};return console.log("props.group",v.group),console.log("props.date",v.date),v.group&&(C.value=v.group),v.date&&(f.value=new Date(v.date+"T00:00:01")),c.holidays().then(a=>{K.value=a,Q()}),(a,l)=>{const o=e.resolveComponent("el-date-picker"),d=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",me,[e.createElementVNode("div",he,[k.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElSelect),{key:0,modelValue:C.value,"onUpdate:modelValue":l[0]||(l[0]=t=>C.value=t),placeholder:"Select",style:{width:"240px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElOption),{key:t.key,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),k.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:1,plain:"",onClick:l[1]||(l[1]=t=>T.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.jobTitle")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(o,{modelValue:R.value,"onUpdate:modelValue":l[2]||(l[2]=t=>R.value=t),type:"month",placeholder:"Выберите месяц",format:"MMM","value-format":"M"},null,8,["modelValue"]),l[19]||(l[19]=e.createElementVNode("div",{class:"expander"},null,-1)),e.createVNode(e.unref(i.ElSwitch),{modelValue:A.value,"onUpdate:modelValue":l[3]||(l[3]=t=>A.value=t),"active-text":a.$t("bids.currentHeight"),"active-value":"100%","inactive-value":"calc(100vh - var(--el-component-size)*4 - var(--el-main-padding)*2 - var(--header-height))"},null,8,["modelValue","active-text"]),e.createVNode(e.unref(i.ElSwitch),{modelValue:j.value,"onUpdate:modelValue":l[4]||(l[4]=t=>j.value=t),"active-text":"Отпуска","active-value":!0,"inactive-value":!1},null,8,["modelValue"])]),e.createVNode(e.unref(i.ElSkeleton),{style:{width:"100%"},loading:Z.value,animated:""},{template:e.withCtx(()=>[e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"100%",height:"2rem"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"4rem","margin-right":"4px"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"4rem"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"8rem","margin-right":"4px"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"8rem"}})]),default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTable),{id:"printTable",data:n.value,style:{width:"100%"},"max-height":A.value,size:"small",align:"center",onCellClick:ee,"empty-text":e.unref(r)("workSchedule.emptyText"),"cell-class-name":le},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.title",{name:C.value})+e.unref(V)(f.value,"month")+` ${new Date(f.value).getFullYear()}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.month"),width:"180",align:"center",fixed:A.value!=="100%"},{default:e.withCtx(t=>[e.createElementVNode("div",fe,e.toDisplayString(n.value[t.$index].name),1)]),_:1},8,["label","fixed"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.numbersMonth"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElTableColumn),{key:t.day,width:"46","class-name":t.holidays,align:"center",label:t.weekday+`
4
4
  `+t.day.toString(),prop:"vacation"},{default:e.withCtx(h=>[e.createElementVNode("div",pe,e.toDisplayString(X(t.day,h.$index)||" "),1)]),_:2},1032,["class-name","label"]))),128))]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.onSchedule"),align:"center",fixed:A.value!=="100%"?"right":!1},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.days"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(n.value[t.$index].days.length||0),1)]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:`${e.unref(r)("workSchedule.hours")} ( ${B.value} )`,align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",{style:e.normalizeStyle(`color: ${B.value===t.row.contHour?"green":"red"};`)},e.toDisplayString(t.row.contHour),5)]),_:1},8,["label"])]),_:1},8,["label","fixed"])]),_:1},8,["label"])]),_:1},8,["data","max-height","empty-text"])]),_:1},8,["loading"]),te.value&&k.checkEdit?(e.openBlock(),e.createElementBlock("div",ye,[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.chartsFilled"))+": ",1),I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:0,type:"primary",onClick:ie},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.confirm")),1)]),_:1})),l[20]||(l[20]=e.createTextVNode()),e.createElementVNode("span",null,e.toDisplayString(k.fullName),1)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(i.ElButton),{disabled:F.value,plain:"",onClick:re,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[d,F.value]]),e.createVNode(e.unref(i.ElDialog),{title:e.unref(r)("workSchedule.jobTitle"),modelValue:T.value,"onUpdate:modelValue":l[6]||(l[6]=t=>T.value=t),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(i.ElButton),{onClick:l[5]||(l[5]=t=>T.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(i.ElButton),{size:"default",type:"primary",onClick:W},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(i.ElForm),{ref:"dialogForm",model:b.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElSwitch),{modelValue:t.val,"onUpdate:modelValue":h=>t.val=h,"active-text":t.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(J.ContextMenu),{show:U.value,"onUpdate:show":l[18]||(l[18]=t=>U.value=t),options:P.value},{default:e.withCtx(()=>[e.createVNode(e.unref(J.ContextMenuItem),{label:g.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(J.ContextMenuSeparator)),g.value.level===2?(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(i.ElRadioGroup),{modelValue:q.value,"onUpdate:modelValue":l[7]||(l[7]=t=>q.value=t),size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElRadioButton),{label:e.unref(r)("workSchedule.Days5"),value:"5"},null,8,["label"]),e.createVNode(e.unref(i.ElRadioButton),{label:"2 Х 2",value:"2x2"}),e.createVNode(e.unref(i.ElRadioButton),{label:"2 Х 5",value:"2x5"})]),_:1},8,["modelValue"]),l[21]||(l[21]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.fromDate"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:M.value,"onUpdate:modelValue":l[8]||(l[8]=t=>M.value=t),step:1,min:1,max:u.value.length},null,8,["modelValue","max"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:p.value,"onUpdate:modelValue":l[9]||(l[9]=t=>p.value=t),step:1,min:0,max:19},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:m.value,"onUpdate:modelValue":l[10]||(l[10]=t=>m.value=t),step:1,min:4,max:e.unref(c.clamp)(p.value!==1?23-p.value:21,4,22)},null,8,["modelValue","max"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[11]||(l[11]=t=>oe(g.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.fillOut")),1)]),_:1}),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[12]||(l[12]=t=>ne(g.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.clearRow")),1)]),_:1})])):(e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",null,e.toDisplayString(X(g.value.day,g.value.ids)),1),l[22]||(l[22]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:p.value,"onUpdate:modelValue":l[13]||(l[13]=t=>p.value=t),step:1,min:0,max:19,onChange:l[14]||(l[14]=t=>_(g.value.day,g.value.ids))},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:m.value,"onUpdate:modelValue":l[15]||(l[15]=t=>m.value=t),step:1,min:4,max:e.unref(c.clamp)(p.value!==1?23-p.value:21,4,22),onChange:l[16]||(l[16]=t=>_(g.value.day,g.value.ids))},null,8,["modelValue","max"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[17]||(l[17]=t=>ue(g.value.day,g.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.delete")),1)]),_:1})]))]),_:1},8,["show","options"])])}}};module.exports=Ce;
package/dist/WorkTable.js CHANGED
@@ -40,8 +40,8 @@ const Ke = { class: "work" }, Qe = { class: "nav" }, Xe = { style: { height: "10
40
40
  // ids: 1
41
41
  // }
42
42
  ]), ee = g(h.date ? (/* @__PURE__ */ new Date(h.date + "T00:00:01")).getMonth() : (/* @__PURE__ */ new Date()).getMonth()), le = g(!1), I = g([]), f = g(new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1)), u = g([]), H = g(0), w = g(9), p = g(8), J = g(!1), me = g(!0), R = g(!1), te = g("5"), W = g(1), $ = g(""), ae = g([]), N = g([]), K = g([]), c = g({ name: "Имя", length: 0, code: "" }), Q = g(!1), ne = g({
43
- zIndex: 30,
44
- minWidth: 220,
43
+ zIndex: 3,
44
+ minWidth: 230,
45
45
  x: 500,
46
46
  y: 200
47
47
  }), he = g({}), P = g("100%");
@@ -1 +1 @@
1
- .work>.nav{display:flex;gap:.5rem;margin-bottom:.5rem;flex-wrap:wrap}.work>.nav .expander{display:inline-block;height:1em;width:1em;flex-grow:3}.wrapper[data-v-d1aa0363]{display:flex}.wrapper .month_year[data-v-d1aa0363]{display:flex;justify-content:space-around;align-items:center}.wrapper .month_year span:not(.text) button[data-v-d1aa0363]{font-size:1.3em}.wrapper>div[data-v-d1aa0363]:not(:first-child){margin-left:2rem}.wrapper button[data-v-d1aa0363]{height:30px;text-align:center;line-height:30px;cursor:pointer;background:none;border:none;border-radius:.2rem;transition:all .3s ease}.wrapper button[data-v-d1aa0363]:hover:not(.disabled):not(.active){color:var(--el-color-success)}.wrapper .week[data-v-d1aa0363]{border-bottom:1px solid var(--el-color-info);margin-bottom:.5rem}.wrapper .month[data-v-d1aa0363],.wrapper .week[data-v-d1aa0363]{width:250px;display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;gap:.2rem}.wrapper .month>button[data-v-d1aa0363],.wrapper .week>button[data-v-d1aa0363]{width:30px}.wrapper .month>button.disabled[data-v-d1aa0363],.wrapper .week>button.disabled[data-v-d1aa0363]{color:var(--el-color-info);cursor:not-allowed}.wrapper .month>button.preholiday[data-v-d1aa0363],.wrapper .week>button.preholiday[data-v-d1aa0363]{background-color:#ffe78070}.wrapper .month>button.weekend[data-v-d1aa0363],.wrapper .week>button.weekend[data-v-d1aa0363]{background-color:#ff808070}.wrapper .month>button.select[data-v-d1aa0363],.wrapper .week>button.select[data-v-d1aa0363]{background-color:#007bff70}.wrapper .month>button.holiday[data-v-d1aa0363],.wrapper .week>button.holiday[data-v-d1aa0363]{background-color:red}.wrapper .month>button.nowork[data-v-d1aa0363],.wrapper .week>button.nowork[data-v-d1aa0363]{background-color:red}.wrapper .month>button.active[data-v-d1aa0363],.wrapper .week>button.active[data-v-d1aa0363]{background-color:#007bff}.noBorder .el-input__wrapper{box-shadow:none}.turn{writing-mode:vertical-rl;text-orientation:sideways;border-left:var(--el-table-border);transform:rotate(180deg)}
1
+ .work>.nav{display:flex;gap:.5rem;margin-bottom:.5rem;flex-wrap:wrap}.work>.nav .expander{display:inline-block;height:1em;width:1em;flex-grow:3}.wrapper[data-v-d1aa0363]{display:flex}.wrapper .month_year[data-v-d1aa0363]{display:flex;justify-content:space-around;align-items:center}.wrapper .month_year span:not(.text) button[data-v-d1aa0363]{font-size:1.3em}.wrapper>div[data-v-d1aa0363]:not(:first-child){margin-left:2rem}.wrapper button[data-v-d1aa0363]{height:30px;text-align:center;line-height:30px;cursor:pointer;background:none;border:none;border-radius:.2rem;transition:all .3s ease}.wrapper button[data-v-d1aa0363]:hover:not(.disabled):not(.active){color:var(--el-color-success)}.wrapper .week[data-v-d1aa0363]{border-bottom:1px solid var(--el-color-info);margin-bottom:.5rem}.wrapper .month[data-v-d1aa0363],.wrapper .week[data-v-d1aa0363]{width:250px;display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;gap:.2rem}.wrapper .month>button[data-v-d1aa0363],.wrapper .week>button[data-v-d1aa0363]{width:30px}.wrapper .month>button.disabled[data-v-d1aa0363],.wrapper .week>button.disabled[data-v-d1aa0363]{color:var(--el-color-info);cursor:not-allowed}.wrapper .month>button.preholiday[data-v-d1aa0363],.wrapper .week>button.preholiday[data-v-d1aa0363]{background-color:#ffe78070}.wrapper .month>button.weekend[data-v-d1aa0363],.wrapper .week>button.weekend[data-v-d1aa0363]{background-color:#ff808070}.wrapper .month>button.select[data-v-d1aa0363],.wrapper .week>button.select[data-v-d1aa0363]{background-color:#007bff70}.wrapper .month>button.holiday[data-v-d1aa0363],.wrapper .week>button.holiday[data-v-d1aa0363]{background-color:red}.wrapper .month>button.nowork[data-v-d1aa0363],.wrapper .week>button.nowork[data-v-d1aa0363]{background-color:red}.wrapper .month>button.active[data-v-d1aa0363],.wrapper .week>button.active[data-v-d1aa0363]{background-color:#007bff}.noBorder .el-input__wrapper{box-shadow:none}.turn{writing-mode:vertical-rl;text-orientation:sideways;border-left:var(--el-table-border);transform:rotate(180deg)}.el-table tbody .cell{padding:0 1px}.nav{display:flex;gap:.5rem;margin-bottom:.5rem;flex-wrap:wrap}.nav .expander{display:inline-block;height:1em;width:1em;flex-grow:3}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studio-west/employees",
3
- "version": "0.6.25",
3
+ "version": "0.6.27",
4
4
  "files": [
5
5
  "dist"
6
6
  ],