@studio-west/employees 0.6.49 → 0.6.52
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.
- package/dist/SheetTable.cjs +2 -2
- package/dist/SheetTable.js +57 -58
- package/dist/VacationTable.cjs +1 -1
- package/dist/VacationTable.js +181 -181
- package/dist/WorkTable.cjs +4 -4
- package/dist/WorkTable.js +50 -50
- package/dist/employees.css +1 -1
- package/package.json +8 -3
package/dist/SheetTable.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),be=require("vue-i18n"),c=require("./index-Dn3djtwj.cjs"),g=require("element-plus"),_=require("@imengyu/vue3-context-menu"),de=require("file-saver"),we=require("exceljs");function De(V){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(V){for(const s in V)if(s!=="default"){const M=Object.getOwnPropertyDescriptor(V,s);Object.defineProperty(y,s,M.get?M:{enumerable:!0,get:()=>V[s]})}}return y.default=V,Object.freeze(y)}const xe=De(we),$e={class:"nav"},ke={style:{height:"20px",width:"100%",display:"inline-block"}},Ne={style:{height:"20px",width:"100%",display:"inline-block"}},Ve={class:"label"},Se={key:0,style:{padding:"0 1rem .5rem"}},Te={key:1,style:{padding:"0 1rem .5rem"}},Ee={__name:"SheetTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"},group:String,date:String,logo:{type:URL,default:"#"},editor:{type:Object,default:()=>({})}},setup(V){const y=V,{t:s,d:M}=be.useI18n(),q=e.ref(!1),b=e.ref([]),P=e.ref("0"),p=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(P.value))),d=e.ref([]),S=e.ref([]),Z=e.ref("100%"),A=e.ref("true"),Q=e.ref([]),ve=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")}]),ne=e.ref([]),ce=e.ref(0),x=e.ref(9),D=e.ref(8),k=e.ref(0),z=e.ref(0),O=e.ref([]),Y=e.ref(!1),H=e.ref(!1),ee=e.ref([]),j=e.ref([]),B=e.ref(!1),J=e.ref(!1),L=e.ref(1),oe=e.ref(null),le=e.ref({zIndex:3,minWidth:230,x:500,y:200}),v=e.ref({name:"",length:0,code:""}),$=e.ref([]),G=e.ref(""),R=e.ref("_____"),i=e.computed(()=>b.value.flatMap((t,l)=>{console.log("allPeriods");const m=$.value.find(n=>n.code===t.code),o=new Map;t.days.forEach(n=>o.set(n.day,{...n})),m&&m.days.forEach(n=>o.set(n.day,{...n}));const h=Array.from(o.values());return[{...t,days:h,key:0,ids:l,numberNonAppearing:[0,0]},{...t,days:h,key:1,ids:l,numberNonAppearing:[0,0]}]}));e.watch(S,async(t,l)=>{t!==l&&(O.value=[],confirm.value=!1,y.odata.personal.forEach(m=>{t.includes(m.divisionName)&&(O.value.some(o=>(o==null?void 0:o.activeText)===m.roleName)||O.value.push({val:!0,activeText:m.roleName}))}),te())}),e.watch(P,t=>{p.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(t)),ue(),te()}),e.watch(D,()=>Y.value=B.value),e.watch(x,()=>Y.value=B.value),e.watch(L,()=>Y.value=B.value);const me=async(t,l,m,o)=>{if(console.log("row",t),console.log("column",l),l.level!==3||l.labelClassName==="turn"||l.no===15||l.no>d.value.length||!y.checkEdit)return"";v.value.ids=t.ids,v.value.key=t.key,v.value.day=l.no<15?l.no:l.no-1;const h=new Date(p.value),n=`${h.getFullYear()}-${(h.getMonth()+1).toString().padStart(2,"0")}-${(v.value.day+1).toString().padStart(2,"0")}`,a=$.value.findIndex(f=>f.code===t.code);v.value.id=a!==-1?$.value[a].days.findIndex(f=>(f==null?void 0:f.day)===n):a,x.value=typeof t.days[v.value.day].tips>"u"?9:parseInt(t.days[v.value.day].tips.match(/(\d{1,2})/)),k.value=typeof t.days[v.value.day].night>"u"?0:parseInt(t.days[v.value.day].night),z.value=typeof t.days[v.value.day].overtime>"u"?0:parseInt(t.days[v.value.day].overtime),D.value=t.days[v.value.day].time!=="-"?parseInt(t.days[v.value.day].time):8;const u=t.days.findIndex(f=>f.day===n);v.value.failure=t.days[u].state,le.value.y=o.clientY,le.value.x=o.clientX,v.value.rest=a!==-1&&v.value.id!==-1,v.value.name=c.byInitials(t.fio),B.value=!0,await e.nextTick(),Y.value=!1},K=t=>{const l=new Date(p.value),m=`${l.getFullYear()}-${(l.getMonth()+1).toString().padStart(2,"0")}-${(v.value.day+1).toString().padStart(2,"0")}`;let o=$.value.findIndex(C=>C.code===b.value[v.value.ids].code);v.value.id=o!==-1?$.value[o].days.findIndex(C=>(C==null?void 0:C.day)===`${l.getFullYear()}-${(l.getMonth()+1).toString().padStart(2,"0")}-${(v.value.day+1).toString().padStart(2,"0")}`):o;let h=b.value[v.value.ids].days[v.value.day].state,n=t,a="-",u,f,w;switch(t){case"Я":h==="В"&&(n="РВ"),a=8;break;case"КВ":case"К":h==="В"||h==="КВ"?n="КВ":n="К";break;case"save":let C=W.value.split('"');n=C[1],Y.value=!1,C[2]!==""&&(a=D.value,w="("+C[2].split("(")[1],u=k.value,f=z.value)}t==="reset"?(n=h,$.value[o].days.splice(v.value.id,1)):o===-1?$.value.push({code:b.value[v.value.ids].code,days:[{day:m,state:n,time:a,night:u,overtime:f,tips:w}]}):v.value.id===-1?$.value[o].days.push({day:m,state:n,time:a,night:u,overtime:f,tips:w}):$.value[o].days[v.value.id]={day:m,state:n,time:a,night:u,overtime:f,tips:w},o=$.value.findIndex(C=>C.code===b.value[v.value.ids].code),y.workSchedule.addWorkSheet({date:c.parseTime(new Date(p.value),"{Y}-{m}-{dd}"),data:[{name:b.value[v.value.ids].fio,days:$.value[o].days,code:b.value[v.value.ids].code}]}),v.value.failure=n,L.value>1&&(L.value--,v.value.day++,K(n)),re()},W=e.computed(()=>{J.value=!1;let t=b.value[v.value.ids].days[v.value.day],l="";k.value=0,z.value=0;let m=D.value>=22?x.value+D.value+2:x.value+D.value+1,o=v.value.failure.split("/")[0];o=/^Н(?!Н$)С?$/.test(o)?t.state!=="В"?"Я":"РВ":o,/^(|Я|РВ)$/.test(o)&&((x.value<6||m>22)&&(l="Н",k.value=x.value<6?Math.min(6,m)-x.value:0,m<=6&&(k.value=D.value,o=""),m===7&&k.value>3&&k.value--,k.value+=Math.max(22,m)-22),D.value>t.time&&o!=="РВ"&&(l+="С",J.value=!0,z.value=D.value-t.time),/РВ/.test(o)&&(J.value=!0)),l.length>0&&o.length>0&&(l="/"+l);let h=`(${x.value}:00 - ${D.value>=22?x.value+D.value+2:x.value+D.value+1}:00)`,n=i.value[v.value.ids*2].days[v.value.day].time!=="-"?" "+D.value+" "+h:"";return'"'+o+l+'"'+n}),he=t=>{if(t.columnIndex<2||t.columnIndex>d.value.length+3&&t.columnIndex<d.value.length+9||t.columnIndex>d.value.length+11)return i.value[t.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},ue=()=>{const t=ne.value,l=new Date(p.value),m=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let o=[],h=0;for(let n=1;n<=m;n++){const a=c.parseTime(l.setDate(n),"{Y}-{m}-{dd}");h+=t.nowork.includes(a)||t.holidays.includes(a)?0:t.preholidays.includes(a)?7:8;let u=t.nowork.includes(a)?"nowork":t.holidays.includes(a)?"holiday":t.preholidays.includes(a)?"preholiday":"";o.push({day:n,holidays:u,weekday:M(new Date(l.getFullYear(),l.getMonth(),n),"day")})}return ce.value=h,d.value=o,y.odata.getPersonal({dismissed:"false"}).then(n=>{var a;S.value.length===0&&(S.value=[(a=n.find(u=>u.employeeName===y.fullName))==null?void 0:a.divisionName]),n.forEach(u=>{Q.value.some(f=>u.dismissalDate.length>0&&new Date(u.dismissalDate)<new Date(p.value)||(f==null?void 0:f.value)===u.divisionName)||Q.value.push({value:u.divisionName,label:u.divisionName,key:u.divisionName})})}),!0},te=()=>{b.value=[],j.value=[],ee.value=[],y.odata.personal.forEach(t=>{if(S.value.includes(t.divisionName)&&O.value.some(l=>l.val&&l.activeText===t.roleName)&&(t.dismissalDate.length===0||new Date(t.dismissalDate)>new Date(p.value))){let l=c.byInitials(t.employeeName);const m={fio:t.employeeName,name:l+" ("+t.roleName+")",code:t.employeeKey,days:[],contHour:0,id:!1,employmentDate:c.parseTime(new Date(t.employmentDate),"{Y}-{m}-{dd}T00:00:00"),dismissalDate:t.dismissalDate};b.value.push(m)}t.employeeName===y.fullName&&(R.value=t.roleName)}),b.value.sort((t,l)=>t.fio<l.fio?-1:t.fio>l.fio?1:0),b.value.forEach((t,l)=>{t.ids=l,j.value.push(t.code)}),y.workSchedule.getUsersYear({code:j.value,year:new Date(p.value).getFullYear()}).then(t=>{t.forEach(l=>{l.dateStart&&ee.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),ge()})},ge=()=>{y.workSchedule.getWorkSheet({code:j.value,date:c.parseTime(new Date(p.value),"{Y}-{m}-{dd}")}).then(t=>{$.value=[],t.forEach(l=>{l!==null&&$.value.push({code:l.code,days:l.data.days})}),y.workSchedule.getWorkSchedule({code:j.value,date:c.parseTime(new Date(p.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((m,o)=>{var n,a;if(m!==null){b.value[o].days=[],m.data.days.forEach(u=>u.state="Я");for(let u=1;u<=d.value.length;u++){let f=c.parseTime(new Date(p.value).setDate(u),"{Y}-{m}-{dd}");const w=(n=m.data)==null?void 0:n.days.findIndex(C=>C.day===f);w===-1?X(u,o,"-","В"):b.value[o].days.push((a=m.data)==null?void 0:a.days[w])}}else for(let u=1;u<=d.value.length;u++)d.value[u-1].holidays===""?X(u,o,8):d.value[u-1].holidays==="preholiday"?X(u,o,7):X(u,o,"-","В");const h=b.value[o];if(h.employmentDate||h.dismissalDate)for(let u=1;u<=d.value.length;u++){const f=new Date(new Date(p.value).setDate(u)),w=c.parseTime(f,"{Y}-{m}-{dd}"),C=h.employmentDate&&f<new Date(h.employmentDate),T=h.dismissalDate&&f>new Date(h.dismissalDate);if(C||T){const N=h.days.findIndex(I=>I.day===w);N!==-1&&(h.days[N].state="-",h.days[N].time="-")}}for(let u=1;u<=d.value.length;u++){let f=new Date(new Date(p.value).getFullYear(),new Date(p.value).getMonth(),u).getTime()+1e3;for(let w of ee.value){const{dateStart:C,dateEnd:T,code:N}=w;if(C&&T&&N===b.value[o].code){const I=new Date(c.parseDate(C)).getTime(),U=new Date(c.parseDate(T)).getTime();if(f>=I&&f<=U){const r=c.parseTime(new Date(p.value).setDate(u),"{Y}-{m}-{dd}"),F=b.value[o].days.findIndex(ae=>ae.day===r);F!==-1?b.value[o].days[F]={day:r,time:"-",state:"ОТ"}:b.value[o].days.push({day:r,time:"-",state:"ОТ"})}}}}}),re()})})},X=(t,l,m,o="Я")=>{const h=c.parseTime(new Date(p.value).setDate(t),"{Y}-{m}-{dd}");b.value[l].days.push({day:h,time:m,state:o})},re=()=>{i.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((n,a)=>{if(a.hasOwnProperty("state")&&/^(|К|КВ|ОТ|Б|Р|ПР|ОЖ|НН|У|ДО|УД|Г)$/.test(a.state)){const u=a.state;n[u]=(n[u]||0)+1}return n},{})).map(([n,a])=>({code:n,count:a}));t.numberNonAppearing=[l.reduce((n,a)=>n+a.count,0),0];const m=Math.ceil(l.length/2),o=l.slice(0,m),h=l.slice(m);t.key===0&&o.length>0&&(t.appearing={code:o.map(n=>n.code).join("/"),count:o.map(n=>n.count).join("/")}),t.key===1&&h.length>0&&(t.appearing={code:h.map(n=>n.code).join("/"),count:h.map(n=>n.count).join("/")});for(let n=0;n<t.days.length;n++)n<15&&t.days[n].time!=="-"&&(t.hourI+=Number(t.days[n].time),t.days[n].overtime&&(t.hourI+=Number(t.days[n].overtime)),t.halfI++),n>=15&&t.days[n].time!=="-"&&(t.days[n].overtime&&(t.hourII+=Number(t.days[n].overtime)),t.hourII+=Number(t.days[n].time),t.halfII++),t.days[n].night&&(t.night+=Number(t.days[n].night)),t.days[n].overtime&&(t.overtime+=Number(t.days[n].overtime)),/{|РВ|}/.test(t.days[n].state)&&(t.weekend+=Number(t.days[n].time)),t.days[n].state==="В"&&t.weekendDays++;t.contDays=t.halfI+t.halfII,t.contHour=t.hourI+t.hourII})},ie=(t,l)=>{var u,f,w,C,T,N,I;if(l===-1)return"";const m=i.value[l],o=new Date(p.value),h=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${t.toString().padStart(2,"0")}`,n=m.days.findIndex(U=>U.day===h);let a=0;return(u=m.days[n])!=null&&u.night&&(a+=m.days[n].night),(f=m.days[n])!=null&&f.overtime&&(a+=m.days[n].overtime),n===-1?"":m.key===0?(w=m.days[n])==null?void 0:w.state:((C=m.days[n])==null?void 0:C.time)===0?a===0?"-":a:a===0||a===((T=m.days[n])==null?void 0:T.time)?(N=m.days[n])==null?void 0:N.time:`${(I=m.days[n])==null?void 0:I.time}/${a}`};y.group&&(S.value[0]=y.group),y.date&&(P.value=new Date(y.date+"T00:00:01").getMonth()),c.holidays().then(t=>{ne.value=t,ue()});const se=t=>new Date(p.value).getMonth()===new Date().getMonth()&&t===new Date().getDate()?" today":"",fe=()=>{let t=W.value.match(/(\d{1,2}):\d{2}\s*-\s*(\d{1,2})/),l=b.value[v.value.ids].days[v.value.day+1].tips;return l=typeof l<"u"?l.match(/(\d{1,2}):\d{2}\s*-\s*(\d{1,2})/):[0,9,18],k.value>0&&(Number(t[1])<=6?t[1]=Number(t[1])+k.value:t[2]=Number(t[2])-k.value),Number(t[1])<Number(l[1])?`${t[1]}:00 по ${Number(t[1])+z.value}:00`:`${Number(t[2])-z.value}:00 по ${t[2]}:00`},ye=()=>{let t=/РВ/.test(W.value),l=t?W.value.match(/\(([^)]+)\)/)[1].replace("-"," по "):fe();G.value=`<p style="position: absolute;"><img src="https://cp.avanta-telecom.ru${y.logo}" style="height: 3rem;"></p><div style="display:inline-block;margin-left:66%;width:34%;">Директору<br>ООО "АВАНТА ТЕЛЕКОМ" Пунину Д. В.<br><br>от ${R.value} ${c.byInitials(y.fullName)}</div><p>${S.value[0]}<br>СЛУЖЕБНАЯ ЗАПИСКА<br>${c.parseTime(new Date(p.value).setDate(v.value.day+1),'"{dd}" {F} {Y}')}г.</p><p style="text-align:center;">Уважаемый Дмитрий Владимирович!</p><p>В связи с производственной необходимостью _________________, прошу привлечь к ${t?"к работе в выходной день":"сверхурочной работе"}, ${c.parseTime(new Date(p.value).setDate(v.value.day+1),"{dd}.{m}.{Y}")} c ${l}, ${i.value[v.value.ids*2].name.match(/\(([^)]+)\)/)[1]} ${i.value[v.value.ids*2].fio} для выполнения вышеуказанных работ с его(её) письменного согласия.</p><p>${R.value} ________________ ${c.byInitials(y.fullName)}</p>`},pe=async()=>{var T,N,I,U;q.value=!0;const t=new xe.Workbook,l=t.addWorksheet(M(p.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),m={vertical:"middle",horizontal:"center"},o={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},h={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${c.cellsDynamically("A1",d.value.length+15)}1`),l.mergeCells("A2:A4"),l.mergeCells("B2:B4"),l.mergeCells("C2:C4"),l.mergeCells("D5:R5"),l.mergeCells(`D2:${c.cellsDynamically("D2",d.value.length+2)}2`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+3)}2:${c.cellsDynamically("D2",d.value.length+8)}2`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+9)}2:${c.cellsDynamically("D2",d.value.length+9)}4`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+10)}2:${c.cellsDynamically("D2",d.value.length+11)}2`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+12)}2:${c.cellsDynamically("D2",d.value.length+12)}4`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+3)}3:${c.cellsDynamically("D3",d.value.length+3)}4`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+4)}3:${c.cellsDynamically("D3",d.value.length+8)}3`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+10)}3:${c.cellsDynamically("D3",d.value.length+10)}4`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+11)}3:${c.cellsDynamically("D3",d.value.length+11)}4`),l.mergeCells(`T5:${c.cellsDynamically("D5",d.value.length+1)}5`);for(let r=1;r<=d.value.length+2;r++)l.mergeCells(`${c.cellsDynamically("D3",r)}3:${c.cellsDynamically("D4",r)}4`),l.getColumn(r+3).width=5,l.getColumn(r+3).alignment=h,l.getCell(3,r+3).border=o,r<16&&(l.getCell(3,r+3).value=r),r>16&&(l.getCell(3,r+3).value=r-1);l.getCell("A1").value=s("sheet.title",{name:S.value[0]})+M(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,d.value.length+5).value="7",l.getCell(2,d.value.length+6).value=s("sheet.workedMonth"),l.getCell(2,d.value.length+12).value=s("sheet.numberNonAppearing"),l.getCell(2,d.value.length+13).value=s("sheet.them"),l.getCell(2,d.value.length+15).value=s("sheet.countWeekend"),l.getCell(3,d.value.length+5).value=s("sheet.halfMonth",{half:"II"}),l.getCell(3,d.value.length+6).value=s("sheet.days"),l.getCell(3,d.value.length+7).value=s("sheet.hours"),l.getCell(4,d.value.length+7).value=s("sheet.all"),l.getCell(4,d.value.length+8).value=s("sheet.overtime"),l.getCell(4,d.value.length+9).value=s("sheet.night"),l.getCell(4,d.value.length+10).value=s("sheet.weekend"),l.getCell(4,d.value.length+13).value=s("sheet.code"),l.getCell(4,d.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(d.value.length+5).width=12,l.getColumn(d.value.length+12).width=11,l.getColumn(d.value.length+15).width=11,l.getCell("A1").alignment=m,l.getColumn(1).alignment=h,l.getColumn(2).alignment=h,l.getColumn(3).alignment=h;for(let r=6;r<=15;r++)l.getCell(5,d.value.length+r).value=r+2,l.getColumn(d.value.length+r).alignment=h,l.getCell(4,d.value.length+r).border=o,l.getCell(5,d.value.length+r).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,d.value.length+6).border=o,l.getCell(2,d.value.length+12).border=o,l.getCell(2,d.value.length+13).border=o,l.getCell(2,d.value.length+15).border=o,l.getCell(3,d.value.length+7).border=o;let n=1,a=5,u=!0;for(const r of i.value){let F=[n,r.name,r.code];for(let E=0;E<d.value.length;E++)E===15&&F.push(u?(r==null?void 0:r.halfI)||"":(r==null?void 0:r.hourI)||""),F.push(u?((T=r.days[E])==null?void 0:T.state)||"":((N=r.days[E])==null?void 0:N.time)||"");F.push(u?(r==null?void 0:r.halfII)||0:(r==null?void 0:r.hourII)||0,(r==null?void 0:r.contDays)||0,(r==null?void 0:r.contHour)||0,(r==null?void 0:r.overtime)||0,(r==null?void 0:r.night)||0,(r==null?void 0:r.weekend)||0,"",u?(r==null?void 0:r.numberNonAppearing[0])||"":(r==null?void 0:r.numberNonAppearing[1])||0,((I=r==null?void 0:r.appearing)==null?void 0:I.code)||"-",((U=r==null?void 0:r.appearing)==null?void 0:U.count)||"-",(r==null?void 0:r.weekendDays)||0);const ae=l.addRow(F);if(ae.border=o,!u){l.mergeCells(`A${a+n*2-1}:A${a+n*2}`),l.mergeCells(`B${a+n*2-1}:B${a+n*2}`),l.mergeCells(`C${a+n*2-1}:C${a+n*2}`);for(let E=d.value.length+3;E<=d.value.length+8;E++)l.mergeCells(`${c.cellsDynamically("D",E)}${a+n*2-1}:${c.cellsDynamically("D",E)}${a+n*2}`);l.mergeCells(`${c.cellsDynamically("D",d.value.length+12)}${a+n*2-1}:${c.cellsDynamically("D",d.value.length+12)}${a+n*2}`),n++}u=!u}let f="Чемарина Н. Ю.";y.odata.personal.forEach(r=>{r.roleName==="Специалист по кадрам и кадровому делопроизводству"&&(f=r.employeeName)}),l.mergeCells(`A${i.value.length+7}:B${i.value.length+7}`),l.mergeCells(`C${i.value.length+7}:G${i.value.length+7}`),l.mergeCells(`H${i.value.length+7}:M${i.value.length+7}`),l.mergeCells(`O${i.value.length+7}:T${i.value.length+7}`),l.mergeCells(`V${i.value.length+7}:AC${i.value.length+7}`),l.mergeCells(`AD${i.value.length+7}:AI${i.value.length+7}`),l.mergeCells(`AJ${i.value.length+7}:AL${i.value.length+7}`),l.mergeCells(`AM${i.value.length+7}:AP${i.value.length+7}`),l.mergeCells(`V${i.value.length+9}:AC${i.value.length+9}`),l.mergeCells(`AD${i.value.length+9}:AI${i.value.length+9}`),l.mergeCells(`AJ${i.value.length+9}:AL${i.value.length+9}`),l.mergeCells(`AM${i.value.length+9}:AP${i.value.length+9}`),l.getCell(`A${i.value.length+7}`).value=s("sheet.responsiblePerson"),l.getCell(`V${i.value.length+7}`).value=s("sheet.headStructural"),l.getCell(`C${i.value.length+7}`).value=R.value+":",l.getCell(`O${i.value.length+7}`).value=c.byInitials(y.fullName),l.getCell(`AD${i.value.length+7}`).value=R.value+":",l.getCell(`AM${i.value.length+7}`).value=c.byInitials(y.fullName),l.getCell(`V${i.value.length+9}`).value=s("sheet.HREmployee"),l.getCell(`AD${i.value.length+9}`).value="Специалист по кадрам и кадровому делопроизводству:",l.getCell(`AM${i.value.length+9}`).value=c.byInitials(f),l.getCell(`A${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`C${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`O${i.value.length+7}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`V${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AD${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AM${i.value.length+7}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`V${i.value.length+9}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AD${i.value.length+9}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AM${i.value.length+9}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`H${i.value.length+7}`).border={bottom:{style:"thin"}},l.getCell(`AJ${i.value.length+7}`).border={bottom:{style:"thin"}},l.getCell(`AJ${i.value.length+9}`).border={bottom:{style:"thin"}};const w=`export_${c.parseTime(Date.now(),"{dd}.{m}.{Y}")}.xlsx`,C=await t.xlsx.writeBuffer();de.saveAs(new Blob([C]),w),q.value=!1},Ce=()=>{let t=new Blob([G.value],{type:"text/plain;charset=utf-8"});de.saveAs(t,`Служебка_${c.byInitials(i.value[v.value.ids*2].fio)}_${c.parseTime(Date.now(),"{dd}.{m}.{Y}")}.html`)};return(t,l)=>{const m=e.resolveComponent("el-form-item"),o=e.resolveComponent("svg-icon"),h=e.resolveComponent("el-slider"),n=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",$e,[V.checkEdit?(e.openBlock(),e.createBlock(e.unref(g.ElSelect),{key:0,modelValue:S.value,"onUpdate:modelValue":l[0]||(l[0]=a=>S.value=a),multiple:"","collapse-tags":"","collapse-tags-tooltip":"",placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,a=>(e.openBlock(),e.createBlock(e.unref(g.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),V.checkEdit?(e.openBlock(),e.createBlock(e.unref(g.ElButton),{key:1,plain:"",onClick:l[1]||(l[1]=a=>H.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("workSchedule.jobTitle")),1)]),_:1})):e.createCommentVNode("",!0),l[19]||(l[19]=e.createElementVNode("div",{class:"expander"},null,-1)),V.checkEdit?(e.openBlock(),e.createBlock(e.unref(g.ElSwitch),{key:2,modelValue:P.value,"onUpdate:modelValue":l[2]||(l[2]=a=>P.value=a),"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(g.ElSwitch),{modelValue:Z.value,"onUpdate:modelValue":l[3]||(l[3]=a=>Z.value=a),"active-text":t.$t("sheet.currentHeight"),"active-value":"100%","inactive-value":"calc(100vh - var(--el-component-size)*5 - var(--el-main-padding)*2 - var(--header-height))"},null,8,["modelValue","active-text"]),e.createVNode(e.unref(g.ElSwitch),{modelValue:A.value,"onUpdate:modelValue":l[4]||(l[4]=a=>A.value=a),"active-text":t.$t("sheet.simplified"),"active-value":"true","inactive-value":"false"},null,8,["modelValue","active-text"])]),e.createVNode(e.unref(g.ElTable),{id:"printTable",data:i.value,"span-method":he,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(s)("sheet.emptyText"),align:"center",onCellClick:me,"max-height":Z.value,"default-sort":{prop:"mame",order:"descending"}},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.title",{name:S.value[0]})+e.unref(M)(p.value,"month"),align:"center",height:"10"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.employee"),width:A.value==="false"?180:t.auto,align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].name),1)]),_:1},8,["label","width"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.personnelNumber"),align:"center",width:"108"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.marks"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.day},[a.day<=15?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:0,width:"39","class-name":a.holidays+se(a.day),align:"center",label:a.day.toString()+`
|
|
1
|
+
"use strict";const e=require("vue"),be=require("vue-i18n"),c=require("./index-Dn3djtwj.cjs"),g=require("element-plus"),_=require("@imengyu/vue3-context-menu"),de=require("file-saver"),we=require("exceljs");function De(V){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(V){for(const s in V)if(s!=="default"){const M=Object.getOwnPropertyDescriptor(V,s);Object.defineProperty(y,s,M.get?M:{enumerable:!0,get:()=>V[s]})}}return y.default=V,Object.freeze(y)}const xe=De(we),$e={class:"nav"},ke={style:{height:"20px",width:"100%",display:"inline-block"}},Ne={style:{height:"20px",width:"100%",display:"inline-block"}},Ve={class:"label"},Se={key:0,style:{padding:"0 1rem .5rem"}},Te={key:1,style:{padding:"0 1rem .5rem"}},Ee={__name:"SheetTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"},group:String,date:String,logo:{type:URL,default:"#"},editor:{type:Object,default:()=>({})}},setup(V){const y=V,{t:s,d:M}=be.useI18n(),q=e.ref(!1),b=e.ref([]),H=e.ref("0"),p=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(H.value))),d=e.ref([]),S=e.ref([]),Z=e.ref("100%"),A=e.ref("true"),Q=e.ref([]),ve=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")}]),ne=e.ref([]),ce=e.ref(0),x=e.ref(9),D=e.ref(8),k=e.ref(0),z=e.ref(0),O=e.ref([]),Y=e.ref(!1),P=e.ref(!1),ee=e.ref([]),j=e.ref([]),B=e.ref(!1),J=e.ref(!1),L=e.ref(1),oe=e.ref(null),le=e.ref({zIndex:3,minWidth:230,x:500,y:200}),v=e.ref({name:"",length:0,code:""}),$=e.ref([]),G=e.ref(""),R=e.ref("_____"),i=e.computed(()=>b.value.flatMap((t,l)=>{const m=$.value.find(n=>n.code===t.code),o=new Map;t.days.forEach(n=>o.set(n.day,{...n})),m&&m.days.forEach(n=>o.set(n.day,{...n}));const h=Array.from(o.values());return[{...t,days:h,key:0,ids:l,numberNonAppearing:[0,0]},{...t,days:h,key:1,ids:l,numberNonAppearing:[0,0]}]}));e.watch(S,async(t,l)=>{t!==l&&(O.value=[],y.odata.personal.forEach(m=>{t.includes(m.divisionName)&&(O.value.some(o=>(o==null?void 0:o.activeText)===m.roleName)||O.value.push({val:!0,activeText:m.roleName}))}),te())}),e.watch(H,t=>{p.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(t)),ue(),te()}),e.watch(D,()=>Y.value=B.value),e.watch(x,()=>Y.value=B.value),e.watch(L,()=>Y.value=B.value);const me=async(t,l,m,o)=>{if(console.log("row",t),console.log("column",l),l.level!==3||l.labelClassName==="turn"||l.no===15||l.no>d.value.length||!y.checkEdit)return"";v.value.ids=t.ids,v.value.key=t.key,v.value.day=l.no<15?l.no:l.no-1;const h=new Date(p.value),n=`${h.getFullYear()}-${(h.getMonth()+1).toString().padStart(2,"0")}-${(v.value.day+1).toString().padStart(2,"0")}`,a=$.value.findIndex(f=>f.code===t.code);v.value.id=a!==-1?$.value[a].days.findIndex(f=>(f==null?void 0:f.day)===n):a,x.value=typeof t.days[v.value.day].tips>"u"?9:parseInt(t.days[v.value.day].tips.match(/(\d{1,2})/)),k.value=typeof t.days[v.value.day].night>"u"?0:parseInt(t.days[v.value.day].night),z.value=typeof t.days[v.value.day].overtime>"u"?0:parseInt(t.days[v.value.day].overtime),D.value=t.days[v.value.day].time!=="-"?parseInt(t.days[v.value.day].time):8;const u=t.days.findIndex(f=>f.day===n);v.value.failure=t.days[u].state,le.value.y=o.clientY,le.value.x=o.clientX,v.value.rest=a!==-1&&v.value.id!==-1,v.value.name=c.byInitials(t.fio),B.value=!0,await e.nextTick(),Y.value=!1},K=t=>{const l=new Date(p.value),m=`${l.getFullYear()}-${(l.getMonth()+1).toString().padStart(2,"0")}-${(v.value.day+1).toString().padStart(2,"0")}`;let o=$.value.findIndex(C=>C.code===b.value[v.value.ids].code);v.value.id=o!==-1?$.value[o].days.findIndex(C=>(C==null?void 0:C.day)===`${l.getFullYear()}-${(l.getMonth()+1).toString().padStart(2,"0")}-${(v.value.day+1).toString().padStart(2,"0")}`):o;let h=b.value[v.value.ids].days[v.value.day].state,n=t,a="-",u,f,w;switch(t){case"Я":h==="В"&&(n="РВ"),a=8;break;case"КВ":case"К":h==="В"||h==="КВ"?n="КВ":n="К";break;case"save":let C=W.value.split('"');n=C[1],Y.value=!1,C[2]!==""&&(a=D.value,w="("+C[2].split("(")[1],u=k.value,f=z.value)}t==="reset"?(n=h,$.value[o].days.splice(v.value.id,1)):o===-1?$.value.push({code:b.value[v.value.ids].code,days:[{day:m,state:n,time:a,night:u,overtime:f,tips:w}]}):v.value.id===-1?$.value[o].days.push({day:m,state:n,time:a,night:u,overtime:f,tips:w}):$.value[o].days[v.value.id]={day:m,state:n,time:a,night:u,overtime:f,tips:w},o=$.value.findIndex(C=>C.code===b.value[v.value.ids].code),y.workSchedule.addWorkSheet({date:c.parseTime(new Date(p.value),"{Y}-{m}-{dd}"),data:[{name:b.value[v.value.ids].fio,days:$.value[o].days,code:b.value[v.value.ids].code}]}),v.value.failure=n,L.value>1&&(L.value--,v.value.day++,K(n)),re()},W=e.computed(()=>{J.value=!1;let t=b.value[v.value.ids].days[v.value.day],l="";k.value=0,z.value=0;let m=D.value>=22?x.value+D.value+2:x.value+D.value+1,o=v.value.failure.split("/")[0];o=/^Н(?!Н$)С?$/.test(o)?t.state!=="В"?"Я":"РВ":o,/^(|Я|РВ)$/.test(o)&&((x.value<6||m>22)&&(l="Н",k.value=x.value<6?Math.min(6,m)-x.value:0,m<=6&&(k.value=D.value,o=""),m===7&&k.value>3&&k.value--,k.value+=Math.max(22,m)-22),D.value>t.time&&o!=="РВ"&&(l+="С",J.value=!0,z.value=D.value-t.time),/РВ/.test(o)&&(J.value=!0)),l.length>0&&o.length>0&&(l="/"+l);let h=`(${x.value}:00 - ${D.value>=22?x.value+D.value+2:x.value+D.value+1}:00)`,n=i.value[v.value.ids*2].days[v.value.day].time!=="-"?" "+D.value+" "+h:"";return'"'+o+l+'"'+n}),he=t=>{if(t.columnIndex<2||t.columnIndex>d.value.length+3&&t.columnIndex<d.value.length+9||t.columnIndex>d.value.length+11)return i.value[t.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},ue=()=>{const t=ne.value,l=new Date(p.value),m=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let o=[],h=0;for(let n=1;n<=m;n++){const a=c.parseTime(l.setDate(n),"{Y}-{m}-{dd}");h+=t.nowork.includes(a)||t.holidays.includes(a)?0:t.preholidays.includes(a)?7:8;let u=t.nowork.includes(a)?"nowork":t.holidays.includes(a)?"holiday":t.preholidays.includes(a)?"preholiday":"";o.push({day:n,holidays:u,weekday:M(new Date(l.getFullYear(),l.getMonth(),n),"day")})}return ce.value=h,d.value=o,y.odata.getPersonal({dismissed:"false"}).then(n=>{var a;S.value.length===0&&(S.value=[(a=n.find(u=>u.employeeName===y.fullName))==null?void 0:a.divisionName]),n.forEach(u=>{Q.value.some(f=>u.dismissalDate.length>0&&new Date(u.dismissalDate)<new Date(p.value)||(f==null?void 0:f.value)===u.divisionName)||Q.value.push({value:u.divisionName,label:u.divisionName,key:u.divisionName})})}),!0},te=()=>{b.value=[],j.value=[],ee.value=[],y.odata.personal.forEach(t=>{if(S.value.includes(t.divisionName)&&O.value.some(l=>l.val&&l.activeText===t.roleName)&&(t.dismissalDate.length===0||new Date(t.dismissalDate)>new Date(p.value))){let l=c.byInitials(t.employeeName);const m={fio:t.employeeName,name:l+" ("+t.roleName+")",code:t.employeeKey,days:[],contHour:0,id:!1,employmentDate:c.parseTime(new Date(t.employmentDate),"{Y}-{m}-{dd}T00:00:00"),dismissalDate:t.dismissalDate};b.value.push(m)}t.employeeName===y.fullName&&(R.value=t.roleName)}),b.value.sort((t,l)=>t.fio<l.fio?-1:t.fio>l.fio?1:0),b.value.forEach((t,l)=>{t.ids=l,j.value.push(t.code)}),y.workSchedule.getUsersYear({code:j.value,year:new Date(p.value).getFullYear()}).then(t=>{t.forEach(l=>{l.dateStart&&ee.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),ge()})},ge=()=>{y.workSchedule.getWorkSheet({code:j.value,date:c.parseTime(new Date(p.value),"{Y}-{m}-{dd}")}).then(t=>{$.value=[],t.forEach(l=>{l!==null&&$.value.push({code:l.code,days:l.data.days})}),y.workSchedule.getWorkSchedule({code:j.value,date:c.parseTime(new Date(p.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((m,o)=>{var n,a;if(m!==null){b.value[o].days=[],m.data.days.forEach(u=>u.state="Я");for(let u=1;u<=d.value.length;u++){let f=c.parseTime(new Date(p.value).setDate(u),"{Y}-{m}-{dd}");const w=(n=m.data)==null?void 0:n.days.findIndex(C=>C.day===f);w===-1?X(u,o,"-","В"):b.value[o].days.push((a=m.data)==null?void 0:a.days[w])}}else for(let u=1;u<=d.value.length;u++)d.value[u-1].holidays===""?X(u,o,8):d.value[u-1].holidays==="preholiday"?X(u,o,7):X(u,o,"-","В");const h=b.value[o];if(h.employmentDate||h.dismissalDate)for(let u=1;u<=d.value.length;u++){const f=new Date(new Date(p.value).setDate(u)),w=c.parseTime(f,"{Y}-{m}-{dd}"),C=h.employmentDate&&f<new Date(h.employmentDate),T=h.dismissalDate&&f>new Date(h.dismissalDate);if(C||T){const N=h.days.findIndex(I=>I.day===w);N!==-1&&(h.days[N].state="-",h.days[N].time="-")}}for(let u=1;u<=d.value.length;u++){let f=new Date(new Date(p.value).getFullYear(),new Date(p.value).getMonth(),u).getTime()+1e3;for(let w of ee.value){const{dateStart:C,dateEnd:T,code:N}=w;if(C&&T&&N===b.value[o].code){const I=new Date(c.parseDate(C)).getTime(),U=new Date(c.parseDate(T)).getTime();if(f>=I&&f<=U){const r=c.parseTime(new Date(p.value).setDate(u),"{Y}-{m}-{dd}"),F=b.value[o].days.findIndex(ae=>ae.day===r);F!==-1?b.value[o].days[F]={day:r,time:"-",state:"ОТ"}:b.value[o].days.push({day:r,time:"-",state:"ОТ"})}}}}}),re()})})},X=(t,l,m,o="Я")=>{const h=c.parseTime(new Date(p.value).setDate(t),"{Y}-{m}-{dd}");b.value[l].days.push({day:h,time:m,state:o})},re=()=>{i.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((n,a)=>{if(a.hasOwnProperty("state")&&/^(|К|КВ|ОТ|Б|Р|ПР|ОЖ|НН|У|ДО|УД|Г)$/.test(a.state)){const u=a.state;n[u]=(n[u]||0)+1}return n},{})).map(([n,a])=>({code:n,count:a}));t.numberNonAppearing=[l.reduce((n,a)=>n+a.count,0),0];const m=Math.ceil(l.length/2),o=l.slice(0,m),h=l.slice(m);t.key===0&&o.length>0&&(t.appearing={code:o.map(n=>n.code).join("/"),count:o.map(n=>n.count).join("/")}),t.key===1&&h.length>0&&(t.appearing={code:h.map(n=>n.code).join("/"),count:h.map(n=>n.count).join("/")});for(let n=0;n<t.days.length;n++)n<15&&t.days[n].time!=="-"&&(t.hourI+=Number(t.days[n].time),t.days[n].overtime&&(t.hourI+=Number(t.days[n].overtime)),t.halfI++),n>=15&&t.days[n].time!=="-"&&(t.days[n].overtime&&(t.hourII+=Number(t.days[n].overtime)),t.hourII+=Number(t.days[n].time),t.halfII++),t.days[n].night&&(t.night+=Number(t.days[n].night)),t.days[n].overtime&&(t.overtime+=Number(t.days[n].overtime)),/{|РВ|}/.test(t.days[n].state)&&(t.weekend+=Number(t.days[n].time)),t.days[n].state==="В"&&t.weekendDays++;t.contDays=t.halfI+t.halfII,t.contHour=t.hourI+t.hourII})},ie=(t,l)=>{var u,f,w,C,T,N,I;if(l===-1)return"";const m=i.value[l],o=new Date(p.value),h=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${t.toString().padStart(2,"0")}`,n=m.days.findIndex(U=>U.day===h);let a=0;return(u=m.days[n])!=null&&u.night&&(a+=m.days[n].night),(f=m.days[n])!=null&&f.overtime&&(a+=m.days[n].overtime),n===-1?"":m.key===0?(w=m.days[n])==null?void 0:w.state:((C=m.days[n])==null?void 0:C.time)===0?a===0?"-":a:a===0||a===((T=m.days[n])==null?void 0:T.time)?(N=m.days[n])==null?void 0:N.time:`${(I=m.days[n])==null?void 0:I.time}/${a}`};y.group&&(S.value[0]=y.group),y.date&&(H.value=new Date(y.date+"T00:00:01").getMonth()),c.holidays().then(t=>{ne.value=t,ue()});const se=t=>new Date(p.value).getMonth()===new Date().getMonth()&&t===new Date().getDate()?" today":"",fe=()=>{let t=W.value.match(/(\d{1,2}):\d{2}\s*-\s*(\d{1,2})/),l=b.value[v.value.ids].days[v.value.day+1].tips;return l=typeof l<"u"?l.match(/(\d{1,2}):\d{2}\s*-\s*(\d{1,2})/):[0,9,18],k.value>0&&(Number(t[1])<=6?t[1]=Number(t[1])+k.value:t[2]=Number(t[2])-k.value),Number(t[1])<Number(l[1])?`${t[1]}:00 по ${Number(t[1])+z.value}:00`:`${Number(t[2])-z.value}:00 по ${t[2]}:00`},ye=()=>{let t=/РВ/.test(W.value),l=t?W.value.match(/\(([^)]+)\)/)[1].replace("-"," по "):fe();G.value=`<p style="position: absolute;"><img src="https://cp.avanta-telecom.ru${y.logo}" style="height: 3rem;"></p><div style="display:inline-block;margin-left:66%;width:34%;">Директору<br>ООО "АВАНТА ТЕЛЕКОМ" Пунину Д. В.<br><br>от ${R.value} ${c.byInitials(y.fullName)}</div><p>${S.value[0]}<br>СЛУЖЕБНАЯ ЗАПИСКА<br>${c.parseTime(new Date(p.value).setDate(v.value.day+1),'"{dd}" {F} {Y}')}г.</p><p style="text-align:center;">Уважаемый Дмитрий Владимирович!</p><p>В связи с производственной необходимостью _________________, прошу привлечь к ${t?"к работе в выходной день":"сверхурочной работе"}, ${c.parseTime(new Date(p.value).setDate(v.value.day+1),"{dd}.{m}.{Y}")} c ${l}, ${i.value[v.value.ids*2].name.match(/\(([^)]+)\)/)[1]} ${i.value[v.value.ids*2].fio} для выполнения вышеуказанных работ с его(её) письменного согласия.</p><p>${R.value} ________________ ${c.byInitials(y.fullName)}</p>`},pe=async()=>{var T,N,I,U;q.value=!0;const t=new xe.Workbook,l=t.addWorksheet(M(p.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),m={vertical:"middle",horizontal:"center"},o={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},h={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${c.cellsDynamically("A1",d.value.length+15)}1`),l.mergeCells("A2:A4"),l.mergeCells("B2:B4"),l.mergeCells("C2:C4"),l.mergeCells("D5:R5"),l.mergeCells(`D2:${c.cellsDynamically("D2",d.value.length+2)}2`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+3)}2:${c.cellsDynamically("D2",d.value.length+8)}2`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+9)}2:${c.cellsDynamically("D2",d.value.length+9)}4`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+10)}2:${c.cellsDynamically("D2",d.value.length+11)}2`),l.mergeCells(`${c.cellsDynamically("D2",d.value.length+12)}2:${c.cellsDynamically("D2",d.value.length+12)}4`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+3)}3:${c.cellsDynamically("D3",d.value.length+3)}4`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+4)}3:${c.cellsDynamically("D3",d.value.length+8)}3`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+10)}3:${c.cellsDynamically("D3",d.value.length+10)}4`),l.mergeCells(`${c.cellsDynamically("D3",d.value.length+11)}3:${c.cellsDynamically("D3",d.value.length+11)}4`),l.mergeCells(`T5:${c.cellsDynamically("D5",d.value.length+1)}5`);for(let r=1;r<=d.value.length+2;r++)l.mergeCells(`${c.cellsDynamically("D3",r)}3:${c.cellsDynamically("D4",r)}4`),l.getColumn(r+3).width=5,l.getColumn(r+3).alignment=h,l.getCell(3,r+3).border=o,r<16&&(l.getCell(3,r+3).value=r),r>16&&(l.getCell(3,r+3).value=r-1);l.getCell("A1").value=s("sheet.title",{name:S.value[0]})+M(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,d.value.length+5).value="7",l.getCell(2,d.value.length+6).value=s("sheet.workedMonth"),l.getCell(2,d.value.length+12).value=s("sheet.numberNonAppearing"),l.getCell(2,d.value.length+13).value=s("sheet.them"),l.getCell(2,d.value.length+15).value=s("sheet.countWeekend"),l.getCell(3,d.value.length+5).value=s("sheet.halfMonth",{half:"II"}),l.getCell(3,d.value.length+6).value=s("sheet.days"),l.getCell(3,d.value.length+7).value=s("sheet.hours"),l.getCell(4,d.value.length+7).value=s("sheet.all"),l.getCell(4,d.value.length+8).value=s("sheet.overtime"),l.getCell(4,d.value.length+9).value=s("sheet.night"),l.getCell(4,d.value.length+10).value=s("sheet.weekend"),l.getCell(4,d.value.length+13).value=s("sheet.code"),l.getCell(4,d.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(d.value.length+5).width=12,l.getColumn(d.value.length+12).width=11,l.getColumn(d.value.length+15).width=11,l.getCell("A1").alignment=m,l.getColumn(1).alignment=h,l.getColumn(2).alignment=h,l.getColumn(3).alignment=h;for(let r=6;r<=15;r++)l.getCell(5,d.value.length+r).value=r+2,l.getColumn(d.value.length+r).alignment=h,l.getCell(4,d.value.length+r).border=o,l.getCell(5,d.value.length+r).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,d.value.length+6).border=o,l.getCell(2,d.value.length+12).border=o,l.getCell(2,d.value.length+13).border=o,l.getCell(2,d.value.length+15).border=o,l.getCell(3,d.value.length+7).border=o;let n=1,a=5,u=!0;for(const r of i.value){let F=[n,r.name,r.code];for(let E=0;E<d.value.length;E++)E===15&&F.push(u?(r==null?void 0:r.halfI)||"":(r==null?void 0:r.hourI)||""),F.push(u?((T=r.days[E])==null?void 0:T.state)||"":((N=r.days[E])==null?void 0:N.time)||"");F.push(u?(r==null?void 0:r.halfII)||0:(r==null?void 0:r.hourII)||0,(r==null?void 0:r.contDays)||0,(r==null?void 0:r.contHour)||0,(r==null?void 0:r.overtime)||0,(r==null?void 0:r.night)||0,(r==null?void 0:r.weekend)||0,"",u?(r==null?void 0:r.numberNonAppearing[0])||"":(r==null?void 0:r.numberNonAppearing[1])||0,((I=r==null?void 0:r.appearing)==null?void 0:I.code)||"-",((U=r==null?void 0:r.appearing)==null?void 0:U.count)||"-",(r==null?void 0:r.weekendDays)||0);const ae=l.addRow(F);if(ae.border=o,!u){l.mergeCells(`A${a+n*2-1}:A${a+n*2}`),l.mergeCells(`B${a+n*2-1}:B${a+n*2}`),l.mergeCells(`C${a+n*2-1}:C${a+n*2}`);for(let E=d.value.length+3;E<=d.value.length+8;E++)l.mergeCells(`${c.cellsDynamically("D",E)}${a+n*2-1}:${c.cellsDynamically("D",E)}${a+n*2}`);l.mergeCells(`${c.cellsDynamically("D",d.value.length+12)}${a+n*2-1}:${c.cellsDynamically("D",d.value.length+12)}${a+n*2}`),n++}u=!u}let f="Чемарина Н. Ю.";y.odata.personal.forEach(r=>{r.roleName==="Специалист по кадрам и кадровому делопроизводству"&&(f=r.employeeName)}),l.mergeCells(`A${i.value.length+7}:B${i.value.length+7}`),l.mergeCells(`C${i.value.length+7}:G${i.value.length+7}`),l.mergeCells(`H${i.value.length+7}:M${i.value.length+7}`),l.mergeCells(`O${i.value.length+7}:T${i.value.length+7}`),l.mergeCells(`V${i.value.length+7}:AC${i.value.length+7}`),l.mergeCells(`AD${i.value.length+7}:AI${i.value.length+7}`),l.mergeCells(`AJ${i.value.length+7}:AL${i.value.length+7}`),l.mergeCells(`AM${i.value.length+7}:AP${i.value.length+7}`),l.mergeCells(`V${i.value.length+9}:AC${i.value.length+9}`),l.mergeCells(`AD${i.value.length+9}:AI${i.value.length+9}`),l.mergeCells(`AJ${i.value.length+9}:AL${i.value.length+9}`),l.mergeCells(`AM${i.value.length+9}:AP${i.value.length+9}`),l.getCell(`A${i.value.length+7}`).value=s("sheet.responsiblePerson"),l.getCell(`V${i.value.length+7}`).value=s("sheet.headStructural"),l.getCell(`C${i.value.length+7}`).value=R.value+":",l.getCell(`O${i.value.length+7}`).value=c.byInitials(y.fullName),l.getCell(`AD${i.value.length+7}`).value=R.value+":",l.getCell(`AM${i.value.length+7}`).value=c.byInitials(y.fullName),l.getCell(`V${i.value.length+9}`).value=s("sheet.HREmployee"),l.getCell(`AD${i.value.length+9}`).value="Специалист по кадрам и кадровому делопроизводству:",l.getCell(`AM${i.value.length+9}`).value=c.byInitials(f),l.getCell(`A${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`C${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`O${i.value.length+7}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`V${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AD${i.value.length+7}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AM${i.value.length+7}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`V${i.value.length+9}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AD${i.value.length+9}`).alignment={vertical:"middle",horizontal:"right",wrapText:!0},l.getCell(`AM${i.value.length+9}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`H${i.value.length+7}`).border={bottom:{style:"thin"}},l.getCell(`AJ${i.value.length+7}`).border={bottom:{style:"thin"}},l.getCell(`AJ${i.value.length+9}`).border={bottom:{style:"thin"}};const w=`export_${c.parseTime(Date.now(),"{dd}.{m}.{Y}")}.xlsx`,C=await t.xlsx.writeBuffer();de.saveAs(new Blob([C]),w),q.value=!1},Ce=()=>{let t=new Blob([G.value],{type:"text/plain;charset=utf-8"});de.saveAs(t,`Служебка_${c.byInitials(i.value[v.value.ids*2].fio)}_${c.parseTime(Date.now(),"{dd}.{m}.{Y}")}.html`)};return(t,l)=>{const m=e.resolveComponent("el-form-item"),o=e.resolveComponent("svg-icon"),h=e.resolveComponent("el-slider"),n=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",$e,[V.checkEdit?(e.openBlock(),e.createBlock(e.unref(g.ElSelect),{key:0,modelValue:S.value,"onUpdate:modelValue":l[0]||(l[0]=a=>S.value=a),multiple:"","collapse-tags":"","collapse-tags-tooltip":"",placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,a=>(e.openBlock(),e.createBlock(e.unref(g.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),V.checkEdit?(e.openBlock(),e.createBlock(e.unref(g.ElButton),{key:1,plain:"",onClick:l[1]||(l[1]=a=>P.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("workSchedule.jobTitle")),1)]),_:1})):e.createCommentVNode("",!0),l[19]||(l[19]=e.createElementVNode("div",{class:"expander"},null,-1)),V.checkEdit?(e.openBlock(),e.createBlock(e.unref(g.ElSwitch),{key:2,modelValue:H.value,"onUpdate:modelValue":l[2]||(l[2]=a=>H.value=a),"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(g.ElSwitch),{modelValue:Z.value,"onUpdate:modelValue":l[3]||(l[3]=a=>Z.value=a),"active-text":t.$t("sheet.currentHeight"),"active-value":"100%","inactive-value":"calc(100vh - var(--el-component-size)*5 - var(--el-main-padding)*2 - var(--header-height))"},null,8,["modelValue","active-text"]),e.createVNode(e.unref(g.ElSwitch),{modelValue:A.value,"onUpdate:modelValue":l[4]||(l[4]=a=>A.value=a),"active-text":t.$t("sheet.simplified"),"active-value":"true","inactive-value":"false"},null,8,["modelValue","active-text"])]),e.createVNode(e.unref(g.ElTable),{id:"printTable",data:i.value,"span-method":he,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(s)("sheet.emptyText"),align:"center",onCellClick:me,"max-height":Z.value,"default-sort":{prop:"mame",order:"descending"}},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.title",{name:S.value[0]})+e.unref(M)(p.value,"month"),align:"center",height:"10"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.employee"),width:A.value==="false"?180:t.auto,align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].name),1)]),_:1},8,["label","width"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.personnelNumber"),align:"center",width:"108"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.marks"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.day},[a.day<=15?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:0,width:"39","class-name":a.holidays+se(a.day),align:"center",label:a.day.toString()+`
|
|
2
2
|
`+a.weekday},{default:e.withCtx(u=>[e.createElementVNode("div",ke,e.toDisplayString(ie(a.day,u.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0),a.day===15?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:1,label:e.unref(s)("sheet.halfMonth",{half:"I"}),align:"center",width:"120"},{default:e.withCtx(u=>[e.createTextVNode(e.toDisplayString(i.value[u.$index].key===0?i.value[u.$index].halfI:i.value[u.$index].hourI),1)]),_:1},8,["label"])):e.createCommentVNode("",!0),a.day>15?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:2,width:"39","class-name":a.holidays+se(a.day),align:"center",label:a.day.toString()+`
|
|
3
|
-
`+a.weekday},{default:e.withCtx(u=>[e.createElementVNode("div",Ne,e.toDisplayString(ie(a.day,u.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.halfMonth",{half:"II"}),align:"center",width:"120"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].key===0?i.value[a.$index].halfII:i.value[a.$index].hourII),1)]),_:1},8,["label"])]),_:1},8,["label"]),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:0,label:e.unref(s)("sheet.workedMonth"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.days"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].contDays),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.hours"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.all"),align:"center","label-class-name":"turn",width:"40"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].contHour),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.overtime"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].overtime),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.night"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].night),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.weekend"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].weekend),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"])):e.createCommentVNode("",!0),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:1,label:e.unref(s)("sheet.numberNonAppearing"),align:"center"},{default:e.withCtx(a=>{var u;return[e.createTextVNode(e.toDisplayString((u=i.value[a.$index])==null?void 0:u.numberNonAppearing[i.value[a.$index].key]),1)]}),_:1},8,["label"])):e.createCommentVNode("",!0),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:2,label:e.unref(s)("sheet.them"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.code"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>{var u;return[e.createTextVNode(e.toDisplayString((u=i.value[a.$index].appearing)==null?void 0:u.code),1)]}),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.count"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>{var u;return[e.createTextVNode(e.toDisplayString((u=i.value[a.$index].appearing)==null?void 0:u.count),1)]}),_:1},8,["label"])]),_:1},8,["label"])):e.createCommentVNode("",!0),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:3,label:e.unref(s)("sheet.countWeekend"),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].weekendDays),1)]),_:1},8,["label"])):e.createCommentVNode("",!0)]),_:1},8,["label"])]),_:1},8,["data","empty-text","max-height"]),e.withDirectives((e.openBlock(),e.createBlock(e.unref(g.ElButton),{disabled:q.value,plain:"",onClick:pe,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[n,q.value]]),e.createVNode(e.unref(g.ElDialog),{title:e.unref(s)("workSchedule.jobTitle"),modelValue:
|
|
3
|
+
`+a.weekday},{default:e.withCtx(u=>[e.createElementVNode("div",Ne,e.toDisplayString(ie(a.day,u.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.halfMonth",{half:"II"}),align:"center",width:"120"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].key===0?i.value[a.$index].halfII:i.value[a.$index].hourII),1)]),_:1},8,["label"])]),_:1},8,["label"]),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:0,label:e.unref(s)("sheet.workedMonth"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.days"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].contDays),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.hours"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.all"),align:"center","label-class-name":"turn",width:"40"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].contHour),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.overtime"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].overtime),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.night"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].night),1)]),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.weekend"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].weekend),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"])):e.createCommentVNode("",!0),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:1,label:e.unref(s)("sheet.numberNonAppearing"),align:"center"},{default:e.withCtx(a=>{var u;return[e.createTextVNode(e.toDisplayString((u=i.value[a.$index])==null?void 0:u.numberNonAppearing[i.value[a.$index].key]),1)]}),_:1},8,["label"])):e.createCommentVNode("",!0),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:2,label:e.unref(s)("sheet.them"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.code"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>{var u;return[e.createTextVNode(e.toDisplayString((u=i.value[a.$index].appearing)==null?void 0:u.code),1)]}),_:1},8,["label"]),e.createVNode(e.unref(g.ElTableColumn),{label:e.unref(s)("sheet.count"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>{var u;return[e.createTextVNode(e.toDisplayString((u=i.value[a.$index].appearing)==null?void 0:u.count),1)]}),_:1},8,["label"])]),_:1},8,["label"])):e.createCommentVNode("",!0),A.value==="false"?(e.openBlock(),e.createBlock(e.unref(g.ElTableColumn),{key:3,label:e.unref(s)("sheet.countWeekend"),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].weekendDays),1)]),_:1},8,["label"])):e.createCommentVNode("",!0)]),_:1},8,["label"])]),_:1},8,["data","empty-text","max-height"]),e.withDirectives((e.openBlock(),e.createBlock(e.unref(g.ElButton),{disabled:q.value,plain:"",onClick:pe,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[n,q.value]]),e.createVNode(e.unref(g.ElDialog),{title:e.unref(s)("workSchedule.jobTitle"),modelValue:P.value,"onUpdate:modelValue":l[7]||(l[7]=a=>P.value=a),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(g.ElButton),{onClick:l[5]||(l[5]=a=>P.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(g.ElButton),{size:"default",type:"primary",onClick:l[6]||(l[6]=a=>{te(),P.value=!1})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(g.ElForm),{ref:"dialogForm",model:O.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,a=>(e.openBlock(),e.createBlock(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(g.ElSwitch),{modelValue:a.val,"onUpdate:modelValue":u=>a.val=u,"active-text":a.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(_.ContextMenu),{show:B.value,"onUpdate:show":l[16]||(l[16]=a=>B.value=a),options:le.value},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"mx-context-menu-item",onClick:l[8]||(l[8]=a=>B.value=!1)},[e.createElementVNode("span",Ve,e.toDisplayString(v.value.name),1),l[20]||(l[20]=e.createElementVNode("div",{class:"expander"},null,-1)),e.createVNode(o,{"icon-class":"cross"})]),e.createVNode(e.unref(_.ContextMenuSeparator)),e.createElementVNode("div",null,[e.createElementVNode("div",null,[e.createVNode(e.unref(_.ContextMenuGroup),{label:W.value,style:{padding:"0 0 .5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ve.value,a=>(e.openBlock(),e.createBlock(e.unref(_.ContextMenuItem),{key:a.value,label:a.label,onClick:u=>{v.value.rest=!0,Y.value=!1,K(a.value)},clickClose:!1},null,8,["label","onClick"]))),128))]),_:1},8,["label"])]),/^(РВ|Я|Н(?![Н])).*$/.test(v.value.failure)?(e.openBlock(),e.createElementBlock("div",Se,[e.createVNode(e.unref(_.ContextMenuItem),{clickClose:!1},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("workSchedule.with"))+":",1)]),_:1}),e.createVNode(h,{modelValue:x.value,"onUpdate:modelValue":l[9]||(l[9]=a=>x.value=a),step:1,min:0,max:19,style:{width:"100%"}},null,8,["modelValue"]),e.createVNode(e.unref(_.ContextMenuItem),{clickClose:!1},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("workSchedule.duration"))+":",1)]),_:1}),e.createVNode(h,{modelValue:D.value,"onUpdate:modelValue":l[10]||(l[10]=a=>D.value=a),step:1,min:4,max:e.unref(c.clamp)(x.value!==1?23-x.value:21,4,22)},null,8,["modelValue","max"])])):e.createCommentVNode("",!0),/^(|К|КВ|ОТ|Б|Р|ОЖ|У|ДО|УД|Г)$/.test(v.value.failure)?(e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(e.unref(_.ContextMenuItem),{clickClose:!1},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("sheet.count"))+":",1)]),_:1}),e.createVNode(h,{modelValue:L.value,"onUpdate:modelValue":l[11]||(l[11]=a=>L.value=a),step:1,min:1,max:d.value.length-v.value.day,style:{width:"100%"}},null,8,["modelValue","max"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(_.ContextMenuItem),{class:"wrap"},{default:e.withCtx(()=>[v.value.rest?(e.openBlock(),e.createBlock(e.unref(g.ElButton),{key:0,onClick:l[12]||(l[12]=a=>K("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(g.ElButton),{key:1,onClick:l[13]||(l[13]=a=>K("save"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("sheet.save")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(g.ElButton),{onClick:l[14]||(l[14]=a=>B.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("sheet.cancel")),1)]),_:1}),J.value?(e.openBlock(),e.createBlock(e.unref(g.ElButton),{key:2,onClick:l[15]||(l[15]=a=>ye()),popovertarget:"my-service"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("sheet.service")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1})])]),_:1},8,["show","options"]),e.createElementVNode("div",{id:"my-service",class:"sw-popover",popover:"",ref_key:"myService",ref:oe},[l[21]||(l[21]=e.createElementVNode("header",null,"Служебная записка",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.editor),{modelValue:G.value,"onUpdate:modelValue":l[17]||(l[17]=a=>G.value=a)},null,8,["modelValue"])),e.createElementVNode("footer",null,[e.createVNode(e.unref(g.ElButton),{onClick:l[18]||(l[18]=a=>oe.value.hidePopover()),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$t("calendar.cancel")),1)]),_:1}),e.createVNode(e.unref(g.ElButton),{type:"success",plain:"",onClick:Ce},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$t("calendar.save")),1)]),_:1})])],512)],64)}}};module.exports=Ee;
|
package/dist/SheetTable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as y, computed as Ne, watch as ne, resolveComponent as $e, resolveDirective as He, createElementBlock as R, openBlock as C, Fragment as q, createElementVNode as A, createVNode as c, withDirectives as Oe, createBlock as S, createCommentVNode as M, unref as n, withCtx as m, renderList as
|
|
1
|
+
import { ref as y, computed as Ne, watch as ne, resolveComponent as $e, resolveDirective as He, createElementBlock as R, openBlock as C, Fragment as q, createElementVNode as A, createVNode as c, withDirectives as Oe, createBlock as S, createCommentVNode as M, unref as n, withCtx as m, renderList as ge, createTextVNode as D, toDisplayString as p, resolveDynamicComponent as Pe, nextTick as Re } from "vue";
|
|
2
2
|
import { useI18n as We } from "vue-i18n";
|
|
3
3
|
import { p as T, b as W, a as _e, h as Je, c as je, d as b } from "./index-2Mx6IUGl.js";
|
|
4
4
|
import { ElSelect as Le, ElOption as Ge, ElButton as H, ElSwitch as me, ElTable as Ke, ElTableColumn as I, ElDialog as Xe, ElForm as qe } from "element-plus";
|
|
@@ -53,44 +53,43 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
53
53
|
// ]
|
|
54
54
|
// }
|
|
55
55
|
]), re = y(""), ae = y("_____"), i = Ne(() => x.value.flatMap((l, e) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return [{ ...l, days: h, key: 0, ids: e, numberNonAppearing: [0, 0] }, { ...l, days: h, key: 1, ids: e, numberNonAppearing: [0, 0] }];
|
|
56
|
+
const h = E.value.find((t) => t.code === l.code), u = /* @__PURE__ */ new Map();
|
|
57
|
+
l.days.forEach((t) => u.set(t.day, { ...t })), h && h.days.forEach((t) => u.set(t.day, { ...t }));
|
|
58
|
+
const g = Array.from(u.values());
|
|
59
|
+
return [{ ...l, days: g, key: 0, ids: e, numberNonAppearing: [0, 0] }, { ...l, days: g, key: 1, ids: e, numberNonAppearing: [0, 0] }];
|
|
61
60
|
}));
|
|
62
61
|
ne(B, async (l, e) => {
|
|
63
|
-
l !== e && (K.value = [],
|
|
64
|
-
l.includes(
|
|
62
|
+
l !== e && (K.value = [], k.odata.personal.forEach((h) => {
|
|
63
|
+
l.includes(h.divisionName) && (K.value.some((u) => (u == null ? void 0 : u.activeText) === h.roleName) || K.value.push({ val: !0, activeText: h.roleName }));
|
|
65
64
|
}), Ce());
|
|
66
65
|
}), ne(Z, (l) => {
|
|
67
66
|
$.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(l)), ke(), Ce();
|
|
68
67
|
}), ne(_, () => j.value = P.value), ne(V, () => j.value = P.value), ne(le, () => j.value = P.value);
|
|
69
|
-
const Ee = async (l, e,
|
|
68
|
+
const Ee = async (l, e, h, u) => {
|
|
70
69
|
if (console.log("row", l), console.log("column", e), e.level !== 3 || e.labelClassName === "turn" || e.no === 15 || e.no > r.value.length || !k.checkEdit) return "";
|
|
71
70
|
v.value.ids = l.ids, v.value.key = l.key, v.value.day = e.no < 15 ? e.no : e.no - 1;
|
|
72
|
-
const
|
|
71
|
+
const g = new Date($.value), t = `${g.getFullYear()}-${(g.getMonth() + 1).toString().padStart(2, "0")}-${(v.value.day + 1).toString().padStart(2, "0")}`, a = E.value.findIndex((f) => f.code === l.code);
|
|
73
72
|
v.value.id = a !== -1 ? E.value[a].days.findIndex((f) => (f == null ? void 0 : f.day) === t) : a, V.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), G.value = typeof l.days[v.value.day].overtime > "u" ? 0 : parseInt(l.days[v.value.day].overtime), _.value = l.days[v.value.day].time !== "-" ? parseInt(l.days[v.value.day].time) : 8;
|
|
74
73
|
const o = l.days.findIndex((f) => f.day === t);
|
|
75
74
|
v.value.failure = l.days[o].state, pe.value.y = u.clientY, pe.value.x = u.clientX, v.value.rest = a !== -1 && v.value.id !== -1, v.value.name = W(l.fio), P.value = !0, await Re(), j.value = !1;
|
|
76
75
|
}, ve = (l) => {
|
|
77
|
-
const e = new Date($.value),
|
|
76
|
+
const e = new Date($.value), h = `${e.getFullYear()}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${(v.value.day + 1).toString().padStart(2, "0")}`;
|
|
78
77
|
let u = E.value.findIndex((w) => w.code === x.value[v.value.ids].code);
|
|
79
78
|
v.value.id = u !== -1 ? E.value[u].days.findIndex((w) => (w == null ? void 0 : w.day) === `${e.getFullYear()}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${(v.value.day + 1).toString().padStart(2, "0")}`) : u;
|
|
80
|
-
let
|
|
79
|
+
let g = x.value[v.value.ids].days[v.value.day].state, t = l, a = "-", o, f, N;
|
|
81
80
|
switch (l) {
|
|
82
81
|
case "Я":
|
|
83
|
-
|
|
82
|
+
g === "В" && (t = "РВ"), a = 8;
|
|
84
83
|
break;
|
|
85
84
|
case "КВ":
|
|
86
85
|
case "К":
|
|
87
|
-
|
|
86
|
+
g === "В" || g === "КВ" ? t = "КВ" : t = "К";
|
|
88
87
|
break;
|
|
89
88
|
case "save":
|
|
90
89
|
let w = te.value.split('"');
|
|
91
90
|
t = w[1], j.value = !1, w[2] !== "" && (a = _.value, N = "(" + w[2].split("(")[1], o = Y.value, f = G.value);
|
|
92
91
|
}
|
|
93
|
-
l === "reset" ? (t =
|
|
92
|
+
l === "reset" ? (t = g, E.value[u].days.splice(v.value.id, 1)) : u === -1 ? E.value.push({ code: x.value[v.value.ids].code, days: [{ day: h, state: t, time: a, night: o, overtime: f, tips: N }] }) : v.value.id === -1 ? E.value[u].days.push({ day: h, state: t, time: a, night: o, overtime: f, tips: N }) : E.value[u].days[v.value.id] = { day: h, state: t, time: a, night: o, overtime: f, tips: N }, u = E.value.findIndex((w) => w.code === x.value[v.value.ids].code), k.workSchedule.addWorkSheet({
|
|
94
93
|
date: T(new Date($.value), "{Y}-{m}-{dd}"),
|
|
95
94
|
data: [{
|
|
96
95
|
name: x.value[v.value.ids].fio,
|
|
@@ -102,9 +101,9 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
102
101
|
de.value = !1;
|
|
103
102
|
let l = x.value[v.value.ids].days[v.value.day], e = "";
|
|
104
103
|
Y.value = 0, G.value = 0;
|
|
105
|
-
let
|
|
106
|
-
u = /^Н(?!Н$)С?$/.test(u) ? l.state !== "В" ? "Я" : "РВ" : u, /^(|Я|РВ)$/.test(u) && ((V.value < 6 ||
|
|
107
|
-
let
|
|
104
|
+
let h = _.value >= 22 ? V.value + _.value + 2 : V.value + _.value + 1, u = v.value.failure.split("/")[0];
|
|
105
|
+
u = /^Н(?!Н$)С?$/.test(u) ? l.state !== "В" ? "Я" : "РВ" : u, /^(|Я|РВ)$/.test(u) && ((V.value < 6 || h > 22) && (e = "Н", Y.value = V.value < 6 ? Math.min(6, h) - V.value : 0, h <= 6 && (Y.value = _.value, u = ""), h === 7 && Y.value > 3 && Y.value--, Y.value += Math.max(22, h) - 22), _.value > l.time && u !== "РВ" && (e += "С", de.value = !0, G.value = _.value - l.time), /РВ/.test(u) && (de.value = !0)), e.length > 0 && u.length > 0 && (e = "/" + e);
|
|
106
|
+
let g = `(${V.value}:00 - ${_.value >= 22 ? V.value + _.value + 2 : V.value + _.value + 1}:00)`, t = i.value[v.value.ids * 2].days[v.value.day].time !== "-" ? " " + _.value + " " + g : "";
|
|
108
107
|
return '"' + u + e + '"' + t;
|
|
109
108
|
}), Te = (l) => {
|
|
110
109
|
if (l.columnIndex < 2 || l.columnIndex > r.value.length + 3 && l.columnIndex < r.value.length + 9 || l.columnIndex > r.value.length + 11)
|
|
@@ -116,15 +115,15 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
116
115
|
colspan: 0
|
|
117
116
|
};
|
|
118
117
|
}, ke = () => {
|
|
119
|
-
const l = we.value, e = new Date($.value),
|
|
120
|
-
let u = [],
|
|
121
|
-
for (let t = 1; t <=
|
|
118
|
+
const l = we.value, e = new Date($.value), h = new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
|
|
119
|
+
let u = [], g = 0;
|
|
120
|
+
for (let t = 1; t <= h; t++) {
|
|
122
121
|
const a = T(e.setDate(t), "{Y}-{m}-{dd}");
|
|
123
|
-
|
|
122
|
+
g += l.nowork.includes(a) || l.holidays.includes(a) ? 0 : l.preholidays.includes(a) ? 7 : 8;
|
|
124
123
|
let o = l.nowork.includes(a) ? "nowork" : l.holidays.includes(a) ? "holiday" : l.preholidays.includes(a) ? "preholiday" : "";
|
|
125
124
|
u.push({ day: t, holidays: o, weekday: se(new Date(e.getFullYear(), e.getMonth(), t), "day") });
|
|
126
125
|
}
|
|
127
|
-
return Ve.value =
|
|
126
|
+
return Ve.value = g, r.value = u, k.odata.getPersonal({ dismissed: "false" }).then((t) => {
|
|
128
127
|
var a;
|
|
129
128
|
B.value.length === 0 && (B.value = [(a = t.find((o) => o.employeeName === k.fullName)) == null ? void 0 : a.divisionName]), t.forEach((o) => {
|
|
130
129
|
fe.value.some((f) => o.dismissalDate.length > 0 && new Date(o.dismissalDate) < new Date($.value) || (f == null ? void 0 : f.value) === o.divisionName) || fe.value.push({ value: o.divisionName, label: o.divisionName, key: o.divisionName });
|
|
@@ -134,7 +133,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
134
133
|
x.value = [], ee.value = [], ye.value = [], k.odata.personal.forEach((l) => {
|
|
135
134
|
if (B.value.includes(l.divisionName) && K.value.some((e) => e.val && e.activeText === l.roleName) && (l.dismissalDate.length === 0 || new Date(l.dismissalDate) > new Date($.value))) {
|
|
136
135
|
let e = W(l.employeeName);
|
|
137
|
-
const
|
|
136
|
+
const h = {
|
|
138
137
|
fio: l.employeeName,
|
|
139
138
|
name: e + " (" + l.roleName + ")",
|
|
140
139
|
code: l.employeeKey,
|
|
@@ -145,7 +144,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
145
144
|
dismissalDate: l.dismissalDate
|
|
146
145
|
// сделать сортировку!!!! сбросить секунды
|
|
147
146
|
};
|
|
148
|
-
x.value.push(
|
|
147
|
+
x.value.push(h);
|
|
149
148
|
}
|
|
150
149
|
l.employeeName === k.fullName && (ae.value = l.roleName);
|
|
151
150
|
}), x.value.sort((l, e) => l.fio < e.fio ? -1 : l.fio > e.fio ? 1 : 0), x.value.forEach((l, e) => {
|
|
@@ -162,25 +161,25 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
162
161
|
e !== null && E.value.push({ code: e.code, days: e.data.days });
|
|
163
162
|
}), k.workSchedule.getWorkSchedule({ code: ee.value, date: T(new Date($.value), "{Y}-{m}-{dd}") }).then(
|
|
164
163
|
(e) => {
|
|
165
|
-
e.forEach((
|
|
164
|
+
e.forEach((h, u) => {
|
|
166
165
|
var t, a;
|
|
167
|
-
if (
|
|
168
|
-
x.value[u].days = [],
|
|
166
|
+
if (h !== null) {
|
|
167
|
+
x.value[u].days = [], h.data.days.forEach((o) => o.state = "Я");
|
|
169
168
|
for (let o = 1; o <= r.value.length; o++) {
|
|
170
169
|
let f = T(new Date($.value).setDate(o), "{Y}-{m}-{dd}");
|
|
171
|
-
const N = (t =
|
|
172
|
-
N === -1 ?
|
|
170
|
+
const N = (t = h.data) == null ? void 0 : t.days.findIndex((w) => w.day === f);
|
|
171
|
+
N === -1 ? he(o, u, "-", "В") : x.value[u].days.push((a = h.data) == null ? void 0 : a.days[N]);
|
|
173
172
|
}
|
|
174
173
|
} else
|
|
175
174
|
for (let o = 1; o <= r.value.length; o++)
|
|
176
|
-
r.value[o - 1].holidays === "" ?
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
175
|
+
r.value[o - 1].holidays === "" ? he(o, u, 8) : r.value[o - 1].holidays === "preholiday" ? he(o, u, 7) : he(o, u, "-", "В");
|
|
176
|
+
const g = x.value[u];
|
|
177
|
+
if (g.employmentDate || g.dismissalDate)
|
|
179
178
|
for (let o = 1; o <= r.value.length; o++) {
|
|
180
|
-
const f = new Date(new Date($.value).setDate(o)), N = T(f, "{Y}-{m}-{dd}"), w =
|
|
179
|
+
const f = new Date(new Date($.value).setDate(o)), N = T(f, "{Y}-{m}-{dd}"), w = g.employmentDate && f < new Date(g.employmentDate), F = g.dismissalDate && f > new Date(g.dismissalDate);
|
|
181
180
|
if (w || F) {
|
|
182
|
-
const z =
|
|
183
|
-
z !== -1 && (
|
|
181
|
+
const z = g.days.findIndex((O) => O.day === N);
|
|
182
|
+
z !== -1 && (g.days[z].state = "-", g.days[z].time = "-");
|
|
184
183
|
}
|
|
185
184
|
}
|
|
186
185
|
for (let o = 1; o <= r.value.length; o++) {
|
|
@@ -201,11 +200,11 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
201
200
|
);
|
|
202
201
|
}
|
|
203
202
|
);
|
|
204
|
-
},
|
|
205
|
-
const
|
|
203
|
+
}, he = (l, e, h, u = "Я") => {
|
|
204
|
+
const g = T(new Date($.value).setDate(l), "{Y}-{m}-{dd}");
|
|
206
205
|
x.value[e].days.push({
|
|
207
|
-
day:
|
|
208
|
-
time:
|
|
206
|
+
day: g,
|
|
207
|
+
time: h,
|
|
209
208
|
state: u
|
|
210
209
|
});
|
|
211
210
|
}, xe = () => {
|
|
@@ -224,13 +223,13 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
224
223
|
}, {})
|
|
225
224
|
).map(([t, a]) => ({ code: t, count: a }));
|
|
226
225
|
l.numberNonAppearing = [e.reduce((t, a) => t + a.count, 0), 0];
|
|
227
|
-
const
|
|
226
|
+
const h = Math.ceil(e.length / 2), u = e.slice(0, h), g = e.slice(h);
|
|
228
227
|
l.key === 0 && u.length > 0 && (l.appearing = {
|
|
229
228
|
code: u.map((t) => t.code).join("/"),
|
|
230
229
|
count: u.map((t) => t.count).join("/")
|
|
231
|
-
}), l.key === 1 &&
|
|
232
|
-
code:
|
|
233
|
-
count:
|
|
230
|
+
}), l.key === 1 && g.length > 0 && (l.appearing = {
|
|
231
|
+
code: g.map((t) => t.code).join("/"),
|
|
232
|
+
count: g.map((t) => t.count).join("/")
|
|
234
233
|
});
|
|
235
234
|
for (let t = 0; t < l.days.length; t++)
|
|
236
235
|
t < 15 && l.days[t].time !== "-" && (l.hourI += Number(l.days[t].time), l.days[t].overtime && (l.hourI += Number(l.days[t].overtime)), l.halfI++), t >= 15 && l.days[t].time !== "-" && (l.days[t].overtime && (l.hourII += Number(l.days[t].overtime)), l.hourII += Number(l.days[t].time), l.halfII++), l.days[t].night && (l.night += Number(l.days[t].night)), l.days[t].overtime && (l.overtime += Number(l.days[t].overtime)), /{|РВ|}/.test(l.days[t].state) && (l.weekend += Number(l.days[t].time)), l.days[t].state === "В" && l.weekendDays++;
|
|
@@ -239,9 +238,9 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
239
238
|
}, Ie = (l, e) => {
|
|
240
239
|
var o, f, N, w, F, z, O;
|
|
241
240
|
if (e === -1) return "";
|
|
242
|
-
const
|
|
241
|
+
const h = i.value[e], u = new Date($.value), g = `${u.getFullYear()}-${(u.getMonth() + 1).toString().padStart(2, "0")}-${l.toString().padStart(2, "0")}`, t = h.days.findIndex((X) => X.day === g);
|
|
243
242
|
let a = 0;
|
|
244
|
-
return (o =
|
|
243
|
+
return (o = h.days[t]) != null && o.night && (a += h.days[t].night), (f = h.days[t]) != null && f.overtime && (a += h.days[t].overtime), t === -1 ? "" : h.key === 0 ? (N = h.days[t]) == null ? void 0 : N.state : ((w = h.days[t]) == null ? void 0 : w.time) === 0 ? a === 0 ? "-" : a : a === 0 || a === ((F = h.days[t]) == null ? void 0 : F.time) ? (z = h.days[t]) == null ? void 0 : z.time : `${(O = h.days[t]) == null ? void 0 : O.time}/${a}`;
|
|
245
244
|
};
|
|
246
245
|
k.group && (B.value[0] = k.group), k.date && (Z.value = (/* @__PURE__ */ new Date(k.date + "T00:00:01")).getMonth()), Je().then((l) => {
|
|
247
246
|
we.value = l, ke();
|
|
@@ -255,13 +254,13 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
255
254
|
}, Fe = async () => {
|
|
256
255
|
var F, z, O, X;
|
|
257
256
|
ie.value = !0;
|
|
258
|
-
const l = new ll.Workbook(), e = l.addWorksheet(se($.value, "month"), { pageSetup: { paperSize: 9, orientation: "landscape", fitToPage: !0 } }),
|
|
257
|
+
const l = new ll.Workbook(), e = l.addWorksheet(se($.value, "month"), { pageSetup: { paperSize: 9, orientation: "landscape", fitToPage: !0 } }), h = { vertical: "middle", horizontal: "center" }, u = { top: { style: "thin" }, left: { style: "thin" }, bottom: { style: "thin" }, right: { style: "thin" } }, g = { vertical: "middle", horizontal: "center", wrapText: !0 };
|
|
259
258
|
e.mergeCells(`A1:${b("A1", r.value.length + 15)}1`), e.mergeCells("A2:A4"), e.mergeCells("B2:B4"), e.mergeCells("C2:C4"), e.mergeCells("D5:R5"), e.mergeCells(`D2:${b("D2", r.value.length + 2)}2`), e.mergeCells(`${b("D2", r.value.length + 3)}2:${b("D2", r.value.length + 8)}2`), e.mergeCells(`${b("D2", r.value.length + 9)}2:${b("D2", r.value.length + 9)}4`), e.mergeCells(`${b("D2", r.value.length + 10)}2:${b("D2", r.value.length + 11)}2`), e.mergeCells(`${b("D2", r.value.length + 12)}2:${b("D2", r.value.length + 12)}4`), e.mergeCells(`${b("D3", r.value.length + 3)}3:${b("D3", r.value.length + 3)}4`), e.mergeCells(`${b("D3", r.value.length + 4)}3:${b("D3", r.value.length + 8)}3`), e.mergeCells(`${b("D3", r.value.length + 10)}3:${b("D3", r.value.length + 10)}4`), e.mergeCells(`${b("D3", r.value.length + 11)}3:${b("D3", r.value.length + 11)}4`), e.mergeCells(`T5:${b("D5", r.value.length + 1)}5`);
|
|
260
259
|
for (let s = 1; s <= r.value.length + 2; s++)
|
|
261
|
-
e.mergeCells(`${b("D3", s)}3:${b("D4", s)}4`), e.getColumn(s + 3).width = 5, e.getColumn(s + 3).alignment =
|
|
262
|
-
e.getCell("A1").value = d("sheet.title", { name: B.value[0] }) + se($.value, "month"), e.getCell("A2").value = d("sheet.listNumber"), e.getCell("B2").value = d("sheet.employee"), e.getCell("C2").value = d("sheet.personnelNumber"), e.getCell("D2").value = d("sheet.marks"), e.getCell("S3").value = d("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, r.value.length + 5).value = "7", e.getCell(2, r.value.length + 6).value = d("sheet.workedMonth"), e.getCell(2, r.value.length + 12).value = d("sheet.numberNonAppearing"), e.getCell(2, r.value.length + 13).value = d("sheet.them"), e.getCell(2, r.value.length + 15).value = d("sheet.countWeekend"), e.getCell(3, r.value.length + 5).value = d("sheet.halfMonth", { half: "II" }), e.getCell(3, r.value.length + 6).value = d("sheet.days"), e.getCell(3, r.value.length + 7).value = d("sheet.hours"), e.getCell(4, r.value.length + 7).value = d("sheet.all"), e.getCell(4, r.value.length + 8).value = d("sheet.overtime"), e.getCell(4, r.value.length + 9).value = d("sheet.night"), e.getCell(4, r.value.length + 10).value = d("sheet.weekend"), e.getCell(4, r.value.length + 13).value = d("sheet.code"), e.getCell(4, r.value.length + 14).value = d("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(r.value.length + 5).width = 12, e.getColumn(r.value.length + 12).width = 11, e.getColumn(r.value.length + 15).width = 11, e.getCell("A1").alignment =
|
|
260
|
+
e.mergeCells(`${b("D3", s)}3:${b("D4", s)}4`), e.getColumn(s + 3).width = 5, e.getColumn(s + 3).alignment = g, e.getCell(3, s + 3).border = u, s < 16 && (e.getCell(3, s + 3).value = s), s > 16 && (e.getCell(3, s + 3).value = s - 1);
|
|
261
|
+
e.getCell("A1").value = d("sheet.title", { name: B.value[0] }) + se($.value, "month"), e.getCell("A2").value = d("sheet.listNumber"), e.getCell("B2").value = d("sheet.employee"), e.getCell("C2").value = d("sheet.personnelNumber"), e.getCell("D2").value = d("sheet.marks"), e.getCell("S3").value = d("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, r.value.length + 5).value = "7", e.getCell(2, r.value.length + 6).value = d("sheet.workedMonth"), e.getCell(2, r.value.length + 12).value = d("sheet.numberNonAppearing"), e.getCell(2, r.value.length + 13).value = d("sheet.them"), e.getCell(2, r.value.length + 15).value = d("sheet.countWeekend"), e.getCell(3, r.value.length + 5).value = d("sheet.halfMonth", { half: "II" }), e.getCell(3, r.value.length + 6).value = d("sheet.days"), e.getCell(3, r.value.length + 7).value = d("sheet.hours"), e.getCell(4, r.value.length + 7).value = d("sheet.all"), e.getCell(4, r.value.length + 8).value = d("sheet.overtime"), e.getCell(4, r.value.length + 9).value = d("sheet.night"), e.getCell(4, r.value.length + 10).value = d("sheet.weekend"), e.getCell(4, r.value.length + 13).value = d("sheet.code"), e.getCell(4, r.value.length + 14).value = d("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(r.value.length + 5).width = 12, e.getColumn(r.value.length + 12).width = 11, e.getColumn(r.value.length + 15).width = 11, e.getCell("A1").alignment = h, e.getColumn(1).alignment = g, e.getColumn(2).alignment = g, e.getColumn(3).alignment = g;
|
|
263
262
|
for (let s = 6; s <= 15; s++)
|
|
264
|
-
e.getCell(5, r.value.length + s).value = s + 2, e.getColumn(r.value.length + s).alignment =
|
|
263
|
+
e.getCell(5, r.value.length + s).value = s + 2, e.getColumn(r.value.length + s).alignment = g, e.getCell(4, r.value.length + s).border = u, e.getCell(5, r.value.length + s).border = u;
|
|
265
264
|
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, r.value.length + 6).border = u, e.getCell(2, r.value.length + 12).border = u, e.getCell(2, r.value.length + 13).border = u, e.getCell(2, r.value.length + 15).border = u, e.getCell(3, r.value.length + 7).border = u;
|
|
266
265
|
let t = 1, a = 5, o = !0;
|
|
267
266
|
for (const s of i.value) {
|
|
@@ -301,7 +300,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
301
300
|
Ae(l, `Служебка_${W(i.value[v.value.ids * 2].fio)}_${T(Date.now(), "{dd}.{m}.{Y}")}.html`);
|
|
302
301
|
};
|
|
303
302
|
return (l, e) => {
|
|
304
|
-
const
|
|
303
|
+
const h = $e("el-form-item"), u = $e("svg-icon"), g = $e("el-slider"), t = He("loading");
|
|
305
304
|
return C(), R(q, null, [
|
|
306
305
|
A("div", al, [
|
|
307
306
|
oe.checkEdit ? (C(), S(n(Le), {
|
|
@@ -315,7 +314,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
315
314
|
style: { width: "240px", "margin-bottom": ".5rem", "margin-right": ".5rem" }
|
|
316
315
|
}, {
|
|
317
316
|
default: m(() => [
|
|
318
|
-
(C(!0), R(q, null,
|
|
317
|
+
(C(!0), R(q, null, ge(fe.value, (a) => (C(), S(n(Ge), {
|
|
319
318
|
key: a.value,
|
|
320
319
|
label: a.label,
|
|
321
320
|
value: a.value
|
|
@@ -403,7 +402,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
403
402
|
align: "center"
|
|
404
403
|
}, {
|
|
405
404
|
default: m(() => [
|
|
406
|
-
(C(!0), R(q, null,
|
|
405
|
+
(C(!0), R(q, null, ge(r.value, (a) => (C(), R(q, {
|
|
407
406
|
key: a.day
|
|
408
407
|
}, [
|
|
409
408
|
a.day <= 15 ? (C(), S(n(I), {
|
|
@@ -644,7 +643,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
644
643
|
autocomplete: "on"
|
|
645
644
|
}, {
|
|
646
645
|
default: m(() => [
|
|
647
|
-
(C(!0), R(q, null,
|
|
646
|
+
(C(!0), R(q, null, ge(K.value, (a) => (C(), S(h, null, {
|
|
648
647
|
default: m(() => [
|
|
649
648
|
c(n(me), {
|
|
650
649
|
modelValue: a.val,
|
|
@@ -682,7 +681,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
682
681
|
style: { padding: "0 0 .5rem" }
|
|
683
682
|
}, {
|
|
684
683
|
default: m(() => [
|
|
685
|
-
(C(!0), R(q, null,
|
|
684
|
+
(C(!0), R(q, null, ge(Me.value, (a) => (C(), S(n(ue), {
|
|
686
685
|
key: a.value,
|
|
687
686
|
label: a.label,
|
|
688
687
|
onClick: (o) => {
|
|
@@ -701,7 +700,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
701
700
|
]),
|
|
702
701
|
_: 1
|
|
703
702
|
}),
|
|
704
|
-
c(
|
|
703
|
+
c(g, {
|
|
705
704
|
modelValue: V.value,
|
|
706
705
|
"onUpdate:modelValue": e[9] || (e[9] = (a) => V.value = a),
|
|
707
706
|
step: 1,
|
|
@@ -715,7 +714,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
715
714
|
]),
|
|
716
715
|
_: 1
|
|
717
716
|
}),
|
|
718
|
-
c(
|
|
717
|
+
c(g, {
|
|
719
718
|
modelValue: _.value,
|
|
720
719
|
"onUpdate:modelValue": e[10] || (e[10] = (a) => _.value = a),
|
|
721
720
|
step: 1,
|
|
@@ -730,7 +729,7 @@ const al = { class: "nav" }, tl = { style: { height: "20px", width: "100%", disp
|
|
|
730
729
|
]),
|
|
731
730
|
_: 1
|
|
732
731
|
}),
|
|
733
|
-
c(
|
|
732
|
+
c(g, {
|
|
734
733
|
modelValue: le.value,
|
|
735
734
|
"onUpdate:modelValue": e[11] || (e[11] = (a) => le.value = a),
|
|
736
735
|
step: 1,
|