@studio-west/employees 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SheetTable.cjs +1 -1
- package/dist/SheetTable.js +1 -1
- package/package.json +1 -1
package/dist/SheetTable.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),$=require("vue-i18n"),p=require("./index-CHGzf-XH.cjs"),o=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(x){const g=x,{t:u,d:C}=$.useI18n(),c=e.ref([]),w=e.ref("0"),y=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(w.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(t,l)=>{t!==l&&(b.value=[],confirm.value=!1,g.odata.personal.forEach(a=>{a.divisionName===t&&(b.value.some(r=>(r==null?void 0:r.activeText)===a.roleName)||b.value.push({val:!0,activeText:a.roleName}))}),D())}),e.watch(w,t=>{y.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(t)),V()});const i=e.computed(()=>c.value.flatMap((t,l)=>[{...t,key:0,ids:l},{...t,key:1,ids:l}])),I=t=>{if(t.columnIndex<2||t.columnIndex>h.value.length+3&&t.columnIndex<h.value.length+9||t.columnIndex>h.value.length+11)return i.value[t.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},V=()=>{const t=T.value,l=new Date(y.value),a=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let r=[],f=0;for(let d=1;d<=a;d++){const n=p.parseTime(l.setDate(d),"{Y}-{m}-{dd}");f+=t.nowork.includes(n)||t.holidays.includes(n)?0:t.preholidays.includes(n)?7:8;let s=t.nowork.includes(n)?"nowork":t.holidays.includes(n)?"holiday":t.preholidays.includes(n)?"preholiday":"";r.push({day:d,holidays:s,weekday:C(new Date(l.getFullYear(),l.getMonth(),d),"day")})}k.value=f,h.value=r,g.odata.getPersonal({}).then(d=>{var n;v.value=(n=d.find(s=>s.employeeName===g.fullName))==null?void 0:n.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})}),D()})},D=()=>{c.value=[];let t=[];g.odata.personal.forEach(l=>{if(l.divisionName===v.value&&b.value.some(a=>a.val&&a.activeText===l.roleName)){let a=p.byInitials(l.employeeName);t.push(l.employeeKey),c.value.push({name:a+" ("+l.roleName+")",code:l.employeeKey,days:[],contHour:0,id:!1,ids:c.value.length})}}),B(t)},B=t=>{g.workSchedule.getWorkSchedule({code:t,date:p.parseTime(new Date(y.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((a,r)=>{var f,d;if(a!==null){a.data.days.forEach(n=>n.state="Я");for(let n=1;n<=h.value.length;n++){let s=p.parseTime(new Date(y.value).setDate(n),"{Y}-{m}-{dd}");const m=(f=a.data)==null?void 0:f.days.findIndex(M=>M.day===s);m===-1?c.value[r].days.push({day:s,time:"-",state:"В"}):c.value[r].days.push((d=a.data)==null?void 0:d.days[m])}}else{c.value[r].days=[];for(let n=1;n<=h.value.length;n++)h.value[n-1].holidays===""?S(n,r,8):h.value[n-1].holidays==="preholiday"?S(n,r,7):c.value[r].days.push({day:p.parseTime(new Date(y.value).setDate(n),"{Y}-{m}-{dd}"),time:"-",state:"В"})}}),_()})},S=(t,l,a)=>{const r=p.parseTime(new Date(y.value).setDate(t),"{Y}-{m}-{dd}");
|
|
1
|
+
"use strict";const e=require("vue"),$=require("vue-i18n"),p=require("./index-CHGzf-XH.cjs"),o=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(x){const g=x,{t:u,d:C}=$.useI18n(),c=e.ref([]),w=e.ref("0"),y=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(w.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(t,l)=>{t!==l&&(b.value=[],confirm.value=!1,g.odata.personal.forEach(a=>{a.divisionName===t&&(b.value.some(r=>(r==null?void 0:r.activeText)===a.roleName)||b.value.push({val:!0,activeText:a.roleName}))}),D())}),e.watch(w,t=>{y.value=new Date(new Date().getFullYear(),new Date().getMonth(),1).setMonth(new Date().getMonth()+Number(t)),V()});const i=e.computed(()=>c.value.flatMap((t,l)=>[{...t,key:0,ids:l},{...t,key:1,ids:l}])),I=t=>{if(t.columnIndex<2||t.columnIndex>h.value.length+3&&t.columnIndex<h.value.length+9||t.columnIndex>h.value.length+11)return i.value[t.rowIndex].key===0?{rowspan:2,colspan:1}:{rowspan:0,colspan:0}},V=()=>{const t=T.value,l=new Date(y.value),a=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let r=[],f=0;for(let d=1;d<=a;d++){const n=p.parseTime(l.setDate(d),"{Y}-{m}-{dd}");f+=t.nowork.includes(n)||t.holidays.includes(n)?0:t.preholidays.includes(n)?7:8;let s=t.nowork.includes(n)?"nowork":t.holidays.includes(n)?"holiday":t.preholidays.includes(n)?"preholiday":"";r.push({day:d,holidays:s,weekday:C(new Date(l.getFullYear(),l.getMonth(),d),"day")})}k.value=f,h.value=r,g.odata.getPersonal({}).then(d=>{var n;v.value=(n=d.find(s=>s.employeeName===g.fullName))==null?void 0:n.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})}),D()})},D=()=>{c.value=[];let t=[];g.odata.personal.forEach(l=>{if(l.divisionName===v.value&&b.value.some(a=>a.val&&a.activeText===l.roleName)){let a=p.byInitials(l.employeeName);t.push(l.employeeKey),c.value.push({name:a+" ("+l.roleName+")",code:l.employeeKey,days:[],contHour:0,id:!1,ids:c.value.length})}}),B(t)},B=t=>{g.workSchedule.getWorkSchedule({code:t,date:p.parseTime(new Date(y.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((a,r)=>{var f,d;if(a!==null){a.data.days.forEach(n=>n.state="Я");for(let n=1;n<=h.value.length;n++){let s=p.parseTime(new Date(y.value).setDate(n),"{Y}-{m}-{dd}");const m=(f=a.data)==null?void 0:f.days.findIndex(M=>M.day===s);m===-1?c.value[r].days.push({day:s,time:"-",state:"В"}):c.value[r].days.push((d=a.data)==null?void 0:d.days[m])}}else{c.value[r].days=[];for(let n=1;n<=h.value.length;n++)h.value[n-1].holidays===""?S(n,r,8):h.value[n-1].holidays==="preholiday"?S(n,r,7):c.value[r].days.push({day:p.parseTime(new Date(y.value).setDate(n),"{Y}-{m}-{dd}"),time:"-",state:"В"})}}),_()})},S=(t,l,a)=>{const r=p.parseTime(new Date(y.value).setDate(t),"{Y}-{m}-{dd}");c.value[l].days.push({day:r,time:a,state:"Я"})},_=()=>{c.value.forEach(t=>{t.hourI=0,t.hourII=0,t.halfII=0,t.halfI=0,t.weekend=0,t.weekendDays=0,t.night=0;for(let l=0;l<t.days.length;l++)l<15&&t.days[l].time!=="-"&&(t.hourI+=t.days[l].time),l<15&&t.days[l].state==="Я"&&t.halfI++,l>=15&&t.days[l].time!=="-"&&(t.hourII+=t.days[l].time),l>=15&&t.days[l].state==="Я"&&t.halfII++,t.days[l].state==="Н"&&(t.night+=t.days[l].time),t.days[l].state==="РВ"&&(t.weekend+=t.days[l].time),t.days[l].state==="В"&&t.weekendDays++;t.contDays=t.halfI+t.halfII,t.contHour=t.hourI+t.hourII,t.overtime=0,k.value<t.contHour&&(t.overtime=t.contHour-k.value),t.numberNonAppearing=0,t.appearing={code:"-",countH:"-"}})},E=(t,l)=>{var d,n;if(l===-1)return"";const a=new Date(y.value),r=`${a.getFullYear()}-${(a.getMonth()+1).toString().padStart(2,"0")}-${t.toString().padStart(2,"0")}`,f=i.value[l].days.findIndex(s=>s.day===r);return f===-1?"":i.value[l].key===0?(d=i.value[l].days[f])==null?void 0:d.state:(n=i.value[l].days[f])==null?void 0:n.time};return p.holidays().then(t=>{T.value=t,V()}),(t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[x.checkEdit?(e.openBlock(),e.createBlock(e.unref(o.ElSelect),{key:0,modelValue:v.value,"onUpdate:modelValue":l[0]||(l[0]=a=>v.value=a),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,a=>(e.openBlock(),e.createBlock(e.unref(o.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),x.checkEdit?(e.openBlock(),e.createBlock(e.unref(o.ElSwitch),{key:1,modelValue:w.value,"onUpdate:modelValue":l[1]||(l[1]=a=>w.value=a),"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(o.ElTable),{id:"printTable",data:i.value,"span-method":I,border:"",style:{width:"100%"},size:"small","empty-text":e.unref(u)("sheet.emptyText"),align:"center",onCellClick:t.coMenu},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.title",{name:v.value})+e.unref(C)(y.value,"month"),align:"center",height:"10"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.employee"),width:"180",align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.personnelNumber"),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].code),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.marks"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.day},[a.day<=15?(e.openBlock(),e.createBlock(e.unref(o.ElTableColumn),{key:0,width:"30","class-name":a.holidays,align:"center",label:a.day.toString()+`
|
|
2
2
|
`+a.weekday},{default:e.withCtx(r=>[e.createElementVNode("div",F,e.toDisplayString(E(a.day,r.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.halfMonth",{half:"I"}),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.day},[a.day>15?(e.openBlock(),e.createBlock(e.unref(o.ElTableColumn),{key:0,width:"30","class-name":a.holidays,align:"center",label:a.day.toString()+`
|
|
3
3
|
`+a.weekday},{default:e.withCtx(r=>[e.createElementVNode("div",Y,e.toDisplayString(E(a.day,r.$index)||" "),1)]),_:2},1032,["class-name","label"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.halfMonth",{half:"II"}),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.workedMonth"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.days"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.hours"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.all"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.overtime"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.night"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.weekend"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.numberNonAppearing"),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.them"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.code"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.count"),align:"center","label-class-name":"turn",width:"30"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"])]),_:1},8,["label"]),e.createVNode(e.unref(o.ElTableColumn),{label:e.unref(u)("sheet.countWeekend"),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(i.value[a.$index].dateStart),1)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","empty-text","onCellClick"])],64))}};module.exports=H;
|
package/dist/SheetTable.js
CHANGED
|
@@ -82,7 +82,7 @@ const ae = { style: { height: "20px", width: "100%", display: "inline-block" } }
|
|
|
82
82
|
);
|
|
83
83
|
}, O = (e, t, a) => {
|
|
84
84
|
const u = M(new Date(x.value).setDate(e), "{Y}-{m}-{dd}");
|
|
85
|
-
|
|
85
|
+
f.value[t].days.push({
|
|
86
86
|
day: u,
|
|
87
87
|
time: a,
|
|
88
88
|
state: "Я"
|