@studio-west/employees 0.5.18 → 0.5.19
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/WorkTable.cjs +1 -1
- package/dist/WorkTable.js +22 -21
- package/package.json +1 -1
package/dist/WorkTable.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),ue=require("file-saver"),re=require("exceljs"),v=require("./index-CmFQ6bqG.cjs"),ie=require("vue-i18n"),i=require("element-plus"),O=require("@imengyu/vue3-context-menu");function de(y){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const C in y)if(C!=="default"){const f=Object.getOwnPropertyDescriptor(y,C);Object.defineProperty(r,C,f.get?f:{enumerable:!0,get:()=>y[C]})}}return r.default=y,Object.freeze(r)}const se=de(re),ce={class:"work"},ve={class:"nav"},me={style:{height:"100px",width:"100%",display:"inline-block"}},ge={style:{height:"100px",width:"100%",display:"inline-block"}},he={key:0,class:"controls-container",style:{"margin-top":".5rem"}},fe={key:0,style:{padding:"0.5em 1.5em"}},pe={key:1,style:{padding:"0.5em 1.5em"}},ye={__name:"WorkTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"}},setup(y){const{t:r,d:C}=ie.useI18n(),f=y,T=e.ref(!1),n=e.ref([]),F=e.ref(new Date().getMonth()+1),P=e.ref(0),w=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1)),u=e.ref([]),b=e.ref(0),x=e.ref(9),p=e.ref(8),M=e.ref(!1),W=e.ref(!0),E=e.ref(!1),U=e.ref("5"),$=e.ref(1),V=e.ref(""),Y=e.ref([]),S=e.ref([]),c=e.ref({name:"Имя",length:0,code:""}),A=e.ref(!1),H=e.ref({zIndex:30,minWidth:220,x:500,y:200}),L=e.ref({}),R=e.ref("100%");e.watch(V,async(a,l)=>{a!==l&&(S.value=[],M.value=!1,f.odata.personal.forEach(o=>{o.divisionName===a&&(S.value.some(d=>(d==null?void 0:d.activeText)===o.roleName)||S.value.push({val:!0,activeText:o.roleName}))}),j())}),e.watch(F,async a=>{
|
|
1
|
+
"use strict";const e=require("vue"),ue=require("file-saver"),re=require("exceljs"),v=require("./index-CmFQ6bqG.cjs"),ie=require("vue-i18n"),i=require("element-plus"),O=require("@imengyu/vue3-context-menu");function de(y){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const C in y)if(C!=="default"){const f=Object.getOwnPropertyDescriptor(y,C);Object.defineProperty(r,C,f.get?f:{enumerable:!0,get:()=>y[C]})}}return r.default=y,Object.freeze(r)}const se=de(re),ce={class:"work"},ve={class:"nav"},me={style:{height:"100px",width:"100%",display:"inline-block"}},ge={style:{height:"100px",width:"100%",display:"inline-block"}},he={key:0,class:"controls-container",style:{"margin-top":".5rem"}},fe={key:0,style:{padding:"0.5em 1.5em"}},pe={key:1,style:{padding:"0.5em 1.5em"}},ye={__name:"WorkTable",props:{checkEdit:{type:Boolean,default:()=>!0},odata:Object,workSchedule:Object,fullName:{type:String,default:"Вы"}},setup(y){const{t:r,d:C}=ie.useI18n(),f=y,T=e.ref(!1),n=e.ref([]),F=e.ref(new Date().getMonth()+1),P=e.ref(0),w=e.ref(new Date(new Date().getFullYear(),new Date().getMonth(),1)),u=e.ref([]),b=e.ref(0),x=e.ref(9),p=e.ref(8),M=e.ref(!1),W=e.ref(!0),E=e.ref(!1),U=e.ref("5"),$=e.ref(1),V=e.ref(""),Y=e.ref([]),S=e.ref([]),c=e.ref({name:"Имя",length:0,code:""}),A=e.ref(!1),H=e.ref({zIndex:30,minWidth:220,x:500,y:200}),L=e.ref({}),R=e.ref("100%");e.watch(V,async(a,l)=>{a!==l&&(S.value=[],M.value=!1,f.odata.personal.forEach(o=>{o.divisionName===a&&(S.value.some(d=>(d==null?void 0:d.activeText)===o.roleName)||S.value.push({val:!0,activeText:o.roleName}))}),j())}),e.watch(F,async a=>{let l=new Date().getMonth(),o=a===null?l:a-1;o=l-1<=o?o:o+l,w.value=new Date(new Date().getFullYear(),o,1),G()});const Q=(a,l,o,d)=>{c.value.ids=a.ids,c.value.key=a.key,c.value.add=a.days.length>0&&a.days[a.days.length-1].cont,c.value.level=l.level,c.value.day=o.cellIndex,H.value.y=d.clientY,H.value.x=d.clientX,l.level===2&&l.no===0&&f.checkEdit&&(c.value.name=r("workSchedule.autocomplete"),A.value=!0),l.level===3&&o.cellIndex-l.no===1&&f.checkEdit&&(N(o.cellIndex,a.ids),c.value.name=r("workSchedule.modeSelection"),A.value=!0)},G=()=>{const a=L.value,l=new Date(w.value),o=new Date(l.getFullYear(),l.getMonth()+1,0).getDate();let d=[],t=0;for(let s=1;s<=o;s++){const h=v.parseTime(l.setDate(s),"{Y}-{m}-{dd}");t+=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":"";d.push({day:s,holidays:g,weekday:C(new Date(l.getFullYear(),l.getMonth(),s),"day")})}b.value=t,u.value=d,f.odata.getPersonal({}).then(s=>{var h;V.value.length===0&&(V.value=(h=s.find(g=>g.employeeName===f.fullName))==null?void 0:h.divisionName),s.forEach(g=>{Y.value.some(k=>(k==null?void 0:k.value)===g.divisionName)||Y.value.push({value:g.divisionName,label:g.divisionName,key:g.divisionName}),g.divisionName===V.value&&!S.value.some(k=>(k==null?void 0:k.activeText)===g.roleName)&&S.value.push({val:!0,activeText:g.roleName})}),j(),W.value=!1})},X=e.computed(()=>!n.value.some(a=>a.contHour!==b.value)),J=(a,l)=>{var s,h,g;const o=new Date(w.value),d=`${o.getFullYear()}-${(o.getMonth()+1).toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}`,t=(s=n.value[l])==null?void 0:s.days.findIndex(k=>k.day===d);return l===-1||t===-1?"":((h=n.value[l].days[t])==null?void 0:h.tips)+"<br>"+((g=n.value[l].days[t])==null?void 0:g.time)},j=()=>{n.value=[];let a=[];f.odata.personal.forEach(l=>{if(l.divisionName===V.value&&S.value.some(o=>o.val&&o.activeText===l.roleName)){let o=v.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})}}),_(a),E.value=!1},_=a=>{f.workSchedule.getWorkSchedule({code:a,date:v.parseTime(new Date(w.value),"{Y}-{m}-{dd}")}).then(l=>{l.forEach((o,d)=>{o!==null&&(n.value[d].days=o.data.days,n.value[d].id=o.id)}),D()})},D=()=>{n.value.forEach(a=>{a.contHour=a.days.reduce((l,o)=>l+o.time,0)})},ee=a=>{n.value[a].days=[],D()},le=a=>{switch(U.value){case"5":for(let l=$.value;l<=u.value.length;l++)u.value[l-1].holidays===""&&N(l,a,!0),u.value[l-1].holidays==="preholiday"&&(p.value-=1,N(l,a,!0),p.value+=1);break;case"2x2":for(let l=$.value;l<=u.value.length;l+=4)N(l,a,!0),l+1<=u.value.length&&N(l+1,a,!0);break;case"2x5":for(let l=$.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"?(p.value-=1,N(o,a,!0),p.value+=1):N(o,a,!0);break}},N=(a,l,o=!1)=>{const{date:d,ind:t}=I(a,l);t===-1?(n.value[l].days.push({day:d,time:p.value,tips:`(${x.value}:00 - ${x.value+p.value+1}:00)`}),D()):o||(p.value=n.value[l].days[t].time,x.value=parseInt(n.value[l].days[t].tips.slice(1,-12)))},te=(a,l)=>{const{ind:o}=I(a,l);n.value[l].days.splice(o,1),D(),document.querySelector(".app-main").click()},Z=(a,l)=>{const{date:o,ind:d}=I(a,l);n.value[l].days[d]={day:o,time:p.value,tips:`(${x.value}:00 - ${x.value+p.value+1}:00)`},D()},I=(a,l)=>{var t;const o=v.parseTime(new Date(w.value).setDate(a),"{Y}-{m}-{dd}"),d=(t=n.value[l])==null?void 0:t.days.findIndex(s=>s.day===o);return{date:o,ind:d}},ae=async()=>{var K;T.value=!0;const a=new se.Workbook,l=a.addWorksheet(C(w.value,"month"),{pageSetup:{paperSize:9,orientation:"landscape",fitToPage:!0}}),o={vertical:"middle",horizontal:"center"},d={top:{style:"thin"},left:{style:"thin"},bottom:{style:"thin"},right:{style:"thin"}},t={vertical:"middle",horizontal:"center",wrapText:!0};l.mergeCells(`A1:${v.cellsDynamically("A1",u.value.length+5)}1`),l.mergeCells(`A2:${v.cellsDynamically("A2",u.value.length+5)}2`),l.mergeCells("A3:A4"),l.mergeCells(`B3:${v.cellsDynamically("B3",u.value.length)}3`),l.mergeCells(`${v.cellsDynamically("B3",u.value.length+1)}3:${v.cellsDynamically("B3",u.value.length+2)}3`),l.mergeCells(`${v.cellsDynamically("B3",u.value.length+3)}3:${v.cellsDynamically("B4",u.value.length+3)}4`),l.mergeCells(`${v.cellsDynamically("B3",u.value.length+4)}3:${v.cellsDynamically("B4",u.value.length+4)}4`),l.getCell("A1").value=r("workSchedule.firm"),l.getCell("A2").value=r("workSchedule.title",{name:V.value})+C(w.value,"month")+` ${new Date(w.value).getFullYear()}`,l.getCell("A3").value=r("workSchedule.month"),l.getCell("B3").value=r("workSchedule.numbersMonth"),l.getCell(3,u.value.length+2).value=r("workSchedule.onSchedule"),l.getCell(3,u.value.length+4).value=r("workSchedule.acquainted"),l.getCell(3,u.value.length+5).value=r("workSchedule.date"),l.getCell(4,u.value.length+2).value=r("workSchedule.days"),l.getCell(4,u.value.length+3).value=`${r("workSchedule.hours")} (${b.value})`;for(let m=2;m<=u.value.length+1;m++)l.getCell(4,m).value=u.value[m-2].weekday+`
|
|
2
2
|
`+(m-1),l.getColumn(m).width=6,l.getColumn(m).alignment=t,l.getCell(4,m).border=d;l.getRow(1).height=40,l.getRow(2).height=30,l.getRow(3).height=20,l.getColumn(1).width=15,l.getColumn(u.value.length+2).width=5,l.getColumn(u.value.length+3).width=6,l.getColumn(u.value.length+4).width=13,l.getColumn(u.value.length+5).width=13,l.getColumn(1).alignment=t,l.getCell("A2").alignment=o,l.getCell("A3").alignment=o,l.getCell("B3").alignment=o,l.getCell(3,u.value.length+2).alignment=o,l.getColumn(u.value.length+2).alignment=t,l.getColumn(u.value.length+3).alignment=t,l.getColumn(u.value.length+4).alignment=o,l.getColumn(u.value.length+5).alignment=o,l.getCell("A3").border=d,l.getCell("B3").border=d,l.getCell(3,u.value.length+2).border=d,l.getCell(4,u.value.length+2).border=d,l.getCell(3,u.value.length+4).border=d,l.getCell(3,u.value.length+5).border=d,l.getCell(4,u.value.length+3).border=d;let s=0;for(const m of n.value){let z=[m.name];for(let B=1;B<=u.value.length;B++){const{ind:q}=I(B,s);q!==-1?z[B]=`${m.days[q].time} ${m.days[q].tips}`:z[B]=" "}z.push(((K=m.days)==null?void 0:K.length)||" ",m.contHour||0);const oe=l.addRow(z);oe.border=d,s++}let h="Щербина Е. В.";f.odata.personal.forEach(m=>{m.roleName==="Начальник отдела правовой и кадровой работы"&&(h=m.employeeName)}),l.mergeCells(`A${n.value.length+6}:P${n.value.length+6}`),l.mergeCells(`Q${n.value.length+6}:AG${n.value.length+6}`),l.mergeCells(`B${n.value.length+8}:E${n.value.length+8}`),l.mergeCells(`F${n.value.length+8}:L${n.value.length+8}`),l.mergeCells(`M${n.value.length+8}:P${n.value.length+8}`),l.mergeCells(`S${n.value.length+8}:V${n.value.length+8}`),l.mergeCells(`W${n.value.length+8}:AC${n.value.length+8}`),l.mergeCells(`AD${n.value.length+8}:AG${n.value.length+8}`),l.mergeCells(`Z${n.value.length+9}:AA${n.value.length+9}`),l.getCell(`A${n.value.length+6}`).value=r("workSchedule.byInitials"),l.getCell(`Q${n.value.length+6}`).value=r("workSchedule.supervisorHR"),l.getCell(`B${n.value.length+8}`).value=r("workSchedule.compiled")+":",l.getCell(`S${n.value.length+8}`).value=r("workSchedule.approved")+":",l.getCell(`M${n.value.length+8}`).value=v.byInitials(f.fullName),l.getCell(`AD${n.value.length+8}`).value=v.byInitials(h),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 g="export_"+v.parseTime(Date.now(),"{dd}.{m}.{Y}")+".xlsx",k=await a.xlsx.writeBuffer();ue.saveAs(new Blob([k]),g),T.value=!1},ne=async()=>{M.value||f.workSchedule.addWorkSchedule({data:n.value,date:v.parseTime(new Date(w.value),"{Y}-{m}-{dd}")}).then(a=>M.value=a)};return v.holidays().then(a=>{L.value=a,G()}),(a,l)=>{const o=e.resolveComponent("el-date-picker"),d=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",ve,[y.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElSelect),{key:0,modelValue:V.value,"onUpdate:modelValue":l[0]||(l[0]=t=>V.value=t),placeholder:"Select",style:{width:"240px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Y.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),y.checkEdit?(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:1,plain:"",onClick:l[1]||(l[1]=t=>E.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.jobTitle")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(o,{modelValue:F.value,"onUpdate:modelValue":l[2]||(l[2]=t=>F.value=t),type:"month",placeholder:"Выберите месяц",format:"MMM","value-format":"M"},null,8,["modelValue"]),l[19]||(l[19]=e.createElementVNode("div",{class:"expander"},null,-1)),e.createVNode(e.unref(i.ElSwitch),{modelValue:R.value,"onUpdate:modelValue":l[3]||(l[3]=t=>R.value=t),"active-text":a.$t("bids.currentHeight"),"active-value":"100%","inactive-value":"calc(100vh - var(--el-component-size)*4 - var(--el-main-padding)*2 - var(--header-height))"},null,8,["modelValue","active-text"]),e.createVNode(e.unref(i.ElSwitch),{modelValue:P.value,"onUpdate:modelValue":l[4]||(l[4]=t=>P.value=t),"active-text":"Отпуска","active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),e.createVNode(e.unref(i.ElSkeleton),{style:{width:"100%"},loading:W.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":R.value,size:"small",align:"center",onCellClick:Q,"empty-text":e.unref(r)("workSchedule.emptyText")},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.title",{name:V.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(r)("workSchedule.month"),width:"180",align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",me,e.toDisplayString(n.value[t.$index].name),1)]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.numbersMonth"),align:"center"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElTableColumn),{key:t.day,width:"45","class-name":t.holidays,align:"center",label:t.weekday+`
|
|
3
3
|
`+t.day.toString()},{default:e.withCtx(s=>[e.createElementVNode("div",ge,e.toDisplayString(J(t.day,s.$index)||" "),1)]),_:2},1032,["class-name","label"]))),128))]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.onSchedule"),align:"center"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElTableColumn),{label:e.unref(r)("workSchedule.days"),align:"center"},{default:e.withCtx(t=>[e.createTextVNode(e.toDisplayString(n.value[t.$index].days.length||0),1)]),_:1},8,["label"]),e.createVNode(e.unref(i.ElTableColumn),{label:`${e.unref(r)("workSchedule.hours")} ( ${b.value} )`,align:"center"},{default:e.withCtx(t=>[e.createElementVNode("div",{style:e.normalizeStyle(`color: ${b.value===t.row.contHour?"green":"red"};`)},e.toDisplayString(t.row.contHour),5)]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["label"])]),_:1},8,["data","max-height","empty-text"])]),_:1},8,["loading"]),X.value&&y.checkEdit?(e.openBlock(),e.createElementBlock("div",he,[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.chartsFilled"))+": ",1),M.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:0,type:"primary",onClick:ne},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.confirm")),1)]),_:1})),l[20]||(l[20]=e.createTextVNode()),e.createElementVNode("span",null,e.toDisplayString(y.fullName),1)])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(e.unref(i.ElButton),{disabled:T.value,plain:"",onClick:ae,style:{"margin-top":".5rem"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.exportExcel")),1)]),_:1},8,["disabled"])),[[d,T.value]]),e.createVNode(e.unref(i.ElDialog),{title:e.unref(r)("workSchedule.jobTitle"),modelValue:E.value,"onUpdate:modelValue":l[6]||(l[6]=t=>E.value=t),width:"400px"},{footer:e.withCtx(()=>[e.createVNode(e.unref(i.ElButton),{onClick:l[5]||(l[5]=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:S.value,autocomplete:"on"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,t=>(e.openBlock(),e.createBlock(e.unref(i.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElSwitch),{modelValue:t.val,"onUpdate:modelValue":s=>t.val=s,"active-text":t.activeText},null,8,["modelValue","onUpdate:modelValue","active-text"])]),_:2},1024))),256))]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),e.createVNode(e.unref(O.ContextMenu),{show:A.value,"onUpdate:show":l[18]||(l[18]=t=>A.value=t),options:H.value},{default:e.withCtx(()=>[e.createVNode(e.unref(O.ContextMenuItem),{label:c.value.name,disabled:""},null,8,["label"]),e.createVNode(e.unref(O.ContextMenuSeparator)),c.value.level===2?(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(e.unref(i.ElRadioGroup),{modelValue:U.value,"onUpdate:modelValue":l[7]||(l[7]=t=>U.value=t),size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElRadioButton),{label:e.unref(r)("workSchedule.Days5"),value:"5"},null,8,["label"]),e.createVNode(e.unref(i.ElRadioButton),{label:"2 Х 2",value:"2x2"}),e.createVNode(e.unref(i.ElRadioButton),{label:"2 Х 5",value:"2x5"})]),_:1},8,["modelValue"]),l[21]||(l[21]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.fromDate"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:$.value,"onUpdate:modelValue":l[8]||(l[8]=t=>$.value=t),step:1,min:1,max:u.value.length},null,8,["modelValue","max"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:x.value,"onUpdate:modelValue":l[9]||(l[9]=t=>x.value=t),step:1,min:8,max:11},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:p.value,"onUpdate:modelValue":l[10]||(l[10]=t=>p.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[11]||(l[11]=t=>le(c.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.fillOut")),1)]),_:1}),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[12]||(l[12]=t=>ee(c.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.clearRow")),1)]),_:1})])):(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",null,e.toDisplayString(J(c.value.day,c.value.ids)),1),l[22]||(l[22]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.with"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:x.value,"onUpdate:modelValue":l[13]||(l[13]=t=>x.value=t),step:1,min:8,max:11,onChange:l[14]||(l[14]=t=>Z(c.value.day,c.value.ids))},null,8,["modelValue"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(r)("workSchedule.duration"))+":",1),e.createVNode(e.unref(i.ElSlider),{modelValue:p.value,"onUpdate:modelValue":l[15]||(l[15]=t=>p.value=t),step:1,min:4,max:12,onChange:l[16]||(l[16]=t=>Z(c.value.day,c.value.ids))},null,8,["modelValue"]),e.createVNode(e.unref(i.ElButton),{style:{"margin-top":".5rem"},size:"small",onClick:l[17]||(l[17]=t=>te(c.value.day,c.value.ids))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("workSchedule.delete")),1)]),_:1})]))]),_:1},8,["show","options"])])}}};module.exports=ye;
|
package/dist/WorkTable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as s, watch as ce, computed as Se, resolveComponent as Ve, resolveDirective as De, createElementBlock as M, openBlock as f, createElementVNode as w, createVNode as i, createCommentVNode as J, withDirectives as Ee, createBlock as B, unref as t, withCtx as v, Fragment as ae, renderList as ne, createTextVNode as
|
|
1
|
+
import { ref as s, watch as ce, computed as Se, resolveComponent as Ve, resolveDirective as De, createElementBlock as M, openBlock as f, createElementVNode as w, createVNode as i, createCommentVNode as J, withDirectives as Ee, createBlock as B, unref as t, withCtx as v, Fragment as ae, renderList as ne, createTextVNode as b, toDisplayString as g, normalizeStyle as Ne } from "vue";
|
|
2
2
|
import { saveAs as Ae } from "file-saver";
|
|
3
3
|
import * as Me from "exceljs";
|
|
4
4
|
import { p as R, b as oe, h as Be, c as D } from "./index-DIjJDdmP.js";
|
|
@@ -48,7 +48,8 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
48
48
|
o.divisionName === a && (E.value.some((r) => (r == null ? void 0 : r.activeText) === o.roleName) || E.value.push({ val: !0, activeText: o.roleName }));
|
|
49
49
|
}), le());
|
|
50
50
|
}), ce(K, async (a) => {
|
|
51
|
-
|
|
51
|
+
let e = (/* @__PURE__ */ new Date()).getMonth(), o = a === null ? e : a - 1;
|
|
52
|
+
o = e - 1 <= o ? o : o + e, C.value = new Date((/* @__PURE__ */ new Date()).getFullYear(), o, 1), se();
|
|
52
53
|
});
|
|
53
54
|
const pe = (a, e, o, r) => {
|
|
54
55
|
h.value.ids = a.ids, h.value.key = a.key, h.value.add = a.days.length > 0 && a.days[a.days.length - 1].cont, h.value.level = e.level, h.value.day = o.cellIndex, _.value.y = r.clientY, _.value.x = r.clientX, e.level === 2 && e.no === 0 && x.checkEdit && (h.value.name = d("workSchedule.autocomplete"), L.value = !0), e.level === 3 && o.cellIndex - e.no === 1 && x.checkEdit && (A(o.cellIndex, a.ids), h.value.name = d("workSchedule.modeSelection"), L.value = !0);
|
|
@@ -64,12 +65,12 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
64
65
|
F.value = l, u.value = r, x.odata.getPersonal({}).then((m) => {
|
|
65
66
|
var y;
|
|
66
67
|
V.value.length === 0 && (V.value = (y = m.find((p) => p.employeeName === x.fullName)) == null ? void 0 : y.divisionName), m.forEach((p) => {
|
|
67
|
-
X.value.some((
|
|
68
|
+
X.value.some(($) => ($ == null ? void 0 : $.value) === p.divisionName) || X.value.push({ value: p.divisionName, label: p.divisionName, key: p.divisionName }), p.divisionName === V.value && !E.value.some(($) => ($ == null ? void 0 : $.activeText) === p.roleName) && E.value.push({ val: !0, activeText: p.roleName });
|
|
68
69
|
}), le(), re.value = !1;
|
|
69
70
|
});
|
|
70
71
|
}, ye = Se(() => !n.value.some((a) => a.contHour !== F.value)), me = (a, e) => {
|
|
71
72
|
var m, y, p;
|
|
72
|
-
const o = new Date(C.value), r = `${o.getFullYear()}-${(o.getMonth() + 1).toString().padStart(2, "0")}-${a.toString().padStart(2, "0")}`, l = (m = n.value[e]) == null ? void 0 : m.days.findIndex((
|
|
73
|
+
const o = new Date(C.value), r = `${o.getFullYear()}-${(o.getMonth() + 1).toString().padStart(2, "0")}-${a.toString().padStart(2, "0")}`, l = (m = n.value[e]) == null ? void 0 : m.days.findIndex(($) => $.day === r);
|
|
73
74
|
return e === -1 || l === -1 ? "" : ((y = n.value[e].days[l]) == null ? void 0 : y.tips) + "<br>" + ((p = n.value[e].days[l]) == null ? void 0 : p.time);
|
|
74
75
|
}, le = () => {
|
|
75
76
|
n.value = [];
|
|
@@ -131,7 +132,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
131
132
|
var l;
|
|
132
133
|
const o = R(new Date(C.value).setDate(a), "{Y}-{m}-{dd}"), r = (l = n.value[e]) == null ? void 0 : l.days.findIndex((m) => m.day === o);
|
|
133
134
|
return { date: o, ind: r };
|
|
134
|
-
},
|
|
135
|
+
}, $e = async () => {
|
|
135
136
|
var he;
|
|
136
137
|
O.value = !0;
|
|
137
138
|
const a = new Me.Workbook(), e = a.addWorksheet(j(C.value, "month"), { pageSetup: { paperSize: 9, orientation: "landscape", fitToPage: !0 } }), o = { vertical: "middle", horizontal: "center" }, r = { top: { style: "thin" }, left: { style: "thin" }, bottom: { style: "thin" }, right: { style: "thin" } }, l = { vertical: "middle", horizontal: "center", wrapText: !0 };
|
|
@@ -155,9 +156,9 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
155
156
|
x.odata.personal.forEach((c) => {
|
|
156
157
|
c.roleName === "Начальник отдела правовой и кадровой работы" && (y = c.employeeName);
|
|
157
158
|
}), e.mergeCells(`A${n.value.length + 6}:P${n.value.length + 6}`), e.mergeCells(`Q${n.value.length + 6}:AG${n.value.length + 6}`), e.mergeCells(`B${n.value.length + 8}:E${n.value.length + 8}`), e.mergeCells(`F${n.value.length + 8}:L${n.value.length + 8}`), e.mergeCells(`M${n.value.length + 8}:P${n.value.length + 8}`), e.mergeCells(`S${n.value.length + 8}:V${n.value.length + 8}`), e.mergeCells(`W${n.value.length + 8}:AC${n.value.length + 8}`), e.mergeCells(`AD${n.value.length + 8}:AG${n.value.length + 8}`), e.mergeCells(`Z${n.value.length + 9}:AA${n.value.length + 9}`), e.getCell(`A${n.value.length + 6}`).value = d("workSchedule.byInitials"), e.getCell(`Q${n.value.length + 6}`).value = d("workSchedule.supervisorHR"), e.getCell(`B${n.value.length + 8}`).value = d("workSchedule.compiled") + ":", e.getCell(`S${n.value.length + 8}`).value = d("workSchedule.approved") + ":", e.getCell(`M${n.value.length + 8}`).value = oe(x.fullName), e.getCell(`AD${n.value.length + 8}`).value = oe(y), e.getCell(`Z${n.value.length + 9}`).value = d("workSchedule.printPlace"), e.getCell(`A${n.value.length + 6}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`Q${n.value.length + 6}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`B${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`F${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "right" }, e.getCell(`M${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "left" }, e.getCell(`AD${n.value.length + 8}`).alignment = { vertical: "middle", horizontal: "left" }, e.getCell(`Z${n.value.length + 9}`).alignment = o, e.getCell(`F${n.value.length + 8}`).border = { bottom: { style: "thin" } }, e.getCell(`W${n.value.length + 8}`).border = { bottom: { style: "thin" } };
|
|
158
|
-
const p = "export_" + R(Date.now(), "{dd}.{m}.{Y}") + ".xlsx",
|
|
159
|
-
Ae(new Blob([
|
|
160
|
-
},
|
|
159
|
+
const p = "export_" + R(Date.now(), "{dd}.{m}.{Y}") + ".xlsx", $ = await a.xlsx.writeBuffer();
|
|
160
|
+
Ae(new Blob([$]), p), O.value = !1;
|
|
161
|
+
}, be = async () => {
|
|
161
162
|
G.value || x.workSchedule.addWorkSchedule({ data: n.value, date: R(new Date(C.value), "{Y}-{m}-{dd}") }).then((a) => G.value = a);
|
|
162
163
|
};
|
|
163
164
|
return Be().then((a) => {
|
|
@@ -188,7 +189,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
188
189
|
onClick: e[1] || (e[1] = (l) => I.value = !0)
|
|
189
190
|
}, {
|
|
190
191
|
default: v(() => [
|
|
191
|
-
|
|
192
|
+
b(g(t(d)("workSchedule.jobTitle")), 1)
|
|
192
193
|
]),
|
|
193
194
|
_: 1
|
|
194
195
|
})) : J("", !0),
|
|
@@ -302,7 +303,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
302
303
|
align: "center"
|
|
303
304
|
}, {
|
|
304
305
|
default: v((l) => [
|
|
305
|
-
|
|
306
|
+
b(g(n.value[l.$index].days.length || 0), 1)
|
|
306
307
|
]),
|
|
307
308
|
_: 1
|
|
308
309
|
}, 8, ["label"]),
|
|
@@ -330,28 +331,28 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
330
331
|
_: 1
|
|
331
332
|
}, 8, ["loading"]),
|
|
332
333
|
ye.value && T.checkEdit ? (f(), M("div", Je, [
|
|
333
|
-
|
|
334
|
+
b(g(t(d)("workSchedule.chartsFilled")) + ": ", 1),
|
|
334
335
|
G.value ? J("", !0) : (f(), B(t(N), {
|
|
335
336
|
key: 0,
|
|
336
337
|
type: "primary",
|
|
337
|
-
onClick:
|
|
338
|
+
onClick: be
|
|
338
339
|
}, {
|
|
339
340
|
default: v(() => [
|
|
340
|
-
|
|
341
|
+
b(g(t(d)("workSchedule.confirm")), 1)
|
|
341
342
|
]),
|
|
342
343
|
_: 1
|
|
343
344
|
})),
|
|
344
|
-
e[20] || (e[20] =
|
|
345
|
+
e[20] || (e[20] = b()),
|
|
345
346
|
w("span", null, g(T.fullName), 1)
|
|
346
347
|
])) : J("", !0),
|
|
347
348
|
Ee((f(), B(t(N), {
|
|
348
349
|
disabled: O.value,
|
|
349
350
|
plain: "",
|
|
350
|
-
onClick:
|
|
351
|
+
onClick: $e,
|
|
351
352
|
style: { "margin-top": ".5rem" }
|
|
352
353
|
}, {
|
|
353
354
|
default: v(() => [
|
|
354
|
-
|
|
355
|
+
b(g(t(d)("workSchedule.exportExcel")), 1)
|
|
355
356
|
]),
|
|
356
357
|
_: 1
|
|
357
358
|
}, 8, ["disabled"])), [
|
|
@@ -369,7 +370,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
369
370
|
size: "default"
|
|
370
371
|
}, {
|
|
371
372
|
default: v(() => [
|
|
372
|
-
|
|
373
|
+
b(g(a.$t("workSchedule.cancel")), 1)
|
|
373
374
|
]),
|
|
374
375
|
_: 1
|
|
375
376
|
}),
|
|
@@ -379,7 +380,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
379
380
|
onClick: le
|
|
380
381
|
}, {
|
|
381
382
|
default: v(() => [
|
|
382
|
-
|
|
383
|
+
b(g(a.$t("workSchedule.select")), 1)
|
|
383
384
|
]),
|
|
384
385
|
_: 1
|
|
385
386
|
})
|
|
@@ -471,7 +472,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
471
472
|
onClick: e[11] || (e[11] = (l) => ke(h.value.ids))
|
|
472
473
|
}, {
|
|
473
474
|
default: v(() => [
|
|
474
|
-
|
|
475
|
+
b(g(t(d)("workSchedule.fillOut")), 1)
|
|
475
476
|
]),
|
|
476
477
|
_: 1
|
|
477
478
|
}),
|
|
@@ -481,7 +482,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
481
482
|
onClick: e[12] || (e[12] = (l) => we(h.value.ids))
|
|
482
483
|
}, {
|
|
483
484
|
default: v(() => [
|
|
484
|
-
|
|
485
|
+
b(g(t(d)("workSchedule.clearRow")), 1)
|
|
485
486
|
]),
|
|
486
487
|
_: 1
|
|
487
488
|
})
|
|
@@ -512,7 +513,7 @@ const Ge = { class: "work" }, Le = { class: "nav" }, Ze = { style: { height: "10
|
|
|
512
513
|
onClick: e[17] || (e[17] = (l) => Ce(h.value.day, h.value.ids))
|
|
513
514
|
}, {
|
|
514
515
|
default: v(() => [
|
|
515
|
-
|
|
516
|
+
b(g(t(d)("workSchedule.delete")), 1)
|
|
516
517
|
]),
|
|
517
518
|
_: 1
|
|
518
519
|
})
|