|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["node-modules/uview-ui/components/u-datetime-picker/u-datetime-picker"],{"1e84":function(t,e,n){"use strict";n.r(e);var i=n("d553"),a=n.n(i);for(var r in i)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(r);e["default"]=a.a},"3ff3":function(t,e,n){"use strict";var i=n("714b"),a=n.n(i);a.a},"714b":function(t,e,n){},"84f8":function(t,e,n){"use strict";n.r(e);var i=n("bbfd"),a=n("1e84");for(var r in a)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(r);n("3ff3");var u=n("f0c5"),o=Object(u["a"])(a["default"],i["b"],i["c"],!1,null,"e63c31da",null,!1,i["a"],void 0);e["default"]=o.exports},bbfd:function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return i}));var i={uPicker:function(){return Promise.all([n.e("common/vendor"),n.e("node-modules/uview-ui/components/u-picker/u-picker")]).then(n.bind(null,"efe5"))}},a=function(){var t=this.$createElement;this._self._c},r=[]},d553:function(t,e,n){"use strict";(function(t){var i=n("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=i(n("9523")),r=i(n("278c")),u=i(n("73ae")),o=i(n("f749"));var s={name:"datetime-picker",mixins:[t.$u.mpMixin,t.$u.mixin,u.default],data:function(){return{columns:[],innerDefaultIndex:[],innerFormatter:function(t,e){return e}}},watch:{show:function(t,e){t&&this.updateColumnValue(this.innerValue)},propsChange:function(){this.init()}},computed:{propsChange:function(){return[this.mode,this.maxDate,this.minDate,this.minHour,this.maxHour,this.minMinute,this.maxMinute,this.filter]}},mounted:function(){this.init()},methods:{init:function(){this.innerValue=this.correctValue(this.value),this.updateColumnValue(this.innerValue)},setFormatter:function(t){this.innerFormatter=t},close:function(){this.closeOnClickOverlay&&this.$emit("close")},cancel:function(){this.$emit("cancel")},confirm:function(){this.$emit("confirm",{value:this.innerValue,mode:this.mode}),this.$emit("input",this.innerValue)},intercept:function(e,n){var i=e.match(/\d+/g);return i.length>1?(t.$u.error("请勿在过滤或格式化函数时添加数字"),0):n&&4==i[0].length?i[0]:i[0].length>2?(t.$u.error("请勿在过滤或格式化函数时添加数字"),0):i[0]},change:function(t){var e=t.indexs,n=t.values,i="";if("time"===this.mode)i="".concat(this.intercept(n[0][e[0]]),":").concat(this.intercept(n[1][e[1]]));else{var a=parseInt(this.intercept(n[0][e[0]],"year")),r=parseInt(this.intercept(n[1][e[1]])),u=parseInt(n[2]?this.intercept(n[2][e[2]]):1),s=0,c=0,m=(0,o.default)("".concat(a,"-").concat(r)).daysInMonth();"year-month"===this.mode&&(u=1),u=Math.min(m,u),"datetime"===this.mode&&(s=parseInt(this.intercept(n[3][e[3]])),c=parseInt(this.intercept(n[4][e[4]]))),i=Number(new Date(a,r-1,u,s,c))}i=this.correctValue(i),this.innerValue=i,this.updateColumnValue(i),this.$emit("change",{value:i,mode:this.mode})},updateColumnValue:function(t){this.innerValue=t,this.updateColumns(),this.updateIndexs(t)},updateIndexs:function(e){var n=[],i=this.formatter||this.innerFormatter,a=t.$u.padZero;if("time"===this.mode){var r=e.split(":");n=[i("hour",r[0]),i("minute",r[1])]}else{new Date(e);n=[i("year","".concat((0,o.default)(e).year())),i("month",a((0,o.default)(e).month()+1))],"date"===this.mode&&n.push(i("day",a((0,o.default)(e).date()))),"datetime"===this.mode&&n.push(i("day",a((0,o.default)(e).date())),i("hour",a((0,o.default)(e).hour())),i("minute",a((0,o.default)(e).minute())))}var u=this.columns.map((function(t,e){return Math.max(0,t.findIndex((function(t){return t===n[e]})))}));this.innerDefaultIndex=u},updateColumns:function(){var t=this.formatter||this.innerFormatter,e=this.getOriginColumns().map((function(e){return e.values.map((function(n){return t(e.type,n)}))}));this.columns=e},getOriginColumns:function(){var e=this,n=this.getRanges().map((function(n){var i=n.type,a=n.range,r=function(t,e){var n=-1,i=Array(t<0?0:t);while(++n<t)i[n]=e(n);return i}(a[1]-a[0]+1,(function(e){var n=a[0]+e;return n="year"===i?"".concat(n):t.$u.padZero(n),n}));return e.filter&&(r=e.filter(i,r)),{type:i,values:r}}));return n},generateArray:function(t,e){return Array.from(new Array(e+1).keys()).slice(t)},correctValue:function(e){var n="time"!==this.mode;if(n&&!t.$u.test.date(e)?e=this.minDate:n||e||(e="".concat(t.$u.padZero(this.minHour),":").concat(t.$u.padZero(this.minMinute))),n)return e=(0,o.default)(e).isBefore((0,o.default)(this.minDate))?this.minDate:e,e=(0,o.default)(e).isAfter((0,o.default)(this.maxDate))?this.maxDate:e,e;if(-1===String(e).indexOf(":"))return t.$u.error("时间错误,请传递如12:24的格式");var i=e.split(":"),a=(0,r.default)(i,2),u=a[0],s=a[1];return u=t.$u.padZero(t.$u.range(this.minHour,this.maxHour,Number(u))),s=t.$u.padZero(t.$u.range(this.minMinute,this.maxMinute,Number(s))),"".concat(u,":").concat(s)},getRanges:function(){if("time"===this.mode)return[{type:"hour",range:[this.minHour,this.maxHour]},{type:"minute",range:[this.minMinute,this.maxMinute]}];var t=this.getBoundary("max",this.innerValue),e=t.maxYear,n=t.maxDate,i=t.maxMonth,a=t.maxHour,r=t.maxMinute,u=this.getBoundary("min",this.innerValue),o=u.minYear,s=u.minDate,c=u.minMonth,m=u.minHour,d=u.minMinute,h=[{type:"year",range:[o,e]},{type:"month",range:[c,i]},{type:"day",range:[s,n]},{type:"hour",range:[m,a]},{type:"minute",range:[d,r]}];return"date"===this.mode&&h.splice(3,2),"year-month"===this.mode&&h.splice(2,3),h},getBoundary:function(t,e){var n,i=new Date(e),r=new Date(this["".concat(t,"Date")]),u=(0,o.default)(r).year(),s=1,c=1,m=0,d=0;return"max"===t&&(s=12,c=(0,o.default)(i).daysInMonth(),m=23,d=59),(0,o.default)(i).year()===u&&(s=(0,o.default)(r).month()+1,(0,o.default)(i).month()+1===s&&(c=(0,o.default)(r).date(),(0,o.default)(i).date()===c&&(m=(0,o.default)(r).hour(),(0,o.default)(i).hour()===m&&(d=(0,o.default)(r).minute())))),n={},(0,a.default)(n,"".concat(t,"Year"),u),(0,a.default)(n,"".concat(t,"Month"),s),(0,a.default)(n,"".concat(t,"Date"),c),(0,a.default)(n,"".concat(t,"Hour"),m),(0,a.default)(n,"".concat(t,"Minute"),d),n}}};e.default=s}).call(this,n("543d")["default"])}}]);
|