123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template','form'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template,Form) {
- return {
- cate_check() {
- Form.events.daterangepicker($('.form'))
- Table.api.init()
- var table = $("#table");
- var table1 = $("#table1");
- // 初始化表格
- table.bootstrapTable({
- url: location.href+'&type=1',
- pk: 'id',
- sortName: 'id',
- searchFormVisible: false,
- showExport: true,
- commonSearch: false,
- search: false,
- columns: [
- [
- {field: 'rank', title: __('排名'), operate: false,},
- {field: 'category_name', title: __('名称'), operate: false,},
- {field: 'num', title: __('数量'), operate: false,},
- ]
- ],
- onLoadSuccess(row){
- let a=Echarts.init(document.getElementById('charts1'))
- let items=[]
- row.rows.forEach(item=>{
- items.push({value:item.num,name:item.category_name})
- })
- console.log(items)
- a.setOption({
- title: {
- text: '订单量排名',
- left: 'center'
- },
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '品类',
- type: 'pie',
- radius: '50%',
- data: items,
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- })
- }
- });
- table1.bootstrapTable({
- url: location.href+'&type=2',
- pk: 'id',
- sortName: 'id',
- searchFormVisible: false,
- showExport: true,
- commonSearch: false,
- search: false,
- columns: [
- [
- {field: 'rank', title: __('排名'), operate: false,},
- {field: 'category_name', title: __('销售人'), operate: false,},
- {field: 'num', title: __('金额'), operate: false,},
- ]
- ],
- onLoadSuccess(row){
- let a=Echarts.init(document.getElementById('charts2'))
- let items=[]
- row.rows.forEach(item=>{
- items.push({value:item.num,name:item.category_name})
- })
- console.log(items)
- a.setOption({
- title: {
- text: '销售额排名',
- left: 'center'
- },
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '品类',
- type: 'pie',
- radius: '50%',
- data: items,
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- })
- }
- });
- Table.api.bindevent(table);
- Table.api.bindevent(table1);
- },
- profit_static() {
- Form.events.daterangepicker($('.form'))
- },
- order_num_amount_rank(){
- Form.events.daterangepicker($('.form'))
- Table.api.init()
- var table = $("#table");
- var table1 = $("#table1");
- // 初始化表格
- table.bootstrapTable({
- url: location.href+'&type=1',
- pk: 'id',
- sortName: 'id',
- searchFormVisible: false,
- showExport: true,
- commonSearch: false,
- search: false,
- columns: [
- [
- {field: 'rank', title: __('排名'), operate: false,},
- {field: 'nickname', title: __('用户名'), operate: false,},
- {field: 'num', title: __('数量'), operate: false,},
- ]
- ],
- onLoadSuccess(row){
- let a=Echarts.init(document.getElementById('charts1'))
- let items=[]
- row.rows.forEach(item=>{
- items.push({value:item.num,name:item.nickname})
- })
- console.log(items)
- a.setOption({
- title: {
- text: '用户订单量排名',
- left: 'center'
- },
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '品类',
- type: 'pie',
- radius: '50%',
- data: items,
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- })
- }
- });
- table1.bootstrapTable({
- url: location.href+'&type=2',
- pk: 'id',
- sortName: 'id',
- searchFormVisible: false,
- showExport: true,
- commonSearch: false,
- search: false,
- columns: [
- [
- {field: 'rank', title: __('排名'), operate: false,},
- {field: 'nickname', title: __('用户名'), operate: false,},
- {field: 'num', title: __('金额'), operate: false,},
- ]
- ],
- onLoadSuccess(row){
- let a=Echarts.init(document.getElementById('charts2'))
- let items=[]
- row.rows.forEach(item=>{
- items.push({value:item.num,name:item.nickname})
- })
- console.log(items)
- a.setOption({
- title: {
- text: '用户订单金额排名',
- left: 'center'
- },
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '品类',
- type: 'pie',
- radius: '50%',
- data: items,
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- })
- }
- });
- Table.api.bindevent(table);
- Table.api.bindevent(table1);
- }
- };
- });
|