@studio-west/employees 0.6.40 → 0.6.42
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 +163 -161
- package/dist/WorkTable.cjs +1 -1
- package/dist/WorkTable.js +39 -37
- package/package.json +1 -1
package/dist/WorkTable.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";const e=require("vue"),de=require("file-saver"),se=require("exceljs"),m=require("./index-Dn3djtwj.cjs"),ve=require("vue-i18n"),i=require("element-plus"),_=require("@imengyu/vue3-context-menu");function ce(C){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(C){for(const V in C)if(V!=="default"){const c=Object.getOwnPropertyDescriptor(C,V);Object.defineProperty(r,V,c.get?c:{enumerable:!0,get:()=>C[V]})}}return r.default=C,Object.freeze(r)}const me=ce(se),ge={class:"work"},he={class:"nav"},fe={style:{height:"100px",width:"100%",display:"inline-block"}},pe={style:{height:"100px",width:"100%",display:"inline-block"}},ye={key:0,class:"controls-container",style:{"margin-top":".5rem"}},we={class:"label"},ke={key:0,style:{padding:"0.5em 1.5em"}},Ce={key:1,style:{padding:"0.5em 1.5em"}},xe={__name:"WorkTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"},group:String,date:String},setup(C){const{t:r,d:V}=ve.useI18n(),c=C,I=e.ref(!1),n=e.ref([]),R=e.ref(c.date?new Date(c.date+"T00:00:01").getMonth():new Date().getMonth()),j=e.ref(!1),B=e.ref([]),f=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1)),u=e.ref([]),T=e.ref(0),p=e.ref(9),h=e.ref(8),Y=e.ref(!1),J=e.ref(!0),$=e.ref(!1),q=e.ref("5"),M=e.ref(1),x=e.ref([]),O=e.ref([]),E=e.ref([]),U=e.ref([]),g=e.ref({name:"Имя",length:0,code:""}),A=e.ref(!1),P=e.ref({zIndex:3,minWidth:230,x:500,y:200}),Z=e.ref({}),z=e.ref("100%");e.watch(x,async(t,l)=>{t!==l&&(E.value=[],Y.value=!1,c.odata.personal.forEach(o=>{t.includes(o.divisionName)&&(E.value.some(d=>(d==null?void 0:d.activeText)===o.roleName)||E.value.push({val:!0,activeText:o.roleName}))}),W())}),e.watch(R,async t=>{let l=new Date().getMonth(),o=t===null?l:t-1;o=l-1<=o?o:o+12,console.log("currentMonth",o),f.value=new Date(new Date().getFullYear(),o,1),K()});const ee=(t,l,o,d)=>{g.value.ids=t.ids,g.value.key=t.key,g.value.add=t.days.length>0&&t.days[t.days.length-1].cont,g.value.level=l.level,g.value.day=o.cellIndex,P.value.y=d.clientY,P.value.x=d.clientX,l.level===2&&l.no===0&&c.checkEdit&&(g.value.name=r("workSchedule.autocomplete"),A.value=!0),l.level===3&&o.cellIndex-l.no===1&&c.checkEdit&&(D(o.cellIndex,t.ids),g.value.name=r("workSchedule.modeSelection"),A.value=!0)},le=({row:t,columnIndex:l})=>{if(!B.value||B.value.length===0||!j.value)return"";const o=new Date(new Date(f.value).getFullYear(),new Date(f.value).getMonth(),l).getTime()+1e3;for(let d of B.value){const{dateStart:v,dateEnd:a,code:w}=d;if(v&&a&&w===t.code&&l!==0&&l<=u.value.length){const N=new Date(m.parseDate(v)).getTime(),b=new Date(m.parseDate(a)).getTime();if(o>=N&&o<=b)return"vacation"}}return""},K=()=>{var a,w,N,b;const t=Z.value,l=new Date(f.value),o=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let d=[],v=0;for(let S=1;S<=o;S++){const s=m.parseTime(l.setDate(S),"{Y}-{m}-{dd}");v+=(a=t.nowork)!=null&&a.includes(s)||t.holidays.includes(s)?0:(w=t.preholidays)!=null&&w.includes(s)?7:8;const y=(N=t.nowork)!=null&&N.includes(s)?"nowork":t.holidays.includes(s)?"holiday":(b=t.preholidays)!=null&&b.includes(s)?"preholiday":"";d.push({day:S,holidays:y,weekday:V(new Date(l.getFullYear(),l.getMonth(),S),"day")})}T.value=v,u.value=d,c.odata.getPersonal({}).then(S=>{var s;x.value.length===0&&(x.value=[(s=S.find(y=>y.employeeName===c.fullName))==null?void 0:s.divisionName]),S.forEach((y,L)=>{O.value.some(k=>(k==null?void 0:k.value)===y.divisionName)||O.value.push({value:y.divisionName,label:y.divisionName,key:L}),x.value.includes(y.divisionName)&&!E.value.some(k=>(k==null?void 0:k.activeText)===y.roleName)&&E.value.push({val:!0,activeText:y.roleName})}),W(),J.value=!1})},te=e.computed(()=>!n.value.some(t=>t.contHour!==T.value)),Q=(t,l)=>{var a,w,N;const o=new Date(f.value),d=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${t.toString().padStart(2,"0")}`,v=(a=n.value[l])==null?void 0:a.days.findIndex(b=>b.day===d);return l===-1||v===-1?"":((w=n.value[l].days[v])==null?void 0:w.tips)+`
|
|
2
|
-
`+((N=n.value[l].days[v])==null?void 0:N.time)},W=()=>{n.value=[],U.value=[],B.value=[],c.odata.personal.forEach(t=>{if(x.value.includes(t.divisionName)&&E.value.some(l=>l.val&&l.activeText===t.roleName)){let l=m.byInitials(t.employeeName);U.value.push(t.employeeKey),n.value.push({name:l+" ("+t.roleName+")",days:[],contHour:0,code:t.employeeKey,id:!1,
|
|
2
|
+
`+((N=n.value[l].days[v])==null?void 0:N.time)},W=()=>{n.value=[],U.value=[],B.value=[],c.odata.personal.forEach(t=>{if(x.value.includes(t.divisionName)&&E.value.some(l=>l.val&&l.activeText===t.roleName)){let l=m.byInitials(t.employeeName);U.value.push(t.employeeKey),n.value.push({name:l+" ("+t.roleName+")",days:[],contHour:0,code:t.employeeKey,id:!1})}}),n.value.sort((t,l)=>t.fio<l.fio?-1:t.fio>l.fio?1:0),n.value.forEach((t,l)=>{t.ids=l}),c.workSchedule.getUsersYear({code:U.value,year:new Date(f.value).getFullYear()}).then(t=>{t.forEach(l=>{l.dateStart&&B.value.push({code:l.code,dateStart:l.dateStart,dateEnd:l.dateEnd})}),ae(),$.value=!1})},ae=()=>{c.workSchedule.getWorkSchedule({code:U.value,date:m.parseTime(new Date(f.value),"{Y}-{m}-{dd}")}).then(t=>{t.forEach((l,o)=>{l!==null&&(n.value[o].days=l.data.days,n.value[o].id=l.id)}),F()})},F=()=>{n.value.forEach(t=>{t.contHour=t.days.reduce((l,o)=>l+o.time,0)})},ne=t=>{n.value[t].days=[],F()},oe=t=>{switch(q.value){case"5":for(let l=M.value;l<=u.value.length;l++)u.value[l-1].holidays===""&&D(l,t,!0),u.value[l-1].holidays==="preholiday"&&(h.value-=1,D(l,t,!0),h.value+=1);break;case"2x2":for(let l=M.value;l<=u.value.length;l+=4)D(l,t,!0),l+1<=u.value.length&&D(l+1,t,!0);break;case"2x5":for(let l=M.value;l<=u.value.length;l+=7)for(let o=l;o<l+5&&o<=u.value.length;o++)u.value[o-1].holidays==="preholiday"?(h.value-=1,D(o,t,!0),h.value+=1):D(o,t,!0);break}},D=(t,l,o=!1)=>{const{date:d,ind:v}=H(t,l);v===-1?(n.value[l].days.push({day:d,time:h.value,tips:`(${p.value}:00 - ${h.value>=22?p.value+h.value+2:p.value+h.value+1}:00)`}),F()):o||(h.value=n.value[l].days[v].time,p.value=parseInt(n.value[l].days[v].tips.slice(1,-12)))},ue=(t,l)=>{const{ind:o}=H(t,l);n.value[l].days.splice(o,1),F(),document.querySelector(".app-main").click()},X=(t,l)=>{const{date:o,ind:d}=H(t,l);n.value[l].days[d]={day:o,time:h.value,tips:`(${p.value}:00 - ${h.value>=22?p.value+h.value+2:p.value+h.value+1}:00)`},F()},H=(t,l)=>{var v;const o=m.parseTime(new Date(f.value).setDate(t),"{Y}-{m}-{dd}"),d=(v=n.value[l])==null?void 0:v.days.findIndex(a=>a.day===o);return{date:o,ind:d}},re=async()=>{var S;I.value=!0;const t=new me.Workbook,l=t.addWorksheet(V(f.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),o={vertical:"middle",horizontal:"center"},d={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},v={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${m.cellsDynamically("A1",u.value.length+5)}1`),l.mergeCells(`A2:${m.cellsDynamically("A2",u.value.length+5)}2`),l.mergeCells("A3:A4"),l.mergeCells(`B3:${m.cellsDynamically("B3",u.value.length)}3`),l.mergeCells(`${m.cellsDynamically("B3",u.value.length+1)}3:${m.cellsDynamically("B3",u.value.length+2)}3`),l.mergeCells(`${m.cellsDynamically("B3",u.value.length+3)}3:${m.cellsDynamically("B4",u.value.length+3)}4`),l.mergeCells(`${m.cellsDynamically("B3",u.value.length+4)}3:${m.cellsDynamically("B4",u.value.length+4)}4`),l.getCell("A1").value=r("workSchedule.firm"),l.getCell("A2").value=r("workSchedule.title",{name:x.value[0]})+V(f.value,"month")+` ${new Date(f.value).getFullYear()}`,l.getCell("A3").value=r("workSchedule.month"),l.getCell("B3").value=r("workSchedule.numbersMonth"),l.getCell(3,u.value.length+2).value=r("workSchedule.onSchedule"),l.getCell(3,u.value.length+4).value=r("workSchedule.acquainted"),l.getCell(3,u.value.length+5).value=r("workSchedule.date"),l.getCell(4,u.value.length+2).value=r("workSchedule.days"),l.getCell(4,u.value.length+3).value=`${r("workSchedule.hours")} (${T.value})`;for(let s=2;s<=u.value.length+1;s++)l.getCell(4,s).value=u.value[s-2].weekday+`
|
|
3
3
|
`+(s-1),l.getColumn(s).width=6,l.getColumn(s).alignment=v,l.getCell(4,s).border=d;l.getRow(1).height=40,l.getRow(2).height=30,l.getRow(3).height=20,l.getColumn(1).width=15,l.getColumn(u.value.length+2).width=5,l.getColumn(u.value.length+3).width=6,l.getColumn(u.value.length+4).width=13,l.getColumn(u.value.length+5).width=13,l.getColumn(1).alignment=v,l.getCell("A2").alignment=o,l.getCell("A3").alignment=o,l.getCell("B3").alignment=o,l.getCell(3,u.value.length+2).alignment=o,l.getColumn(u.value.length+2).alignment=v,l.getColumn(u.value.length+3).alignment=v,l.getColumn(u.value.length+4).alignment=o,l.getColumn(u.value.length+5).alignment=o,l.getCell("A3").border=d,l.getCell("B3").border=d,l.getCell(3,u.value.length+2).border=d,l.getCell(4,u.value.length+2).border=d,l.getCell(3,u.value.length+4).border=d,l.getCell(3,u.value.length+5).border=d,l.getCell(4,u.value.length+3).border=d;let a=0;for(const s of n.value){let y=[s.name];for(let k=1;k<=u.value.length;k++){const{ind:G}=H(k,a);G!==-1?y[k]=`${s.days[G].time} ${s.days[G].tips}`:y[k]=" "}y.push(((S=s.days)==null?void 0:S.length)||" ",s.contHour||0);const L=l.addRow(y);L.border=d,a++}let w="Щербина Е. В.";c.odata.personal.forEach(s=>{s.roleName==="Начальник отдела правовой и кадровой работы"&&(w=s.employeeName)}),l.mergeCells(`A${n.value.length+6}:P${n.value.length+6}`),l.mergeCells(`Q${n.value.length+6}:AG${n.value.length+6}`),l.mergeCells(`B${n.value.length+8}:E${n.value.length+8}`),l.mergeCells(`F${n.value.length+8}:L${n.value.length+8}`),l.mergeCells(`M${n.value.length+8}:P${n.value.length+8}`),l.mergeCells(`S${n.value.length+8}:V${n.value.length+8}`),l.mergeCells(`W${n.value.length+8}:AC${n.value.length+8}`),l.mergeCells(`AD${n.value.length+8}:AG${n.value.length+8}`),l.mergeCells(`Z${n.value.length+9}:AA${n.value.length+9}`),l.getCell(`A${n.value.length+6}`).value=r("workSchedule.byInitials"),l.getCell(`Q${n.value.length+6}`).value=r("workSchedule.supervisorHR"),l.getCell(`B${n.value.length+8}`).value=r("workSchedule.compiled")+":",l.getCell(`S${n.value.length+8}`).value=r("workSchedule.approved")+":",l.getCell(`M${n.value.length+8}`).value=m.byInitials(c.fullName),l.getCell(`AD${n.value.length+8}`).value=m.byInitials(w),l.getCell(`Z${n.value.length+9}`).value=r("workSchedule.printPlace"),l.getCell(`A${n.value.length+6}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`Q${n.value.length+6}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`B${n.value.length+8}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`F${n.value.length+8}`).alignment={vertical:"middle",horizontal:"right"},l.getCell(`M${n.value.length+8}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`AD${n.value.length+8}`).alignment={vertical:"middle",horizontal:"left"},l.getCell(`Z${n.value.length+9}`).alignment=o,l.getCell(`F${n.value.length+8}`).border={bottom:{style:"thin"}},l.getCell(`W${n.value.length+8}`).border={bottom:{style:"thin"}};const N="export_"+m.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",b=await t.xlsx.writeBuffer();de.saveAs(new Blob([b]),N),I.value=!1},ie=async()=>{Y.value||c.workSchedule.addWorkSchedule({data:n.value,date:m.parseTime(new Date(f.value),"{Y}-{m}-{dd}"),group:x.value[0]}).then(t=>Y.value=t)};return console.log("props.group",c.group),console.log("props.date",c.date),c.group&&(x.value[0]=c.group),c.date&&(f.value=new Date(c.date+"T00:00:01")),m.holidays().then(t=>{Z.value=t,K()}),(t,l)=>{const o=e.resolveComponent("el-date-picker"),d=e.resolveComponent("svg-icon"),v=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("div",he,[C.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElSelect),{key:0,modelValue:x.value,"onUpdate:modelValue":l[0]||(l[0]=a=>x.value=a),multiple:"","collapse-tags":"","collapse-tags-tooltip":"",placeholder:"Select",style:{width:"240px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,a=>(e.openBlock(),e.createBlock(e.unref(i.ElOption),{key:a.key,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),C.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:1,plain:"",onClick:l[1]||(l[1]=a=>$.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.jobTitle")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(o,{modelValue:R.value,"onUpdate:modelValue":l[2]||(l[2]=a=>R.value=a),type:"month",placeholder:"Выберите месяц",format:"MMM","value-format":"M"},null,8,["modelValue"]),l[21]||(l[21]=e.createElementVNode("div",{class:"expander"},null,-1)),e.createVNode(e.unref(i.ElSwitch),{modelValue:z.value,"onUpdate:modelValue":l[3]||(l[3]=a=>z.value=a),"active-text":t.$t("bids.currentHeight"),"active-value":"100%","inactive-value":"calc(100vh - var(--el-component-size)*5 - var(--el-main-padding)*2 - var(--header-height))"},null,8,["modelValue","active-text"]),e.createVNode(e.unref(i.ElSwitch),{modelValue:j.value,"onUpdate:modelValue":l[4]||(l[4]=a=>j.value=a),"active-text":"Отпуска","active-value":!0,"inactive-value":!1},null,8,["modelValue"])]),e.createVNode(e.unref(i.ElSkeleton),{style:{width:"100%"},loading:J.value,animated:""},{template:e.withCtx(()=>[e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"100%",height:"2rem"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"4rem","margin-right":"4px"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"4rem"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"180px",height:"8rem","margin-right":"4px"}}),e.createVNode(e.unref(i.ElSkeletonItem),{variant:"text",style:{width:"calc( 100% - 184px)",height:"8rem"}})]),default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTable),{id:"printTable",data:n.value,style:{width:"100%"},"max-height":z.value,size:"small",align:"center",onCellClick:ee,"empty-text":e.unref(r)("workSchedule.emptyText"),"cell-class-name":le},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.title",{name:x.value[0]})+e.unref(V)(f.value,"month")+` ${new Date(f.value).getFullYear()}`,align:"center",height:"34"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.month"),width:"180",align:"center",fixed:z.value!=="100%"},{default:e.withCtx(a=>[e.createElementVNode("div",fe,e.toDisplayString(n.value[a.$index].name),1)]),_:1},8,["label","fixed"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.numbersMonth"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,a=>(e.openBlock(),e.createBlock(e.unref(i.ElTableColumn),{key:a.day,width:"46","class-name":a.holidays,align:"center",label:a.weekday+`
|
|
4
4
|
`+a.day.toString(),prop:"vacation"},{default:e.withCtx(w=>[e.createElementVNode("div",pe,e.toDisplayString(Q(a.day,w.$index)||" "),1)]),_:2},1032,["class-name","label"]))),128))]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.onSchedule"),align:"center",fixed:z.value!=="100%"?"right":!1},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.days"),align:"center"},{default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString(n.value[a.$index].days.length||0),1)]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:`${e.unref(r)("workSchedule.hours")} ( ${T.value} )`,align:"center"},{default:e.withCtx(a=>[e.createElementVNode("div",{style:e.normalizeStyle(`color: ${T.value===a.row.contHour?"green":"red"};`)},e.toDisplayString(a.row.contHour),5)]),_:1},8,["label"])]),_:1},8,["label","fixed"])]),_:1},8,["label"])]),_:1},8,["data","max-height","empty-text"])]),_:1},8,["loading"]),te.value&&C.checkEdit?(e.openBlock(),e.createElementBlock("div",ye,[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.chartsFilled"))+": ",1),Y.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:0,type:"primary",onClick:ie},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.confirm")),1)]),_:1})),l[22]||(l[22]=e.createTextVNode()),e.createElementVNode("span",null,e.toDisplayString(C.fullName),1)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(i.ElButton),{disabled:I.value,plain:"",onClick:re,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[v,I.value]]),e.createVNode(e.unref(i.ElDialog),{title:e.unref(r)("workSchedule.jobTitle"),modelValue:$.value,"onUpdate:modelValue":l[7]||(l[7]=a=>$.value=a),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(i.ElButton),{onClick:l[5]||(l[5]=a=>$.value=!1),size:"default"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$t("workSchedule.cancel")),1)]),_:1}),e.createVNode(e.unref(i.ElButton),{size:"default",type:"primary",onClick:l[6]||(l[6]=a=>{W(),$.value=!1})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$t("workSchedule.select")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(i.ElForm),{ref:"dialogForm",model:E.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,a=>(e.openBlock(),e.createBlock(e.unref(i.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElSwitch),{modelValue:a.val,"onUpdate:modelValue":w=>a.val=w,"active-text":a.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(_.ContextMenu),{show:A.value,"onUpdate:show":l[20]||(l[20]=a=>A.value=a),options:P.value},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"mx-context-menu-item",onClick:l[8]||(l[8]=a=>A.value=!1)},[e.createElementVNode("span",we,e.toDisplayString(g.value.name),1),l[23]||(l[23]=e.createElementVNode("div",{class:"expander"},null,-1)),e.createVNode(d,{"icon-class":"cross"})]),e.createVNode(e.unref(_.ContextMenuSeparator)),g.value.level===2?(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(e.unref(i.ElRadioGroup),{modelValue:q.value,"onUpdate:modelValue":l[9]||(l[9]=a=>q.value=a),size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElRadioButton),{label:e.unref(r)("workSchedule.Days5"),value:"5"},null,8,["label"]),e.createVNode(e.unref(i.ElRadioButton),{label:"2 Х 2",value:"2x2"}),e.createVNode(e.unref(i.ElRadioButton),{label:"2 Х 5",value:"2x5"})]),_:1},8,["modelValue"]),l[24]||(l[24]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.fromDate"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:M.value,"onUpdate:modelValue":l[10]||(l[10]=a=>M.value=a),step:1,min:1,max:u.value.length},null,8,["modelValue","max"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:p.value,"onUpdate:modelValue":l[11]||(l[11]=a=>p.value=a),step:1,min:0,max:19},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:h.value,"onUpdate:modelValue":l[12]||(l[12]=a=>h.value=a),step:1,min:4,max:e.unref(m.clamp)(p.value!==1?23-p.value:21,4,22)},null,8,["modelValue","max"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[13]||(l[13]=a=>oe(g.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.fillOut")),1)]),_:1}),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[14]||(l[14]=a=>ne(g.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.clearRow")),1)]),_:1})])):(e.openBlock(),e.createElementBlock("div",Ce,[e.createElementVNode("div",null,e.toDisplayString(Q(g.value.day,g.value.ids)),1),l[25]||(l[25]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:p.value,"onUpdate:modelValue":l[15]||(l[15]=a=>p.value=a),step:1,min:0,max:19,onChange:l[16]||(l[16]=a=>X(g.value.day,g.value.ids))},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:h.value,"onUpdate:modelValue":l[17]||(l[17]=a=>h.value=a),step:1,min:4,max:e.unref(m.clamp)(p.value!==1?23-p.value:21,4,22),onChange:l[18]||(l[18]=a=>X(g.value.day,g.value.ids))},null,8,["modelValue","max"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[19]||(l[19]=a=>ue(g.value.day,g.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.delete")),1)]),_:1})]))]),_:1},8,["show","options"])])}}};module.exports=xe;
|
package/dist/WorkTable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as g, watch as
|
|
1
|
+
import { ref as g, watch as ye, computed as Ae, resolveComponent as we, resolveDirective as Te, createElementBlock as z, openBlock as S, createElementVNode as y, createVNode as i, createCommentVNode as _, withDirectives as Be, createBlock as F, unref as a, withCtx as v, Fragment as ie, renderList as re, createTextVNode as V, toDisplayString as h, normalizeStyle as ze } from "vue";
|
|
2
2
|
import { saveAs as Fe } from "file-saver";
|
|
3
3
|
import * as Ye from "exceljs";
|
|
4
4
|
import { p as G, b as se, h as Ue, c as ke, a as Ce, d as M } from "./index-2Mx6IUGl.js";
|
|
@@ -39,17 +39,17 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
39
39
|
// code: '0000-00052'
|
|
40
40
|
// ids: 1
|
|
41
41
|
// }
|
|
42
|
-
]), ee = g(c.date ? (/* @__PURE__ */ new Date(c.date + "T00:00:01")).getMonth() : (/* @__PURE__ */ new Date()).getMonth()), le = g(!1), I = g([]), w = g(new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1)), u = g([]), R = g(0), k = g(9),
|
|
42
|
+
]), ee = g(c.date ? (/* @__PURE__ */ new Date(c.date + "T00:00:01")).getMonth() : (/* @__PURE__ */ new Date()).getMonth()), le = g(!1), I = g([]), w = g(new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1)), u = g([]), R = g(0), k = g(9), f = g(8), K = g(!1), me = g(!0), U = g(!1), te = g("5"), W = g(1), b = g([]), ae = g([]), N = g([]), Q = g([]), p = g({ name: "Имя", length: 0, code: "" }), P = g(!1), ne = g({
|
|
43
43
|
zIndex: 3,
|
|
44
44
|
minWidth: 230,
|
|
45
45
|
x: 500,
|
|
46
46
|
y: 200
|
|
47
47
|
}), he = g({}), j = g("100%");
|
|
48
|
-
|
|
48
|
+
ye(b, async (l, e) => {
|
|
49
49
|
l !== e && (N.value = [], K.value = !1, c.odata.personal.forEach((o) => {
|
|
50
50
|
l.includes(o.divisionName) && (N.value.some((r) => (r == null ? void 0 : r.activeText) === o.roleName) || N.value.push({ val: !0, activeText: o.roleName }));
|
|
51
51
|
}), oe());
|
|
52
|
-
}),
|
|
52
|
+
}), ye(ee, async (l) => {
|
|
53
53
|
let e = (/* @__PURE__ */ new Date()).getMonth(), o = l === null ? e : l - 1;
|
|
54
54
|
o = e - 1 <= o ? o : o + 12, console.log("currentMonth", o), w.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), o, 1), ce();
|
|
55
55
|
});
|
|
@@ -91,12 +91,14 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
91
91
|
n.value = [], Q.value = [], I.value = [], c.odata.personal.forEach((l) => {
|
|
92
92
|
if (b.value.includes(l.divisionName) && N.value.some((e) => e.val && e.activeText === l.roleName)) {
|
|
93
93
|
let e = se(l.employeeName);
|
|
94
|
-
Q.value.push(l.employeeKey), n.value.push({ name: e + " (" + l.roleName + ")", days: [], contHour: 0, code: l.employeeKey, id: !1
|
|
94
|
+
Q.value.push(l.employeeKey), n.value.push({ name: e + " (" + l.roleName + ")", days: [], contHour: 0, code: l.employeeKey, id: !1 });
|
|
95
95
|
}
|
|
96
|
+
}), n.value.sort((l, e) => l.fio < e.fio ? -1 : l.fio > e.fio ? 1 : 0), n.value.forEach((l, e) => {
|
|
97
|
+
l.ids = e;
|
|
96
98
|
}), c.workSchedule.getUsersYear({ code: Q.value, year: new Date(w.value).getFullYear() }).then((l) => {
|
|
97
99
|
l.forEach((e) => {
|
|
98
100
|
e.dateStart && I.value.push({ code: e.code, dateStart: e.dateStart, dateEnd: e.dateEnd });
|
|
99
|
-
}),
|
|
101
|
+
}), be(), U.value = !1;
|
|
100
102
|
});
|
|
101
103
|
}, be = () => {
|
|
102
104
|
c.workSchedule.getWorkSchedule({ code: Q.value, date: G(new Date(w.value), "{Y}-{m}-{dd}") }).then(
|
|
@@ -116,7 +118,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
116
118
|
switch (te.value) {
|
|
117
119
|
case "5":
|
|
118
120
|
for (let e = W.value; e <= u.value.length; e++)
|
|
119
|
-
u.value[e - 1].holidays === "" && B(e, l, !0), u.value[e - 1].holidays === "preholiday" && (
|
|
121
|
+
u.value[e - 1].holidays === "" && B(e, l, !0), u.value[e - 1].holidays === "preholiday" && (f.value -= 1, B(e, l, !0), f.value += 1);
|
|
120
122
|
break;
|
|
121
123
|
case "2x2":
|
|
122
124
|
for (let e = W.value; e <= u.value.length; e += 4)
|
|
@@ -125,25 +127,25 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
125
127
|
case "2x5":
|
|
126
128
|
for (let e = W.value; e <= u.value.length; e += 7)
|
|
127
129
|
for (let o = e; o < e + 5 && o <= u.value.length; o++)
|
|
128
|
-
u.value[o - 1].holidays === "preholiday" ? (
|
|
130
|
+
u.value[o - 1].holidays === "preholiday" ? (f.value -= 1, B(o, l, !0), f.value += 1) : B(o, l, !0);
|
|
129
131
|
break;
|
|
130
132
|
}
|
|
131
133
|
}, B = (l, e, o = !1) => {
|
|
132
134
|
const { date: r, ind: m } = X(l, e);
|
|
133
135
|
m === -1 ? (n.value[e].days.push({
|
|
134
136
|
day: r,
|
|
135
|
-
time:
|
|
136
|
-
tips: `(${k.value}:00 - ${
|
|
137
|
-
}), O()) : o || (
|
|
137
|
+
time: f.value,
|
|
138
|
+
tips: `(${k.value}:00 - ${f.value >= 22 ? k.value + f.value + 2 : k.value + f.value + 1}:00)`
|
|
139
|
+
}), O()) : o || (f.value = n.value[e].days[m].time, k.value = parseInt(n.value[e].days[m].tips.slice(1, -12)));
|
|
138
140
|
}, Ee = (l, e) => {
|
|
139
141
|
const { ind: o } = X(l, e);
|
|
140
142
|
n.value[e].days.splice(o, 1), O(), document.querySelector(".app-main").click();
|
|
141
|
-
},
|
|
143
|
+
}, fe = (l, e) => {
|
|
142
144
|
const { date: o, ind: r } = X(l, e);
|
|
143
145
|
n.value[e].days[r] = {
|
|
144
146
|
day: o,
|
|
145
|
-
time:
|
|
146
|
-
tips: `(${k.value}:00 - ${
|
|
147
|
+
time: f.value,
|
|
148
|
+
tips: `(${k.value}:00 - ${f.value >= 22 ? k.value + f.value + 2 : k.value + f.value + 1}:00)`
|
|
147
149
|
}, O();
|
|
148
150
|
}, X = (l, e) => {
|
|
149
151
|
var m;
|
|
@@ -183,7 +185,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
183
185
|
}), (l, e) => {
|
|
184
186
|
const o = we("el-date-picker"), r = we("svg-icon"), m = Te("loading");
|
|
185
187
|
return S(), z("div", Je, [
|
|
186
|
-
|
|
188
|
+
y("div", Ke, [
|
|
187
189
|
H.checkEdit ? (S(), F(a(Ie), {
|
|
188
190
|
key: 0,
|
|
189
191
|
modelValue: b.value,
|
|
@@ -221,7 +223,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
221
223
|
format: "MMM",
|
|
222
224
|
"value-format": "M"
|
|
223
225
|
}, null, 8, ["modelValue"]),
|
|
224
|
-
e[21] || (e[21] =
|
|
226
|
+
e[21] || (e[21] = y("div", { class: "expander" }, null, -1)),
|
|
225
227
|
i(a(ve), {
|
|
226
228
|
modelValue: j.value,
|
|
227
229
|
"onUpdate:modelValue": e[3] || (e[3] = (t) => j.value = t),
|
|
@@ -290,7 +292,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
290
292
|
fixed: j.value !== "100%"
|
|
291
293
|
}, {
|
|
292
294
|
default: v((t) => [
|
|
293
|
-
|
|
295
|
+
y("div", Qe, h(n.value[t.$index].name), 1)
|
|
294
296
|
]),
|
|
295
297
|
_: 1
|
|
296
298
|
}, 8, ["label", "fixed"]),
|
|
@@ -309,7 +311,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
309
311
|
prop: "vacation"
|
|
310
312
|
}, {
|
|
311
313
|
default: v((x) => [
|
|
312
|
-
|
|
314
|
+
y("div", Xe, h(pe(t.day, x.$index) || " "), 1)
|
|
313
315
|
]),
|
|
314
316
|
_: 2
|
|
315
317
|
}, 1032, ["class-name", "label"]))), 128))
|
|
@@ -336,7 +338,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
336
338
|
align: "center"
|
|
337
339
|
}, {
|
|
338
340
|
default: v((t) => [
|
|
339
|
-
|
|
341
|
+
y("div", {
|
|
340
342
|
style: ze(`color: ${R.value === t.row.contHour ? "green" : "red"};`)
|
|
341
343
|
}, h(t.row.contHour), 5)
|
|
342
344
|
]),
|
|
@@ -367,7 +369,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
367
369
|
_: 1
|
|
368
370
|
})),
|
|
369
371
|
e[22] || (e[22] = V()),
|
|
370
|
-
|
|
372
|
+
y("span", null, h(H.fullName), 1)
|
|
371
373
|
])) : _("", !0),
|
|
372
374
|
Be((S(), F(a(T), {
|
|
373
375
|
disabled: J.value,
|
|
@@ -440,12 +442,12 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
440
442
|
options: ne.value
|
|
441
443
|
}, {
|
|
442
444
|
default: v(() => [
|
|
443
|
-
|
|
445
|
+
y("div", {
|
|
444
446
|
class: "mx-context-menu-item",
|
|
445
447
|
onClick: e[8] || (e[8] = (t) => P.value = !1)
|
|
446
448
|
}, [
|
|
447
|
-
|
|
448
|
-
e[23] || (e[23] =
|
|
449
|
+
y("span", el, h(p.value.name), 1),
|
|
450
|
+
e[23] || (e[23] = y("div", { class: "expander" }, null, -1)),
|
|
449
451
|
i(r, { "icon-class": "cross" })
|
|
450
452
|
]),
|
|
451
453
|
i(a(qe)),
|
|
@@ -471,8 +473,8 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
471
473
|
]),
|
|
472
474
|
_: 1
|
|
473
475
|
}, 8, ["modelValue"]),
|
|
474
|
-
e[24] || (e[24] =
|
|
475
|
-
|
|
476
|
+
e[24] || (e[24] = y("br", null, null, -1)),
|
|
477
|
+
y("span", null, h(a(d)("workSchedule.fromDate")) + ":", 1),
|
|
476
478
|
i(a(Z), {
|
|
477
479
|
modelValue: W.value,
|
|
478
480
|
"onUpdate:modelValue": e[10] || (e[10] = (t) => W.value = t),
|
|
@@ -480,7 +482,7 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
480
482
|
min: 1,
|
|
481
483
|
max: u.value.length
|
|
482
484
|
}, null, 8, ["modelValue", "max"]),
|
|
483
|
-
|
|
485
|
+
y("span", null, h(a(d)("workSchedule.with")) + ":", 1),
|
|
484
486
|
i(a(Z), {
|
|
485
487
|
modelValue: k.value,
|
|
486
488
|
"onUpdate:modelValue": e[11] || (e[11] = (t) => k.value = t),
|
|
@@ -488,10 +490,10 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
488
490
|
min: 0,
|
|
489
491
|
max: 19
|
|
490
492
|
}, null, 8, ["modelValue"]),
|
|
491
|
-
|
|
493
|
+
y("span", null, h(a(d)("workSchedule.duration")) + ":", 1),
|
|
492
494
|
i(a(Z), {
|
|
493
|
-
modelValue:
|
|
494
|
-
"onUpdate:modelValue": e[12] || (e[12] = (t) =>
|
|
495
|
+
modelValue: f.value,
|
|
496
|
+
"onUpdate:modelValue": e[12] || (e[12] = (t) => f.value = t),
|
|
495
497
|
step: 1,
|
|
496
498
|
min: 4,
|
|
497
499
|
max: a(ke)(k.value !== 1 ? 23 - k.value : 21, 4, 22)
|
|
@@ -517,25 +519,25 @@ const Je = { class: "work" }, Ke = { class: "nav" }, Qe = { style: { height: "10
|
|
|
517
519
|
_: 1
|
|
518
520
|
})
|
|
519
521
|
])) : (S(), z("div", tl, [
|
|
520
|
-
|
|
521
|
-
e[25] || (e[25] =
|
|
522
|
-
|
|
522
|
+
y("div", null, h(pe(p.value.day, p.value.ids)), 1),
|
|
523
|
+
e[25] || (e[25] = y("br", null, null, -1)),
|
|
524
|
+
y("span", null, h(a(d)("workSchedule.with")) + ":", 1),
|
|
523
525
|
i(a(Z), {
|
|
524
526
|
modelValue: k.value,
|
|
525
527
|
"onUpdate:modelValue": e[15] || (e[15] = (t) => k.value = t),
|
|
526
528
|
step: 1,
|
|
527
529
|
min: 0,
|
|
528
530
|
max: 19,
|
|
529
|
-
onChange: e[16] || (e[16] = (t) =>
|
|
531
|
+
onChange: e[16] || (e[16] = (t) => fe(p.value.day, p.value.ids))
|
|
530
532
|
}, null, 8, ["modelValue"]),
|
|
531
|
-
|
|
533
|
+
y("span", null, h(a(d)("workSchedule.duration")) + ":", 1),
|
|
532
534
|
i(a(Z), {
|
|
533
|
-
modelValue:
|
|
534
|
-
"onUpdate:modelValue": e[17] || (e[17] = (t) =>
|
|
535
|
+
modelValue: f.value,
|
|
536
|
+
"onUpdate:modelValue": e[17] || (e[17] = (t) => f.value = t),
|
|
535
537
|
step: 1,
|
|
536
538
|
min: 4,
|
|
537
539
|
max: a(ke)(k.value !== 1 ? 23 - k.value : 21, 4, 22),
|
|
538
|
-
onChange: e[18] || (e[18] = (t) =>
|
|
540
|
+
onChange: e[18] || (e[18] = (t) => fe(p.value.day, p.value.ids))
|
|
539
541
|
}, null, 8, ["modelValue", "max"]),
|
|
540
542
|
i(a(T), {
|
|
541
543
|
style: { "margin-top": ".5rem" },
|