mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
2 lines
6.6 KiB
JavaScript
Vendored
2 lines
6.6 KiB
JavaScript
Vendored
"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[199],{8824:function(t,e,a){a.r(e),a.d(e,{default:function(){return y}});var i=function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"cardBox"},[e("div",{staticClass:"searchBox"},[e("div",{staticClass:"row",staticStyle:{width:"100%"}},[e("span",[t._v("统计时间:")]),e("el-select",{staticStyle:{width:"100px","margin-right":"5px"},on:{change:t.changeTimeType},model:{value:t.time_type,callback:function(e){t.time_type=e},expression:"time_type"}},t._l(t.timeTypeList,(function(t){return e("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1),"week"==t.time_type||"seven"==t.time_type||"thirty"==t.time_type?e("el-date-picker",{attrs:{clearable:!1,type:"date",placeholder:"选择日期",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd"},on:{change:t.changeDayTime},model:{value:t.dayValue,callback:function(e){t.dayValue=e},expression:"dayValue"}}):"month"==t.time_type?e("el-date-picker",{attrs:{type:"month",clearable:!1,format:"yyyy-MM","value-format":"yyyy-MM",placeholder:"选择月"},on:{change:t.changeMonthTime},model:{value:t.monthValue,callback:function(e){t.monthValue=e},expression:"monthValue"}}):"custom"==t.time_type?e("el-date-picker",{staticStyle:{width:"250px"},attrs:{type:"datetimerange","range-separator":"-","start-placeholder":"开始时间","end-placeholder":"结束时间",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd",clearable:!1},on:{change:t.changeCustomTime},model:{value:t.customValue,callback:function(e){t.customValue=e},expression:"customValue"}}):"day"==t.time_type?e("el-time-picker",{staticStyle:{width:"200px"},attrs:{"is-range":"","value-format":"HH:mm:ss",format:"HH:mm:ss","range-separator":"至",clearable:!1,"start-placeholder":"开始时间","end-placeholder":"结束时间",placeholder:"选择时间范围"},on:{change:t.changeTimePicker},model:{value:t.dayTimeList,callback:function(e){t.dayTimeList=e},expression:"dayTimeList"}}):t._e(),e("div",{staticClass:"time"},[e("span",[t._v("当前统计时间:")]),t.startTime==t.endTime?e("span",[t._v(t._s(t.startTime))]):e("span",[t._v(t._s(t.startTime)+"~"+t._s(t.endTime))])])],1),e("div",{staticClass:"row"},[e("span",[t._v("规格:")]),e("el-select",{attrs:{filterable:"",remote:"",clearable:"","reserve-keyword":"",placeholder:"请选择具体规格","remote-method":t.remoteMethod,loading:t.remoteLoading},model:{value:t.sku_id,callback:function(e){t.sku_id=e},expression:"sku_id"}},t._l(t.skusList,(function(t){return e("el-option",{key:t.id,attrs:{label:t.title,value:t.id}})})),1)],1),e("div",{staticClass:"row"},[e("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(e){return t.handleSearch()}}},[t._v("筛选")])],1)])]),e("el-card",[e("div",{staticClass:"echartBox",attrs:{id:"myEchart"}})])],1)},s=[],h=(a(560),a(1808)),l=a(9036),m=a(7484),r=a.n(m),n=a(2092),o={data(){return{loading:!1,time_type:"thirty",timeTypeList:[{label:"自然周",value:"week"},{label:"自然月",value:"month"},{label:"近7天",value:"seven"},{label:"近30天",value:"thirty"},{label:"自定义",value:"custom"}],dayValue:"",monthValue:"",customValue:[],startTime:"",endTime:"",dateList:[],totalNum:[],totalAmount:[],myChart:null,dayTimeList:[],sku_id:"",skusList:[],remoteLoading:!1}},mounted(){this.getInitList(),window.onresize=()=>{this.myChart&&this.myChart.resize()}},methods:{getInitList(){this.dayValue=this.endTime=r()().format("YYYY-MM-DD"),this.startTime=r()().subtract(30,"day").format("YYYY-MM-DD"),this.fetchData()},changeTimeType(){"week"==this.time_type?(this.dayValue=this.endTime=r()().format("YYYY-MM-DD"),this.startTime=r()(this.getFirstDay(this.dayValue)).format("YYYY-MM-DD")):"month"==this.time_type?(this.monthValue=r()().format("YYYY-MM"),this.startTime=this.monthValue+"-01",this.endTime=this.monthValue+"-"+this.getDaysInMonth(this.monthValue)):"seven"==this.time_type?(this.dayValue=this.endTime=r()().format("YYYY-MM-DD"),this.startTime=r()().subtract(7,"day").format("YYYY-MM-DD")):"thirty"==this.time_type?(this.dayValue=this.endTime=r()().format("YYYY-MM-DD"),this.startTime=r()().subtract(30,"day").format("YYYY-MM-DD")):"custom"==this.time_type&&(this.startTime=this.endTime=r()().format("YYYY-MM-DD"),this.customValue=[this.startTime,this.startTime]),this.fetchData()},fetchData(){this.loading=!0;let t={start_time:this.startTime+" 00:00:00",end_time:this.endTime+" 23:59:59",sku_id:this.sku_id||0};(0,h.ei)(t).then((t=>{this.dateList=[],this.totalNum=[],this.totalAmount=[],t.data.data.forEach((t=>{this.dateList.push(t.date),this.totalNum.push(t.total_num),this.totalAmount.push(t.total_loss_amount)})),this.renderChart()})).catch((()=>{this.loading=!1}))},renderChart(){this.myChart=n.S1(document.getElementById("myEchart")),this.myChart.setOption({grid:{left:"1%",bottom:"2%",containLabel:!0},color:["#3cd08f","#f89f34"],tooltip:{trigger:"axis"},legend:{icon:"rect",left:30,data:["报损数","报损金额"]},xAxis:{type:"category",data:this.dateList},yAxis:{type:"value"},series:[{name:"报损数",type:"line",smooth:!0,data:this.totalNum},{name:"报损金额",type:"line",smooth:!0,data:this.totalAmount}]}),this.loading=!1},getDayTime(){let t=r()().format("YYYY-MM-DD");return t},getFirstDay(t){let e=new Date(t).getDay()||7;return new Date(new Date(t).getFullYear(),new Date(t).getMonth(),new Date(t).getDate()+1-e)},getDaysInMonth(t){let e=1*t.split("-")[0],a=1*t.split("-")[1];const i=r()(new Date(e,a-1,1)),s=i.endOf("month");return s.date()},changeDayTime(){"day"==this.time_type?this.startTime=this.endTime=this.dayValue:"week"==this.time_type?(this.endTime=this.dayValue,this.startTime=r()(this.getFirstDay(this.dayValue)).format("YYYY-MM-DD")):"seven"==this.time_type?(this.endTime=this.dayValue,this.startTime=r()(this.dayValue).subtract(7,"day").format("YYYY-MM-DD")):"thirty"==this.time_type&&(this.endTime=this.dayValue,this.startTime=r()(this.dayValue).subtract(30,"day").format("YYYY-MM-DD")),this.fetchData()},changeMonthTime(){this.startTime=this.monthValue+"-01",this.endTime=this.monthValue+"-"+this.getDaysInMonth(this.monthValue),this.fetchData()},changeCustomTime(){this.startTime=this.customValue[0],this.endTime=this.customValue[1],this.fetchData()},changeTimePicker(){let t=this.getDayTime();this.startTime=t+" "+this.dayTimeList[0],this.endTime=t+" "+this.dayTimeList[1],this.fetchData()},handleSearch(){this.fetchData()},remoteMethod(t){t?(this.remoteLoading=!0,(0,l.no)(t).then((t=>{this.skusList=t.data.data,this.remoteLoading=!1}))):this.skusList=[]}},beforeDestroy(){this.myChart&&(this.myChart.dispose(),this.myChart=null)}},d=o,u=a(1001),c=(0,u.Z)(d,i,s,!1,null,"42163996",null),y=c.exports}}]);
|
|
//# sourceMappingURL=199.5e20f3e2.js.map
|