liuxiaolong
2019-05-06 3e0536f508aad49f743e7bfabca34e3980a1b6e2
1
webpackJsonp([5],{FykZ:function(t,e,i){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0});var s={name:"light-timeline",components:{},props:{dataList:{type:Array,default:function(){}},activeColor:{type:String,default:"#26B4FF"},indexVal:{default:0}},data:function(){return{presetReg:/defaultColor|orange|yellow/,items:[],total:[{id:"001",type:"circle",color:"red",tag:"测试",address:"学校教学楼",isActive:!0,content:"2019-01-07",year:"2019",month:"01",day:"01",close:!1},{id:"002",type:"circle",color:"red",tag:"测试",address:"学校宿舍楼",isActive:!1,content:"2019-01-07",year:"2019",month:"01",day:"02",close:!1},{id:"003",type:"circle",color:"red",tag:"测试",address:"学校东门",isActive:!0,content:"2019-01-07",year:"2019",month:"02",day:"01",close:!1},{id:"004",type:"circle",color:"red",tag:"测试",address:"学校操场",isActive:!1,content:"2019-01-07",year:"2019",month:"02",day:"02",close:!1},{id:"005",type:"circle",color:"red",tag:"测试",address:"学校食堂",isActive:!0,content:"2019-01-07",year:"2019",month:"03",day:"01",close:!1},{id:"006",type:"circle",color:"red",tag:"测试",address:"学校篮球场",isActive:!1,content:"2019-01-07",year:"2019",month:"03",day:"02",close:!1},{id:"007",type:"circle",color:"red",tag:"测试",address:"学校哪路",isActive:!0,content:"2019-01-07",year:"2019",month:"04",day:"01",close:!1}],leftIndex:0,ringhtIndex:0}},watch:{dataList:{handler:function(t,e){t!==e&&(console.log(t,"timeline newVal"),this.total=this.dataList,this.InitTimeline())},deep:!0}},methods:{getColorClass:function(t){return this.presetReg.test(t)?t:""},getStyle:function(t){var e=t.color&&""!==t.color?t.color:this.activeColor;return this.presetReg.test(e)?{}:"star"===t.type?this.makeStarColor(e):this.makeCircleColor(e)},makeCircleColor:function(t){return{border:"2px solid "+t}},makeStarColor:function(t){return{stroke:t}},clickTimerIteam:function(t,e){this.$emit("clickBackfn",t,e)},goLeft:function(){console.log(this.leftIndex,"this.leftIndex"),0!==this.leftIndex&&(this.items=[].concat(n(this.total.slice(this.leftIndex-1,this.leftIndex)),n(this.items)),this.items=[].concat(n(this.items.splice(0,4))),this.leftIndex-=1,this.ringhtIndex-=1)},goRight:function(){0!==this.ringhtIndex&&this.total.length-this.ringhtIndex>0&&(this.items=[].concat(n(this.items),n(this.total.slice(this.ringhtIndex,this.ringhtIndex+1))),this.items=[].concat(n(this.items.splice(1,5))),this.leftIndex+=1,this.ringhtIndex+=1)},closeMonth:function(t,e){if(console.log(t),t&&void 0!==t)if(t.close){var i=this.items.splice(0,e+1);console.log(i,"arr1");var s=this.total,o=this.items;i.forEach(function(e){s=s.filter(function(t){return t.id!==e.id}),e.close&&(s=s.filter(function(e){return e.month===t.month}))}),console.log(s,"arr2");var c=[].concat(n(i),n(s));c.forEach(function(t){o=o.filter(function(e){return e.id!==t.id})}),console.log(o,"arr3");var l=[].concat(n(c),n(o));console.log(l,"arr5"),this.items=l.splice(0,4),this.$set(t,"close",!1),console.log(this.items,"展开的数据")}else{var r=this.items.filter(function(e){return e.month!==t.month||e.id===t.id}),a=this.total.filter(function(e){return e.month!==t.month&&e.id!==t.id});r.forEach(function(t){a=a.filter(function(e){return e.id!==t.id}),t.close&&(a=a.filter(function(e){return e.month!==t.month}))});var h=[].concat(n(r),n(a));this.items=h.slice(0,4),this.$set(t,"close",!0),console.log(this.items,"收起的数据")}},InitTimeline:function(){this.items=this.total.slice(0,4),0!==this.items.length&&(this.items.length<=4?(this.leftIndex=0,this.ringhtIndex=this.items.length):(this.leftIndex=0,this.ringhtIndex=4))},setStartTime:function(t){var e=this;if(void 0!==t&&0!==t.length){var i=t[0],s=t[t.length-1];this.total.forEach(function(t,n){t.id===i.id&&(e.leftIndex=n),t.id===s.id&&(e.ringhtIndex=n)})}this.items=[].concat(n(this.total.slice(this.leftIndex+1,this.ringhtIndex+1)))},selectLocal:function(t){this.$emit("changParam",t,"tlList2")}},mounted:function(){this.total=this.dataList,this.InitTimeline()}},o=i("XyMi");var c=function(t){i("fhVB")},l=Object(o.a)(s,function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"flex-center timeline-out-content"},[i("fTemplate",{nativeOn:{click:function(e){t.goLeft()}}},[i("i",{staticClass:"d-block fas fa-chevron-left timeline-out-icon"})]),t._v(" "),t._l(t.items,function(e,n){return i("div",{key:n,style:"float:left;width:"+1/t.items.length*100+"%"},[i("div",{staticClass:"flex-center",on:{click:function(i){t.selectLocal(e)}}},[0!==n?i("div",{staticClass:"flex-center",staticStyle:{width:"50px","margin-right":"3px"}},[i("div",{staticClass:"linex"}),t._v(" "),i("i",{staticClass:"d-block fas fa-caret-right timeline-out-icon"})]):t._e(),t._v(" "),i("div",{class:["d-block fas fa-map-marker-alt",e.isActive?"timeline-icon-active":"timeline-out-icon"]}),t._v(" "),i("span",{class:["timeline-address",e.isActive?"timeline-icon-active":"timeline-out-icon"]},[t._v(t._s(e.address))])])])}),t._v(" "),i("fTemplate",{nativeOn:{click:function(e){t.goRight()}}},[i("i",{staticClass:"d-block fas fa-chevron-right timeline-out-icon"})])],2)},[],!1,c,null,null);e.default=l.exports},fhVB:function(t,e){}});