vue-attendance-calendar
Version:
基于vue + element-ui实现的考勤日历组件
1 lines • 11.8 kB
JavaScript
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=6)}([function(t,e,n){var r=n(11);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(3)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(14);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(3)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"});return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];null!=a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),s=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var r=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}}(),c=null,u=0,l=[],f=n(12);function d(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(y(r.parts[a],e))}else{var s=[];for(a=0;a<r.parts.length;a++)s.push(y(r.parts[a],e));i[r.id]={id:r.id,refs:1,parts:s}}}}function p(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function v(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=s(t.insertAt.before,n);n.insertBefore(e,o)}}function h(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function m(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=function(){0;return n.nc}();r&&(t.attrs.nonce=r)}return b(e,t.attrs),v(t,e),e}function b(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function y(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var a=u++;n=c||(c=m(e)),r=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),v(t,e),e}(e),r=function(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=f(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),o=function(){h(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=function(t,e){var n=e.css,r=e.media;r&&t.setAttribute("media",r);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){h(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var a=n[o];(s=i[a.id]).refs--,r.push(s)}t&&d(p(t,e),e);for(o=0;o<r.length;o++){var s;if(0===(s=r[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete i[s.id]}}}};var g,_=(g=[],function(t,e){return g[t]=e,g.filter(Boolean).join("\n")});function x(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=_(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}},function(t,e){t.exports=require("element-ui")},function(t,e){t.exports=require("vue")},function(t,e,n){t.exports=n(16)},function(t,e){t.exports=require("core-js/modules/es6.function.name")},function(t,e){t.exports=require("core-js/modules/es6.regexp.split")},function(t,e){t.exports=require("core-js/modules/es6.number.constructor")},function(t,e,n){"use strict";var r=n(0);n.n(r).a},function(t,e,n){(t.exports=n(2)(!1)).push([t.i,"@keyframes rotate {\nto {\n transform: translate(-50%, -50%) rotate(360deg);\n}\n}\n",""])},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}},function(t,e,n){"use strict";var r=n(1);n.n(r).a},function(t,e,n){(t.exports=n(2)(!1)).push([t.i,".loading[data-v-a396b06c] {\n display: inline-block;\n position: absolute;\n width: 20%;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n /*animation: rotate 2s 0s infinite linear;*/\n transform-origin: 50% 50%;\n}\n.container[data-v-a396b06c] {\n position: absolute;\n display: inline-block;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: gainsboro;\n}\n.container .calendar[data-v-a396b06c] {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n.container .calendar .center[data-v-a396b06c] {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.container .calendar .date[data-v-a396b06c] {\n position: absolute;\n width: 100%;\n height: 100%;\n font-size: 4.5vw;\n color: #abababab;\n}\n.container .calendar .item[data-v-a396b06c] {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n.container .calendar .item .null[data-v-a396b06c] {\n height: 100%;\n color: red;\n}\n.container .calendar .item .attendance[data-v-a396b06c] {\n height: 100%;\n}\n.container .calendar .item .attendance .time[data-v-a396b06c] {\n height: 50%;\n font-size: 1.8vw;\n}\n.container .calendar .item .attendance .start[data-v-a396b06c] {\n border-bottom: 1px solid gainsboro;\n}\n",""])},function(t,e){t.exports=require("element-ui/lib/theme-chalk/index.css")},function(t,e,n){"use strict";n.r(e);n(7);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"container"},[n("el-calendar",{staticClass:"calendar",attrs:{value:t.options.month},scopedSlots:t._u([{key:"dateCell",fn:function(e){var r=e.date,o=e.data;return[n("div",{staticStyle:{position:"relative",width:"100%",height:"100%"}},[n("div",{staticClass:"center date"},[t._v("\n "+t._s(r.getMonth()+1==t.options.month.split("-")[1]?o.day.split("-")[2]:"")+"\n ")]),n("div",{staticClass:"item"},[t.options.records[o.day]&&(t.options.records[o.day].start_time||t.options.records[o.day].end_time)?n("div",{staticClass:"attendance",style:"background:"+t.getAttendance(t.options.records[o.day].start_time,t.options.records[o.day].end_time,r)},[n("div",{staticClass:"center time start"},[t._v(t._s(t.options.records[o.day].start_time))]),n("div",{staticClass:"center time end"},[t._v(t._s(t.options.records[o.day].end_time))])]):n("div",{staticClass:"null center"},[t._v("\n "+t._s(r.getDay()%7==6||r.getDay()%7==0||r.getMonth()+1!=t.options.month.split("-")[1]||r.getTime()>=(new Date).getTime()?"":"缺勤")+"\n ")])])])]}}])})],1)};r._withStripped=!0;n(8),n(9);var o={name:"attendance-calendar",created:function(){},data:function(){},props:{options:{type:Object,required:!0},worktime:{type:Number,required:!0},leavetime:{type:String,required:!0,default:"18:00"}},methods:{getDiffTime:function(t,e){return 60*(e.split(":")[0]-t.split(":")[0])+(e.split(":")[1]-t.split(":")[1])},isLeaveTooEarly:function(t){return t<this.leavetime},getAttendance:function(t,e,n){return t&&e?n.getDay()%7==0||n.getDay()%7==6?"#aaaaaa55":this.getDiffTime(t,e)<60*this.worktime||this.isLeaveTooEarly(e)?"#ffff0055":"#00ff0055":"#ff000055"}},mounted:function(){}};n(10),n(13);var i=function(t,e,n,r,o,i,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}(o,r,[],!1,null,"a396b06c",null);i.options.__file="src/lib/AttendanceCalendar.vue";var a=i.exports,s=(n(15),n(4)),c=n.n(s),u=n(5),l=n.n(u);a.install=function(t){t.component(a.name,a)},l.a.use(c.a);e.default=a}]).default;