sth
This commit is contained in:
parent
00a3f2bb21
commit
06715272c8
|
|
@ -52,11 +52,14 @@ class Dispatcher extends Backend
|
||||||
$today = now()->format('Y-m-d');
|
$today = now()->format('Y-m-d');
|
||||||
$today_end = now()->format('Y-m-d');
|
$today_end = now()->format('Y-m-d');
|
||||||
|
|
||||||
|
|
||||||
//设置过滤方法
|
//设置过滤方法
|
||||||
$this->request->filter(['strip_tags', 'trim']);
|
$this->request->filter(['strip_tags', 'trim']);
|
||||||
if (false === $this->request->isAjax()) {
|
if (false === $this->request->isAjax()) {
|
||||||
$this->assign('daterange',$today.' - '.$today_end);
|
$this->assign('daterange',$today.' - '.$today_end);
|
||||||
|
|
||||||
|
$this->assignconfig('default_daterange',now()->format('Y-m-d 00:00:00').' - '.now()->format('Y-m-d 23:59:59'));
|
||||||
|
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,7 +102,7 @@ class Dispatcher extends Backend
|
||||||
|
|
||||||
|
|
||||||
$newData = [
|
$newData = [
|
||||||
['派单员','总业绩(¥)','转化率(%)','利润率(%)','变现值']
|
['派单员','总业绩','转化率','利润率','变现值']
|
||||||
];
|
];
|
||||||
foreach ($data as $datum){
|
foreach ($data as $datum){
|
||||||
$newData[] = [
|
$newData[] = [
|
||||||
|
|
@ -127,7 +130,7 @@ class Dispatcher extends Backend
|
||||||
"COUNT(CASE WHEN status = 60 THEN 1 END) AS finish_num", //完成数
|
"COUNT(CASE WHEN status = 60 THEN 1 END) AS finish_num", //完成数
|
||||||
"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS count_num", //总订单数 (排除取消 和草稿)
|
"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS count_num", //总订单数 (排除取消 和草稿)
|
||||||
"SUM(CASE WHEN status = 60 THEN total END) AS total", //成效额
|
"SUM(CASE WHEN status = 60 THEN total END) AS total", //成效额
|
||||||
"SUM(CASE WHEN status = 60 THEN total END) AS performance", //业绩
|
"SUM(CASE WHEN status = 60 THEN performance END) AS performance", //业绩
|
||||||
|
|
||||||
"SUM(CASE WHEN status = 60 THEN (cost + material_cost) END) AS cost_total", //总成本
|
"SUM(CASE WHEN status = 60 THEN (cost + material_cost) END) AS cost_total", //总成本
|
||||||
|
|
||||||
|
|
@ -189,7 +192,7 @@ class Dispatcher extends Backend
|
||||||
}else{
|
}else{
|
||||||
$datum->admin_user = '系统';
|
$datum->admin_user = '系统';
|
||||||
}
|
}
|
||||||
$datum->avg_time_diff = $this->_calc($datum->avg_time_diff,3600,2);
|
$datum->avg_time_diff = $this->_calc($datum->avg_time_diff,3600*24,2);
|
||||||
|
|
||||||
$datum->id = $datum->dispatch_admin_id;
|
$datum->id = $datum->dispatch_admin_id;
|
||||||
$newData[] = $datum->toArray();
|
$newData[] = $datum->toArray();
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,9 @@ return [
|
||||||
// 是否自动开启 SESSION
|
// 是否自动开启 SESSION
|
||||||
'auto_start' => true,
|
'auto_start' => true,
|
||||||
|
|
||||||
|
//有效期
|
||||||
|
'expire' => 3600*24,
|
||||||
|
|
||||||
'type' => 'redis',
|
'type' => 'redis',
|
||||||
'host' => Env::get('redis.redis_host'), // Redis 服务器地址
|
'host' => Env::get('redis.redis_host'), // Redis 服务器地址
|
||||||
'port' => Env::get('redis.redis_port'), // Redis 端口
|
'port' => Env::get('redis.redis_port'), // Redis 端口
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
||||||
columns: [
|
columns: [
|
||||||
[
|
[
|
||||||
//{field: 'id', title: __('Id')},
|
//{field: 'id', title: __('Id')},
|
||||||
{field: 'id', title: __('ID'),visible:false,operate: false},
|
{field: 'id', title: __('ID'),visible:true,operate: false},
|
||||||
{field: 'admin_user', title: __('派单员'),operate: "LIKE"},
|
{field: 'admin_user', title: __('派单员'),operate: "LIKE"},
|
||||||
{field: 'count_num', title: __('总订单数'),operate: false},
|
{field: 'count_num', title: __('总订单数'),operate: false},
|
||||||
{field: 'finish_num', title: __('完单数'),operate: false},
|
{field: 'finish_num', title: __('完单数'),operate: false},
|
||||||
|
|
@ -45,7 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
||||||
{field: 'performance_avg', title: __('客单利润(¥)'), operate: false},
|
{field: 'performance_avg', title: __('客单利润(¥)'), operate: false},
|
||||||
{field: 'total_avg', title: __('客单价(¥)'), operate: false},
|
{field: 'total_avg', title: __('客单价(¥)'), operate: false},
|
||||||
|
|
||||||
{field: 'avg_time_diff', title: __('派单时效(小时)'), operate: false},
|
{field: 'avg_time_diff', title: __('派单时效(天)'), operate: false},
|
||||||
|
|
||||||
//{field: 'admin_user', title: __('派单员'),operate: "LIKE",visible:false},
|
//{field: 'admin_user', title: __('派单员'),operate: "LIKE",visible:false},
|
||||||
//{field: 'city_name', title: __('城市'),operate: "LIKE",visible:false},
|
//{field: 'city_name', title: __('城市'),operate: "LIKE",visible:false},
|
||||||
|
|
@ -57,7 +57,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
||||||
datetimeFormat: "YYYY-MM-DD",
|
datetimeFormat: "YYYY-MM-DD",
|
||||||
//defaultValue:today()+' - '+today(),
|
//defaultValue:today()+' - '+today(),
|
||||||
data:'autocomplete="off" data-local={"format":"YYYY-MM-DD"}',
|
data:'autocomplete="off" data-local={"format":"YYYY-MM-DD"}',
|
||||||
visible:false},
|
visible:false,
|
||||||
|
defaultValue: Config.default_daterange
|
||||||
|
},
|
||||||
|
|
||||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||||
]
|
]
|
||||||
|
|
@ -105,6 +107,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
||||||
// ]
|
// ]
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
const headers = response[0];
|
||||||
|
const units = ['元', '%', '%', '']; // 如果你有单位可以一起拼接
|
||||||
|
|
||||||
var barChart = Echarts.init(document.getElementById('bar-chart'), 'walden');
|
var barChart = Echarts.init(document.getElementById('bar-chart'), 'walden');
|
||||||
var option = {
|
var option = {
|
||||||
legend: {},
|
legend: {},
|
||||||
|
|
@ -112,14 +117,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
||||||
dataset: {
|
dataset: {
|
||||||
source: response
|
source: response
|
||||||
},
|
},
|
||||||
xAxis: { type: 'category' },
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
axisLabel: {
|
||||||
|
show: true // 隐藏“系统”
|
||||||
|
},
|
||||||
|
axisTick: { show: false },
|
||||||
|
axisLine: { show: false }
|
||||||
|
},
|
||||||
yAxis: {},
|
yAxis: {},
|
||||||
series: [
|
series: headers.slice(1).map((title, i) => ({
|
||||||
{ type: 'bar' },
|
type: 'bar',
|
||||||
{ type: 'bar' },
|
label: {
|
||||||
{ type: 'bar' },
|
show: true,
|
||||||
{ type: 'bar' }
|
position: 'top',
|
||||||
]
|
formatter: function (params) {
|
||||||
|
const value = params.value[i + 1]; // 因为第一列是“派单员”
|
||||||
|
const unit = units[i] || '';
|
||||||
|
return `${value} ${unit}`; // 显示数值 + 单位
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemStyle: {
|
||||||
|
borderRadius: 4
|
||||||
|
}
|
||||||
|
}))
|
||||||
};
|
};
|
||||||
barChart.setOption(option);
|
barChart.setOption(option);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user