@studio-west/employees 0.5.4 → 0.5.6
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 +3 -3
- package/dist/SheetTable.js +149 -143
- package/dist/VacationTable.cjs +1 -1
- package/dist/VacationTable.js +3 -3
- package/dist/WorkTable.cjs +1 -1
- package/dist/WorkTable.js +6 -6
- package/dist/index-CmFQ6bqG.cjs +1 -0
- package/dist/{index-uVRk2ARj.js → index-DIjJDdmP.js} +109 -6
- package/package.json +2 -2
- package/dist/index-CHGzf-XH.cjs +0 -1
package/dist/SheetTable.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const e=require("vue")
|
|
2
|
-
`+
|
|
3
|
-
`+
|
|
1
|
+
"use strict";const e=require("vue"),M=require("vue-i18n"),p=require("./index-CmFQ6bqG.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
|
+
`+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
|
+
`+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,8 +1,8 @@
|
|
|
1
|
-
import { ref as w, watch as K, computed as L,
|
|
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-
|
|
4
|
-
import { ElSelect as X, ElOption as Z, ElSwitch as Q, ElTable as ee, ElTableColumn as
|
|
5
|
-
const ae = { style: { height: "20px", width: "100%", display: "inline-block" } },
|
|
3
|
+
import { p as M, b as G, h as R } from "./index-DIjJDdmP.js";
|
|
4
|
+
import { ElSelect as X, ElOption as Z, ElSwitch as Q, ElTable as ee, ElTableColumn as r } from "element-plus";
|
|
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",
|
|
7
7
|
props: {
|
|
8
8
|
checkEdit: { type: Boolean, default: () => !0 },
|
|
@@ -11,17 +11,17 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
11
11
|
fullName: { type: String, default: "Вы" }
|
|
12
12
|
},
|
|
13
13
|
setup(T) {
|
|
14
|
-
const
|
|
15
|
-
K(k, async (e,
|
|
16
|
-
e !==
|
|
17
|
-
a.divisionName === e && (I.value.some((
|
|
14
|
+
const _ = T, { t: i, d: C } = q(), f = w([]), S = w("0"), x = w(new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(S.value))), b = w([]), k = w("all"), V = w([{ value: "all", label: "Все", key: "all" }]), F = w([]), Y = w(0), I = w([]);
|
|
15
|
+
K(k, async (e, l) => {
|
|
16
|
+
e !== l && (I.value = [], confirm.value = !1, _.odata.personal.forEach((a) => {
|
|
17
|
+
a.divisionName === e && (I.value.some((n) => (n == null ? void 0 : n.activeText) === a.roleName) || I.value.push({ val: !0, activeText: a.roleName }));
|
|
18
18
|
}), j());
|
|
19
|
-
}), K(
|
|
19
|
+
}), K(S, (e) => {
|
|
20
20
|
x.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(e)), B();
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const u = L(() => f.value.flatMap((e, l) => [{ ...e, key: 0, ids: l }, { ...e, key: 1, ids: l }])), U = (e) => {
|
|
23
23
|
if (e.columnIndex < 2 || e.columnIndex > b.value.length + 3 && e.columnIndex < b.value.length + 9 || e.columnIndex > b.value.length + 11)
|
|
24
|
-
return
|
|
24
|
+
return u.value[e.rowIndex].key === 0 ? {
|
|
25
25
|
rowspan: 2,
|
|
26
26
|
colspan: 1
|
|
27
27
|
} : {
|
|
@@ -29,50 +29,50 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
29
29
|
colspan: 0
|
|
30
30
|
};
|
|
31
31
|
}, B = () => {
|
|
32
|
-
const e =
|
|
33
|
-
let
|
|
32
|
+
const e = F.value, l = new Date(x.value), a = new Date(l.getFullYear(), l.getMonth() + 1, 0).getDate();
|
|
33
|
+
let n = [], g = 0;
|
|
34
34
|
for (let v = 1; v <= a; v++) {
|
|
35
|
-
const
|
|
36
|
-
g += e.nowork.includes(
|
|
37
|
-
let h = e.nowork.includes(
|
|
38
|
-
|
|
35
|
+
const o = M(l.setDate(v), "{Y}-{m}-{dd}");
|
|
36
|
+
g += e.nowork.includes(o) || e.holidays.includes(o) ? 0 : e.preholidays.includes(o) ? 7 : 8;
|
|
37
|
+
let h = e.nowork.includes(o) ? "nowork" : e.holidays.includes(o) ? "holiday" : e.preholidays.includes(o) ? "preholiday" : "";
|
|
38
|
+
n.push({ day: v, holidays: h, weekday: C(new Date(l.getFullYear(), l.getMonth(), v), "day") });
|
|
39
39
|
}
|
|
40
|
-
Y.value = g, b.value =
|
|
41
|
-
var
|
|
42
|
-
k.value = (
|
|
40
|
+
Y.value = g, b.value = n, _.odata.getPersonal({}).then((v) => {
|
|
41
|
+
var o;
|
|
42
|
+
k.value = (o = v.find((h) => h.employeeName === _.fullName)) == null ? void 0 : o.divisionName, v.forEach((h) => {
|
|
43
43
|
V.value.some((p) => (p == null ? void 0 : p.value) === h.divisionName) || V.value.push({ value: h.divisionName, label: h.divisionName, key: h.divisionName }), h.divisionName === k.value && !I.value.some((p) => (p == null ? void 0 : p.activeText) === h.roleName) && I.value.push({ val: !0, activeText: h.roleName });
|
|
44
44
|
}), j();
|
|
45
45
|
});
|
|
46
46
|
}, j = () => {
|
|
47
47
|
f.value = [];
|
|
48
48
|
let e = [];
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
let a = G(
|
|
52
|
-
e.push(
|
|
49
|
+
_.odata.personal.forEach((l) => {
|
|
50
|
+
if (l.divisionName === k.value && I.value.some((a) => a.val && a.activeText === l.roleName)) {
|
|
51
|
+
let a = G(l.employeeName);
|
|
52
|
+
e.push(l.employeeKey), f.value.push({ name: a + " (" + l.roleName + ")", code: l.employeeKey, days: [], contHour: 0, id: !1, ids: f.value.length });
|
|
53
53
|
}
|
|
54
54
|
}), W(e);
|
|
55
55
|
}, W = (e) => {
|
|
56
|
-
|
|
57
|
-
(
|
|
58
|
-
|
|
56
|
+
_.workSchedule.getWorkSchedule({ code: e, date: M(new Date(x.value), "{Y}-{m}-{dd}") }).then(
|
|
57
|
+
(l) => {
|
|
58
|
+
l.forEach((a, n) => {
|
|
59
59
|
var g, v;
|
|
60
60
|
if (a !== null) {
|
|
61
|
-
a.data.days.forEach((
|
|
62
|
-
for (let
|
|
63
|
-
let h = M(new Date(x.value).setDate(
|
|
61
|
+
a.data.days.forEach((o) => o.state = "Я");
|
|
62
|
+
for (let o = 1; o <= b.value.length; o++) {
|
|
63
|
+
let h = M(new Date(x.value).setDate(o), "{Y}-{m}-{dd}");
|
|
64
64
|
const p = (g = a.data) == null ? void 0 : g.days.findIndex((J) => J.day === h);
|
|
65
|
-
p === -1 ? f.value[
|
|
65
|
+
p === -1 ? f.value[n].days.push({
|
|
66
66
|
day: h,
|
|
67
67
|
time: "-",
|
|
68
68
|
state: "В"
|
|
69
|
-
}) : f.value[
|
|
69
|
+
}) : f.value[n].days.push((v = a.data) == null ? void 0 : v.days[p]);
|
|
70
70
|
}
|
|
71
71
|
} else {
|
|
72
|
-
f.value[
|
|
73
|
-
for (let
|
|
74
|
-
b.value[
|
|
75
|
-
day: M(new Date(x.value).setDate(
|
|
72
|
+
f.value[n].days = [];
|
|
73
|
+
for (let o = 1; o <= b.value.length; o++)
|
|
74
|
+
b.value[o - 1].holidays === "" ? A(o, n, 8) : b.value[o - 1].holidays === "preholiday" ? A(o, n, 7) : f.value[n].days.push({
|
|
75
|
+
day: M(new Date(x.value).setDate(o), "{Y}-{m}-{dd}"),
|
|
76
76
|
time: "-",
|
|
77
77
|
state: "В"
|
|
78
78
|
});
|
|
@@ -80,41 +80,41 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
80
80
|
}), z();
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
const
|
|
85
|
-
f.value[
|
|
86
|
-
day:
|
|
83
|
+
}, A = (e, l, a) => {
|
|
84
|
+
const n = M(new Date(x.value).setDate(e), "{Y}-{m}-{dd}");
|
|
85
|
+
f.value[l].days.push({
|
|
86
|
+
day: n,
|
|
87
87
|
time: a,
|
|
88
88
|
state: "Я"
|
|
89
89
|
});
|
|
90
90
|
}, z = () => {
|
|
91
91
|
f.value.forEach((e) => {
|
|
92
92
|
e.hourI = 0, e.hourII = 0, e.halfII = 0, e.halfI = 0, e.weekend = 0, e.weekendDays = 0, e.night = 0;
|
|
93
|
-
for (let
|
|
94
|
-
|
|
93
|
+
for (let l = 0; l < e.days.length; l++)
|
|
94
|
+
l < 15 && e.days[l].time !== "-" && (e.hourI += e.days[l].time), l < 15 && e.days[l].state === "Я" && e.halfI++, l >= 15 && e.days[l].time !== "-" && (e.hourII += e.days[l].time), l >= 15 && e.days[l].state === "Я" && e.halfII++, e.days[l].state === "Н" && (e.night += e.days[l].time), e.days[l].state === "РВ" && (e.weekend += e.days[l].time), e.days[l].state === "В" && e.weekendDays++;
|
|
95
95
|
e.contDays = e.halfI + e.halfII, e.contHour = e.hourI + e.hourII, e.overtime = 0, Y.value < e.contHour && (e.overtime = e.contHour - Y.value), e.numberNonAppearing = 0, e.appearing = {
|
|
96
96
|
code: "-",
|
|
97
97
|
countH: "-"
|
|
98
98
|
};
|
|
99
99
|
});
|
|
100
|
-
},
|
|
101
|
-
var v,
|
|
102
|
-
if (
|
|
103
|
-
const a = new Date(x.value),
|
|
104
|
-
return g === -1 ? "" :
|
|
100
|
+
}, O = (e, l) => {
|
|
101
|
+
var v, o;
|
|
102
|
+
if (l === -1) return "";
|
|
103
|
+
const a = new Date(x.value), n = `${a.getFullYear()}-${(a.getMonth() + 1).toString().padStart(2, "0")}-${e.toString().padStart(2, "0")}`, g = u.value[l].days.findIndex((h) => h.day === n);
|
|
104
|
+
return g === -1 ? "" : u.value[l].key === 0 ? (v = u.value[l].days[g]) == null ? void 0 : v.state : (o = u.value[l].days[g]) == null ? void 0 : o.time;
|
|
105
105
|
};
|
|
106
106
|
return R().then((e) => {
|
|
107
|
-
|
|
108
|
-
}), (e,
|
|
109
|
-
T.checkEdit ? (y(),
|
|
107
|
+
F.value = e, B();
|
|
108
|
+
}), (e, l) => (y(), D(N, null, [
|
|
109
|
+
T.checkEdit ? (y(), $(t(X), {
|
|
110
110
|
key: 0,
|
|
111
111
|
modelValue: k.value,
|
|
112
|
-
"onUpdate:modelValue":
|
|
112
|
+
"onUpdate:modelValue": l[0] || (l[0] = (a) => k.value = a),
|
|
113
113
|
placeholder: "Select",
|
|
114
114
|
style: { width: "240px", "margin-bottom": ".5rem", "margin-right": ".5rem" }
|
|
115
115
|
}, {
|
|
116
|
-
default:
|
|
117
|
-
(y(!0), D(
|
|
116
|
+
default: s(() => [
|
|
117
|
+
(y(!0), D(N, null, H(V.value, (a) => (y(), $(t(Z), {
|
|
118
118
|
key: a.value,
|
|
119
119
|
label: a.label,
|
|
120
120
|
value: a.value
|
|
@@ -122,61 +122,61 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
122
122
|
]),
|
|
123
123
|
_: 1
|
|
124
124
|
}, 8, ["modelValue"])) : E("", !0),
|
|
125
|
-
T.checkEdit ? (y(),
|
|
125
|
+
T.checkEdit ? (y(), $(t(Q), {
|
|
126
126
|
key: 1,
|
|
127
|
-
modelValue:
|
|
128
|
-
"onUpdate:modelValue":
|
|
129
|
-
"active-text":
|
|
127
|
+
modelValue: S.value,
|
|
128
|
+
"onUpdate:modelValue": l[1] || (l[1] = (a) => S.value = a),
|
|
129
|
+
"active-text": t(i)("workSchedule.currentMonth"),
|
|
130
130
|
"active-value": "0",
|
|
131
131
|
"inactive-value": "-1",
|
|
132
132
|
style: { "margin-bottom": ".5rem", "margin-left": ".5rem" }
|
|
133
133
|
}, null, 8, ["modelValue", "active-text"])) : E("", !0),
|
|
134
|
-
d(
|
|
134
|
+
d(t(ee), {
|
|
135
135
|
id: "printTable",
|
|
136
|
-
data:
|
|
136
|
+
data: u.value,
|
|
137
137
|
"span-method": U,
|
|
138
138
|
border: "",
|
|
139
139
|
style: { width: "100%" },
|
|
140
140
|
size: "small",
|
|
141
|
-
"empty-text":
|
|
141
|
+
"empty-text": t(i)("sheet.emptyText"),
|
|
142
142
|
align: "center",
|
|
143
143
|
onCellClick: e.coMenu
|
|
144
144
|
}, {
|
|
145
|
-
default:
|
|
146
|
-
d(
|
|
147
|
-
label:
|
|
145
|
+
default: s(() => [
|
|
146
|
+
d(t(r), {
|
|
147
|
+
label: t(i)("sheet.title", { name: k.value }) + t(C)(x.value, "month"),
|
|
148
148
|
align: "center",
|
|
149
149
|
height: "10"
|
|
150
150
|
}, {
|
|
151
|
-
default:
|
|
152
|
-
d(
|
|
153
|
-
label:
|
|
151
|
+
default: s(() => [
|
|
152
|
+
d(t(r), {
|
|
153
|
+
label: t(i)("sheet.employee"),
|
|
154
154
|
width: "180",
|
|
155
155
|
align: "center"
|
|
156
156
|
}, {
|
|
157
|
-
default:
|
|
158
|
-
m(c(
|
|
157
|
+
default: s((a) => [
|
|
158
|
+
m(c(u.value[a.$index].name), 1)
|
|
159
159
|
]),
|
|
160
160
|
_: 1
|
|
161
161
|
}, 8, ["label"]),
|
|
162
|
-
d(
|
|
163
|
-
label:
|
|
162
|
+
d(t(r), {
|
|
163
|
+
label: t(i)("sheet.personnelNumber"),
|
|
164
164
|
align: "center"
|
|
165
165
|
}, {
|
|
166
|
-
default:
|
|
167
|
-
m(c(
|
|
166
|
+
default: s((a) => [
|
|
167
|
+
m(c(u.value[a.$index].code), 1)
|
|
168
168
|
]),
|
|
169
169
|
_: 1
|
|
170
170
|
}, 8, ["label"]),
|
|
171
|
-
d(
|
|
172
|
-
label:
|
|
171
|
+
d(t(r), {
|
|
172
|
+
label: t(i)("sheet.marks"),
|
|
173
173
|
align: "center"
|
|
174
174
|
}, {
|
|
175
|
-
default:
|
|
176
|
-
(y(!0), D(
|
|
175
|
+
default: s(() => [
|
|
176
|
+
(y(!0), D(N, null, H(b.value, (a) => (y(), D(N, {
|
|
177
177
|
key: a.day
|
|
178
178
|
}, [
|
|
179
|
-
a.day <= 15 ? (y(),
|
|
179
|
+
a.day <= 15 ? (y(), $(t(r), {
|
|
180
180
|
key: 0,
|
|
181
181
|
width: "30",
|
|
182
182
|
"class-name": a.holidays,
|
|
@@ -184,25 +184,25 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
184
184
|
label: a.day.toString() + `
|
|
185
185
|
` + a.weekday
|
|
186
186
|
}, {
|
|
187
|
-
default:
|
|
188
|
-
P("div", ae, c(
|
|
187
|
+
default: s((n) => [
|
|
188
|
+
P("div", ae, c(O(a.day, n.$index) || " "), 1)
|
|
189
189
|
]),
|
|
190
190
|
_: 2
|
|
191
191
|
}, 1032, ["class-name", "label"])) : E("", !0)
|
|
192
192
|
], 64))), 128)),
|
|
193
|
-
d(
|
|
194
|
-
label:
|
|
193
|
+
d(t(r), {
|
|
194
|
+
label: t(i)("sheet.halfMonth", { half: "I" }),
|
|
195
195
|
align: "center"
|
|
196
196
|
}, {
|
|
197
|
-
default:
|
|
198
|
-
m(c(
|
|
197
|
+
default: s((a) => [
|
|
198
|
+
m(c(u.value[a.$index].key === 0 ? u.value[a.$index].halfI : u.value[a.$index].hourI), 1)
|
|
199
199
|
]),
|
|
200
200
|
_: 1
|
|
201
201
|
}, 8, ["label"]),
|
|
202
|
-
(y(!0), D(
|
|
202
|
+
(y(!0), D(N, null, H(b.value, (a) => (y(), D(N, {
|
|
203
203
|
key: a.day
|
|
204
204
|
}, [
|
|
205
|
-
a.day > 15 ? (y(),
|
|
205
|
+
a.day > 15 ? (y(), $(t(r), {
|
|
206
206
|
key: 0,
|
|
207
207
|
width: "30",
|
|
208
208
|
"class-name": a.holidays,
|
|
@@ -210,86 +210,86 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
210
210
|
label: a.day.toString() + `
|
|
211
211
|
` + a.weekday
|
|
212
212
|
}, {
|
|
213
|
-
default:
|
|
214
|
-
P("div",
|
|
213
|
+
default: s((n) => [
|
|
214
|
+
P("div", le, c(O(a.day, n.$index) || " "), 1)
|
|
215
215
|
]),
|
|
216
216
|
_: 2
|
|
217
217
|
}, 1032, ["class-name", "label"])) : E("", !0)
|
|
218
218
|
], 64))), 128)),
|
|
219
|
-
d(
|
|
220
|
-
label:
|
|
219
|
+
d(t(r), {
|
|
220
|
+
label: t(i)("sheet.halfMonth", { half: "II" }),
|
|
221
221
|
align: "center"
|
|
222
222
|
}, {
|
|
223
|
-
default:
|
|
224
|
-
m(c(
|
|
223
|
+
default: s((a) => [
|
|
224
|
+
m(c(u.value[a.$index].key === 0 ? u.value[a.$index].halfII : u.value[a.$index].hourII), 1)
|
|
225
225
|
]),
|
|
226
226
|
_: 1
|
|
227
227
|
}, 8, ["label"])
|
|
228
228
|
]),
|
|
229
229
|
_: 1
|
|
230
230
|
}, 8, ["label"]),
|
|
231
|
-
d(
|
|
232
|
-
label:
|
|
231
|
+
d(t(r), {
|
|
232
|
+
label: t(i)("sheet.workedMonth"),
|
|
233
233
|
align: "center"
|
|
234
234
|
}, {
|
|
235
|
-
default:
|
|
236
|
-
d(
|
|
237
|
-
label:
|
|
235
|
+
default: s(() => [
|
|
236
|
+
d(t(r), {
|
|
237
|
+
label: t(i)("sheet.days"),
|
|
238
238
|
align: "center",
|
|
239
239
|
"label-class-name": "turn",
|
|
240
|
-
width: "
|
|
240
|
+
width: "34"
|
|
241
241
|
}, {
|
|
242
|
-
default:
|
|
243
|
-
m(c(
|
|
242
|
+
default: s((a) => [
|
|
243
|
+
m(c(u.value[a.$index].contDays), 1)
|
|
244
244
|
]),
|
|
245
245
|
_: 1
|
|
246
246
|
}, 8, ["label"]),
|
|
247
|
-
d(
|
|
248
|
-
label:
|
|
247
|
+
d(t(r), {
|
|
248
|
+
label: t(i)("sheet.hours"),
|
|
249
249
|
align: "center"
|
|
250
250
|
}, {
|
|
251
|
-
default:
|
|
252
|
-
d(
|
|
253
|
-
label:
|
|
251
|
+
default: s(() => [
|
|
252
|
+
d(t(r), {
|
|
253
|
+
label: t(i)("sheet.all"),
|
|
254
254
|
align: "center",
|
|
255
255
|
"label-class-name": "turn",
|
|
256
|
-
width: "
|
|
256
|
+
width: "40"
|
|
257
257
|
}, {
|
|
258
|
-
default:
|
|
259
|
-
m(c(
|
|
258
|
+
default: s((a) => [
|
|
259
|
+
m(c(u.value[a.$index].contHour), 1)
|
|
260
260
|
]),
|
|
261
261
|
_: 1
|
|
262
262
|
}, 8, ["label"]),
|
|
263
|
-
d(
|
|
264
|
-
label:
|
|
263
|
+
d(t(r), {
|
|
264
|
+
label: t(i)("sheet.overtime"),
|
|
265
265
|
align: "center",
|
|
266
266
|
"label-class-name": "turn",
|
|
267
|
-
width: "
|
|
267
|
+
width: "34"
|
|
268
268
|
}, {
|
|
269
|
-
default:
|
|
270
|
-
m(c(
|
|
269
|
+
default: s((a) => [
|
|
270
|
+
m(c(u.value[a.$index].overtime), 1)
|
|
271
271
|
]),
|
|
272
272
|
_: 1
|
|
273
273
|
}, 8, ["label"]),
|
|
274
|
-
d(
|
|
275
|
-
label:
|
|
274
|
+
d(t(r), {
|
|
275
|
+
label: t(i)("sheet.night"),
|
|
276
276
|
align: "center",
|
|
277
277
|
"label-class-name": "turn",
|
|
278
|
-
width: "
|
|
278
|
+
width: "34"
|
|
279
279
|
}, {
|
|
280
|
-
default:
|
|
281
|
-
m(c(
|
|
280
|
+
default: s((a) => [
|
|
281
|
+
m(c(u.value[a.$index].night), 1)
|
|
282
282
|
]),
|
|
283
283
|
_: 1
|
|
284
284
|
}, 8, ["label"]),
|
|
285
|
-
d(
|
|
286
|
-
label:
|
|
285
|
+
d(t(r), {
|
|
286
|
+
label: t(i)("sheet.weekend"),
|
|
287
287
|
align: "center",
|
|
288
288
|
"label-class-name": "turn",
|
|
289
|
-
width: "
|
|
289
|
+
width: "34"
|
|
290
290
|
}, {
|
|
291
|
-
default:
|
|
292
|
-
m(c(
|
|
291
|
+
default: s((a) => [
|
|
292
|
+
m(c(u.value[a.$index].weekend), 1)
|
|
293
293
|
]),
|
|
294
294
|
_: 1
|
|
295
295
|
}, 8, ["label"])
|
|
@@ -299,51 +299,57 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
299
299
|
]),
|
|
300
300
|
_: 1
|
|
301
301
|
}, 8, ["label"]),
|
|
302
|
-
d(
|
|
303
|
-
label:
|
|
302
|
+
d(t(r), {
|
|
303
|
+
label: t(i)("sheet.numberNonAppearing"),
|
|
304
304
|
align: "center"
|
|
305
305
|
}, {
|
|
306
|
-
default:
|
|
307
|
-
m(c(
|
|
306
|
+
default: s((a) => [
|
|
307
|
+
m(c(u.value[a.$index].numberNonAppearing), 1)
|
|
308
308
|
]),
|
|
309
309
|
_: 1
|
|
310
310
|
}, 8, ["label"]),
|
|
311
|
-
d(
|
|
312
|
-
label:
|
|
311
|
+
d(t(r), {
|
|
312
|
+
label: t(i)("sheet.them"),
|
|
313
313
|
align: "center"
|
|
314
314
|
}, {
|
|
315
|
-
default:
|
|
316
|
-
d(
|
|
317
|
-
label:
|
|
315
|
+
default: s(() => [
|
|
316
|
+
d(t(r), {
|
|
317
|
+
label: t(i)("sheet.code"),
|
|
318
318
|
align: "center",
|
|
319
319
|
"label-class-name": "turn",
|
|
320
320
|
width: "30"
|
|
321
321
|
}, {
|
|
322
|
-
default:
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
default: s((a) => {
|
|
323
|
+
var n;
|
|
324
|
+
return [
|
|
325
|
+
m(c((n = u.value[a.$index].appearing) == null ? void 0 : n.code), 1)
|
|
326
|
+
];
|
|
327
|
+
}),
|
|
325
328
|
_: 1
|
|
326
329
|
}, 8, ["label"]),
|
|
327
|
-
d(
|
|
328
|
-
label:
|
|
330
|
+
d(t(r), {
|
|
331
|
+
label: t(i)("sheet.count"),
|
|
329
332
|
align: "center",
|
|
330
333
|
"label-class-name": "turn",
|
|
331
334
|
width: "30"
|
|
332
335
|
}, {
|
|
333
|
-
default:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
+
default: s((a) => {
|
|
337
|
+
var n;
|
|
338
|
+
return [
|
|
339
|
+
m(c((n = u.value[a.$index].appearing) == null ? void 0 : n.countH), 1)
|
|
340
|
+
];
|
|
341
|
+
}),
|
|
336
342
|
_: 1
|
|
337
343
|
}, 8, ["label"])
|
|
338
344
|
]),
|
|
339
345
|
_: 1
|
|
340
346
|
}, 8, ["label"]),
|
|
341
|
-
d(
|
|
342
|
-
label:
|
|
347
|
+
d(t(r), {
|
|
348
|
+
label: t(i)("sheet.countWeekend"),
|
|
343
349
|
align: "center"
|
|
344
350
|
}, {
|
|
345
|
-
default:
|
|
346
|
-
m(c(
|
|
351
|
+
default: s((a) => [
|
|
352
|
+
m(c(u.value[a.$index].weekendDays), 1)
|
|
347
353
|
]),
|
|
348
354
|
_: 1
|
|
349
355
|
}, 8, ["label"])
|
package/dist/VacationTable.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),V=require("./index-CHGzf-XH.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:["init"],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(),w=/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()+w;a<=s.getDate()&&s.getDay()!==6+w;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()+w)%7&&r.getDay()!==w;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(w)),"{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(w))%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(w)),"{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(w))%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-5b3d4c74"]]),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"}]),w=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()=>{w.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 b of p.value)if(b.days.length>1)b.days.forEach(j=>{let R=[b.jobTitle,b.name,b.code,j.count,j.dateStart,j.dateEnd,j.note];const Z=t.addRow(R);Z.border=l,M++}),t.mergeCells(`A${M-b.days.length+1}:A${M}`),t.mergeCells(`B${M-b.days.length+1}:B${M}`),t.mergeCells(`C${M-b.days.length+1}:C${M}`);else{let j=[b.jobTitle,b.name,b.code,b.days[0].count,b.days[0].dateStart,b.days[0].dateEnd,b.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),w.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:w.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,w.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-CmFQ6bqG.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:["init"],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(),w=/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()+w;a<=s.getDate()&&s.getDay()!==6+w;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()+w)%7&&r.getDay()!==w;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(w)),"{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(w))%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(w)),"{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(w))%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-5b3d4c74"]]),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"}]),w=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()=>{w.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 b of p.value)if(b.days.length>1)b.days.forEach(j=>{let R=[b.jobTitle,b.name,b.code,j.count,j.dateStart,j.dateEnd,j.note];const Z=t.addRow(R);Z.border=l,M++}),t.mergeCells(`A${M-b.days.length+1}:A${M}`),t.mergeCells(`B${M-b.days.length+1}:B${M}`),t.mergeCells(`C${M-b.days.length+1}:C${M}`);else{let j=[b.jobTitle,b.name,b.code,b.days[0].count,b.days[0].dateStart,b.days[0].dateEnd,b.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),w.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:w.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,w.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,9 +1,9 @@
|
|
|
1
|
-
import { ref as f, openBlock as h,
|
|
2
|
-
import { p as A, h as Se } from "./index-
|
|
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-DIjJDdmP.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";
|
|
6
|
-
import { ElSelect as ie, ElOption as de, ElButton as F, ElSkeleton as ke,
|
|
6
|
+
import { ElSelect as ie, ElOption as de, ElButton as F, ElSkeleton as ke, ElTable as Ee, ElTableColumn as R, ElInput as $e, ElSkeletonItem as le, ElDialog as ve, ElForm as ce, ElFormItem as Te, ElSwitch as Ve } from "element-plus";
|
|
7
7
|
import { ContextMenu as Ie, ContextMenuItem as se, ContextMenuSeparator as Ne } from "@imengyu/vue3-context-menu";
|
|
8
8
|
const Me = (j, I) => {
|
|
9
9
|
const o = j.__vccOpts || j;
|
package/dist/WorkTable.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),ne=require("file-saver"),oe=require("exceljs"),c=require("./index-
|
|
1
|
+
"use strict";const e=require("vue"),ne=require("file-saver"),oe=require("exceljs"),c=require("./index-CmFQ6bqG.cjs"),ue=require("vue-i18n"),i=require("element-plus"),H=require("@imengyu/vue3-context-menu");function re(p){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const C in p)if(C!=="default"){const f=Object.getOwnPropertyDescriptor(p,C);Object.defineProperty(u,C,f.get?f:{enumerable:!0,get:()=>p[C]})}}return u.default=p,Object.freeze(u)}const ie=re(oe),de={style:{height:"100px",width:"100%",display:"inline-block"}},se={style:{height:"100px",width:"100%",display:"inline-block"}},ce={key:3,class:"controls-container",style:{"margin-top":".5rem"}},ve={key:0,style:{padding:"0.5em 1.5em"}},me={key:1,style:{padding:"0.5em 1.5em"}},ge={__name:"WorkTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"}},setup(p){const{t:u,d:C}=ue.useI18n(),f=p,T=e.ref(!1),n=e.ref([]),M=e.ref("1"),w=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(M.value))),r=e.ref([]),N=e.ref(0),x=e.ref(9),y=e.ref(8),A=e.ref(!1),O=e.ref(!0),E=e.ref(!1),Y=e.ref("5"),$=e.ref(1),S=e.ref("Сектор разработок и эксплуатации сети"),U=e.ref([]),V=e.ref([]),s=e.ref({name:"Имя",length:0,code:""}),I=e.ref(!1),R=e.ref({zIndex:30,minWidth:220,x:500,y:200}),P=e.ref({});e.watch(S,async(a,l)=>{a!==l&&(V.value=[],A.value=!1,f.odata.personal.forEach(o=>{o.divisionName===a&&(V.value.some(t=>(t==null?void 0:t.activeText)===o.roleName)||V.value.push({val:!0,activeText:o.roleName}))}),j())}),e.watch(M,async a=>{w.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(a)),W()});const Z=(a,l,o,t)=>{s.value.ids=a.ids,s.value.key=a.key,s.value.add=a.days.length>0&&a.days[a.days.length-1].cont,s.value.level=l.level,s.value.day=o.cellIndex,R.value.y=t.clientY,R.value.x=t.clientX,l.level===2&&l.no===0&&f.checkEdit&&(s.value.name=u("workSchedule.autocomplete"),I.value=!0),l.level===3&&o.cellIndex-l.no===1&&f.checkEdit&&(b(o.cellIndex,a.ids),s.value.name=u("workSchedule.modeSelection"),I.value=!0)},W=()=>{const a=P.value,l=new Date(w.value),o=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let t=[],d=0;for(let m=1;m<=o;m++){const h=c.parseTime(l.setDate(m),"{Y}-{m}-{dd}");d+=a.nowork.includes(h)||a.holidays.includes(h)?0:a.preholidays.includes(h)?7:8;const g=a.nowork.includes(h)?"nowork":a.holidays.includes(h)?"holiday":a.preholidays.includes(h)?"preholiday":"";t.push({day:m,holidays:g,weekday:C(new Date(l.getFullYear(),l.getMonth(),m),"day")})}N.value=d,r.value=t,f.odata.getPersonal({}).then(m=>{var h;S.value=(h=m.find(g=>g.employeeName===f.fullName))==null?void 0:h.divisionName,m.forEach(g=>{U.value.some(k=>(k==null?void 0:k.value)===g.divisionName)||U.value.push({value:g.divisionName,label:g.divisionName,key:g.divisionName}),g.divisionName===S.value&&!V.value.some(k=>(k==null?void 0:k.activeText)===g.roleName)&&V.value.push({val:!0,activeText:g.roleName})}),j(),O.value=!1})},K=e.computed(()=>!n.value.some(a=>a.contHour!==N.value)),L=(a,l)=>{var m,h,g;const o=new Date(w.value),t=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,d=(m=n.value[l])==null?void 0:m.days.findIndex(k=>k.day===t);return l===-1||d===-1?"":((h=n.value[l].days[d])==null?void 0:h.time)+" "+((g=n.value[l].days[d])==null?void 0:g.tips)},j=()=>{n.value=[];let a=[];f.odata.personal.forEach(l=>{if(l.divisionName===S.value&&V.value.some(o=>o.val&&o.activeText===l.roleName)){let o=c.byInitials(l.employeeName);a.push(l.employeeKey),n.value.push({name:o+" ("+l.roleName+")",days:[],contHour:0,code:l.employeeKey,id:!1,ids:n.value.length})}}),Q(a),E.value=!1},Q=a=>{f.workSchedule.getWorkSchedule({code:a,date:c.parseTime(new Date(w.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((o,t)=>{o!==null&&(n.value[t].days=o.data.days,n.value[t].id=o.id)}),D()})},D=()=>{n.value.forEach(a=>{a.contHour=a.days.reduce((l,o)=>l+o.time,0)})},X=a=>{n.value[a].days=[],D()},_=a=>{switch(Y.value){case"5":for(let l=$.value;l<=r.value.length;l++)r.value[l-1].holidays===""&&b(l,a,!0),r.value[l-1].holidays==="preholiday"&&(y.value-=1,b(l,a,!0),y.value+=1);break;case"2x2":for(let l=$.value;l<=r.value.length;l+=4)b(l,a,!0),l+1<=r.value.length&&b(l+1,a,!0);break;case"2x5":for(let l=$.value;l<=r.value.length;l+=7)for(let o=l;o<l+5&&o<=r.value.length;o++)r.value[o-1].holidays==="preholiday"?(y.value-=1,b(o,a,!0),y.value+=1):b(o,a,!0);break}},b=(a,l,o=!1)=>{const{date:t,ind:d}=z(a,l);d===-1?(n.value[l].days.push({day:t,time:y.value,tips:`(${x.value}:00 - ${x.value+y.value+1}:00)`}),D()):o||(y.value=n.value[l].days[d].time,x.value=parseInt(n.value[l].days[d].tips.slice(1,-12)))},ee=(a,l)=>{const{ind:o}=z(a,l);n.value[l].days.splice(o,1),D(),document.querySelector(".app-main").click()},G=(a,l)=>{const{date:o,ind:t}=z(a,l);n.value[l].days[t]={day:o,time:y.value,tips:`(${x.value}:00 - ${x.value+y.value+1}:00)`},D()},z=(a,l)=>{var d;const o=c.parseTime(new Date(w.value).setDate(a),"{Y}-{m}-{dd}"),t=(d=n.value[l])==null?void 0:d.days.findIndex(m=>m.day===o);return{date:o,ind:t}},le=async()=>{var J;T.value=!0;const a=new ie.Workbook,l=a.addWorksheet(C(w.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),o={vertical:"middle",horizontal:"center"},t={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},d={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${c.cellsDynamically("A1",r.value.length+5)}1`),l.mergeCells(`A2:${c.cellsDynamically("A2",r.value.length+5)}2`),l.mergeCells("A3:A4"),l.mergeCells(`B3:${c.cellsDynamically("B3",r.value.length)}3`),l.mergeCells(`${c.cellsDynamically("B3",r.value.length+1)}3:${c.cellsDynamically("B3",r.value.length+2)}3`),l.mergeCells(`${c.cellsDynamically("B3",r.value.length+3)}3:${c.cellsDynamically("B4",r.value.length+3)}4`),l.mergeCells(`${c.cellsDynamically("B3",r.value.length+4)}3:${c.cellsDynamically("B4",r.value.length+4)}4`),l.getCell("A1").value=u("workSchedule.firm"),l.getCell("A2").value=u("workSchedule.title",{name:S.value})+C(w.value,"month")+` ${new Date(w.value).getFullYear()}`,l.getCell("A3").value=u("workSchedule.month"),l.getCell("B3").value=u("workSchedule.numbersMonth"),l.getCell(3,r.value.length+2).value=u("workSchedule.onSchedule"),l.getCell(3,r.value.length+4).value=u("workSchedule.acquainted"),l.getCell(3,r.value.length+5).value=u("workSchedule.date"),l.getCell(4,r.value.length+2).value=u("workSchedule.days"),l.getCell(4,r.value.length+3).value=`${u("workSchedule.hours")} (${N.value})`;for(let v=2;v<=r.value.length+1;v++)l.getCell(4,v).value=r.value[v-2].weekday+`
|
|
2
2
|
`+(v-1),l.getColumn(v).width=6,l.getColumn(v).alignment=d,l.getCell(4,v).border=t;l.getRow(1).height=40,l.getRow(2).height=30,l.getRow(3).height=20,l.getColumn(1).width=15,l.getColumn(r.value.length+2).width=5,l.getColumn(r.value.length+3).width=6,l.getColumn(r.value.length+4).width=13,l.getColumn(r.value.length+5).width=13,l.getColumn(1).alignment=d,l.getCell("A2").alignment=o,l.getCell("A3").alignment=o,l.getCell("B3").alignment=o,l.getCell(3,r.value.length+2).alignment=o,l.getColumn(r.value.length+2).alignment=d,l.getColumn(r.value.length+3).alignment=d,l.getColumn(r.value.length+4).alignment=o,l.getColumn(r.value.length+5).alignment=o,l.getCell("A3").border=t,l.getCell("B3").border=t,l.getCell(3,r.value.length+2).border=t,l.getCell(4,r.value.length+2).border=t,l.getCell(3,r.value.length+4).border=t,l.getCell(3,r.value.length+5).border=t,l.getCell(4,r.value.length+3).border=t;let m=0;for(const v of n.value){let F=[v.name];for(let B=1;B<=r.value.length;B++){const{ind:q}=z(B,m);q!==-1?F[B]=`${v.days[q].time} ${v.days[q].tips}`:F[B]=" "}F.push(((J=v.days)==null?void 0:J.length)||" ",v.contHour||0);const ae=l.addRow(F);ae.border=t,m++}let h="Щербина Е. В.";f.odata.personal.forEach(v=>{v.roleName==="Начальник отдела правовой и кадровой работы"&&(h=v.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=u("workSchedule.byInitials"),l.getCell(`Q${n.value.length+6}`).value=u("workSchedule.supervisorHR"),l.getCell(`B${n.value.length+8}`).value=u("workSchedule.compiled")+":",l.getCell(`S${n.value.length+8}`).value=u("workSchedule.approved")+":",l.getCell(`M${n.value.length+8}`).value=c.byInitials(f.fullName),l.getCell(`AD${n.value.length+8}`).value=c.byInitials(h),l.getCell(`Z${n.value.length+9}`).value=u("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 g="export_"+c.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",k=await a.xlsx.writeBuffer();ne.saveAs(new Blob([k]),g),T.value=!1},te=async()=>{A.value||f.workSchedule.addWorkSchedule({data:n.value,date:c.parseTime(new Date(w.value),"{Y}-{m}-{dd}")}).then(a=>A.value=a)};return c.holidays().then(a=>{P.value=a,W()}),(a,l)=>{const o=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",null,[p.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElSelect),{key:0,modelValue:S.value,"onUpdate:modelValue":l[0]||(l[0]=t=>S.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(U.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),p.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:1,plain:"",onClick:l[1]||(l[1]=t=>E.value=!0),style:{"margin-bottom":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.jobTitle")),1)]),_:1})):e.createCommentVNode("",!0),p.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElSwitch),{key:2,modelValue:M.value,"onUpdate:modelValue":l[2]||(l[2]=t=>M.value=t),"active-text":e.unref(u)("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(i.ElSkeleton),{style:{width:"100%"},loading:O.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%"},size:"small",align:"center",onCellClick:Z,"empty-text":e.unref(u)("workSchedule.emptyText")},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(u)("workSchedule.title",{name:S.value})+e.unref(C)(w.value,"month")+` ${new Date(w.value).getFullYear()}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(u)("workSchedule.month"),width:"180",align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",de,e.toDisplayString(n.value[t.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(u)("workSchedule.numbersMonth"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElTableColumn),{key:t.day,width:"45","class-name":t.holidays,align:"center",label:t.weekday+`
|
|
3
3
|
`+t.day.toString()},{default:e.withCtx(d=>[e.createElementVNode("div",se,e.toDisplayString(L(t.day,d.$index)||" "),1)]),_:2},1032,["class-name","label"]))),128))]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(u)("workSchedule.onSchedule"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(u)("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(u)("workSchedule.hours")} ( ${N.value} )`,align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",{style:e.normalizeStyle(`color: ${N.value===t.row.contHour?"green":"red"};`)},e.toDisplayString(t.row.contHour),5)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])]),_:1},8,["loading"]),K.value&&p.checkEdit?(e.openBlock(),e.createElementBlock("div",ce,[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.chartsFilled"))+": ",1),A.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:0,type:"primary",onClick:te},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.confirm")),1)]),_:1})),l[17]||(l[17]=e.createTextVNode()),e.createElementVNode("span",null,e.toDisplayString(p.fullName),1)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(i.ElButton),{disabled:T.value,plain:"",onClick:le,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[o,T.value]]),e.createVNode(e.unref(i.ElDialog),{title:e.unref(u)("workSchedule.jobTitle"),modelValue:E.value,"onUpdate:modelValue":l[4]||(l[4]=t=>E.value=t),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(i.ElButton),{onClick:l[3]||(l[3]=t=>E.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:j},{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":d=>t.val=d,"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(H.ContextMenu),{show:I.value,"onUpdate:show":l[16]||(l[16]=t=>I.value=t),options:R.value},{default:e.withCtx(()=>[e.createVNode(e.unref(H.ContextMenuItem),{label:s.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(H.ContextMenuSeparator)),s.value.level===2?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(e.unref(i.ElRadioGroup),{modelValue:Y.value,"onUpdate:modelValue":l[5]||(l[5]=t=>Y.value=t),size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElRadioButton),{label:e.unref(u)("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[18]||(l[18]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(u)("workSchedule.fromDate"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:$.value,"onUpdate:modelValue":l[6]||(l[6]=t=>$.value=t),step:1,min:1,max:r.value.length},null,8,["modelValue","max"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(u)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:x.value,"onUpdate:modelValue":l[7]||(l[7]=t=>x.value=t),step:1,min:8,max:11},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(u)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:y.value,"onUpdate:modelValue":l[8]||(l[8]=t=>y.value=t),step:1,min:4,max:12},null,8,["modelValue"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[9]||(l[9]=t=>_(s.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.fillOut")),1)]),_:1}),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[10]||(l[10]=t=>X(s.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.clearRow")),1)]),_:1})])):(e.openBlock(),e.createElementBlock("div",me,[e.createElementVNode("div",null,e.toDisplayString(L(s.value.day,s.value.ids)),1),l[19]||(l[19]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(u)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:x.value,"onUpdate:modelValue":l[11]||(l[11]=t=>x.value=t),step:1,min:8,max:11,onChange:l[12]||(l[12]=t=>G(s.value.day,s.value.ids))},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(u)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:y.value,"onUpdate:modelValue":l[13]||(l[13]=t=>y.value=t),step:1,min:4,max:12,onChange:l[14]||(l[14]=t=>G(s.value.day,s.value.ids))},null,8,["modelValue"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[15]||(l[15]=t=>ee(s.value.day,s.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u)("workSchedule.delete")),1)]),_:1})]))]),_:1},8,["show","options"])])}}};module.exports=ge;
|
package/dist/WorkTable.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as v, watch as me, computed as $e, resolveDirective as Se,
|
|
1
|
+
import { ref as v, watch as me, computed as $e, resolveDirective as Se, createElementBlock as B, openBlock as f, createBlock as N, createCommentVNode as R, createVNode as i, withDirectives as xe, unref as t, withCtx as r, Fragment as te, renderList as ae, createTextVNode as $, toDisplayString as m, createElementVNode as k, normalizeStyle as De } from "vue";
|
|
2
2
|
import { saveAs as Ve } from "file-saver";
|
|
3
3
|
import * as Ee from "exceljs";
|
|
4
|
-
import { p as W, b as ne, h as Ne, c as D } from "./index-
|
|
4
|
+
import { p as W, b as ne, h as Ne, c as D } from "./index-DIjJDdmP.js";
|
|
5
5
|
import { useI18n as Ae } from "vue-i18n";
|
|
6
|
-
import { ElSelect as Me, ElOption as Be, ElButton as A, ElSwitch as ge, ElSkeleton as Te,
|
|
6
|
+
import { ElSelect as Me, ElOption as Be, ElButton as A, ElSwitch as ge, ElSkeleton as Te, ElTable as ze, ElTableColumn as T, ElSkeletonItem as P, ElDialog as Fe, ElForm as Ie, ElFormItem as Ye, ElRadioGroup as Ue, ElRadioButton as oe, ElSlider as j } from "element-plus";
|
|
7
7
|
import { ContextMenu as He, ContextMenuItem as Re, ContextMenuSeparator as We } from "@imengyu/vue3-context-menu";
|
|
8
8
|
const Pe = { style: { height: "100px", width: "100%", display: "inline-block" } }, je = { style: { height: "100px", width: "100%", display: "inline-block" } }, Oe = {
|
|
9
9
|
key: 3,
|
|
@@ -47,7 +47,7 @@ const Pe = { style: { height: "100px", width: "100%", display: "inline-block" }
|
|
|
47
47
|
a !== e && (E.value = [], Z.value = !1, S.odata.personal.forEach((o) => {
|
|
48
48
|
o.divisionName === a && (E.value.some((l) => (l == null ? void 0 : l.activeText) === o.roleName) || E.value.push({ val: !0, activeText: o.roleName }));
|
|
49
49
|
}), ee());
|
|
50
|
-
}), me(L, async (a
|
|
50
|
+
}), me(L, async (a) => {
|
|
51
51
|
C.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1).setMonth((/* @__PURE__ */ new Date()).getMonth() + Number(a)), ie();
|
|
52
52
|
});
|
|
53
53
|
const he = (a, e, o, l) => {
|
|
@@ -296,7 +296,7 @@ const Pe = { style: { height: "100px", width: "100%", display: "inline-block" }
|
|
|
296
296
|
}, {
|
|
297
297
|
default: r((l) => [
|
|
298
298
|
k("div", {
|
|
299
|
-
style:
|
|
299
|
+
style: De(`color: ${F.value === l.row.contHour ? "green" : "red"};`)
|
|
300
300
|
}, m(l.row.contHour), 5)
|
|
301
301
|
]),
|
|
302
302
|
_: 1
|
|
@@ -328,7 +328,7 @@ const Pe = { style: { height: "100px", width: "100%", display: "inline-block" }
|
|
|
328
328
|
e[17] || (e[17] = $()),
|
|
329
329
|
k("span", null, m(z.fullName), 1)
|
|
330
330
|
])) : R("", !0),
|
|
331
|
-
|
|
331
|
+
xe((f(), N(t(A), {
|
|
332
332
|
disabled: G.value,
|
|
333
333
|
plain: "",
|
|
334
334
|
onClick: ke,
|
|
@@ -0,0 +1 @@
|
|
|
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 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 p(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":h(),"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 h=()=>i.get("X-Token")||!1;exports.byInitials=p;exports.cellsDynamically=f;exports.holidays=g;exports.parseTime=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import u from "js-cookie";
|
|
2
2
|
function g(t, e) {
|
|
3
3
|
if (arguments.length === 0 || !t)
|
|
4
4
|
return null;
|
|
@@ -18,7 +18,7 @@ function g(t, e) {
|
|
|
18
18
|
F: new Intl.DateTimeFormat(a, { month: "long" }).format(r),
|
|
19
19
|
M: new Intl.DateTimeFormat(a, { month: "short" }).format(r)
|
|
20
20
|
};
|
|
21
|
-
return o.replace(/{(dd|[YmdGHisDFM])+}/g, (
|
|
21
|
+
return o.replace(/{(dd|[YmdGHisDFM])+}/g, (f, c) => l[c]);
|
|
22
22
|
}
|
|
23
23
|
function h(t, e) {
|
|
24
24
|
let r = t.replace(/[0-9]/g, "").split("").reverse().map((a) => a.charCodeAt(0));
|
|
@@ -39,7 +39,7 @@ async function y() {
|
|
|
39
39
|
headers: {
|
|
40
40
|
"Content-Type": "application/json",
|
|
41
41
|
Accept: "text/html",
|
|
42
|
-
"X-Token":
|
|
42
|
+
"X-Token": p(),
|
|
43
43
|
// Предполагается, что эта функция определена где-то в коде
|
|
44
44
|
"Cache-Control": "no-cache"
|
|
45
45
|
},
|
|
@@ -77,8 +77,111 @@ async function y() {
|
|
|
77
77
|
"2025-05-01",
|
|
78
78
|
"2025-05-09",
|
|
79
79
|
"2025-06-12",
|
|
80
|
-
"2025-11-04"
|
|
81
|
-
|
|
80
|
+
"2025-11-04",
|
|
81
|
+
"2026-01-01",
|
|
82
|
+
"2026-01-02",
|
|
83
|
+
"2026-01-03",
|
|
84
|
+
"2026-01-04",
|
|
85
|
+
"2026-01-05",
|
|
86
|
+
"2026-01-06",
|
|
87
|
+
"2026-01-07",
|
|
88
|
+
"2026-01-08",
|
|
89
|
+
"2026-02-23",
|
|
90
|
+
"2026-03-08",
|
|
91
|
+
"2026-05-01",
|
|
92
|
+
"2026-05-09",
|
|
93
|
+
"2026-06-12",
|
|
94
|
+
"2026-11-04",
|
|
95
|
+
"2027-01-01",
|
|
96
|
+
"2027-01-02",
|
|
97
|
+
"2027-01-03",
|
|
98
|
+
"2027-01-04",
|
|
99
|
+
"2027-01-05",
|
|
100
|
+
"2027-01-06",
|
|
101
|
+
"2027-01-07",
|
|
102
|
+
"2027-01-08",
|
|
103
|
+
"2027-02-23",
|
|
104
|
+
"2027-03-08",
|
|
105
|
+
"2027-05-01",
|
|
106
|
+
"2027-05-09",
|
|
107
|
+
"2027-06-12",
|
|
108
|
+
"2027-11-04",
|
|
109
|
+
// праздничные локальные Краснодар
|
|
110
|
+
"2024-05-14",
|
|
111
|
+
"2025-04-29",
|
|
112
|
+
"2026-04-21",
|
|
113
|
+
"2027-05-11",
|
|
114
|
+
"2028-04-25",
|
|
115
|
+
"2029-04-17",
|
|
116
|
+
"2030-05-07",
|
|
117
|
+
"2031-04-22",
|
|
118
|
+
"2032-05-11",
|
|
119
|
+
"2033-05-03",
|
|
120
|
+
"2034-04-18",
|
|
121
|
+
"2035-05-08",
|
|
122
|
+
"2036-04-29",
|
|
123
|
+
"2037-04-14",
|
|
124
|
+
"2038-05-04",
|
|
125
|
+
"2039-04-26",
|
|
126
|
+
"2040-05-15",
|
|
127
|
+
"2041-04-30",
|
|
128
|
+
"2042-04-22",
|
|
129
|
+
"2043-05-12",
|
|
130
|
+
"2044-05-03",
|
|
131
|
+
"2045-04-18",
|
|
132
|
+
"2046-05-08",
|
|
133
|
+
"2047-04-30"
|
|
134
|
+
], e.result.holidays.push(
|
|
135
|
+
"2024-05-14",
|
|
136
|
+
"2025-04-29",
|
|
137
|
+
"2026-04-21",
|
|
138
|
+
"2027-05-11",
|
|
139
|
+
"2028-04-25",
|
|
140
|
+
"2029-04-17",
|
|
141
|
+
"2030-05-07",
|
|
142
|
+
"2031-04-22",
|
|
143
|
+
"2032-05-11",
|
|
144
|
+
"2033-05-03",
|
|
145
|
+
"2034-04-18",
|
|
146
|
+
"2035-05-08",
|
|
147
|
+
"2036-04-29",
|
|
148
|
+
"2037-04-14",
|
|
149
|
+
"2038-05-04",
|
|
150
|
+
"2039-04-26",
|
|
151
|
+
"2040-05-15",
|
|
152
|
+
"2041-04-30",
|
|
153
|
+
"2042-04-22",
|
|
154
|
+
"2043-05-12",
|
|
155
|
+
"2044-05-03",
|
|
156
|
+
"2045-04-18",
|
|
157
|
+
"2046-05-08",
|
|
158
|
+
"2047-04-30"
|
|
159
|
+
), e.result.preholidays.push(
|
|
160
|
+
"2024-05-13",
|
|
161
|
+
"2025-04-28",
|
|
162
|
+
"2026-04-20",
|
|
163
|
+
"2027-05-10",
|
|
164
|
+
"2028-04-24",
|
|
165
|
+
"2029-04-16",
|
|
166
|
+
"2030-05-06",
|
|
167
|
+
"2031-04-21",
|
|
168
|
+
"2032-05-10",
|
|
169
|
+
"2033-05-02",
|
|
170
|
+
"2034-04-17",
|
|
171
|
+
"2035-05-07",
|
|
172
|
+
"2036-04-28",
|
|
173
|
+
"2037-04-13",
|
|
174
|
+
"2038-05-03",
|
|
175
|
+
"2039-04-25",
|
|
176
|
+
"2040-05-14",
|
|
177
|
+
"2041-04-29",
|
|
178
|
+
"2042-04-21",
|
|
179
|
+
"2043-05-11",
|
|
180
|
+
"2044-05-02",
|
|
181
|
+
"2045-04-17",
|
|
182
|
+
"2046-05-07",
|
|
183
|
+
"2047-04-29"
|
|
184
|
+
), n = e.result, n;
|
|
82
185
|
} catch (t) {
|
|
83
186
|
throw console.error("Ошибка загрузки данных о праздниках:", t), t;
|
|
84
187
|
}
|
|
@@ -91,7 +194,7 @@ function s(t, e, o) {
|
|
|
91
194
|
t[o] = (t[o] - 65 + e) % 26 + 65, s(t, r, o + 1);
|
|
92
195
|
}
|
|
93
196
|
}
|
|
94
|
-
const
|
|
197
|
+
const p = () => u.get("X-Token") || !1;
|
|
95
198
|
export {
|
|
96
199
|
m as b,
|
|
97
200
|
h as c,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studio-west/employees",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
32
32
|
"sass-embedded": "^1.83.0",
|
|
33
|
-
"vite": "^6.0
|
|
33
|
+
"vite": "^6.2.0"
|
|
34
34
|
},
|
|
35
35
|
"author": "Alexander Efimov",
|
|
36
36
|
"license": "MIT"
|
package/dist/index-CHGzf-XH.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,(m,c)=>l[c])}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 p(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":h(),"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"],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 h=()=>i.get("X-Token")||!1;exports.byInitials=p;exports.cellsDynamically=f;exports.holidays=g;exports.parseTime=u;
|