Merge remote-tracking branch 'origin/develop' into feature/hant
This commit is contained in:
commit
222a19a331
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\controller\statistics\Kpidispatcher;
|
||||
use app\admin\model\Admin;
|
||||
use app\admin\model\kpi\Template;
|
||||
use app\admin\model\oa\Task;
|
||||
|
|
@ -143,22 +144,87 @@ class Dashboard extends Backend
|
|||
$groupIds = $this->auth->getGroupIds();
|
||||
$groupId = $groupIds[0] ?? 0;
|
||||
|
||||
$kpiTemplate = (new Template())
|
||||
->where('group_id','=', $groupId)
|
||||
->with('kpiitem')
|
||||
->find();
|
||||
if ($groupId == 6) {
|
||||
$kpiTemplate = (new Template())
|
||||
->where('group_id','=', 6)
|
||||
->with('kpiitem')
|
||||
->find();
|
||||
|
||||
if (!$kpiTemplate) {
|
||||
$this->error('kpi模板未找到');
|
||||
if (!$kpiTemplate) {
|
||||
$this->error('kpi模板未找到');
|
||||
}
|
||||
|
||||
$filter['group_id'] = 6;
|
||||
$filter['admin_user_ids'] = 3;
|
||||
$filter['start_time'] = date('Y-m-01 00:00:00');
|
||||
$filter['end_time'] = date('Y-m-t 23:59:59');
|
||||
$chart = (new Kpidispatcher())->chart($filter);
|
||||
$chart = $chart[0] ?? [];
|
||||
|
||||
$datalist = [
|
||||
//转化率 = 完单数 / 总订单数
|
||||
'trans_rate' => $chart['trans_rate'] ?? 0,
|
||||
'finish_num' => $chart['finish_num'] ?? 0,
|
||||
'count_num' => $chart['count_num'] ?? 0,
|
||||
//利润率 = 总业绩/总成效额
|
||||
'performance_rate' => $chart['performance_rate'] ?? 0,
|
||||
'performance' => $chart['performance'] ?? 0,
|
||||
'total' => $chart['total'] ?? 0,
|
||||
//派单时效
|
||||
'avg_time_diff' => $chart['avg_time_diff'] ?? 0,
|
||||
//派单成功率
|
||||
'succ_rate' => $chart['succ_rate'] ?? 0,
|
||||
'finish_num' => $chart['finish_num'] ?? 0,
|
||||
'count_num' => $chart['count_num'] ?? 0,
|
||||
|
||||
//录入师傅数
|
||||
'worker_num' => $chart['worker_num'] ?? 0,
|
||||
];
|
||||
|
||||
$kpiItems = $kpiTemplate['kpiitem'];
|
||||
|
||||
foreach ($kpiItems as &$kpiItem) {
|
||||
if ($kpiItem['unit'] == 1) {
|
||||
$kpiItem['target_value'] .= '%';
|
||||
}
|
||||
if ($kpiItem['attr'] == 'ZHL') {
|
||||
$kpiItem['complete_value'] = $datalist['trans_rate'] . '%';
|
||||
$kpiItem['detail'] = $datalist['finish_num'] . '/' . $datalist['count_num'];
|
||||
}
|
||||
if ($kpiItem['attr'] == 'LRL') {
|
||||
$kpiItem['complete_value'] = $datalist['performance_rate'] . '%';
|
||||
$kpiItem['detail'] = $datalist['performance'] . '/' . $datalist['total'];
|
||||
}
|
||||
if ($kpiItem['attr'] == 'PDSX') {
|
||||
$kpiItem['complete_value'] = $datalist['avg_time_diff'];
|
||||
$kpiItem['detail'] = $datalist['avg_time_diff'];
|
||||
}
|
||||
if ($kpiItem['attr'] == 'PCCGL') {
|
||||
$kpiItem['complete_value'] = $datalist['succ_rate'] . '%';
|
||||
$kpiItem['detail'] = $datalist['finish_num'] . '/' . $datalist['count_num'];
|
||||
}
|
||||
if ($kpiItem['attr'] == 'GDJSL') {
|
||||
$kpiItem['complete_value'] = 0;
|
||||
$kpiItem['detail'] = 0;
|
||||
}
|
||||
if ($kpiItem['attr'] == 'LRSFS') {
|
||||
$kpiItem['complete_value'] = $datalist['worker_num'];
|
||||
$kpiItem['detail'] = $datalist['worker_num'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('kpi_template', $kpiTemplate);
|
||||
$this->view->assign('kpi_items', $kpiItems);
|
||||
|
||||
return $this->view->fetch('kpi_dispatch');
|
||||
}
|
||||
|
||||
if ($groupId == 10) {
|
||||
return $this->view->fetch('kpi_presale');
|
||||
}
|
||||
|
||||
$kpiItems = $kpiTemplate['kpiitem'];
|
||||
$this->error('当前岗位暂未支持');
|
||||
|
||||
$this->view->assign('kpi_template', $kpiTemplate);
|
||||
$this->view->assign('kpi_items', $kpiItems);
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function task_complete($ids = null)
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ class Detail extends Backend
|
|||
|
||||
$result = array("total" => count($res), "rows" => $res);
|
||||
|
||||
|
||||
$this->assignconfig("manage", $this->auth->isSuperAdmin());
|
||||
return json($result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Dispatcher extends Backend
|
|||
{
|
||||
//$this->chart();
|
||||
//$today = now()->sub('')->format('Y-m-d' );
|
||||
$today = now()->sub(new \DateInterval('P7D'))->format('Y-m-d');
|
||||
$today = now()->format('Y-m-01');
|
||||
$today_end = now()->format('Y-m-d');
|
||||
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ class Dispatcher extends Backend
|
|||
if (false === $this->request->isAjax()) {
|
||||
$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'));
|
||||
$this->assignconfig('default_daterange',now()->format('Y-m-01 00:00:00').' - '.now()->format('Y-m-d 23:59:59'));
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
|
@ -67,6 +67,14 @@ class Dispatcher extends Backend
|
|||
$filter = $this->request->param('filter');
|
||||
$filter = json_decode($filter,true);
|
||||
|
||||
$orderByData = [
|
||||
'sort' => $this->request->get('sort','dispatch_admin_id'),
|
||||
'order' => $this->request->get('order','desc')
|
||||
];
|
||||
|
||||
$filter['orderBy'] = $orderByData;
|
||||
|
||||
|
||||
if(!empty($filter['daterange'])){
|
||||
$arr = explode(' - ',$filter['daterange']);
|
||||
if(trim($arr[0])){
|
||||
|
|
@ -77,11 +85,6 @@ class Dispatcher extends Backend
|
|||
}
|
||||
}
|
||||
|
||||
if(!empty($filter['admin_user'])){
|
||||
$adminIds = Admin::where('username','like','%'.$filter['admin_user'].'%')->column('id');
|
||||
$filter['admin_user_ids'] = $adminIds;
|
||||
}
|
||||
|
||||
$list = $this->chart($filter,false);
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
|
@ -147,8 +150,12 @@ class Dispatcher extends Backend
|
|||
->field($fields);
|
||||
//->where('dispatch_admin_id','>',0);
|
||||
|
||||
if(isset($filter['admin_user_ids'])){
|
||||
$builder->whereIn('dispatch_admin_id',$filter['admin_user_ids']);
|
||||
if(!empty($filter['orderBy'])){
|
||||
$builder->order($filter['orderBy']['sort'],$filter['orderBy']['order']);
|
||||
}
|
||||
|
||||
if(isset($filter['dispatch_admin_id'])){
|
||||
$builder->whereIn('dispatch_admin_id',$filter['dispatch_admin_id']);
|
||||
}
|
||||
|
||||
if(!empty($filter['start_time']) && !empty($filter['end_time'])){
|
||||
|
|
|
|||
|
|
@ -312,6 +312,23 @@ class Worker extends Backend
|
|||
$filter = $this->request->get("filter", '');
|
||||
$op = $this->request->get("op", '', 'trim');
|
||||
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
|
||||
|
||||
$asortFields = ['dispatch_count','get_count','refuse_count','arrive_count'];
|
||||
$bsortFields = ['finish_num','total','performance','refund_total','refund_count','cost'];
|
||||
$csortFields = ['good_count'];
|
||||
|
||||
if(!empty($sort) ){
|
||||
if(in_array($sort,$asortFields)){
|
||||
$sort = 'a.'.$sort;
|
||||
}
|
||||
if(in_array($sort,$bsortFields)){
|
||||
$sort = 'b.'.$sort;
|
||||
}
|
||||
if(in_array($sort,$csortFields)){
|
||||
$sort = 'c.'.$sort;
|
||||
}
|
||||
}
|
||||
|
||||
$order = $this->request->get("order", "DESC");
|
||||
$offset = max(0, $this->request->get("offset/d", 0));
|
||||
$limit = max(0, $this->request->get("limit/d", 0));
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
<tr>
|
||||
<td>{$item->name|htmlentities}</td>
|
||||
<td>{$item->target_value|htmlentities}</td>
|
||||
<td>0</td>
|
||||
<td>{$item->complete_value|htmlentities}</td>
|
||||
<td>{$item->desc|htmlentities}</td>
|
||||
<td>0</td>
|
||||
<td>{$item->pivot->rate|htmlentities}</td>
|
||||
<td>{$item->detail|htmlentities}</td>
|
||||
<td>{$item->pivot->rate|htmlentities}%</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
30
application/admin/view/dashboard/kpi_presale.html
Normal file
30
application/admin/view/dashboard/kpi_presale.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
<div class="panel-heading">
|
||||
<h1>KPI面板</h1>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
</div>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>姓名</th>
|
||||
<th>录单数</th>
|
||||
<th>录单业绩</th>
|
||||
<th>提成比例(固定3%)</th>
|
||||
<th>提成</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>111</td>
|
||||
<td>22</td>
|
||||
<td>33</td>
|
||||
<td>44</td>
|
||||
<td>55</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -61,4 +61,18 @@ class Order extends Model
|
|||
|
||||
return $images;
|
||||
}
|
||||
|
||||
public function getMaterialImagesAttr($val)
|
||||
{
|
||||
if (empty($val)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$images = explode(',', $val);
|
||||
foreach ($images as $k => $v) {
|
||||
$images[$k] = cdnurl($v, true);
|
||||
}
|
||||
|
||||
return $images;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@ class OrderDispatchService extends BaseService
|
|||
'images',
|
||||
'status',
|
||||
'coupon_id',
|
||||
'is_material_used',
|
||||
'material_cost',
|
||||
'material_images',
|
||||
];
|
||||
$orderDispatchFields = [
|
||||
'id',
|
||||
|
|
@ -384,6 +387,18 @@ class OrderDispatchService extends BaseService
|
|||
$orderDispatch->images = $this->removeStrCdnUrl($params['complete_images']);
|
||||
$orderDispatch->finish_time = $time;
|
||||
|
||||
// 材料相关
|
||||
$order = $this->getOrderModel()->where('id', $orderDispatch->order_id)->find();
|
||||
// 是否使用材料
|
||||
$order->is_material_used = $params['is_material_used'];
|
||||
if ($order->is_material_used == 1) {
|
||||
// 材料成本
|
||||
$order->material_cost = $params['material_cost'];
|
||||
// 材料凭证图片组
|
||||
$order->material_images = $this->removeStrCdnUrl($params['material_images']);
|
||||
$order->save();
|
||||
}
|
||||
|
||||
if ($params['receive_type'] == 1) {
|
||||
$orderDispatch->image = $this->removeStrCdnUrl($params['payment_image']);
|
||||
$orderDispatch->offline_total_type = $params['offline_total_type'];
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ class OrderDispatch extends Validate
|
|||
'is_finish_today|今日完成' => 'require|in:0,1',
|
||||
'estimated_finish_time|完成时间' => 'require|date',
|
||||
'work_progress|当前施工进度' => 'max:200',
|
||||
|
||||
//材料相关
|
||||
'is_material_used|是否使用材料' => 'require|in:0,1',
|
||||
'material_cost|材料成本' => 'requireIf:is_material_used,1|number|between:0,10000000',
|
||||
'material_images|材料凭证' => 'requireIf:is_material_used,1|max:1000',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
|
|
@ -39,7 +44,7 @@ class OrderDispatch extends Validate
|
|||
'info' => ['order_dispatch_id'],
|
||||
'appointmentTime' => ['order_dispatch_id', 'plan_time'],
|
||||
'arrivedOnSite' => ['order_dispatch_id', 'images'],
|
||||
'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type'],
|
||||
'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type', 'is_material_used', 'material_cost', 'material_images'],
|
||||
'saveWorkerRemark' => ['order_dispatch_id', 'worker_remark'],
|
||||
'updateProgress' => ['order_dispatch_id', 'is_finish_today', 'estimated_finish_time', 'work_progress'],
|
||||
];
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -61,7 +61,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
{field: 'refund_amount', title: __('Refund_amount'), operate:false},
|
||||
{field: 'real_amount', title: __('Real_amount'), operate:false},
|
||||
{field: 'cost', title: __('Cost'), operate:false},
|
||||
{field: 'material_cost', title: __('材料成本'), operate:false},
|
||||
{
|
||||
field: 'material_cost_text', title: '材料成本',
|
||||
operate: false,
|
||||
cellStyle: {css: {"text-align": "left !important"}},
|
||||
formatter: function (val, row) {
|
||||
if (row.is_material_used === 1) {
|
||||
return `¥${row.material_cost}`
|
||||
}
|
||||
return '无'
|
||||
}},
|
||||
{field: 'material_images', title: __('材料凭证'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
{field: 'performance', title: __('Performance'), operate:false},
|
||||
|
||||
// {field: 'dispatch_type', title: __('Dispatch_type')},
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
"field":"name",
|
||||
},{
|
||||
"title":"用户id",
|
||||
"field":"admin_id",
|
||||
"field":"target_admin_id",
|
||||
"visible":false
|
||||
});
|
||||
|
||||
|
|
@ -95,6 +95,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
return 'salary/detail/custom_edit?target_admin_id=' + row.target_admin_id + '&month=' + row.month;
|
||||
},
|
||||
extend: 'data-area=\'["800px", "600px"]\'',
|
||||
visible:function(row){
|
||||
if (!Config.manage) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'complete',
|
||||
|
|
@ -118,6 +124,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
return false;
|
||||
},
|
||||
visible: function (row) {
|
||||
if (!Config.manage) {
|
||||
return false;
|
||||
}
|
||||
//返回true时按钮显示,返回false隐藏
|
||||
if (row.settle_status != 1) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
|||
table2.bootstrapTable({
|
||||
url: 'statistics/dispatcher/index' + location.search,
|
||||
toolbar: '#toolbar1',
|
||||
sortName: 'id',
|
||||
sortName: 'dispatch_admin_id',
|
||||
search: false,
|
||||
commonSearch:true,
|
||||
visible: false,
|
||||
|
|
@ -30,14 +30,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
|||
[
|
||||
//{field: 'id', title: __('Id')},
|
||||
{field: 'id', title: __('ID'),visible:true,operate: false},
|
||||
{field: 'admin_user', title: __('派单员'),operate: "LIKE"},
|
||||
{field: 'count_num', title: __('总订单数'),operate: false},
|
||||
{field: 'finish_num', title: __('完单数'),operate: false},
|
||||
{field: 'total', title: __('成效额(¥)'), operate: false},
|
||||
{field: 'performance', title: __('总业绩(¥)'), operate: false},
|
||||
{field: 'cost_total', title: __('总成本(¥)'), operate: false},
|
||||
{field: 'refund_total', title: __('退款金额(¥)'), operate: false},
|
||||
{field: 'refund_count', title: __('退款单数'), operate: false},
|
||||
{field: 'admin_user', title: __('派单员'),operate: false},
|
||||
{field: 'count_num', title: __('总订单数'),operate: false,sortable:true},
|
||||
{field: 'finish_num', title: __('完单数'),operate: false,sortable:true},
|
||||
{field: 'total', title: __('成效额(¥)'), operate: false,sortable:true},
|
||||
{field: 'performance', title: __('总业绩(¥)'), operate: false,sortable:true},
|
||||
{field: 'cost_total', title: __('总成本(¥)'), operate: false,sortable:true},
|
||||
{field: 'refund_total', title: __('退款金额(¥)'), operate: false,sortable:true},
|
||||
{field: 'refund_count', title: __('退款单数'), operate: false,sortable:true},
|
||||
|
||||
{field: 'performance_rate', title: __('利润率(%)'), operate: false},
|
||||
{field: 'trans_rate', title: __('转化率(%)'), operate: false},
|
||||
|
|
@ -50,6 +50,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
|||
//{field: 'admin_user', title: __('派单员'),operate: "LIKE",visible:false},
|
||||
//{field: 'city_name', title: __('城市'),operate: "LIKE",visible:false},
|
||||
//{field: 'city_name', title: __('城市'),operate: "LIKE",visible:false},
|
||||
|
||||
{field: 'dispatch_admin_id', title: __('派单员'), searchList:$.getJSON("orders/configorder/getadminuser"),operate: 'IN',visible:false},
|
||||
|
||||
{field: 'time_by', title: __('时间维度'), visible:false,searchList: {"1":__('录单时间'),"2":__('派单时间')},defaultValue:1, formatter: Table.api.formatter.normal},
|
||||
{field: 'daterange', title: __('时间筛选'), addclass:'datetimerange',
|
||||
autocomplete:false,
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
|||
[
|
||||
//{field: 'id', title: __('Id')},
|
||||
{field: 'id', title: __('ID'),visible:true},
|
||||
{field: 'name', title: __('姓名'),operate: "="},
|
||||
{field: 'tel', title: __('电话'),operate: "="},
|
||||
{field: 'name', title: __('姓名'),operate: "like"},
|
||||
{field: 'tel', title: __('电话'),operate: "like"},
|
||||
{field: 'area2.name', title: __('城市'),operate: false},
|
||||
{field: 'star', title: __('评分'),operate: false},
|
||||
{field: 'performance', title: __('总业绩(¥)'), operate: false},
|
||||
{field: 'get_count', title: __('接单数'),operate: false},
|
||||
{field: 'finish_num', title: __('完单数'),operate: false},
|
||||
{field: 'cost', title: __('收入(¥)'), operate: false},
|
||||
{field: 'get_count', title: __('接单数'),operate: false,sortable:true},
|
||||
{field: 'finish_num', title: __('完单数'),operate: false,sortable:true},
|
||||
{field: 'cost', title: __('收入(¥)'), operate: false,sortable:true},
|
||||
{field: 'performance_rate', title: __('利润率(%)'), operate: false},
|
||||
{field: 'trans_rate', title: __('转化率(%)'), operate: false},
|
||||
{field: 'cash_value', title: __('变现值'), operate: false},
|
||||
|
|
@ -46,7 +46,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
|||
{field: 'good_rate', title: __('好评率(%)'), operate: false},
|
||||
|
||||
//{field: 'refund_total', title: __('退款金额(¥)'), operate: false},
|
||||
{field: 'refund_count', title: __('退款单数'), operate: false},
|
||||
{field: 'refund_count', title: __('退款单数'), operate: false,sortable:true},
|
||||
|
||||
|
||||
{field: 'avg_time_diff', title: __('联系时效(小时)'), operate: false},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user