@studio-west/employees 0.6.15 → 0.6.17
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 +1 -1
- package/dist/SheetTable.js +1 -1
- package/dist/VacationTable.cjs +1 -1
- package/dist/VacationTable.js +1 -1
- package/dist/WorkTable.cjs +3 -3
- package/dist/WorkTable.js +61 -61
- package/dist/{index-D4ZMBdCa.js → index-2Mx6IUGl.js} +20 -16
- package/dist/index-Dn3djtwj.cjs +1 -0
- package/package.json +1 -1
- package/dist/index-DxdyeKnm.cjs +0 -1
package/dist/SheetTable.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),M=require("vue-i18n"),p=require("./index-
|
|
1
|
+
"use strict";const e=require("vue"),M=require("vue-i18n"),p=require("./index-Dn3djtwj.cjs"),r=require("element-plus"),F={style:{height:"20px",width:"100%",display:"inline-block"}},Y={style:{height:"20px",width:"100%",display:"inline-block"}},H={__name:"SheetTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"}},setup(w){const g=w,{t:i,d:C}=M.useI18n(),c=e.ref([]),x=e.ref("0"),y=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(x.value))),h=e.ref([]),v=e.ref("all"),N=e.ref([{value:"all",label:"Все",key:"all"}]),T=e.ref([]),k=e.ref(0),b=e.ref([]);e.watch(v,async(a,l)=>{a!==l&&(b.value=[],confirm.value=!1,g.odata.personal.forEach(t=>{t.divisionName===a&&(b.value.some(n=>(n==null?void 0:n.activeText)===t.roleName)||b.value.push({val:!0,activeText:t.roleName}))}),V())}),e.watch(x,a=>{y.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(a)),D()});const u=e.computed(()=>c.value.flatMap((a,l)=>[{...a,key:0,ids:l},{...a,key:1,ids:l}])),S=a=>{if(a.columnIndex<2||a.columnIndex>h.value.length+3&&a.columnIndex<h.value.length+9||a.columnIndex>h.value.length+11)return u.value[a.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},D=()=>{const a=T.value,l=new Date(y.value),t=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let n=[],f=0;for(let d=1;d<=t;d++){const o=p.parseTime(l.setDate(d),"{Y}-{m}-{dd}");f+=a.nowork.includes(o)||a.holidays.includes(o)?0:a.preholidays.includes(o)?7:8;let s=a.nowork.includes(o)?"nowork":a.holidays.includes(o)?"holiday":a.preholidays.includes(o)?"preholiday":"";n.push({day:d,holidays:s,weekday:C(new Date(l.getFullYear(),l.getMonth(),d),"day")})}k.value=f,h.value=n,g.odata.getPersonal({}).then(d=>{var o;v.value=(o=d.find(s=>s.employeeName===g.fullName))==null?void 0:o.divisionName,d.forEach(s=>{N.value.some(m=>(m==null?void 0:m.value)===s.divisionName)||N.value.push({value:s.divisionName,label:s.divisionName,key:s.divisionName}),s.divisionName===v.value&&!b.value.some(m=>(m==null?void 0:m.activeText)===s.roleName)&&b.value.push({val:!0,activeText:s.roleName})}),V()})},V=()=>{c.value=[];let a=[];g.odata.personal.forEach(l=>{if(l.divisionName===v.value&&b.value.some(t=>t.val&&t.activeText===l.roleName)){let t=p.byInitials(l.employeeName);a.push(l.employeeKey),c.value.push({name:t+" ("+l.roleName+")",code:l.employeeKey,days:[],contHour:0,id:!1,ids:c.value.length})}}),B(a)},B=a=>{g.workSchedule.getWorkSchedule({code:a,date:p.parseTime(new Date(y.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((t,n)=>{var f,d;if(t!==null){t.data.days.forEach(o=>o.state="Я");for(let o=1;o<=h.value.length;o++){let s=p.parseTime(new Date(y.value).setDate(o),"{Y}-{m}-{dd}");const m=(f=t.data)==null?void 0:f.days.findIndex($=>$.day===s);m===-1?c.value[n].days.push({day:s,time:"-",state:"В"}):c.value[n].days.push((d=t.data)==null?void 0:d.days[m])}}else{c.value[n].days=[];for(let o=1;o<=h.value.length;o++)h.value[o-1].holidays===""?E(o,n,8):h.value[o-1].holidays==="preholiday"?E(o,n,7):c.value[n].days.push({day:p.parseTime(new Date(y.value).setDate(o),"{Y}-{m}-{dd}"),time:"-",state:"В"})}}),_()})},E=(a,l,t)=>{const n=p.parseTime(new Date(y.value).setDate(a),"{Y}-{m}-{dd}");c.value[l].days.push({day:n,time:t,state:"Я"})},_=()=>{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,k.value<a.contHour&&(a.overtime=a.contHour-k.value),a.numberNonAppearing=0,a.appearing={code:"-",countH:"-"}})},I=(a,l)=>{var d,o;if(l===-1)return"";const t=new Date(y.value),n=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,f=u.value[l].days.findIndex(s=>s.day===n);return f===-1?"":u.value[l].key===0?(d=u.value[l].days[f])==null?void 0:d.state:(o=u.value[l].days[f])==null?void 0:o.time};return p.holidays().then(a=>{T.value=a,D()}),(a,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[w.checkEdit?(e.openBlock(),e.createBlock(e.unref(r.ElSelect),{key:0,modelValue:v.value,"onUpdate:modelValue":l[0]||(l[0]=t=>v.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(N.value,t=>(e.openBlock(),e.createBlock(e.unref(r.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),w.checkEdit?(e.openBlock(),e.createBlock(e.unref(r.ElSwitch),{key:1,modelValue:x.value,"onUpdate:modelValue":l[1]||(l[1]=t=>x.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(r.ElTable),{id:"printTable",data:u.value,"span-method":S,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(r.ElTableColumn),{label:e.unref(i)("sheet.title",{name:v.value})+e.unref(C)(y.value,"month"),align:"center",height:"10"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.employee"),width:"180",align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.personnelNumber"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.marks"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.day},[t.day<=15?(e.openBlock(),e.createBlock(e.unref(r.ElTableColumn),{key:0,width:"30","class-name":t.holidays,align:"center",label:t.day.toString()+`
|
|
2
2
|
`+t.weekday},{default:e.withCtx(n=>[e.createElementVNode("div",F,e.toDisplayString(I(t.day,n.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.halfMonth",{half:"I"}),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].key===0?u.value[t.$index].halfI:u.value[t.$index].hourI),1)]),_:1},8,["label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.day},[t.day>15?(e.openBlock(),e.createBlock(e.unref(r.ElTableColumn),{key:0,width:"30","class-name":t.holidays,align:"center",label:t.day.toString()+`
|
|
3
3
|
`+t.weekday},{default:e.withCtx(n=>[e.createElementVNode("div",Y,e.toDisplayString(I(t.day,n.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.halfMonth",{half:"II"}),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].key===0?u.value[t.$index].halfII:u.value[t.$index].hourII),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.workedMonth"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.days"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].contDays),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.hours"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.all"),align:"center","label-class-name":"turn",width:"40"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].contHour),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.overtime"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].overtime),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.night"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].night),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.weekend"),align:"center","label-class-name":"turn",width:"34"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].weekend),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.numberNonAppearing"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].numberNonAppearing),1)]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.them"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.code"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(t=>{var n;return[e.createTextVNode(e.toDisplayString((n=u.value[t.$index].appearing)==null?void 0:n.code),1)]}),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.count"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(t=>{var n;return[e.createTextVNode(e.toDisplayString((n=u.value[t.$index].appearing)==null?void 0:n.countH),1)]}),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(r.ElTableColumn),{label:e.unref(i)("sheet.countWeekend"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(u.value[t.$index].weekendDays),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text","onCellClick"])],64))}};module.exports=H;
|
package/dist/SheetTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref as w, watch as K, computed as L, createElementBlock as D, openBlock as y, Fragment as N, createBlock as $, createCommentVNode as E, createVNode as d, unref as t, withCtx as s, renderList as H, createTextVNode as m, toDisplayString as c, createElementVNode as P } from "vue";
|
|
2
2
|
import { useI18n as q } from "vue-i18n";
|
|
3
|
-
import { p as M, b as G, h as R } from "./index-
|
|
3
|
+
import { p as M, b as G, h as R } from "./index-2Mx6IUGl.js";
|
|
4
4
|
import { ElSelect as X, ElOption as Z, ElSwitch as Q, ElTable as ee, ElTableColumn as r } from "element-plus";
|
|
5
5
|
const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }, le = { style: { height: "20px", width: "100%", display: "inline-block" } }, se = {
|
|
6
6
|
__name: "SheetTable",
|
package/dist/VacationTable.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),V=require("./index-DxdyeKnm.cjs"),W=require("vue-i18n"),Q=require("file-saver"),ee=require("exceljs"),d=require("element-plus"),G=require("@imengyu/vue3-context-menu");function te(D){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const n in D)if(n!=="default"){const p=Object.getOwnPropertyDescriptor(D,n);Object.defineProperty(x,n,p.get?p:{enumerable:!0,get:()=>D[n]})}}return x.default=D,Object.freeze(x)}const le=te(ee),ae=(D,x)=>{const n=D.__vccOpts||D;for(const[p,o]of x)n[p]=o;return n},ne={class:"wrapper"},oe={class:"month_year"},ue={class:"text"},re={class:"week"},ie={class:"month"},de=["onClick"],ce={key:0},se={class:"month_year"},ve={class:"text"},me={class:"week"},fe={class:"month"},ge=["onClick"],pe={__name:"DataPicker",props:{data:Object,limitation:{type:[Boolean,Array],default:()=>!1},range:{type:String,default:()=>"solid"}},emits:["input"],setup(D,{emit:x}){var U,P,J,O;const n=e.ref(new Date),p=e.ref(new Date),o=D,F=x,y=e.ref(new Date().getFullYear()),T=e.ref(new Date().getMonth()),Y=e.ref(new Date().getFullYear()),m=e.ref(new Date().getMonth()),c=e.ref([]),$=e.ref(0),_=e.ref(0),h=e.ref(-1),k=e.ref(-1),{locale:A}=W.useI18n(),b=/en|zh|ja|he/.test(A.value)?0:1,N=o.range==="range"?2:1,I=s=>{const r=s.split(s.match(/\D.*?\D?/));return r[0].length>2?r.join("-")+"T00:00:01":r.reverse().join("-")+"T00:00:01"};typeof((U=o.data)==null?void 0:U.startDate)<"u"&&(n.value=new Date(I(o.data.startDate)),y.value=n.value.getFullYear(),m.value=n.value.getMonth()),typeof((P=o.data)==null?void 0:P.endDate)<"u"&&(p.value=new Date(I(o.data.endDate)),Y.value=p.value.getFullYear(),T.value=p.value.getMonth());const v=()=>{let s=new Date(y.value,m.value,0);for(let a=s.getDate()-s.getDay()+b;a<=s.getDate()&&s.getDay()!==6+b;a++)$.value++,c.value.push({day:a,month:s.getMonth(),year:s.getFullYear(),class:[]});for(let a=1;a<=new Date(y.value,m.value+1,0).getDate();a++)$.value++,c.value.push({day:a,month:m.value,year:y.value,class:[]});if(o.range==="range"){_.value=new Date(y.value,m.value+2,0);for(let a=1;a<=_.value.getDate();a++)c.value.push({day:a,month:_.value.getMonth(),year:_.value.getFullYear(),class:[]})}let r=new Date(y.value,m.value+N,1);console.log(r.getDay());for(let a=1;a<=(7-r.getDay()+b)%7&&r.getDay()!==b;a++)c.value.push({day:a,month:r.getMonth(),year:r.getFullYear(),class:[]});o.data.holiday.length!==0&&(o.data.holiday.preholidays.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="preholiday")}),o.data.holiday.holidays.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="weekend")}),o.data.holiday.holiday.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="holiday")}),o.data.holiday.nowork.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="nowork")}))},L=(s,r)=>{let a=s-r+1;for(let i=0;i<=s-r;i++)c.value[i+r].class[0]==="holiday"&&a--;return a},E=(s,r)=>{const a=V.parseTime(new Date(s.year,s.month,s.day),"{dd}.{m}.{Y}");if(o.range==="range")if(console.log(h.value),k.value!==-1){if(k.value<=h.value)for(let i=k.value;i<=h.value;i++)c.value[i].class[1]="";else for(let i=h.value;i<=k.value;i++)c.value[i].class[1]="";h.value=r,k.value=-1,c.value[r].class[1]="active"}else if(h.value!==-1){if(k.value=r,k.value>=h.value)for(let C=h.value+1;C<r;C++)c.value[C].class[1]="select";else for(let C=r+1;C<h.value;C++)c.value[C].class[1]="select";c.value[r].class[1]="active";let i=V.parseTime(new Date(c.value[h.value].year,c.value[h.value].month,c.value[h.value].day),"{dd}.{m}.{Y}");h.value>r?F("input",{dateStart:a,dateEnd:i,count:L(h.value,r)}):F("input",{dateStart:i,dateEnd:a,count:L(r,h.value)})}else h.value=r,c.value[r].class[1]="active";else c.value[h.value].class[1]="",h.value=r,c.value[r].class[1]="active",F("input",{dateStart:a,count:1})};if(v(),typeof((J=o.data)==null?void 0:J.startDate)<"u"&&(h.value=c.value.findIndex(s=>s.day===n.value.getDate()&&s.month===m.value&&s.year===y.value),c.value[h.value].class[1]="active"),typeof((O=o.data)==null?void 0:O.endDate)<"u"&&o.range==="range"){k.value=c.value.findIndex(s=>s.day===p.value.getDate()&&s.month===T.value&&s.year===Y.value),c.value[k.value].class[1]="active";for(let s=h.value+1;s<k.value;s++)c.value[s].class[1]="select"}const B=(s,r)=>{z(s,r)&&(c.value=[],$.value=0,n.value=new Date(s,r,1),y.value=n.value.getFullYear(),m.value=n.value.getMonth(),v())},z=(s,r)=>{if(!o.limitation)return!0;if(o.limitation[0].dateStart){console.log(o.limitation[0].dateStart);let a=o.limitation[0].dateStart.split(o.limitation[0].dateStart.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])>s||parseInt(a[2])===s&&parseInt(a[1])>r+1)return!1}if(o.limitation[o.limitation.length-1].dateEnd){console.log(o.limitation[o.limitation.length-1].dateEnd);let a=o.limitation[o.limitation.length-1].dateEnd.split(o.limitation[o.limitation.length-1].dateEnd.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])<s||parseInt(a[2])===s&&parseInt(a[1])<r+N)return!1}return!0};return(s,r)=>(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("div",null,[e.createElementVNode("p",oe,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[0]||(r[0]=a=>B(y.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[1]||(r[1]=a=>B(y.value,m.value-1))},"‹")]),e.createElementVNode("span",ue,[e.createElementVNode("button",null,e.toDisplayString(y.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[2]||(r[2]=a=>B(y.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[3]||(r[3]=a=>B(y.value+1,m.value))},"»")])]),e.createElementVNode("div",re,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i<$.value+(7-new Date(y.value,m.value+1,1).getDay()+e.unref(b))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===m.value&&(!o.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date(I(o.limitation[0].dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date(I(o.limitation[0].dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===m.value&&E(a,i)}},e.toDisplayString(a.day),11,de)):e.createCommentVNode("",!0)],64))),128))])]),o.range==="range"?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("p",se,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[4]||(r[4]=a=>B(y.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[5]||(r[5]=a=>B(y.value,m.value-1))},"‹")]),e.createElementVNode("span",ve,[e.createElementVNode("button",null,e.toDisplayString(new Date(y.value,m.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[6]||(r[6]=a=>B(y.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[7]||(r[7]=a=>B(y.value+1,m.value))},"»")])]),e.createElementVNode("div",me,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i>=$.value-(7+new Date(y.value,m.value+1,1).getDay()-e.unref(b))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===_.value.getMonth()&&(!o.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date(I(o.limitation[0].dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date(I(o.limitation[0].dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===_.value.getMonth()&&E(a,i)}},e.toDisplayString(a.day),11,ge)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}},he=ae(pe,[["__scopeId","data-v-d1aa0363"]]),ye={key:1,class:"controls-container",style:{"margin-top":".5rem"}},Ce={key:0},ke={key:1,style:{padding:"0 1rem .5rem"}},xe={__name:"VacationTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,query:String,fullName:{type:String,default:"Вы"}},setup(D){const x=D,{t:n}=W.useI18n(),p=e.ref([]);e.ref([]);const o=e.ref(new Date().getFullYear()),F=e.ref(!1),y=e.ref(!1),T=e.ref(!1),Y=e.ref({zIndex:3,minWidth:230,x:500,y:200}),m=e.ref(!1),c=e.ref(!1),$=e.ref({participants:[]}),_=e.ref([]),h=e.ref([]),k=e.ref("all"),A=e.ref([{value:"all",label:n("vacationSchedule.all"),key:"all"}]),b=e.ref(!1),N=e.ref([]),I=e.ref(!1),v=e.ref({name:"",length:0,code:""}),L=new Date().getMonth()>11?[{value:o.value,label:o.value},{value:o.value+1,label:o.value+1}]:[{value:o.value-1,label:o.value-1},{value:o.value,label:o.value}];e.watch(k,async(u,t)=>{u!==t&&(console.log(u),N.value=[],F.value=!1,x.odata.employee.forEach(f=>{(f.divisionName===u||u==="all")&&(N.value.some(l=>(l==null?void 0:l.activeText)===f.roleName)||N.value.push({val:!0,activeText:f.roleName}))}),z())});const E=e.computed(()=>p.value.flatMap((u,t)=>!u.days||u.days.length===0?[{...u,key:0,ids:t}]:u.days.map((f,l)=>({ids:t,key:l,...u,...f})))),B=async()=>{x.odata.getEmployee(o.value-1+"-12-17T23:59:00").then(u=>{var t;k.value=(t=u.find(f=>f.employeeName===x.fullName))==null?void 0:t.divisionName,u.forEach(f=>{A.value.some(l=>(l==null?void 0:l.value)===f.divisionName)||A.value.push({value:f.divisionName,label:f.divisionName,key:f.divisionName}),f.divisionName===k.value&&!N.value.some(l=>(l==null?void 0:l.activeText)===f.roleName)&&N.value.push({val:!0,activeText:f.roleName})}),z(),y.value=!1})},z=()=>{p.value=[];let u=[];x.odata.employee.forEach(t=>{(t.divisionName===k.value||k.value==="all")&&N.value.some(f=>f.val&&f.activeText===t.roleName)&&(u.push(t.employeeKey),p.value.push({name:t.employeeName,days:[{note:""}],jobTitle:t.roleName,code:t.employeeKey}))}),U(u),m.value=!1},U=u=>{x.workSchedule.getAllVacations({year:o.value}).then(t=>{u.forEach((f,l)=>{p.value[l].days=[{note:""}],t.forEach(g=>{f===g.code&&(typeof p.value[l].days[0].dateStart>"u"?p.value[l].days[0]={dateStart:V.parseTime(g.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(g.dateEnd,"{dd}.{m}.{Y}"),note:g.note,count:g.count}:p.value[l].days.push({dateStart:V.parseTime(g.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(g.dateEnd,"{dd}.{m}.{Y}"),note:g.note,count:g.count}))})})})},P=u=>{if(u.columnIndex<3&&E.value[u.rowIndex].key<E.value[u.rowIndex].days.length)return E.value[u.rowIndex].key===0?{rowspan:E.value[u.rowIndex].days.length,colspan:1}:{rowspan:0,colspan:0}},J=(u,t,f,l)=>{v.value.ids=u.ids,v.value.key=u.key,v.value.startDate=u.dateStart,v.value.endDate=u.dateEnd,v.value.name=u.name,v.value.count=u.count,v.value.allCount=()=>u.days.length===0?0:u.days.reduce((g,q,M)=>M!==u.key?g+parseInt(q.count):g,0),v.value.length=u.days.length,v.value.add=u.days.length>0&&u.days[u.days.length-1].count,v.value.level=t.level,v.value.holiday=h.value,Y.value.y=l.clientY,Y.value.x=l.clientX,t.level===2&&t.no<4&&(v.value.add||u.days.length>1)&&(T.value=!0),t.level===3&&(T.value=!0)},O=u=>{let t=p.value[v.value.ids];switch(u){case"add":t.days.push({note:""}),console.log(t.days.length);break;case"delete":delete t.days.pop(),a(v.value.ids);break}T.value=!1},s=u=>{I.value=u,v.value.count=u.count},r=()=>{I.value&&(p.value[v.value.ids].days[v.value.key]={...I.value,note:""},a(v.value.ids)),T.value=!1},a=u=>{x.workSchedule.rewriteFull({year:o.value,code:p.value[u].code,data:p.value[u].days.map(t=>({dateStart:t.dateStart.split(".").reverse().join("-"),dateEnd:t.dateEnd.split(".").reverse().join("-"),note:t.note,count:t.count}))})},i=u=>{x.workSchedule.sendConfirmMessage({fullname:x.fullName,confirm:u}),x.query=""},C=()=>{x.workSchedule.sendAgreementMessage({users:$.value.participants}),c.value=!1};x.workSchedule.getBoss().then(u=>{_.value=u[0].users}),V.holidays().then(u=>{h.value=u,B()});const S=()=>v.value.length<2?[{dateStart:"01.01."+o.value,dateEnd:"31.12."+o.value}]:[{dateStart:"01.01."+o.value,dateEnd:"31.12."+o.value}],K=async()=>{b.value=!0;const u=new le.Workbook,t=u.addWorksheet(o.value.toString(),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),f={vertical:"middle",horizontal:"center"},l={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},g={vertical:"middle",horizontal:"center",wrapText:!0},q={vertical:"middle",horizontal:"right",wrapText:!0};t.mergeCells("D1:G1"),t.mergeCells("D2:G2"),t.mergeCells("D3:G3"),t.mergeCells("D4:G4"),t.mergeCells("A5:G5"),t.mergeCells("A6:G6"),t.mergeCells("A9:G9"),t.mergeCells("A10:A11"),t.mergeCells("B10:B11"),t.mergeCells("C10:C11"),t.mergeCells("D10:F10"),t.mergeCells("G10:G11"),t.getCell("D1").value=n("vacationSchedule.approve"),t.getCell("D2").value=n("vacationSchedule.dateApprove",{year:o.value-1}),t.getCell("D3").value=n("workSchedule.printPlace"),t.getCell("D4").value=n("vacationSchedule.dateApprove",{year:o.value-1}),t.getCell("A5").value=n("workSchedule.firm"),t.getCell("B7").value=n("vacationSchedule.vacationSchedule"),t.getCell("C7").value=n("vacationSchedule.numberDocs"),t.getCell("D7").value=n("vacationSchedule.compilation"),t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("C8").value="",t.getCell("D8").value="",t.getCell("E8").value=o.value,t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("A10").value=n("vacationSchedule.jobTitle"),t.getCell("B10").value=n("vacationSchedule.fullName"),t.getCell("C10").value=n("vacationSchedule.personnelNumber"),t.getCell("D10").value=n("vacationSchedule.vacation"),t.getCell("D11").value=n("vacationSchedule.days"),t.getCell("E11").value=n("vacationSchedule.date"),t.getCell("F11").value=n("vacationSchedule.endDate"),t.getCell("G11").value=n("vacationSchedule.note"),t.getRow(1).height=80,t.getColumn(1).width=28,t.getColumn(2).width=28,t.getColumn(3).width=18,t.getColumn(4).width=18,t.getColumn(5).width=14,t.getColumn(6).width=14,t.getColumn(7).width=14,t.getColumn(1).alignment=g,t.getColumn(2).alignment=g,t.getColumn(3).alignment=g,t.getColumn(4).alignment=g,t.getColumn(5).alignment=g,t.getColumn(6).alignment=g,t.getColumn(7).alignment=g,t.getCell("D1").alignment=q,t.getCell("D2").alignment=q,t.getCell("D4").alignment=q,t.getCell("A5").alignment=f,t.getCell("C7").border=l,t.getCell("D7").border=l,t.getCell("E7").border=l,t.getCell("C8").border=l,t.getCell("D8").border=l,t.getCell("E8").border=l,t.getCell("A10").border=l,t.getCell("B10").border=l,t.getCell("C10").border=l,t.getCell("D10").border=l,t.getCell("G10").border=l,t.getCell("D11").border=l,t.getCell("E11").border=l,t.getCell("F11").border=l;let M=11;for(const w of p.value)if(w.days.length>1)w.days.forEach(j=>{let R=[w.jobTitle,w.name,w.code,j.count,j.dateStart,j.dateEnd,j.note];const Z=t.addRow(R);Z.border=l,M++}),t.mergeCells(`A${M-w.days.length+1}:A${M}`),t.mergeCells(`B${M-w.days.length+1}:B${M}`),t.mergeCells(`C${M-w.days.length+1}:C${M}`);else{let j=[w.jobTitle,w.name,w.code,w.days[0].count,w.days[0].dateStart,w.days[0].dateEnd,w.days[0].note];const R=t.addRow(j);R.border=l,M++}const X="export_"+V.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",H=await u.xlsx.writeBuffer();Q.saveAs(new Blob([H]),X),b.value=!1};return(u,t)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",null,[D.checkEdit?(e.openBlock(),e.createBlock(e.unref(d.ElSelect),{key:0,modelValue:k.value,"onUpdate:modelValue":t[0]||(t[0]=l=>k.value=l),placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(d.ElButton),{plain:"",onClick:t[1]||(t[1]=l=>m.value=!0),style:{"margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.jobTitle")),1)]),_:1}),e.createVNode(e.unref(d.ElSelect),{modelValue:o.value,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value=l),onChange:B,placeholder:"Year",style:{width:"80px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),e.createVNode(e.unref(d.ElSkeleton),{style:{width:"100%"},loading:y.value,animated:""},{template:e.withCtx(()=>[e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"100%",height:"2rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"4rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"4rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"8rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"8rem"}})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTable),{id:"printTable",data:E.value,"span-method":P,onCellClick:J,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(n)("vacationSchedule.emptyText")},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:k.value!=="all"?e.unref(n)("vacationSchedule.title",{name:k.value}):e.unref(n)("vacationSchedule.enterprise")+` ${o.value}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.jobTitle"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].jobTitle),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.fullName"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.personnelNumber"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.vacation"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.days"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].count),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.date"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.endDate"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateEnd),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.note"),align:"center"},{default:e.withCtx(l=>[e.createVNode(e.unref(d.ElInput),{modelValue:p.value[E.value[l.$index].ids].days[E.value[l.$index].key].note,"onUpdate:modelValue":g=>p.value[E.value[l.$index].ids].days[E.value[l.$index].key].note=g,style:{width:"100%"},placeholder:" ",class:"noBorder",onBlur:g=>a(E.value[l.$index].ids)},null,8,["modelValue","onUpdate:modelValue","onBlur"])]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])]),_:1},8,["loading"]),D.checkEdit?(e.openBlock(),e.createElementBlock("div",ye,[F.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,type:"primary",onClick:t[3]||(t[3]=l=>c.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.sendInformation")),1)]),_:1})),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:1,type:"primary",onClick:t[4]||(t[4]=l=>i(!0))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.agreeOn")),1)]),_:1})):e.createCommentVNode("",!0),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:2,type:"primary",onClick:t[5]||(t[5]=l=>i(!1))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.reject")),1)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(d.ElButton),{disabled:b.value,plain:"",onClick:K,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[f,b.value]]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("workSchedule.jobTitle"),modelValue:m.value,"onUpdate:modelValue":t[7]||(t[7]=l=>m.value=l),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[6]||(t[6]=l=>m.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:N.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSwitch),{modelValue:l.val,"onUpdate:modelValue":g=>l.val=g,"active-text":l.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("vacationSchedule.pleaseCoordinate"),modelValue:c.value,"onUpdate:modelValue":t[10]||(t[10]=l=>c.value=l),width:"500px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[9]||(t[9]=l=>c.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.send")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:$.value,autocomplete:"on"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSelect),{modelValue:$.value.participants,"onUpdate:modelValue":t[8]||(t[8]=l=>$.value.participants=l),placeholder:e.unref(n)("vacationSchedule.fullName"),multiple:"",size:"default"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l,label:l,value:l},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(G.ContextMenu),{show:T.value,"onUpdate:show":t[14]||(t[14]=l=>T.value=l),options:Y.value},{default:e.withCtx(()=>[e.createVNode(e.unref(G.ContextMenuItem),{label:v.value.level===3&&typeof v.value.count<"u"?v.value.name+" "+v.value.count+" "+e.unref(n)("vacationSchedule.day",v.value.count)+` ${e.unref(n)("vacationSchedule.from")}: ${v.value.allCount()+parseInt(v.value.count)}`:v.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(G.ContextMenuSeparator)),v.value.level===2?(e.openBlock(),e.createElementBlock("div",Ce,[v.value.length>1?(e.openBlock(),e.createBlock(e.unref(G.ContextMenuItem),{key:0,label:e.unref(n)("vacationSchedule.deleteLast"),onClick:t[11]||(t[11]=l=>O("delete"))},null,8,["label"])):e.createCommentVNode("",!0),v.value.add?(e.openBlock(),e.createBlock(e.unref(G.ContextMenuItem),{key:1,label:e.unref(n)("vacationSchedule.addVacation"),onClick:t[12]||(t[12]=l=>O("add"))},null,8,["label"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(he,{data:v.value,range:"range",limitation:S(),onInput:s},null,8,["data","limitation"]),e.createElementVNode("div",null,[e.createVNode(e.unref(d.ElButton),{onClick:t[13]||(t[13]=l=>T.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.save")),1)]),_:1})])]))]),_:1},8,["show","options"])])}}};module.exports=xe;
|
|
1
|
+
"use strict";const e=require("vue"),V=require("./index-Dn3djtwj.cjs"),W=require("vue-i18n"),Q=require("file-saver"),ee=require("exceljs"),d=require("element-plus"),G=require("@imengyu/vue3-context-menu");function te(D){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const n in D)if(n!=="default"){const p=Object.getOwnPropertyDescriptor(D,n);Object.defineProperty(x,n,p.get?p:{enumerable:!0,get:()=>D[n]})}}return x.default=D,Object.freeze(x)}const le=te(ee),ae=(D,x)=>{const n=D.__vccOpts||D;for(const[p,o]of x)n[p]=o;return n},ne={class:"wrapper"},oe={class:"month_year"},ue={class:"text"},re={class:"week"},ie={class:"month"},de=["onClick"],ce={key:0},se={class:"month_year"},ve={class:"text"},me={class:"week"},fe={class:"month"},ge=["onClick"],pe={__name:"DataPicker",props:{data:Object,limitation:{type:[Boolean,Array],default:()=>!1},range:{type:String,default:()=>"solid"}},emits:["input"],setup(D,{emit:x}){var U,P,J,O;const n=e.ref(new Date),p=e.ref(new Date),o=D,F=x,y=e.ref(new Date().getFullYear()),T=e.ref(new Date().getMonth()),Y=e.ref(new Date().getFullYear()),m=e.ref(new Date().getMonth()),c=e.ref([]),$=e.ref(0),_=e.ref(0),h=e.ref(-1),k=e.ref(-1),{locale:A}=W.useI18n(),b=/en|zh|ja|he/.test(A.value)?0:1,N=o.range==="range"?2:1,I=s=>{const r=s.split(s.match(/\D.*?\D?/));return r[0].length>2?r.join("-")+"T00:00:01":r.reverse().join("-")+"T00:00:01"};typeof((U=o.data)==null?void 0:U.startDate)<"u"&&(n.value=new Date(I(o.data.startDate)),y.value=n.value.getFullYear(),m.value=n.value.getMonth()),typeof((P=o.data)==null?void 0:P.endDate)<"u"&&(p.value=new Date(I(o.data.endDate)),Y.value=p.value.getFullYear(),T.value=p.value.getMonth());const v=()=>{let s=new Date(y.value,m.value,0);for(let a=s.getDate()-s.getDay()+b;a<=s.getDate()&&s.getDay()!==6+b;a++)$.value++,c.value.push({day:a,month:s.getMonth(),year:s.getFullYear(),class:[]});for(let a=1;a<=new Date(y.value,m.value+1,0).getDate();a++)$.value++,c.value.push({day:a,month:m.value,year:y.value,class:[]});if(o.range==="range"){_.value=new Date(y.value,m.value+2,0);for(let a=1;a<=_.value.getDate();a++)c.value.push({day:a,month:_.value.getMonth(),year:_.value.getFullYear(),class:[]})}let r=new Date(y.value,m.value+N,1);console.log(r.getDay());for(let a=1;a<=(7-r.getDay()+b)%7&&r.getDay()!==b;a++)c.value.push({day:a,month:r.getMonth(),year:r.getFullYear(),class:[]});o.data.holiday.length!==0&&(o.data.holiday.preholidays.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="preholiday")}),o.data.holiday.holidays.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="weekend")}),o.data.holiday.holiday.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="holiday")}),o.data.holiday.nowork.forEach(a=>{let i=a.split("-");const C=c.value.findIndex(S=>S.year==i[0]&&S.month+1==i[1]&&S.day==i[2]);C!==-1&&(c.value[C].class[0]="nowork")}))},L=(s,r)=>{let a=s-r+1;for(let i=0;i<=s-r;i++)c.value[i+r].class[0]==="holiday"&&a--;return a},E=(s,r)=>{const a=V.parseTime(new Date(s.year,s.month,s.day),"{dd}.{m}.{Y}");if(o.range==="range")if(console.log(h.value),k.value!==-1){if(k.value<=h.value)for(let i=k.value;i<=h.value;i++)c.value[i].class[1]="";else for(let i=h.value;i<=k.value;i++)c.value[i].class[1]="";h.value=r,k.value=-1,c.value[r].class[1]="active"}else if(h.value!==-1){if(k.value=r,k.value>=h.value)for(let C=h.value+1;C<r;C++)c.value[C].class[1]="select";else for(let C=r+1;C<h.value;C++)c.value[C].class[1]="select";c.value[r].class[1]="active";let i=V.parseTime(new Date(c.value[h.value].year,c.value[h.value].month,c.value[h.value].day),"{dd}.{m}.{Y}");h.value>r?F("input",{dateStart:a,dateEnd:i,count:L(h.value,r)}):F("input",{dateStart:i,dateEnd:a,count:L(r,h.value)})}else h.value=r,c.value[r].class[1]="active";else c.value[h.value].class[1]="",h.value=r,c.value[r].class[1]="active",F("input",{dateStart:a,count:1})};if(v(),typeof((J=o.data)==null?void 0:J.startDate)<"u"&&(h.value=c.value.findIndex(s=>s.day===n.value.getDate()&&s.month===m.value&&s.year===y.value),c.value[h.value].class[1]="active"),typeof((O=o.data)==null?void 0:O.endDate)<"u"&&o.range==="range"){k.value=c.value.findIndex(s=>s.day===p.value.getDate()&&s.month===T.value&&s.year===Y.value),c.value[k.value].class[1]="active";for(let s=h.value+1;s<k.value;s++)c.value[s].class[1]="select"}const B=(s,r)=>{z(s,r)&&(c.value=[],$.value=0,n.value=new Date(s,r,1),y.value=n.value.getFullYear(),m.value=n.value.getMonth(),v())},z=(s,r)=>{if(!o.limitation)return!0;if(o.limitation[0].dateStart){console.log(o.limitation[0].dateStart);let a=o.limitation[0].dateStart.split(o.limitation[0].dateStart.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])>s||parseInt(a[2])===s&&parseInt(a[1])>r+1)return!1}if(o.limitation[o.limitation.length-1].dateEnd){console.log(o.limitation[o.limitation.length-1].dateEnd);let a=o.limitation[o.limitation.length-1].dateEnd.split(o.limitation[o.limitation.length-1].dateEnd.match(/\D.*?\D?/));if(a[0].length>2&&a.reverse(),parseInt(a[2])<s||parseInt(a[2])===s&&parseInt(a[1])<r+N)return!1}return!0};return(s,r)=>(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("div",null,[e.createElementVNode("p",oe,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[0]||(r[0]=a=>B(y.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[1]||(r[1]=a=>B(y.value,m.value-1))},"‹")]),e.createElementVNode("span",ue,[e.createElementVNode("button",null,e.toDisplayString(y.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[2]||(r[2]=a=>B(y.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[3]||(r[3]=a=>B(y.value+1,m.value))},"»")])]),e.createElementVNode("div",re,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i<$.value+(7-new Date(y.value,m.value+1,1).getDay()+e.unref(b))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===m.value&&(!o.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date(I(o.limitation[0].dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date(I(o.limitation[0].dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===m.value&&E(a,i)}},e.toDisplayString(a.day),11,de)):e.createCommentVNode("",!0)],64))),128))])]),o.range==="range"?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("p",se,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[4]||(r[4]=a=>B(y.value-1,m.value))},"«"),e.createElementVNode("button",{onClick:r[5]||(r[5]=a=>B(y.value,m.value-1))},"‹")]),e.createElementVNode("span",ve,[e.createElementVNode("button",null,e.toDisplayString(new Date(y.value,m.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(V.parseTime)(n.value.setMonth(m.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:r[6]||(r[6]=a=>B(y.value,m.value+1))},"›"),e.createElementVNode("button",{onClick:r[7]||(r[7]=a=>B(y.value+1,m.value))},"»")])]),e.createElementVNode("div",me,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(a,i)=>e.createElementVNode("button",{key:i,class:"disabled"},e.toDisplayString(e.unref(V.parseTime)(new Date(1970,1,a+e.unref(b)),"{D}")),1)),64))]),e.createElementVNode("div",fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[i>=$.value-(7+new Date(y.value,m.value+1,1).getDay()-e.unref(b))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(a.month===_.value.getMonth()&&(!o.limitation||new Date(a.year,a.month,a.day+1).getTime()>new Date(I(o.limitation[0].dateStart)).getTime()&&new Date(a.year,a.month,a.day).getTime()<new Date(I(o.limitation[0].dateEnd)).getTime())?a.class:"disabled"),onClick:()=>{a.month===_.value.getMonth()&&E(a,i)}},e.toDisplayString(a.day),11,ge)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}},he=ae(pe,[["__scopeId","data-v-d1aa0363"]]),ye={key:1,class:"controls-container",style:{"margin-top":".5rem"}},Ce={key:0},ke={key:1,style:{padding:"0 1rem .5rem"}},xe={__name:"VacationTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,query:String,fullName:{type:String,default:"Вы"}},setup(D){const x=D,{t:n}=W.useI18n(),p=e.ref([]);e.ref([]);const o=e.ref(new Date().getFullYear()),F=e.ref(!1),y=e.ref(!1),T=e.ref(!1),Y=e.ref({zIndex:3,minWidth:230,x:500,y:200}),m=e.ref(!1),c=e.ref(!1),$=e.ref({participants:[]}),_=e.ref([]),h=e.ref([]),k=e.ref("all"),A=e.ref([{value:"all",label:n("vacationSchedule.all"),key:"all"}]),b=e.ref(!1),N=e.ref([]),I=e.ref(!1),v=e.ref({name:"",length:0,code:""}),L=new Date().getMonth()>11?[{value:o.value,label:o.value},{value:o.value+1,label:o.value+1}]:[{value:o.value-1,label:o.value-1},{value:o.value,label:o.value}];e.watch(k,async(u,t)=>{u!==t&&(console.log(u),N.value=[],F.value=!1,x.odata.employee.forEach(f=>{(f.divisionName===u||u==="all")&&(N.value.some(l=>(l==null?void 0:l.activeText)===f.roleName)||N.value.push({val:!0,activeText:f.roleName}))}),z())});const E=e.computed(()=>p.value.flatMap((u,t)=>!u.days||u.days.length===0?[{...u,key:0,ids:t}]:u.days.map((f,l)=>({ids:t,key:l,...u,...f})))),B=async()=>{x.odata.getEmployee(o.value-1+"-12-17T23:59:00").then(u=>{var t;k.value=(t=u.find(f=>f.employeeName===x.fullName))==null?void 0:t.divisionName,u.forEach(f=>{A.value.some(l=>(l==null?void 0:l.value)===f.divisionName)||A.value.push({value:f.divisionName,label:f.divisionName,key:f.divisionName}),f.divisionName===k.value&&!N.value.some(l=>(l==null?void 0:l.activeText)===f.roleName)&&N.value.push({val:!0,activeText:f.roleName})}),z(),y.value=!1})},z=()=>{p.value=[];let u=[];x.odata.employee.forEach(t=>{(t.divisionName===k.value||k.value==="all")&&N.value.some(f=>f.val&&f.activeText===t.roleName)&&(u.push(t.employeeKey),p.value.push({name:t.employeeName,days:[{note:""}],jobTitle:t.roleName,code:t.employeeKey}))}),U(u),m.value=!1},U=u=>{x.workSchedule.getAllVacations({year:o.value}).then(t=>{u.forEach((f,l)=>{p.value[l].days=[{note:""}],t.forEach(g=>{f===g.code&&(typeof p.value[l].days[0].dateStart>"u"?p.value[l].days[0]={dateStart:V.parseTime(g.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(g.dateEnd,"{dd}.{m}.{Y}"),note:g.note,count:g.count}:p.value[l].days.push({dateStart:V.parseTime(g.dateStart,"{dd}.{m}.{Y}"),dateEnd:V.parseTime(g.dateEnd,"{dd}.{m}.{Y}"),note:g.note,count:g.count}))})})})},P=u=>{if(u.columnIndex<3&&E.value[u.rowIndex].key<E.value[u.rowIndex].days.length)return E.value[u.rowIndex].key===0?{rowspan:E.value[u.rowIndex].days.length,colspan:1}:{rowspan:0,colspan:0}},J=(u,t,f,l)=>{v.value.ids=u.ids,v.value.key=u.key,v.value.startDate=u.dateStart,v.value.endDate=u.dateEnd,v.value.name=u.name,v.value.count=u.count,v.value.allCount=()=>u.days.length===0?0:u.days.reduce((g,q,M)=>M!==u.key?g+parseInt(q.count):g,0),v.value.length=u.days.length,v.value.add=u.days.length>0&&u.days[u.days.length-1].count,v.value.level=t.level,v.value.holiday=h.value,Y.value.y=l.clientY,Y.value.x=l.clientX,t.level===2&&t.no<4&&(v.value.add||u.days.length>1)&&(T.value=!0),t.level===3&&(T.value=!0)},O=u=>{let t=p.value[v.value.ids];switch(u){case"add":t.days.push({note:""}),console.log(t.days.length);break;case"delete":delete t.days.pop(),a(v.value.ids);break}T.value=!1},s=u=>{I.value=u,v.value.count=u.count},r=()=>{I.value&&(p.value[v.value.ids].days[v.value.key]={...I.value,note:""},a(v.value.ids)),T.value=!1},a=u=>{x.workSchedule.rewriteFull({year:o.value,code:p.value[u].code,data:p.value[u].days.map(t=>({dateStart:t.dateStart.split(".").reverse().join("-"),dateEnd:t.dateEnd.split(".").reverse().join("-"),note:t.note,count:t.count}))})},i=u=>{x.workSchedule.sendConfirmMessage({fullname:x.fullName,confirm:u}),x.query=""},C=()=>{x.workSchedule.sendAgreementMessage({users:$.value.participants}),c.value=!1};x.workSchedule.getBoss().then(u=>{_.value=u[0].users}),V.holidays().then(u=>{h.value=u,B()});const S=()=>v.value.length<2?[{dateStart:"01.01."+o.value,dateEnd:"31.12."+o.value}]:[{dateStart:"01.01."+o.value,dateEnd:"31.12."+o.value}],K=async()=>{b.value=!0;const u=new le.Workbook,t=u.addWorksheet(o.value.toString(),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),f={vertical:"middle",horizontal:"center"},l={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},g={vertical:"middle",horizontal:"center",wrapText:!0},q={vertical:"middle",horizontal:"right",wrapText:!0};t.mergeCells("D1:G1"),t.mergeCells("D2:G2"),t.mergeCells("D3:G3"),t.mergeCells("D4:G4"),t.mergeCells("A5:G5"),t.mergeCells("A6:G6"),t.mergeCells("A9:G9"),t.mergeCells("A10:A11"),t.mergeCells("B10:B11"),t.mergeCells("C10:C11"),t.mergeCells("D10:F10"),t.mergeCells("G10:G11"),t.getCell("D1").value=n("vacationSchedule.approve"),t.getCell("D2").value=n("vacationSchedule.dateApprove",{year:o.value-1}),t.getCell("D3").value=n("workSchedule.printPlace"),t.getCell("D4").value=n("vacationSchedule.dateApprove",{year:o.value-1}),t.getCell("A5").value=n("workSchedule.firm"),t.getCell("B7").value=n("vacationSchedule.vacationSchedule"),t.getCell("C7").value=n("vacationSchedule.numberDocs"),t.getCell("D7").value=n("vacationSchedule.compilation"),t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("C8").value="",t.getCell("D8").value="",t.getCell("E8").value=o.value,t.getCell("E7").value=n("vacationSchedule.year"),t.getCell("A10").value=n("vacationSchedule.jobTitle"),t.getCell("B10").value=n("vacationSchedule.fullName"),t.getCell("C10").value=n("vacationSchedule.personnelNumber"),t.getCell("D10").value=n("vacationSchedule.vacation"),t.getCell("D11").value=n("vacationSchedule.days"),t.getCell("E11").value=n("vacationSchedule.date"),t.getCell("F11").value=n("vacationSchedule.endDate"),t.getCell("G11").value=n("vacationSchedule.note"),t.getRow(1).height=80,t.getColumn(1).width=28,t.getColumn(2).width=28,t.getColumn(3).width=18,t.getColumn(4).width=18,t.getColumn(5).width=14,t.getColumn(6).width=14,t.getColumn(7).width=14,t.getColumn(1).alignment=g,t.getColumn(2).alignment=g,t.getColumn(3).alignment=g,t.getColumn(4).alignment=g,t.getColumn(5).alignment=g,t.getColumn(6).alignment=g,t.getColumn(7).alignment=g,t.getCell("D1").alignment=q,t.getCell("D2").alignment=q,t.getCell("D4").alignment=q,t.getCell("A5").alignment=f,t.getCell("C7").border=l,t.getCell("D7").border=l,t.getCell("E7").border=l,t.getCell("C8").border=l,t.getCell("D8").border=l,t.getCell("E8").border=l,t.getCell("A10").border=l,t.getCell("B10").border=l,t.getCell("C10").border=l,t.getCell("D10").border=l,t.getCell("G10").border=l,t.getCell("D11").border=l,t.getCell("E11").border=l,t.getCell("F11").border=l;let M=11;for(const w of p.value)if(w.days.length>1)w.days.forEach(j=>{let R=[w.jobTitle,w.name,w.code,j.count,j.dateStart,j.dateEnd,j.note];const Z=t.addRow(R);Z.border=l,M++}),t.mergeCells(`A${M-w.days.length+1}:A${M}`),t.mergeCells(`B${M-w.days.length+1}:B${M}`),t.mergeCells(`C${M-w.days.length+1}:C${M}`);else{let j=[w.jobTitle,w.name,w.code,w.days[0].count,w.days[0].dateStart,w.days[0].dateEnd,w.days[0].note];const R=t.addRow(j);R.border=l,M++}const X="export_"+V.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",H=await u.xlsx.writeBuffer();Q.saveAs(new Blob([H]),X),b.value=!1};return(u,t)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",null,[D.checkEdit?(e.openBlock(),e.createBlock(e.unref(d.ElSelect),{key:0,modelValue:k.value,"onUpdate:modelValue":t[0]||(t[0]=l=>k.value=l),placeholder:"Select",style:{width:"240px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(d.ElButton),{plain:"",onClick:t[1]||(t[1]=l=>m.value=!0),style:{"margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.jobTitle")),1)]),_:1}),e.createVNode(e.unref(d.ElSelect),{modelValue:o.value,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value=l),onChange:B,placeholder:"Year",style:{width:"80px","margin-bottom":".5rem","margin-right":".5rem"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),e.createVNode(e.unref(d.ElSkeleton),{style:{width:"100%"},loading:y.value,animated:""},{template:e.withCtx(()=>[e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"100%",height:"2rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"4rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"4rem"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"8rem","margin-right":"4px"}}),e.createVNode(e.unref(d.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"8rem"}})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTable),{id:"printTable",data:E.value,"span-method":P,onCellClick:J,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(n)("vacationSchedule.emptyText")},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:k.value!=="all"?e.unref(n)("vacationSchedule.title",{name:k.value}):e.unref(n)("vacationSchedule.enterprise")+` ${o.value}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.jobTitle"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].jobTitle),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.fullName"),width:"180",align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.personnelNumber"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.vacation"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.days"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].count),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.date"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.endDate"),align:"center"},{default:e.withCtx(l=>[e.createTextVNode(e.toDisplayString(E.value[l.$index].dateEnd),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(d.ElTableColumn),{label:e.unref(n)("vacationSchedule.note"),align:"center"},{default:e.withCtx(l=>[e.createVNode(e.unref(d.ElInput),{modelValue:p.value[E.value[l.$index].ids].days[E.value[l.$index].key].note,"onUpdate:modelValue":g=>p.value[E.value[l.$index].ids].days[E.value[l.$index].key].note=g,style:{width:"100%"},placeholder:" ",class:"noBorder",onBlur:g=>a(E.value[l.$index].ids)},null,8,["modelValue","onUpdate:modelValue","onBlur"])]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])]),_:1},8,["loading"]),D.checkEdit?(e.openBlock(),e.createElementBlock("div",ye,[F.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,type:"primary",onClick:t[3]||(t[3]=l=>c.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.sendInformation")),1)]),_:1})),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:1,type:"primary",onClick:t[4]||(t[4]=l=>i(!0))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.agreeOn")),1)]),_:1})):e.createCommentVNode("",!0),D.query==="confirm"?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:2,type:"primary",onClick:t[5]||(t[5]=l=>i(!1))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.reject")),1)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(d.ElButton),{disabled:b.value,plain:"",onClick:K,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[f,b.value]]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("workSchedule.jobTitle"),modelValue:m.value,"onUpdate:modelValue":t[7]||(t[7]=l=>m.value=l),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[6]||(t[6]=l=>m.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:N.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSwitch),{modelValue:l.val,"onUpdate:modelValue":g=>l.val=g,"active-text":l.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(d.ElDialog),{title:e.unref(n)("vacationSchedule.pleaseCoordinate"),modelValue:c.value,"onUpdate:modelValue":t[10]||(t[10]=l=>c.value=l),width:"500px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:t[9]||(t[9]=l=>c.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{size:"default",type:"primary",onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.send")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElForm),{model:$.value,autocomplete:"on"},{default:e.withCtx(()=>[e.createVNode(e.unref(d.ElSelect),{modelValue:$.value.participants,"onUpdate:modelValue":t[8]||(t[8]=l=>$.value.participants=l),placeholder:e.unref(n)("vacationSchedule.fullName"),multiple:"",size:"default"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,l=>(e.openBlock(),e.createBlock(e.unref(d.ElOption),{key:l,label:l,value:l},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(G.ContextMenu),{show:T.value,"onUpdate:show":t[14]||(t[14]=l=>T.value=l),options:Y.value},{default:e.withCtx(()=>[e.createVNode(e.unref(G.ContextMenuItem),{label:v.value.level===3&&typeof v.value.count<"u"?v.value.name+" "+v.value.count+" "+e.unref(n)("vacationSchedule.day",v.value.count)+` ${e.unref(n)("vacationSchedule.from")}: ${v.value.allCount()+parseInt(v.value.count)}`:v.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(G.ContextMenuSeparator)),v.value.level===2?(e.openBlock(),e.createElementBlock("div",Ce,[v.value.length>1?(e.openBlock(),e.createBlock(e.unref(G.ContextMenuItem),{key:0,label:e.unref(n)("vacationSchedule.deleteLast"),onClick:t[11]||(t[11]=l=>O("delete"))},null,8,["label"])):e.createCommentVNode("",!0),v.value.add?(e.openBlock(),e.createBlock(e.unref(G.ContextMenuItem),{key:1,label:e.unref(n)("vacationSchedule.addVacation"),onClick:t[12]||(t[12]=l=>O("add"))},null,8,["label"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(he,{data:v.value,range:"range",limitation:S(),onInput:s},null,8,["data","limitation"]),e.createElementVNode("div",null,[e.createVNode(e.unref(d.ElButton),{onClick:t[13]||(t[13]=l=>T.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(d.ElButton),{onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("vacationSchedule.save")),1)]),_:1})])]))]),_:1},8,["show","options"])])}}};module.exports=xe;
|
package/dist/VacationTable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as f, createElementBlock as $, openBlock as h, createElementVNode as p, createCommentVNode as P, toDisplayString as b, unref as a, Fragment as q, renderList as W, normalizeClass as re, watch as ye, computed as Ce, resolveDirective as be, createBlock as B, createVNode as v, withDirectives as De, withCtx as m, createTextVNode as V } from "vue";
|
|
2
|
-
import { p as A, h as Se } from "./index-
|
|
2
|
+
import { p as A, h as Se } from "./index-2Mx6IUGl.js";
|
|
3
3
|
import { useI18n as me } from "vue-i18n";
|
|
4
4
|
import { saveAs as we } from "file-saver";
|
|
5
5
|
import * as xe from "exceljs";
|
package/dist/WorkTable.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),de=require("file-saver"),se=require("exceljs"),v=require("./index-
|
|
2
|
-
`+((h=n.value[l].days[t])==null?void 0:h.time)},W=()=>{n.value=[],I.value=[],E.value=[],p.odata.personal.forEach(a=>{if(a.divisionName===C.value&&V.value.some(l=>l.val&&l.activeText===a.roleName)){let l=v.byInitials(a.employeeName);I.value.push(a.employeeKey),n.value.push({name:l+" ("+a.roleName+")",days:[],contHour:0,code:a.employeeKey,id:!1,ids:n.value.length})}}),p.workSchedule.getUsersYear({code:I.value,year:new Date(w.value).getFullYear()}).then(a=>{a.forEach(l=>{l.dateStart&&E.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),console.log(a),te(),$.value=!1})},te=()=>{p.workSchedule.getWorkSchedule({code:I.value,date:v.parseTime(new Date(w.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)}),M()})},M=()=>{n.value.forEach(a=>{a.contHour=a.days.reduce((l,o)=>l+o.time,0)})},ae=a=>{n.value[a].days=[],M()},ne=a=>{switch(q.value){case"5":for(let l=B.value;l<=u.value.length;l++)u.value[l-1].holidays===""&&N(l,a,!0),u.value[l-1].holidays==="preholiday"&&(m.value-=1,N(l,a,!0),m.value+=1);break;case"2x2":for(let l=B.value;l<=u.value.length;l+=4)N(l,a,!0),l+1<=u.value.length&&N(l+1,a,!0);break;case"2x5":for(let l=B.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,N(o,a,!0),m.value+=1):N(o,a,!0);break}},N=(a,l,o=!1)=>{const{date:d,ind:t}=U(a,l);t===-1?(n.value[l].days.push({day:d,time:m.value,tips:`(${y.value}:00 - ${m.value
|
|
1
|
+
"use strict";const e=require("vue"),de=require("file-saver"),se=require("exceljs"),v=require("./index-Dn3djtwj.cjs"),ve=require("vue-i18n"),i=require("element-plus"),G=require("@imengyu/vue3-context-menu");function ce(k){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(k){for(const S in k)if(S!=="default"){const p=Object.getOwnPropertyDescriptor(k,S);Object.defineProperty(r,S,p.get?p:{enumerable:!0,get:()=>k[S]})}}return r.default=k,Object.freeze(r)}const me=ce(se),ge={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},setup(k){const{t:r,d:S}=ve.useI18n(),p=k,z=e.ref(!1),n=e.ref([]),R=e.ref(new Date().getMonth()+1),j=e.ref(!1),E=e.ref([]),w=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1)),u=e.ref([]),D=e.ref(0),y=e.ref(9),m=e.ref(8),F=e.ref(!1),J=e.ref(!0),$=e.ref(!1),q=e.ref("5"),B=e.ref(1),C=e.ref(""),O=e.ref([]),V=e.ref([]),I=e.ref([]),c=e.ref({name:"Имя",length:0,code:""}),Y=e.ref(!1),P=e.ref({zIndex:30,minWidth:220,x:500,y:200}),Z=e.ref({}),T=e.ref("100%");e.watch(C,async(a,l)=>{a!==l&&(V.value=[],F.value=!1,p.odata.personal.forEach(o=>{o.divisionName===a&&(V.value.some(d=>(d==null?void 0:d.activeText)===o.roleName)||V.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,w.value=new Date(new Date().getFullYear(),o,1),K()});const _=(a,l,o,d)=>{c.value.ids=a.ids,c.value.key=a.key,c.value.add=a.days.length>0&&a.days[a.days.length-1].cont,c.value.level=l.level,c.value.day=o.cellIndex,P.value.y=d.clientY,P.value.x=d.clientX,l.level===2&&l.no===0&&p.checkEdit&&(c.value.name=r("workSchedule.autocomplete"),Y.value=!0),l.level===3&&o.cellIndex-l.no===1&&p.checkEdit&&(N(o.cellIndex,a.ids),c.value.name=r("workSchedule.modeSelection"),Y.value=!0)},ee=({row:a,columnIndex:l})=>{if(!E.value||E.value.length===0||!j.value)return"";const o=new Date(new Date(w.value).getFullYear(),new Date(w.value).getMonth(),l).getTime()+1e3;for(let d of E.value){const{dateStart:t,dateEnd:s,code:g}=d;if(t&&s&&g===a.code&&l!==0&&l<=u.value.length){const h=new Date(v.parseDate(t)).getTime(),b=new Date(v.parseDate(s)).getTime();if(o>=h&&o<=b)return"vacation"}}return""},K=()=>{const a=Z.value,l=new Date(w.value),o=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let d=[],t=0;for(let s=1;s<=o;s++){const g=v.parseTime(l.setDate(s),"{Y}-{m}-{dd}");t+=a.nowork.includes(g)||a.holidays.includes(g)?0:a.preholidays.includes(g)?7:8;const h=a.nowork.includes(g)?"nowork":a.holidays.includes(g)?"holiday":a.preholidays.includes(g)?"preholiday":"";d.push({day:s,holidays:h,weekday:S(new Date(l.getFullYear(),l.getMonth(),s),"day")})}D.value=t,u.value=d,p.odata.getPersonal({}).then(s=>{var g;C.value.length===0&&(C.value=(g=s.find(h=>h.employeeName===p.fullName))==null?void 0:g.divisionName),s.forEach((h,b)=>{O.value.some(x=>(x==null?void 0:x.value)===h.divisionName)||O.value.push({value:h.divisionName,label:h.divisionName,key:b}),h.divisionName===C.value&&!V.value.some(x=>(x==null?void 0:x.activeText)===h.roleName)&&V.value.push({val:!0,activeText:h.roleName})}),W(),J.value=!1})},le=e.computed(()=>!n.value.some(a=>a.contHour!==D.value)),Q=(a,l)=>{var s,g,h;const o=new Date(w.value),d=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,t=(s=n.value[l])==null?void 0:s.days.findIndex(b=>b.day===d);return l===-1||t===-1?"":((g=n.value[l].days[t])==null?void 0:g.tips)+`
|
|
2
|
+
`+((h=n.value[l].days[t])==null?void 0:h.time)},W=()=>{n.value=[],I.value=[],E.value=[],p.odata.personal.forEach(a=>{if(a.divisionName===C.value&&V.value.some(l=>l.val&&l.activeText===a.roleName)){let l=v.byInitials(a.employeeName);I.value.push(a.employeeKey),n.value.push({name:l+" ("+a.roleName+")",days:[],contHour:0,code:a.employeeKey,id:!1,ids:n.value.length})}}),p.workSchedule.getUsersYear({code:I.value,year:new Date(w.value).getFullYear()}).then(a=>{a.forEach(l=>{l.dateStart&&E.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),console.log(a),te(),$.value=!1})},te=()=>{p.workSchedule.getWorkSchedule({code:I.value,date:v.parseTime(new Date(w.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)}),M()})},M=()=>{n.value.forEach(a=>{a.contHour=a.days.reduce((l,o)=>l+o.time,0)})},ae=a=>{n.value[a].days=[],M()},ne=a=>{switch(q.value){case"5":for(let l=B.value;l<=u.value.length;l++)u.value[l-1].holidays===""&&N(l,a,!0),u.value[l-1].holidays==="preholiday"&&(m.value-=1,N(l,a,!0),m.value+=1);break;case"2x2":for(let l=B.value;l<=u.value.length;l+=4)N(l,a,!0),l+1<=u.value.length&&N(l+1,a,!0);break;case"2x5":for(let l=B.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,N(o,a,!0),m.value+=1):N(o,a,!0);break}},N=(a,l,o=!1)=>{const{date:d,ind:t}=U(a,l);t===-1?(n.value[l].days.push({day:d,time:m.value,tips:`(${y.value}:00 - ${m.value>=22?y.value+m.value+2:y.value+m.value+1}:00)`}),M()):o||(m.value=n.value[l].days[t].time,y.value=parseInt(n.value[l].days[t].tips.slice(1,-12)))},oe=(a,l)=>{const{ind:o}=U(a,l);n.value[l].days.splice(o,1),M(),document.querySelector(".app-main").click()},X=(a,l)=>{const{date:o,ind:d}=U(a,l);n.value[l].days[d]={day:o,time:m.value,tips:`(${y.value}:00 - ${m.value>=22?y.value+m.value+2:y.value+m.value+1}:00)`},M()},U=(a,l)=>{var t;const o=v.parseTime(new Date(w.value).setDate(a),"{Y}-{m}-{dd}"),d=(t=n.value[l])==null?void 0:t.days.findIndex(s=>s.day===o);return{date:o,ind:d}},ue=async()=>{var x;z.value=!0;const a=new me.Workbook,l=a.addWorksheet(S(w.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:${v.cellsDynamically("A1",u.value.length+5)}1`),l.mergeCells(`A2:${v.cellsDynamically("A2",u.value.length+5)}2`),l.mergeCells("A3:A4"),l.mergeCells(`B3:${v.cellsDynamically("B3",u.value.length)}3`),l.mergeCells(`${v.cellsDynamically("B3",u.value.length+1)}3:${v.cellsDynamically("B3",u.value.length+2)}3`),l.mergeCells(`${v.cellsDynamically("B3",u.value.length+3)}3:${v.cellsDynamically("B4",u.value.length+3)}4`),l.mergeCells(`${v.cellsDynamically("B3",u.value.length+4)}3:${v.cellsDynamically("B4",u.value.length+4)}4`),l.getCell("A1").value=r("workSchedule.firm"),l.getCell("A2").value=r("workSchedule.title",{name:C.value})+S(w.value,"month")+` ${new Date(w.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")} (${D.value})`;for(let f=2;f<=u.value.length+1;f++)l.getCell(4,f).value=u.value[f-2].weekday+`
|
|
3
3
|
`+(f-1),l.getColumn(f).width=6,l.getColumn(f).alignment=t,l.getCell(4,f).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 s=0;for(const f of n.value){let H=[f.name];for(let A=1;A<=u.value.length;A++){const{ind:L}=U(A,s);L!==-1?H[A]=`${f.days[L].time} ${f.days[L].tips}`:H[A]=" "}H.push(((x=f.days)==null?void 0:x.length)||" ",f.contHour||0);const ie=l.addRow(H);ie.border=d,s++}let g="Щербина Е. В.";p.odata.personal.forEach(f=>{f.roleName==="Начальник отдела правовой и кадровой работы"&&(g=f.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=v.byInitials(p.fullName),l.getCell(`AD${n.value.length+8}`).value=v.byInitials(g),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 h="export_"+v.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",b=await a.xlsx.writeBuffer();de.saveAs(new Blob([b]),h),z.value=!1},re=async()=>{F.value||p.workSchedule.addWorkSchedule({data:n.value,date:v.parseTime(new Date(w.value),"{Y}-{m}-{dd}"),group:C.value}).then(a=>F.value=a)};return p.group&&(C.value=p.group),v.holidays().then(a=>{Z.value=a,K()}),(a,l)=>{const o=e.resolveComponent("el-date-picker"),d=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",ge,[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=>$.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:T.value,"onUpdate:modelValue":l[3]||(l[3]=t=>T.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:J.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":T.value,size:"small",align:"center",onCellClick:_,"empty-text":e.unref(r)("workSchedule.emptyText"),"cell-class-name":ee},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.title",{name:C.value})+e.unref(S)(w.value,"month")+` ${new Date(w.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:T.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
|
-
`+t.day.toString(),prop:"vacation"},{default:e.withCtx(s=>[e.createElementVNode("div",pe,e.toDisplayString(Q(t.day,s.$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:T.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")} ( ${D.value} )`,align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",{style:e.normalizeStyle(`color: ${D.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"]),le.value&&k.checkEdit?(e.openBlock(),e.createElementBlock("div",ye,[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.chartsFilled"))+": ",1),F.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:0,type:"primary",onClick:re},{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:z.value,plain:"",onClick:ue,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[d,z.value]]),e.createVNode(e.unref(i.ElDialog),{title:e.unref(r)("workSchedule.jobTitle"),modelValue:$.value,"onUpdate:modelValue":l[6]||(l[6]=t=>$.value=t),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(i.ElButton),{onClick:l[5]||(l[5]=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:V.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.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":s=>t.val=s,"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(G.ContextMenu),{show:Y.value,"onUpdate:show":l[18]||(l[18]=t=>Y.value=t),options:P.value},{default:e.withCtx(()=>[e.createVNode(e.unref(G.ContextMenuItem),{label:c.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(G.ContextMenuSeparator)),c.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:B.value,"onUpdate:modelValue":l[8]||(l[8]=t=>B.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:y.value,"onUpdate:modelValue":l[9]||(l[9]=t=>y.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:
|
|
4
|
+
`+t.day.toString(),prop:"vacation"},{default:e.withCtx(s=>[e.createElementVNode("div",pe,e.toDisplayString(Q(t.day,s.$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:T.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")} ( ${D.value} )`,align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",{style:e.normalizeStyle(`color: ${D.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"]),le.value&&k.checkEdit?(e.openBlock(),e.createElementBlock("div",ye,[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.chartsFilled"))+": ",1),F.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:0,type:"primary",onClick:re},{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:z.value,plain:"",onClick:ue,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[d,z.value]]),e.createVNode(e.unref(i.ElDialog),{title:e.unref(r)("workSchedule.jobTitle"),modelValue:$.value,"onUpdate:modelValue":l[6]||(l[6]=t=>$.value=t),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(i.ElButton),{onClick:l[5]||(l[5]=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:V.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.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":s=>t.val=s,"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(G.ContextMenu),{show:Y.value,"onUpdate:show":l[18]||(l[18]=t=>Y.value=t),options:P.value},{default:e.withCtx(()=>[e.createVNode(e.unref(G.ContextMenuItem),{label:c.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(G.ContextMenuSeparator)),c.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:B.value,"onUpdate:modelValue":l[8]||(l[8]=t=>B.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:y.value,"onUpdate:modelValue":l[9]||(l[9]=t=>y.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(v.clamp)(y.value!==1?23-y.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=>ne(c.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=>ae(c.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(Q(c.value.day,c.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:y.value,"onUpdate:modelValue":l[13]||(l[13]=t=>y.value=t),step:1,min:0,max:19,onChange:l[14]||(l[14]=t=>X(c.value.day,c.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(v.clamp)(y.value!==1?23-y.value:21,4,22),onChange:l[16]||(l[16]=t=>X(c.value.day,c.value.ids))},null,8,["modelValue","max"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[17]||(l[17]=t=>oe(c.value.day,c.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
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ref as s, watch as ye, computed as
|
|
2
|
-
import { saveAs as
|
|
3
|
-
import * as
|
|
4
|
-
import { p as j, b as re, h as
|
|
5
|
-
import { useI18n as
|
|
6
|
-
import { ElSelect as
|
|
7
|
-
import { ContextMenu as
|
|
8
|
-
const
|
|
1
|
+
import { ref as s, watch as ye, computed as Ae, resolveComponent as Me, resolveDirective as Be, createElementBlock as B, openBlock as C, createElementVNode as x, createVNode as i, createCommentVNode as _, withDirectives as Te, createBlock as T, unref as a, withCtx as v, Fragment as de, renderList as ie, createTextVNode as b, toDisplayString as m, normalizeStyle as ze } from "vue";
|
|
2
|
+
import { saveAs as Fe } from "file-saver";
|
|
3
|
+
import * as Ye from "exceljs";
|
|
4
|
+
import { p as j, b as re, h as Ue, c as fe, a as we, d as D } from "./index-2Mx6IUGl.js";
|
|
5
|
+
import { useI18n as Ie } from "vue-i18n";
|
|
6
|
+
import { ElSelect as He, ElOption as Re, ElButton as N, ElSwitch as ve, ElSkeleton as We, ElTable as Pe, ElTableColumn as z, ElSkeletonItem as O, ElDialog as je, ElForm as Oe, ElFormItem as Ge, ElRadioGroup as Le, ElRadioButton as se, ElSlider as G } from "element-plus";
|
|
7
|
+
import { ContextMenu as Ze, ContextMenuItem as qe, ContextMenuSeparator as Je } from "@imengyu/vue3-context-menu";
|
|
8
|
+
const Ke = { class: "work" }, Qe = { class: "nav" }, Xe = { style: { height: "100px", width: "100%", display: "inline-block" } }, _e = { style: { height: "100px", width: "100%", display: "inline-block" } }, el = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "controls-container",
|
|
11
11
|
style: { "margin-top": ".5rem" }
|
|
12
|
-
},
|
|
12
|
+
}, ll = {
|
|
13
13
|
key: 0,
|
|
14
14
|
style: { padding: "0.5em 1.5em" }
|
|
15
|
-
},
|
|
15
|
+
}, tl = {
|
|
16
16
|
key: 1,
|
|
17
17
|
style: { padding: "0.5em 1.5em" }
|
|
18
|
-
},
|
|
18
|
+
}, rl = {
|
|
19
19
|
__name: "WorkTable",
|
|
20
20
|
props: {
|
|
21
21
|
checkEdit: { type: Boolean, default: () => !0 },
|
|
@@ -25,7 +25,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
25
25
|
group: String
|
|
26
26
|
},
|
|
27
27
|
setup(F) {
|
|
28
|
-
const { t: d, d: L } =
|
|
28
|
+
const { t: d, d: L } = Ie(), S = F, Z = s(!1), n = s([
|
|
29
29
|
// { name: 'Иванов П.М. (Ведущий работник месяца)',
|
|
30
30
|
// days: [], // {day: "2024-11-01", tips: '(9:00 - 18:00)', time: 8 }
|
|
31
31
|
// contHour: 0,
|
|
@@ -52,15 +52,15 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
52
52
|
let e = (/* @__PURE__ */ new Date()).getMonth(), o = t === null ? e : t - 1;
|
|
53
53
|
o = e - 1 <= o ? o : o + 12, k.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), o, 1), he();
|
|
54
54
|
});
|
|
55
|
-
const
|
|
55
|
+
const ke = (t, e, o, r) => {
|
|
56
56
|
h.value.ids = t.ids, h.value.key = t.key, h.value.add = t.days.length > 0 && t.days[t.days.length - 1].cont, h.value.level = e.level, h.value.day = o.cellIndex, ne.value.y = r.clientY, ne.value.x = r.clientX, e.level === 2 && e.no === 0 && S.checkEdit && (h.value.name = d("workSchedule.autocomplete"), K.value = !0), e.level === 3 && o.cellIndex - e.no === 1 && S.checkEdit && (A(o.cellIndex, t.ids), h.value.name = d("workSchedule.modeSelection"), K.value = !0);
|
|
57
|
-
},
|
|
57
|
+
}, Ce = ({ row: t, columnIndex: e }) => {
|
|
58
58
|
if (!Y.value || Y.value.length === 0 || !le.value) return "";
|
|
59
59
|
const o = new Date(new Date(k.value).getFullYear(), new Date(k.value).getMonth(), e).getTime() + 1e3;
|
|
60
60
|
for (let r of Y.value) {
|
|
61
61
|
const { dateStart: l, dateEnd: g, code: p } = r;
|
|
62
62
|
if (l && g && p === t.code && e !== 0 && e <= u.value.length) {
|
|
63
|
-
const y = new Date(
|
|
63
|
+
const y = new Date(we(l)).getTime(), M = new Date(we(g)).getTime();
|
|
64
64
|
if (o >= y && o <= M) return "vacation";
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -80,7 +80,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
80
80
|
ae.value.some((V) => (V == null ? void 0 : V.value) === y.divisionName) || ae.value.push({ value: y.divisionName, label: y.divisionName, key: M }), y.divisionName === $.value && !E.value.some((V) => (V == null ? void 0 : V.activeText) === y.roleName) && E.value.push({ val: !0, activeText: y.roleName });
|
|
81
81
|
}), oe(), ge.value = !1;
|
|
82
82
|
});
|
|
83
|
-
},
|
|
83
|
+
}, xe = Ae(() => !n.value.some((t) => t.contHour !== U.value)), ce = (t, e) => {
|
|
84
84
|
var g, p, y;
|
|
85
85
|
const o = new Date(k.value), r = `${o.getFullYear()}-${(o.getMonth() + 1).toString().padStart(2, "0")}-${t.toString().padStart(2, "0")}`, l = (g = n.value[e]) == null ? void 0 : g.days.findIndex((M) => M.day === r);
|
|
86
86
|
return e === -1 || l === -1 ? "" : ((p = n.value[e].days[l]) == null ? void 0 : p.tips) + `
|
|
@@ -94,9 +94,9 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
94
94
|
}), S.workSchedule.getUsersYear({ code: J.value, year: new Date(k.value).getFullYear() }).then((t) => {
|
|
95
95
|
t.forEach((e) => {
|
|
96
96
|
e.dateStart && Y.value.push({ code: e.code, dateStart: e.dateStart, dateEnd: e.dateEnd });
|
|
97
|
-
}), console.log(t),
|
|
97
|
+
}), console.log(t), Se(), I.value = !1;
|
|
98
98
|
});
|
|
99
|
-
},
|
|
99
|
+
}, Se = () => {
|
|
100
100
|
S.workSchedule.getWorkSchedule({ code: J.value, date: j(new Date(k.value), "{Y}-{m}-{dd}") }).then(
|
|
101
101
|
(t) => {
|
|
102
102
|
t.forEach((e, o) => {
|
|
@@ -108,9 +108,9 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
108
108
|
n.value.forEach((t) => {
|
|
109
109
|
t.contHour = t.days.reduce((e, o) => e + o.time, 0);
|
|
110
110
|
});
|
|
111
|
-
}, Se = (t) => {
|
|
112
|
-
n.value[t].days = [], W();
|
|
113
111
|
}, $e = (t) => {
|
|
112
|
+
n.value[t].days = [], W();
|
|
113
|
+
}, be = (t) => {
|
|
114
114
|
switch (te.value) {
|
|
115
115
|
case "5":
|
|
116
116
|
for (let e = H.value; e <= u.value.length; e++)
|
|
@@ -131,9 +131,9 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
131
131
|
l === -1 ? (n.value[e].days.push({
|
|
132
132
|
day: r,
|
|
133
133
|
time: c.value,
|
|
134
|
-
tips: `(${w.value}:00 - ${c.value
|
|
134
|
+
tips: `(${w.value}:00 - ${c.value >= 22 ? w.value + c.value + 2 : w.value + c.value + 1}:00)`
|
|
135
135
|
}), W()) : o || (c.value = n.value[e].days[l].time, w.value = parseInt(n.value[e].days[l].tips.slice(1, -12)));
|
|
136
|
-
},
|
|
136
|
+
}, Ve = (t, e) => {
|
|
137
137
|
const { ind: o } = Q(t, e);
|
|
138
138
|
n.value[e].days.splice(o, 1), W(), document.querySelector(".app-main").click();
|
|
139
139
|
}, pe = (t, e) => {
|
|
@@ -141,16 +141,16 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
141
141
|
n.value[e].days[r] = {
|
|
142
142
|
day: o,
|
|
143
143
|
time: c.value,
|
|
144
|
-
tips: `(${w.value}:00 - ${c.value
|
|
144
|
+
tips: `(${w.value}:00 - ${c.value >= 22 ? w.value + c.value + 2 : w.value + c.value + 1}:00)`
|
|
145
145
|
}, W();
|
|
146
146
|
}, Q = (t, e) => {
|
|
147
147
|
var l;
|
|
148
148
|
const o = j(new Date(k.value).setDate(t), "{Y}-{m}-{dd}"), r = (l = n.value[e]) == null ? void 0 : l.days.findIndex((g) => g.day === o);
|
|
149
149
|
return { date: o, ind: r };
|
|
150
|
-
},
|
|
150
|
+
}, De = async () => {
|
|
151
151
|
var V;
|
|
152
152
|
Z.value = !0;
|
|
153
|
-
const t = new
|
|
153
|
+
const t = new Ye.Workbook(), e = t.addWorksheet(L(k.value, "month"), { pageSetup: { paperSize: 9, orientation: "landscape", fitToPage: !0 } }), o = { vertical: "middle", horizontal: "center" }, r = { top: { style: "thin" }, left: { style: "thin" }, bottom: { style: "thin" }, right: { style: "thin" } }, l = { vertical: "middle", horizontal: "center", wrapText: !0 };
|
|
154
154
|
e.mergeCells(`A1:${D("A1", u.value.length + 5)}1`), e.mergeCells(`A2:${D("A2", u.value.length + 5)}2`), e.mergeCells("A3:A4"), e.mergeCells(`B3:${D("B3", u.value.length)}3`), e.mergeCells(`${D("B3", u.value.length + 1)}3:${D("B3", u.value.length + 2)}3`), e.mergeCells(`${D("B3", u.value.length + 3)}3:${D("B4", u.value.length + 3)}4`), e.mergeCells(`${D("B3", u.value.length + 4)}3:${D("B4", u.value.length + 4)}4`), e.getCell("A1").value = d("workSchedule.firm"), e.getCell("A2").value = d("workSchedule.title", { name: $.value }) + L(k.value, "month") + ` ${new Date(k.value).getFullYear()}`, e.getCell("A3").value = d("workSchedule.month"), e.getCell("B3").value = d("workSchedule.numbersMonth"), e.getCell(3, u.value.length + 2).value = d("workSchedule.onSchedule"), e.getCell(3, u.value.length + 4).value = d("workSchedule.acquainted"), e.getCell(3, u.value.length + 5).value = d("workSchedule.date"), e.getCell(4, u.value.length + 2).value = d("workSchedule.days"), e.getCell(4, u.value.length + 3).value = `${d("workSchedule.hours")} (${U.value})`;
|
|
155
155
|
for (let f = 2; f <= u.value.length + 1; f++)
|
|
156
156
|
e.getCell(4, f).value = u.value[f - 2].weekday + `
|
|
@@ -164,25 +164,25 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
164
164
|
ue !== -1 ? X[P] = `${f.days[ue].time} ${f.days[ue].tips}` : X[P] = " ";
|
|
165
165
|
}
|
|
166
166
|
X.push(((V = f.days) == null ? void 0 : V.length) || " ", f.contHour || 0);
|
|
167
|
-
const
|
|
168
|
-
|
|
167
|
+
const Ne = e.addRow(X);
|
|
168
|
+
Ne.border = r, g++;
|
|
169
169
|
}
|
|
170
170
|
let p = "Щербина Е. В.";
|
|
171
171
|
S.odata.personal.forEach((f) => {
|
|
172
172
|
f.roleName === "Начальник отдела правовой и кадровой работы" && (p = f.employeeName);
|
|
173
173
|
}), e.mergeCells(`A${n.value.length + 6}:P${n.value.length + 6}`), e.mergeCells(`Q${n.value.length + 6}:AG${n.value.length + 6}`), e.mergeCells(`B${n.value.length + 8}:E${n.value.length + 8}`), e.mergeCells(`F${n.value.length + 8}:L${n.value.length + 8}`), e.mergeCells(`M${n.value.length + 8}:P${n.value.length + 8}`), e.mergeCells(`S${n.value.length + 8}:V${n.value.length + 8}`), e.mergeCells(`W${n.value.length + 8}:AC${n.value.length + 8}`), e.mergeCells(`AD${n.value.length + 8}:AG${n.value.length + 8}`), e.mergeCells(`Z${n.value.length + 9}:AA${n.value.length + 9}`), e.getCell(`A${n.value.length + 6}`).value = d("workSchedule.byInitials"), e.getCell(`Q${n.value.length + 6}`).value = d("workSchedule.supervisorHR"), e.getCell(`B${n.value.length + 8}`).value = d("workSchedule.compiled") + ":", e.getCell(`S${n.value.length + 8}`).value = d("workSchedule.approved") + ":", e.getCell(`M${n.value.length + 8}`).value = re(S.fullName), e.getCell(`AD${n.value.length + 8}`).value = re(p), e.getCell(`Z${n.value.length + 9}`).value = d("workSchedule.printPlace"), e.getCell(`A${n.value.length + 6}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`Q${n.value.length + 6}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`B${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`F${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`M${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "left" }, e.getCell(`AD${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "left" }, e.getCell(`Z${n.value.length + 9}`).alignment = o, e.getCell(`F${n.value.length + 8}`).border = { bottom: { style: "thin" } }, e.getCell(`W${n.value.length + 8}`).border = { bottom: { style: "thin" } };
|
|
174
174
|
const y = "export_" + j(Date.now(), "{dd}.{m}.{Y}") + ".xlsx", M = await t.xlsx.writeBuffer();
|
|
175
|
-
|
|
176
|
-
},
|
|
175
|
+
Fe(new Blob([M]), y), Z.value = !1;
|
|
176
|
+
}, Ee = async () => {
|
|
177
177
|
q.value || S.workSchedule.addWorkSchedule({ data: n.value, date: j(new Date(k.value), "{Y}-{m}-{dd}"), group: $.value }).then((t) => q.value = t);
|
|
178
178
|
};
|
|
179
|
-
return S.group && ($.value = S.group),
|
|
179
|
+
return S.group && ($.value = S.group), Ue().then((t) => {
|
|
180
180
|
me.value = t, he();
|
|
181
181
|
}), (t, e) => {
|
|
182
|
-
const o =
|
|
183
|
-
return C(), B("div",
|
|
184
|
-
x("div",
|
|
185
|
-
F.checkEdit ? (C(), T(a(
|
|
182
|
+
const o = Me("el-date-picker"), r = Be("loading");
|
|
183
|
+
return C(), B("div", Ke, [
|
|
184
|
+
x("div", Qe, [
|
|
185
|
+
F.checkEdit ? (C(), T(a(He), {
|
|
186
186
|
key: 0,
|
|
187
187
|
modelValue: $.value,
|
|
188
188
|
"onUpdate:modelValue": e[0] || (e[0] = (l) => $.value = l),
|
|
@@ -190,7 +190,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
190
190
|
style: { width: "240px" }
|
|
191
191
|
}, {
|
|
192
192
|
default: v(() => [
|
|
193
|
-
(C(!0), B(de, null, ie(ae.value, (l) => (C(), T(a(
|
|
193
|
+
(C(!0), B(de, null, ie(ae.value, (l) => (C(), T(a(Re), {
|
|
194
194
|
key: l.key,
|
|
195
195
|
label: l.label,
|
|
196
196
|
value: l.value
|
|
@@ -232,7 +232,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
232
232
|
"inactive-value": !1
|
|
233
233
|
}, null, 8, ["modelValue"])
|
|
234
234
|
]),
|
|
235
|
-
i(a(
|
|
235
|
+
i(a(We), {
|
|
236
236
|
style: { width: "100%" },
|
|
237
237
|
loading: ge.value,
|
|
238
238
|
animated: ""
|
|
@@ -260,16 +260,16 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
260
260
|
})
|
|
261
261
|
]),
|
|
262
262
|
default: v(() => [
|
|
263
|
-
i(a(
|
|
263
|
+
i(a(Pe), {
|
|
264
264
|
id: "printTable",
|
|
265
265
|
data: n.value,
|
|
266
266
|
style: { width: "100%" },
|
|
267
267
|
"max-height": R.value,
|
|
268
268
|
size: "small",
|
|
269
269
|
align: "center",
|
|
270
|
-
onCellClick:
|
|
270
|
+
onCellClick: ke,
|
|
271
271
|
"empty-text": a(d)("workSchedule.emptyText"),
|
|
272
|
-
"cell-class-name":
|
|
272
|
+
"cell-class-name": Ce
|
|
273
273
|
}, {
|
|
274
274
|
default: v(() => [
|
|
275
275
|
i(a(z), {
|
|
@@ -285,7 +285,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
285
285
|
fixed: R.value !== "100%"
|
|
286
286
|
}, {
|
|
287
287
|
default: v((l) => [
|
|
288
|
-
x("div",
|
|
288
|
+
x("div", Xe, m(n.value[l.$index].name), 1)
|
|
289
289
|
]),
|
|
290
290
|
_: 1
|
|
291
291
|
}, 8, ["label", "fixed"]),
|
|
@@ -304,7 +304,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
304
304
|
prop: "vacation"
|
|
305
305
|
}, {
|
|
306
306
|
default: v((g) => [
|
|
307
|
-
x("div",
|
|
307
|
+
x("div", _e, m(ce(l.day, g.$index) || " "), 1)
|
|
308
308
|
]),
|
|
309
309
|
_: 2
|
|
310
310
|
}, 1032, ["class-name", "label"]))), 128))
|
|
@@ -332,7 +332,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
332
332
|
}, {
|
|
333
333
|
default: v((l) => [
|
|
334
334
|
x("div", {
|
|
335
|
-
style:
|
|
335
|
+
style: ze(`color: ${U.value === l.row.contHour ? "green" : "red"};`)
|
|
336
336
|
}, m(l.row.contHour), 5)
|
|
337
337
|
]),
|
|
338
338
|
_: 1
|
|
@@ -349,12 +349,12 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
349
349
|
]),
|
|
350
350
|
_: 1
|
|
351
351
|
}, 8, ["loading"]),
|
|
352
|
-
|
|
352
|
+
xe.value && F.checkEdit ? (C(), B("div", el, [
|
|
353
353
|
b(m(a(d)("workSchedule.chartsFilled")) + ": ", 1),
|
|
354
354
|
q.value ? _("", !0) : (C(), T(a(N), {
|
|
355
355
|
key: 0,
|
|
356
356
|
type: "primary",
|
|
357
|
-
onClick:
|
|
357
|
+
onClick: Ee
|
|
358
358
|
}, {
|
|
359
359
|
default: v(() => [
|
|
360
360
|
b(m(a(d)("workSchedule.confirm")), 1)
|
|
@@ -364,10 +364,10 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
364
364
|
e[20] || (e[20] = b()),
|
|
365
365
|
x("span", null, m(F.fullName), 1)
|
|
366
366
|
])) : _("", !0),
|
|
367
|
-
|
|
367
|
+
Te((C(), T(a(N), {
|
|
368
368
|
disabled: Z.value,
|
|
369
369
|
plain: "",
|
|
370
|
-
onClick:
|
|
370
|
+
onClick: De,
|
|
371
371
|
style: { "margin-top": ".5rem" }
|
|
372
372
|
}, {
|
|
373
373
|
default: v(() => [
|
|
@@ -377,7 +377,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
377
377
|
}, 8, ["disabled"])), [
|
|
378
378
|
[r, Z.value]
|
|
379
379
|
]),
|
|
380
|
-
i(a(
|
|
380
|
+
i(a(je), {
|
|
381
381
|
title: a(d)("workSchedule.jobTitle"),
|
|
382
382
|
modelValue: I.value,
|
|
383
383
|
"onUpdate:modelValue": e[6] || (e[6] = (l) => I.value = l),
|
|
@@ -405,13 +405,13 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
405
405
|
})
|
|
406
406
|
]),
|
|
407
407
|
default: v(() => [
|
|
408
|
-
i(a(
|
|
408
|
+
i(a(Oe), {
|
|
409
409
|
ref: "dialogForm",
|
|
410
410
|
model: E.value,
|
|
411
411
|
autocomplete: "on"
|
|
412
412
|
}, {
|
|
413
413
|
default: v(() => [
|
|
414
|
-
(C(!0), B(de, null, ie(E.value, (l) => (C(), T(a(
|
|
414
|
+
(C(!0), B(de, null, ie(E.value, (l) => (C(), T(a(Ge), null, {
|
|
415
415
|
default: v(() => [
|
|
416
416
|
i(a(ve), {
|
|
417
417
|
modelValue: l.val,
|
|
@@ -427,19 +427,19 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
427
427
|
]),
|
|
428
428
|
_: 1
|
|
429
429
|
}, 8, ["title", "modelValue"]),
|
|
430
|
-
i(a(
|
|
430
|
+
i(a(Ze), {
|
|
431
431
|
show: K.value,
|
|
432
432
|
"onUpdate:show": e[18] || (e[18] = (l) => K.value = l),
|
|
433
433
|
options: ne.value
|
|
434
434
|
}, {
|
|
435
435
|
default: v(() => [
|
|
436
|
-
i(a(
|
|
436
|
+
i(a(qe), {
|
|
437
437
|
label: h.value.name,
|
|
438
438
|
disabled: ""
|
|
439
439
|
}, null, 8, ["label"]),
|
|
440
|
-
i(a(
|
|
441
|
-
h.value.level === 2 ? (C(), B("div",
|
|
442
|
-
i(a(
|
|
440
|
+
i(a(Je)),
|
|
441
|
+
h.value.level === 2 ? (C(), B("div", ll, [
|
|
442
|
+
i(a(Le), {
|
|
443
443
|
modelValue: te.value,
|
|
444
444
|
"onUpdate:modelValue": e[7] || (e[7] = (l) => te.value = l),
|
|
445
445
|
size: "small"
|
|
@@ -483,12 +483,12 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
483
483
|
"onUpdate:modelValue": e[10] || (e[10] = (l) => c.value = l),
|
|
484
484
|
step: 1,
|
|
485
485
|
min: 4,
|
|
486
|
-
max:
|
|
486
|
+
max: a(fe)(w.value !== 1 ? 23 - w.value : 21, 4, 22)
|
|
487
487
|
}, null, 8, ["modelValue", "max"]),
|
|
488
488
|
i(a(N), {
|
|
489
489
|
style: { "margin-top": ".5rem" },
|
|
490
490
|
size: "small",
|
|
491
|
-
onClick: e[11] || (e[11] = (l) =>
|
|
491
|
+
onClick: e[11] || (e[11] = (l) => be(h.value.ids))
|
|
492
492
|
}, {
|
|
493
493
|
default: v(() => [
|
|
494
494
|
b(m(a(d)("workSchedule.fillOut")), 1)
|
|
@@ -498,14 +498,14 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
498
498
|
i(a(N), {
|
|
499
499
|
style: { "margin-top": ".5rem" },
|
|
500
500
|
size: "small",
|
|
501
|
-
onClick: e[12] || (e[12] = (l) =>
|
|
501
|
+
onClick: e[12] || (e[12] = (l) => $e(h.value.ids))
|
|
502
502
|
}, {
|
|
503
503
|
default: v(() => [
|
|
504
504
|
b(m(a(d)("workSchedule.clearRow")), 1)
|
|
505
505
|
]),
|
|
506
506
|
_: 1
|
|
507
507
|
})
|
|
508
|
-
])) : (C(), B("div",
|
|
508
|
+
])) : (C(), B("div", tl, [
|
|
509
509
|
x("div", null, m(ce(h.value.day, h.value.ids)), 1),
|
|
510
510
|
e[22] || (e[22] = x("br", null, null, -1)),
|
|
511
511
|
x("span", null, m(a(d)("workSchedule.with")) + ":", 1),
|
|
@@ -523,13 +523,13 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
523
523
|
"onUpdate:modelValue": e[15] || (e[15] = (l) => c.value = l),
|
|
524
524
|
step: 1,
|
|
525
525
|
min: 4,
|
|
526
|
-
max:
|
|
526
|
+
max: a(fe)(w.value !== 1 ? 23 - w.value : 21, 4, 22),
|
|
527
527
|
onChange: e[16] || (e[16] = (l) => pe(h.value.day, h.value.ids))
|
|
528
528
|
}, null, 8, ["modelValue", "max"]),
|
|
529
529
|
i(a(N), {
|
|
530
530
|
style: { "margin-top": ".5rem" },
|
|
531
531
|
size: "small",
|
|
532
|
-
onClick: e[17] || (e[17] = (l) =>
|
|
532
|
+
onClick: e[17] || (e[17] = (l) => Ve(h.value.day, h.value.ids))
|
|
533
533
|
}, {
|
|
534
534
|
default: v(() => [
|
|
535
535
|
b(m(a(d)("workSchedule.delete")), 1)
|
|
@@ -545,5 +545,5 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
545
545
|
}
|
|
546
546
|
};
|
|
547
547
|
export {
|
|
548
|
-
|
|
548
|
+
rl as default
|
|
549
549
|
};
|
|
@@ -2,10 +2,10 @@ import u from "js-cookie";
|
|
|
2
2
|
function h(t, e) {
|
|
3
3
|
if (arguments.length === 0 || !t)
|
|
4
4
|
return null;
|
|
5
|
-
const
|
|
5
|
+
const a = e || "{Y}-{m}-{d} {G}:{i}:{s}";
|
|
6
6
|
let r;
|
|
7
7
|
typeof t == "object" ? r = t : (typeof t == "string" && (/^[0-9]+$/.test(t) ? t = parseInt(t) : t = t.replace(new RegExp(/-/gm), "/")), typeof t == "number" && t.toString().length === 10 && (t = t * 1e3), r = new Date(t));
|
|
8
|
-
const
|
|
8
|
+
const o = "ru-RU", l = {
|
|
9
9
|
Y: r.getFullYear(),
|
|
10
10
|
m: (r.getMonth() + 1).toString().padStart(2, "0"),
|
|
11
11
|
d: r.getDate(),
|
|
@@ -14,25 +14,28 @@ function h(t, e) {
|
|
|
14
14
|
H: r.getHours().toString().padStart(2, "0"),
|
|
15
15
|
i: r.getMinutes().toString().padStart(2, "0"),
|
|
16
16
|
s: r.getSeconds().toString().padStart(2, "0"),
|
|
17
|
-
D: new Intl.DateTimeFormat(
|
|
18
|
-
F: new Intl.DateTimeFormat(
|
|
19
|
-
M: new Intl.DateTimeFormat(
|
|
17
|
+
D: new Intl.DateTimeFormat(o, { weekday: "short" }).format(r),
|
|
18
|
+
F: new Intl.DateTimeFormat(o, { month: "long" }).format(r),
|
|
19
|
+
M: new Intl.DateTimeFormat(o, { month: "short" }).format(r)
|
|
20
20
|
};
|
|
21
|
-
return
|
|
21
|
+
return a.replace(/{(dd|[YmdGHisDFM])+}/g, (p, c) => l[c]);
|
|
22
22
|
}
|
|
23
23
|
function g(t) {
|
|
24
24
|
let e = t.split(t.match(/\D.*?\D?/));
|
|
25
25
|
return e[0].length > 2 ? e.join("-") + "T00:00:01" : e.reverse().join("-") + "T00:00:01";
|
|
26
26
|
}
|
|
27
27
|
function m(t, e) {
|
|
28
|
-
let r = t.replace(/[0-9]/g, "").split("").reverse().map((
|
|
29
|
-
return s(r, e, 0), r.map((
|
|
28
|
+
let r = t.replace(/[0-9]/g, "").split("").reverse().map((o) => o.charCodeAt(0));
|
|
29
|
+
return s(r, e, 0), r.map((o) => String.fromCharCode(o)).reverse().join("");
|
|
30
30
|
}
|
|
31
31
|
function y(t) {
|
|
32
|
-
return t.split(" ", 3).map((e,
|
|
32
|
+
return t.split(" ", 3).map((e, a) => a !== 0 ? e.slice(0, 1) + "." : e).join(" ");
|
|
33
|
+
}
|
|
34
|
+
function d(t, e, a) {
|
|
35
|
+
return Math.min(Math.max(t, e), a);
|
|
33
36
|
}
|
|
34
37
|
let n = {};
|
|
35
|
-
async function
|
|
38
|
+
async function S() {
|
|
36
39
|
if (n != null && n.holidays) return n;
|
|
37
40
|
try {
|
|
38
41
|
const t = await fetch("https://cp.avanta-telecom.ru/api/v2/calendar/getHoliday", {
|
|
@@ -190,19 +193,20 @@ async function d() {
|
|
|
190
193
|
throw console.error("Ошибка загрузки данных о праздниках:", t), t;
|
|
191
194
|
}
|
|
192
195
|
}
|
|
193
|
-
function s(t, e,
|
|
196
|
+
function s(t, e, a) {
|
|
194
197
|
if (typeof e != "number" || e < 1) return !0;
|
|
195
|
-
if (e = e - 1, (typeof t[
|
|
198
|
+
if (e = e - 1, (typeof t[a] != "number" || t[a] < 65) && (t[a] = 65), t[a] + e <= 90) t[a] = t[a] + e;
|
|
196
199
|
else {
|
|
197
|
-
let r = Math.floor((t[
|
|
198
|
-
t[
|
|
200
|
+
let r = Math.floor((t[a] - 65 + e) / 26);
|
|
201
|
+
t[a] = (t[a] - 65 + e) % 26 + 65, s(t, r, a + 1);
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
const i = () => u.get("X-Token") || !1;
|
|
202
205
|
export {
|
|
203
206
|
g as a,
|
|
204
207
|
y as b,
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
d as c,
|
|
209
|
+
m as d,
|
|
210
|
+
S as h,
|
|
207
211
|
h as p
|
|
208
212
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("js-cookie");function u(t,e){if(arguments.length===0||!t)return null;const a=e||"{Y}-{m}-{d} {G}:{i}:{s}";let r;typeof t=="object"?r=t:(typeof t=="string"&&(/^[0-9]+$/.test(t)?t=parseInt(t):t=t.replace(new RegExp(/-/gm),"/")),typeof t=="number"&&t.toString().length===10&&(t=t*1e3),r=new Date(t));const o="ru-RU",l={Y:r.getFullYear(),m:(r.getMonth()+1).toString().padStart(2,"0"),d:r.getDate(),dd:r.getDate().toString().padStart(2,"0"),G:r.getHours(),H:r.getHours().toString().padStart(2,"0"),i:r.getMinutes().toString().padStart(2,"0"),s:r.getSeconds().toString().padStart(2,"0"),D:new Intl.DateTimeFormat(o,{weekday:"short"}).format(r),F:new Intl.DateTimeFormat(o,{month:"long"}).format(r),M:new Intl.DateTimeFormat(o,{month:"short"}).format(r)};return a.replace(/{(dd|[YmdGHisDFM])+}/g,(d,c)=>l[c])}function p(t){let e=t.split(t.match(/\D.*?\D?/));return e[0].length>2?e.join("-")+"T00:00:01":e.reverse().join("-")+"T00:00:01"}function f(t,e){let r=t.replace(/[0-9]/g,"").split("").reverse().map(o=>o.charCodeAt(0));return s(r,e,0),r.map(o=>String.fromCharCode(o)).reverse().join("")}function h(t){return t.split(" ",3).map((e,a)=>a!==0?e.slice(0,1)+".":e).join(" ")}function g(t,e,a){return Math.min(Math.max(t,e),a)}let n={};async function m(){if(n!=null&&n.holidays)return n;try{const t=await fetch("https://cp.avanta-telecom.ru/api/v2/calendar/getHoliday",{method:"GET",mode:"cors",cache:"default",credentials:"same-origin",headers:{"Content-Type":"application/json",Accept:"text/html","X-Token":y(),"Cache-Control":"no-cache"},redirect:"follow",referrerPolicy:"no-referrer"});if(!t.ok)throw new Error(`HTTP error! Status: ${t.status}`);const e=await t.json();return e.result.holiday=["2024-01-01","2024-01-02","2024-01-03","2024-01-04","2024-01-05","2024-01-06","2024-01-07","2024-01-08","2024-02-23","2024-03-08","2024-05-01","2024-05-09","2024-06-12","2024-11-04","2025-01-01","2025-01-02","2025-01-03","2025-01-04","2025-01-05","2025-01-06","2025-01-07","2025-01-08","2025-02-23","2025-03-08","2025-05-01","2025-05-09","2025-06-12","2025-11-04","2026-01-01","2026-01-02","2026-01-03","2026-01-04","2026-01-05","2026-01-06","2026-01-07","2026-01-08","2026-02-23","2026-03-08","2026-05-01","2026-05-09","2026-06-12","2026-11-04","2027-01-01","2027-01-02","2027-01-03","2027-01-04","2027-01-05","2027-01-06","2027-01-07","2027-01-08","2027-02-23","2027-03-08","2027-05-01","2027-05-09","2027-06-12","2027-11-04","2024-05-14","2025-04-29","2026-04-21","2027-05-11","2028-04-25","2029-04-17","2030-05-07","2031-04-22","2032-05-11","2033-05-03","2034-04-18","2035-05-08","2036-04-29","2037-04-14","2038-05-04","2039-04-26","2040-05-15","2041-04-30","2042-04-22","2043-05-12","2044-05-03","2045-04-18","2046-05-08","2047-04-30"],e.result.holidays.push("2024-05-14","2025-04-29","2026-04-21","2027-05-11","2028-04-25","2029-04-17","2030-05-07","2031-04-22","2032-05-11","2033-05-03","2034-04-18","2035-05-08","2036-04-29","2037-04-14","2038-05-04","2039-04-26","2040-05-15","2041-04-30","2042-04-22","2043-05-12","2044-05-03","2045-04-18","2046-05-08","2047-04-30"),e.result.preholidays.push("2024-05-13","2025-04-28","2026-04-20","2027-05-10","2028-04-24","2029-04-16","2030-05-06","2031-04-21","2032-05-10","2033-05-02","2034-04-17","2035-05-07","2036-04-28","2037-04-13","2038-05-03","2039-04-25","2040-05-14","2041-04-29","2042-04-21","2043-05-11","2044-05-02","2045-04-17","2046-05-07","2047-04-29"),n=e.result,n}catch(t){throw console.error("Ошибка загрузки данных о праздниках:",t),t}}function s(t,e,a){if(typeof e!="number"||e<1)return!0;if(e=e-1,(typeof t[a]!="number"||t[a]<65)&&(t[a]=65),t[a]+e<=90)t[a]=t[a]+e;else{let r=Math.floor((t[a]-65+e)/26);t[a]=(t[a]-65+e)%26+65,s(t,r,a+1)}}const y=()=>i.get("X-Token")||!1;exports.byInitials=h;exports.cellsDynamically=f;exports.clamp=g;exports.holidays=m;exports.parseDate=p;exports.parseTime=u;
|
package/package.json
CHANGED
package/dist/index-DxdyeKnm.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("js-cookie");function u(t,e){if(arguments.length===0||!t)return null;const o=e||"{Y}-{m}-{d} {G}:{i}:{s}";let r;typeof t=="object"?r=t:(typeof t=="string"&&(/^[0-9]+$/.test(t)?t=parseInt(t):t=t.replace(new RegExp(/-/gm),"/")),typeof t=="number"&&t.toString().length===10&&(t=t*1e3),r=new Date(t));const a="ru-RU",l={Y:r.getFullYear(),m:(r.getMonth()+1).toString().padStart(2,"0"),d:r.getDate(),dd:r.getDate().toString().padStart(2,"0"),G:r.getHours(),H:r.getHours().toString().padStart(2,"0"),i:r.getMinutes().toString().padStart(2,"0"),s:r.getSeconds().toString().padStart(2,"0"),D:new Intl.DateTimeFormat(a,{weekday:"short"}).format(r),F:new Intl.DateTimeFormat(a,{month:"long"}).format(r),M:new Intl.DateTimeFormat(a,{month:"short"}).format(r)};return o.replace(/{(dd|[YmdGHisDFM])+}/g,(y,c)=>l[c])}function p(t){let e=t.split(t.match(/\D.*?\D?/));return e[0].length>2?e.join("-")+"T00:00:01":e.reverse().join("-")+"T00:00:01"}function f(t,e){let r=t.replace(/[0-9]/g,"").split("").reverse().map(a=>a.charCodeAt(0));return s(r,e,0),r.map(a=>String.fromCharCode(a)).reverse().join("")}function h(t){return t.split(" ",3).map((e,o)=>o!==0?e.slice(0,1)+".":e).join(" ")}let n={};async function g(){if(n!=null&&n.holidays)return n;try{const t=await fetch("https://cp.avanta-telecom.ru/api/v2/calendar/getHoliday",{method:"GET",mode:"cors",cache:"default",credentials:"same-origin",headers:{"Content-Type":"application/json",Accept:"text/html","X-Token":m(),"Cache-Control":"no-cache"},redirect:"follow",referrerPolicy:"no-referrer"});if(!t.ok)throw new Error(`HTTP error! Status: ${t.status}`);const e=await t.json();return e.result.holiday=["2024-01-01","2024-01-02","2024-01-03","2024-01-04","2024-01-05","2024-01-06","2024-01-07","2024-01-08","2024-02-23","2024-03-08","2024-05-01","2024-05-09","2024-06-12","2024-11-04","2025-01-01","2025-01-02","2025-01-03","2025-01-04","2025-01-05","2025-01-06","2025-01-07","2025-01-08","2025-02-23","2025-03-08","2025-05-01","2025-05-09","2025-06-12","2025-11-04","2026-01-01","2026-01-02","2026-01-03","2026-01-04","2026-01-05","2026-01-06","2026-01-07","2026-01-08","2026-02-23","2026-03-08","2026-05-01","2026-05-09","2026-06-12","2026-11-04","2027-01-01","2027-01-02","2027-01-03","2027-01-04","2027-01-05","2027-01-06","2027-01-07","2027-01-08","2027-02-23","2027-03-08","2027-05-01","2027-05-09","2027-06-12","2027-11-04","2024-05-14","2025-04-29","2026-04-21","2027-05-11","2028-04-25","2029-04-17","2030-05-07","2031-04-22","2032-05-11","2033-05-03","2034-04-18","2035-05-08","2036-04-29","2037-04-14","2038-05-04","2039-04-26","2040-05-15","2041-04-30","2042-04-22","2043-05-12","2044-05-03","2045-04-18","2046-05-08","2047-04-30"],e.result.holidays.push("2024-05-14","2025-04-29","2026-04-21","2027-05-11","2028-04-25","2029-04-17","2030-05-07","2031-04-22","2032-05-11","2033-05-03","2034-04-18","2035-05-08","2036-04-29","2037-04-14","2038-05-04","2039-04-26","2040-05-15","2041-04-30","2042-04-22","2043-05-12","2044-05-03","2045-04-18","2046-05-08","2047-04-30"),e.result.preholidays.push("2024-05-13","2025-04-28","2026-04-20","2027-05-10","2028-04-24","2029-04-16","2030-05-06","2031-04-21","2032-05-10","2033-05-02","2034-04-17","2035-05-07","2036-04-28","2037-04-13","2038-05-03","2039-04-25","2040-05-14","2041-04-29","2042-04-21","2043-05-11","2044-05-02","2045-04-17","2046-05-07","2047-04-29"),n=e.result,n}catch(t){throw console.error("Ошибка загрузки данных о праздниках:",t),t}}function s(t,e,o){if(typeof e!="number"||e<1)return!0;if(e=e-1,(typeof t[o]!="number"||t[o]<65)&&(t[o]=65),t[o]+e<=90)t[o]=t[o]+e;else{let r=Math.floor((t[o]-65+e)/26);t[o]=(t[o]-65+e)%26+65,s(t,r,o+1)}}const m=()=>i.get("X-Token")||!1;exports.byInitials=h;exports.cellsDynamically=f;exports.holidays=g;exports.parseDate=p;exports.parseTime=u;
|