diff --git a/application/admin/behavior/OrderDispatchLog.php b/application/admin/behavior/OrderDispatchLog.php index 9708c55..b152f5a 100644 --- a/application/admin/behavior/OrderDispatchLog.php +++ b/application/admin/behavior/OrderDispatchLog.php @@ -48,7 +48,8 @@ class OrderDispatchLog 'type' => 1, 'outid' => md5(time().rand(1000,9999).rand(1000,9999)), 'create_time' => date('Y-m-d H:i:s'), - 'status' => $alibaba_dyvms['sync']?1:0 + 'status' => $alibaba_dyvms['sync']?1:0, + 'mobile' => $dispatch->worker_tel, ]; $service = new NoticeLogic(); $service->dispatchNotice($dispatch); diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 918f744..7fb1b9f 100755 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -374,6 +374,6 @@ class Ajax extends Backend public function getItems(){ - return $items = \app\admin\model\Item::where('level',1)->field('id,title as name')->select(); + return $items = \app\admin\model\Item::where('level',1)->field('id,title as name')->order('sort','desc')->select(); } } diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index 63a35ab..ceed3d3 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -177,6 +177,11 @@ class Order extends Backend ]) ->where($where); $filter = (array)json_decode(input()['filter'] ?? '', true); + + if(isset($filter['audit_time'])){ + $build->where('status',\app\admin\model\Order::STATUS_FINISHED); + } + $admin_filter = $filter['user.nickname'] ?? false; $area_id = $filter['area_id'] ?? false; $item_id = $filter['item_id'] ?? false; @@ -252,6 +257,10 @@ class Order extends Backend }else{ $item->source_total_name = ($item->getRelation('source')->title??''); } + + if($item->status <60){ + $item->audit_time = null; + } unset($item->source); } $result = ['total' => $list->total(), 'rows' => $list->items()]; @@ -327,6 +336,7 @@ class Order extends Backend $params['create_time'] = date('Y-m-d H:i:s'); $params['update_time'] = date('Y-m-d H:i:s'); $params['receive_type'] = $params['receive_type']?: 1; + $params['audit_time'] = date('Y-m-d H:i:s'); $result = $this->model->allowField(true)->save($params); $auth = clone $this->auth; @@ -627,14 +637,16 @@ class Order extends Backend 'update_time' => now()->format('Y-m-d H:m:s'), ]; + $orderDispatch = OrderDispatch::where('order_id',$order->id)->whereBetween('status','>=',0)->find(); if ($params['abnormal_id'] == 2 || $params['abnormal_id'] == 3) { $order->status = \app\admin\model\Order::STATUS_CANCEL; $order->save(); - if (!empty($order->dispatch->id)) { + + if (!empty($orderDispatch)) { $orderLogic = new OrderLogic(); - $orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false); + $orderLogic->cancelOrderDispatch($orderDispatch, $this->auth, '订单被取消', false); //日志 $hookparams['order'] = $order; $hookparams['role'] = 1; @@ -654,9 +666,9 @@ class Order extends Backend $order->status = \app\admin\model\Order::STATUS_DISPATCHING; $order->save(); - if (!empty($order->dispatch->id)) { + if (!empty($orderDispatch)) { $OrderLogic = new OrderLogic(); - $OrderLogic->noWorkerCanGetIt($order->dispatch, '系统取消' . $abnormal_title); + $OrderLogic->noWorkerCanGetIt($orderDispatch, '系统取消' . $abnormal_title); AutoDispatchLogic::autoDispatch($order); } @@ -679,7 +691,6 @@ class Order extends Backend $result = \model('order_abnormal')->insert($insert); Db::commit(); } catch (ValidateException|PDOException|Exception $e) { - throw $e; Db::rollback(); $this->error($e->getMessage()); } diff --git a/application/admin/controller/Orderplan.php b/application/admin/controller/Orderplan.php index 97444e1..658442f 100644 --- a/application/admin/controller/Orderplan.php +++ b/application/admin/controller/Orderplan.php @@ -133,13 +133,13 @@ class Orderplan extends Backend } $build->field([ - 'DATE(create_time) day', + 'DATE(audit_time) day', 'sum(total) total', 'count(id) count', 'sum(performance) performance' ]) ->where('status',\app\admin\model\Order::STATUS_FINISHED) - ->group(' DATE(create_time)'); + ->group(' DATE(audit_time)'); $res = $this->buildDate($build)->select(); $data = []; @@ -300,17 +300,26 @@ class Orderplan extends Backend $start = now()->format('Y-m-d 00:00:00'); $end_at = now()->format('Y-m-d 23:59:59'); + $build = new \app\admin\model\Order(); + $build->whereBetween('audit_time', [$start, $end_at]) + ->where('status',\app\admin\model\Order::STATUS_FINISHED); + $data1 = $build->field([ + 'sum(total) total', + 'count(*) count', + ])->select(); + + $build = new \app\admin\model\Order(); $build->whereBetween('create_time', [$start, $end_at]); $data = $build->field([ - 'sum(total) total', - 'count(id) count', + /* 'sum(total) total', + 'count(id) count',*/ 'count(if(status=-10,1,null)) cancel' ])->select(); $today = [ - 'total' => $data[0]->total ?? 0, - 'count' => $data[0]->count ?? 0, + 'total' => $data1[0]->total ?? 0, + 'count' => $data1[0]->count ?? 0, 'cancel' => $data[0]->cancel ?? 0, ]; diff --git a/application/admin/controller/aftersales/Aftersale.php b/application/admin/controller/aftersales/Aftersale.php index 5a9cf39..3ec0905 100644 --- a/application/admin/controller/aftersales/Aftersale.php +++ b/application/admin/controller/aftersales/Aftersale.php @@ -264,6 +264,7 @@ class Aftersale extends Backend $this->error('订单不存在'); } $order->status = Order::STATUS_FINISHED; + $order->audit_time = date('Y-m-d H:i:s'); $order->save(); } diff --git a/application/admin/controller/aftersales/Aftersale2.php b/application/admin/controller/aftersales/Aftersale2.php index 341e8cb..a34707a 100644 --- a/application/admin/controller/aftersales/Aftersale2.php +++ b/application/admin/controller/aftersales/Aftersale2.php @@ -478,6 +478,7 @@ class Aftersale2 extends Backend $order = Order::get($row->order_id); //重新计算订单利润 $order->status = Order::STATUS_FINISHED; + $order->audit_time = date('Y-m-d H:i:s'); $order->save(); $orderLogic = new OrderLogic(); $orderLogic->recacle($order,$row); diff --git a/application/admin/controller/orders/Auditorder.php b/application/admin/controller/orders/Auditorder.php index 2979194..b5b37f0 100644 --- a/application/admin/controller/orders/Auditorder.php +++ b/application/admin/controller/orders/Auditorder.php @@ -124,7 +124,8 @@ class Auditorder extends Backend if (false === $this->request->isPost()) { $order = Order::where('id',$ids)->find(); $this->view->assign('row', $row); - $this->view->assign('worker',Worker::where('id',$order->worker_id)->find()); + $worker = Worker::withTrashed()->where('id', $order->worker_id)->find(); + $this->view->assign('worker',$worker); $this->view->assign('cdnurl', config('upload.cdnurl')); return $this->view->fetch(); } diff --git a/application/admin/controller/orders/Configorder.php b/application/admin/controller/orders/Configorder.php index 942ea8e..0dcc945 100644 --- a/application/admin/controller/orders/Configorder.php +++ b/application/admin/controller/orders/Configorder.php @@ -118,7 +118,8 @@ class Configorder extends Backend } if (false === $this->request->isPost()) { $this->view->assign('row', $row); - $worker = Worker::where('id',$row->worker_id)->find(); + //$worker = Worker::where('id',$row->worker_id)->find(); + $worker = Worker::withTrashed()->where('id', $row->worker_id)->find(); $this->view->assign('worker', $worker); return $this->view->fetch(); } @@ -143,6 +144,7 @@ class Configorder extends Backend $data = [ 'status' => Order::STATUS_AUDITING, + 'online_amount' => $params['online_amount'], 'online_amount_last' => $params['online_amount_last'], 'offline_amount' => $params['offline_amount'], // 'refund_amount' => $params['refund_amount'], @@ -160,7 +162,7 @@ class Configorder extends Backend $cost = bcadd($params['cost'],$params['material_cost'],2); - $data['total'] = bcadd($row->online_amount,$last_amount,2); + $data['total'] = bcadd($params['online_amount'],$last_amount,2); $data['real_amount'] = $data['total']; $data['performance'] = bcsub($data['real_amount'],$cost,2); $result = $row->allowField(true)->save($data); diff --git a/application/admin/controller/orders/Dispatch2.php b/application/admin/controller/orders/Dispatch2.php index ecd1363..840e4b2 100644 --- a/application/admin/controller/orders/Dispatch2.php +++ b/application/admin/controller/orders/Dispatch2.php @@ -323,6 +323,7 @@ class Dispatch2 extends Backend //计算价格 $data = [ + 'online_amount' => $orderParsms['online_amount'], //线上尾款 'online_amount_last' => $row->online_total, //线上尾款 'offline_amount' => $row->total, //线下尾款 'cost' => $orderParsms['cost'], @@ -340,7 +341,7 @@ class Dispatch2 extends Backend $cost = bcadd($data['cost'],$data['material_cost'],2); - $data['total'] = bcadd($order->online_amount,$last_amount,2); + $data['total'] = bcadd($data['online_amount'],$last_amount,2); $data['real_amount'] = $data['total']; $data['performance'] = bcsub($data['real_amount'],$cost,2); $order->allowField(true)->save($data); diff --git a/application/admin/controller/statistics/Dispatcher.php b/application/admin/controller/statistics/Dispatcher.php index 5d53698..2f59615 100644 --- a/application/admin/controller/statistics/Dispatcher.php +++ b/application/admin/controller/statistics/Dispatcher.php @@ -137,14 +137,17 @@ class Dispatcher extends Backend // 使用 IFNULL 确保结果为 null 时返回 0 "IFNULL(COUNT(CASE WHEN status = 60 THEN 1 END), 0) AS finish_num", //完成数 "IFNULL(COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END), 0) AS count_num", //总订单数 (排除取消 和草稿) - "IFNULL(COUNT(CASE WHEN is_overtime = 1 THEN 1 END), 0) AS overtime_num", //超时数 + "IFNULL(COUNT(CASE WHEN status = 60 AND is_overtime = 1 THEN 1 END), 0) AS overtime_num", //超时数 "IFNULL(SUM(CASE WHEN status = 60 THEN total END), 0) AS total", //成效额 "IFNULL(SUM(CASE WHEN status = 60 THEN performance END), 0) AS performance", //业绩 "IFNULL(SUM(CASE WHEN status = 60 THEN (cost + material_cost) END), 0) AS cost_total", //总成本 - "IFNULL(SUM(CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) END), 0) AS refund_total", //退款总数 - "IFNULL(COUNT(CASE WHEN refund_amount > 0 OR worker_refund_amount > 0 THEN 1 END), 0) AS refund_count", //退款订单数量 - "IFNULL(AVG(CASE WHEN status > 10 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff", //派单时效 + //"IFNULL(SUM(CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) END), 0) AS refund_total", //退款总数 + "SUM( + CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) ELSE 0 END +) AS refund_total", + "IFNULL(COUNT(CASE WHEN status = 60 AND (refund_amount > 0 OR worker_refund_amount > 0) THEN 1 END), 0) AS refund_count", //退款订单数量 + "IFNULL(AVG(CASE WHEN status = 60 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff", //派单时效 // "SUM(CASE WHEN status = 60 THEN (field1 + field2) END) AS performance", ]; diff --git a/application/admin/controller/statistics/Item.php b/application/admin/controller/statistics/Item.php index ec424fa..7396079 100644 --- a/application/admin/controller/statistics/Item.php +++ b/application/admin/controller/statistics/Item.php @@ -10,6 +10,7 @@ use app\admin\model\OrderReview; use app\common\controller\Backend; use PDOStatement; use think\Collection; +use think\Db; use think\Exception; use think\exception\DbException; use think\Loader; @@ -24,7 +25,7 @@ use function Symfony\Component\Clock\now; */ class Item extends Backend { - + protected $itemsformattedTree = null; protected $noNeedRight = ['list','chartData']; @@ -33,6 +34,43 @@ class Item extends Backend public function _initialize() { parent::_initialize(); + + $sources = Db::name('source') + ->where('status', 1) + ->field(['id', 'title', 'key_word', 'pid']) + ->order('pid', 'asc') + ->order('sort', 'desc') + ->select(); + $filtered = array_filter($sources, function ($item) { + return $item['pid'] == 0; + }); + + $pid_map = array_column($filtered, null, 'id'); + $res = []; + foreach ($sources as $item) { + if ($item['pid'] != 0 && isset($pid_map[$item['pid']])) { + $res [] = [ + ...$item, 'ptitle' => $pid_map[$item['pid']]['title'] + ]; + } + } + + /* $items = Db::name('item') + ->where('status', 1) + ->field(['id', 'title', 'key_word', 'pid']) + ->order('pid', 'asc') + ->order('sort', 'desc') + ->select(); + $tree = $this->buildTree($items); + $formattedTree = $this->formatTree($tree); + + $this->items = $items; + $this->itemsformattedTree = $formattedTree;*/ + + $items = \app\admin\model\Item::where('level',1)->field('id,title')->order('sort','desc')->select(); + $this->view->assign("sources", $res); + $this->view->assign("items", $items); + } public function index() @@ -48,6 +86,8 @@ class Item extends Backend public function list() { $build = new Order(); + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $start = now()->modify('-7 days')->format('Y-m-d'); $end_at = now()->format('Y-m-d 23:29:59'); @@ -69,6 +109,21 @@ class Item extends Backend $build->where('area_id', 'like', $area_id . '%'); } + //来源 + if(!empty(request()->get('source',null))){ + $build->where('source',request()->get('source')); + } + //城市 + /* if(!empty(request()->post('area_id',null))){ + $build->where('area_id','LIKE',request()->post('source').'%'); + }*/ + + if(!empty(request()->get('item_id',null))){ + $item_id =request()->get('item_id'); + $item_ids = $this->getItemsById($item_id); + $item_ids [] = $item_id; + $build->whereIn('item_id', $item_ids); + } $build->whereBetween('create_time', [$start, $end_at]) ->field([ @@ -86,7 +141,7 @@ class Item extends Backend ])->group('item_title') ->order('count_num', 'desc'); // dd($total); - $res = $build->paginate(); + $res = $build->paginate($limit); $total = $res->total(); $ress = $res->items(); $data = []; @@ -103,7 +158,7 @@ class Item extends Backend $re['total_avg'] = $this->mydiv($re['total'],$re['count_num'],2,false); $re['performance_avg'] = $this->mydiv($re['performance'],$re['finish_num'],2,false); $re['avg_time_diff'] = $this->mydiv($re['avg_time_diff'],3600,2,false); - $re['cost_total'] = $cost_total; + $re['cost_total'] = number_format($cost_total,2,'.',''); // $re['id'] = $re['item_id']; $data [] = $re; } @@ -139,6 +194,8 @@ class Item extends Backend $filter ['daterange'] = request()->post('daterange'); + + if (!empty($filter['daterange'])) { $arr = explode(' - ', $filter['daterange']); if (trim($arr[0])) { @@ -149,9 +206,28 @@ class Item extends Backend } } - $res = $build - ->whereBetween('create_time', [$start, $end_at]) - ->field([ + $build = $build + ->whereBetween('create_time', [$start, $end_at]); + + //来源 + if(!empty(request()->post('source',null))){ + $build->where('source',request()->post('source')); + } + + //城市 + if(!empty(request()->post('area_id',null))){ + $build->where('area_id','LIKE',request()->post('source').'%'); + } + + if(!empty(request()->post('item_id',null))){ + $item_id =request()->post('item_id'); + $item_ids = $this->getItemsById($item_id); + $item_ids [] = $item_id; + $build->whereIn('item_id', $item_ids); + } + + + $res = $build->field([ 'item_title name', // 类型 'sum(total) total', // 营业额 'count(id) count', // 单量 diff --git a/application/admin/model/Order.php b/application/admin/model/Order.php index 1036f48..136fcef 100644 --- a/application/admin/model/Order.php +++ b/application/admin/model/Order.php @@ -167,7 +167,8 @@ class Order extends Model self::STATUS_CHECKING, self::STATUS_CHECKONCE, self::STATUS_AUDITING, - self::STATUS_FINISHED + self::STATUS_FINISHED, + self::STATUS_AFTERSALE ], ]; return $tabStatus[$tab] ?? []; diff --git a/application/admin/view/aftersales/aftersale/edit.html b/application/admin/view/aftersales/aftersale/edit.html index 0d508d2..939033c 100644 --- a/application/admin/view/aftersales/aftersale/edit.html +++ b/application/admin/view/aftersales/aftersale/edit.html @@ -3,14 +3,14 @@
- +
- +
@@ -18,7 +18,7 @@
- +
diff --git a/application/admin/view/aftersales/aftersale2/edit.html b/application/admin/view/aftersales/aftersale2/edit.html index c5b731c..9349182 100644 --- a/application/admin/view/aftersales/aftersale2/edit.html +++ b/application/admin/view/aftersales/aftersale2/edit.html @@ -3,14 +3,14 @@
- +
- +
@@ -18,7 +18,7 @@
- +
diff --git a/application/admin/view/dashboard/kpi_presale.html b/application/admin/view/dashboard/kpi_presale.html index f159350..be42f86 100644 --- a/application/admin/view/dashboard/kpi_presale.html +++ b/application/admin/view/dashboard/kpi_presale.html @@ -11,14 +11,12 @@ 姓名 录单数 - 录单业绩 {$adminname|htmlentities} {$data['total']|htmlentities} - {$data['money']|htmlentities} diff --git a/application/admin/view/orders/auditorder/edit.html b/application/admin/view/orders/auditorder/edit.html index e51e1b5..f0ad698 100755 --- a/application/admin/view/orders/auditorder/edit.html +++ b/application/admin/view/orders/auditorder/edit.html @@ -8,20 +8,20 @@ -
+ -
+
@@ -160,18 +160,20 @@
-
+ + + -
+
- +
@@ -225,6 +227,7 @@ + diff --git a/application/admin/view/orders/configorder/edit.html b/application/admin/view/orders/configorder/edit.html index f2e88b3..c0b3428 100644 --- a/application/admin/view/orders/configorder/edit.html +++ b/application/admin/view/orders/configorder/edit.html @@ -18,7 +18,7 @@
-
+ @@ -51,11 +51,12 @@
- +
+ {if condition='$row.status eq 40'}
@@ -82,7 +83,7 @@
- +
@@ -97,12 +98,12 @@
-
+
@@ -111,12 +112,12 @@
-
+
@@ -126,6 +127,8 @@
+ + @@ -181,7 +185,7 @@
- +
@@ -195,12 +199,12 @@
-
- -
- -
-
+ + + + + +
@@ -208,13 +212,13 @@
- +
@@ -224,29 +228,31 @@
- -
- -
- -
-
+ -
- -
-
- -
- - -
- + {/if} diff --git a/application/admin/view/orders/dispatch2/edit.html b/application/admin/view/orders/dispatch2/edit.html index 83ce45f..dee9247 100644 --- a/application/admin/view/orders/dispatch2/edit.html +++ b/application/admin/view/orders/dispatch2/edit.html @@ -89,7 +89,7 @@
- +
@@ -107,7 +107,7 @@
- +
@@ -153,28 +153,31 @@ {/if} -
+ + + -
- -
-
- -
- - + +
diff --git a/application/admin/view/orders/review/edit.html b/application/admin/view/orders/review/edit.html index 353cf3a..583fbd6 100644 --- a/application/admin/view/orders/review/edit.html +++ b/application/admin/view/orders/review/edit.html @@ -10,7 +10,6 @@
-
@@ -33,13 +32,70 @@
- +
- +
+ {if condition='$row.status eq 60'} + + +
+ +
+ +
+
+ + +
+ +
+ {:build_select('row[offline_amount_type]',$offlineTotalTypeList,$row['offline_amount_type'],['class'=>'form-control readonly','data-rule'=>'required'])} +
+
+ + +
+ +
+ +
+
+ + +
+ +
+ +
+
+ + + {/if} + + + + + + {if condition='$row.status eq -10'} +
+ +
+ +
+
+ + {/if} + {if condition='$row.cancel_detail neq ""'} diff --git a/application/admin/view/statistics/item/index.html b/application/admin/view/statistics/item/index.html index d97d0e4..7d86ea6 100644 --- a/application/admin/view/statistics/item/index.html +++ b/application/admin/view/statistics/item/index.html @@ -1,3 +1,34 @@ + + +
+ + +
@@ -43,22 +77,55 @@
-
-
- - +
+ +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
-
- -
- - -
- + +
+ + diff --git a/application/admin/view/workers/worker/add.html b/application/admin/view/workers/worker/add.html index 3848c40..d92a4d3 100644 --- a/application/admin/view/workers/worker/add.html +++ b/application/admin/view/workers/worker/add.html @@ -75,7 +75,7 @@
- +
diff --git a/application/admin/view/workers/worker/edit.html b/application/admin/view/workers/worker/edit.html index 5e4f07c..6338a36 100644 --- a/application/admin/view/workers/worker/edit.html +++ b/application/admin/view/workers/worker/edit.html @@ -92,10 +92,10 @@
- +
- +
diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js index def402a..c64b12d 100644 --- a/public/assets/js/backend/order.js +++ b/public/assets/js/backend/order.js @@ -147,7 +147,7 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'} }, operate: '=', }, - {field: 'dispatch_admin_user', title: '派单员',operate: 'LIKE'}, + {field: 'customer', title: __('Customer'), operate: 'LIKE'}, { field: 'dispatch_type', title: '派单方式', @@ -161,7 +161,8 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'} {field: 'user.nickname', title: '录单员',operate: 'LIKE'}, - {field: 'customer', title: __('Customer'), operate: 'LIKE'}, + {field: 'dispatch_admin_user', title: '派单员',operate: 'LIKE'}, + {field: 'tel', title: __('Tel'), operate: 'LIKE'}, {field: 'area.merge_name', title: __('Area_id'), searchable: false}, { diff --git a/public/assets/js/backend/statistics/dispatcher.js b/public/assets/js/backend/statistics/dispatcher.js index 23a6bec..ebc91cc 100644 --- a/public/assets/js/backend/statistics/dispatcher.js +++ b/public/assets/js/backend/statistics/dispatcher.js @@ -55,7 +55,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t {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: 'time_by', title: __('时间维度'), visible:false,searchList: {"1":__('审核时间')},defaultValue:1, formatter: Table.api.formatter.normal}, {field: 'daterange', title: __('时间筛选'), addclass:'datetimerange', autocomplete:false, operate: "RANGE", diff --git a/public/assets/js/backend/statistics/item.js b/public/assets/js/backend/statistics/item.js index f31db4a..7b57a67 100644 --- a/public/assets/js/backend/statistics/item.js +++ b/public/assets/js/backend/statistics/item.js @@ -1,4 +1,5 @@ -define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-theme', 'template', 'addtabs', 'moment','citypicker'], function ($, undefined, Backend, Table, Form, echarts, undefined, Template, Datatable, Moment) { +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-theme', 'template', 'addtabs', 'moment','citypicker','cascader'], function ($, undefined, Backend, Table, Form, echarts, undefined, Template, Datatable, Moment) { + var Controller = { @@ -56,6 +57,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t }); // 为表格2绑定事件 Table.api.bindevent(table2); + + setTimeout(function () { + var $city = $('#select_city'); + if ($city.data('citypicker')) { + $city.citypicker('destroy'); + } + $city.citypicker(); + + $city.off("cp:updated").on("cp:updated", function () { + var citypicker = $(this).data("citypicker"); + var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province"); + $("#select_area_id").val(code); + }); + }, 500); + } }); @@ -74,20 +90,49 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t $('#filter-btn-table').on('click', function () { - const area_id = $('#area_id').val(); + const area_id = $('#select_area_id').val(); const range = $('#daterange-table').val(); + + const source1 = $('#source').val(); + const item_id = $('#item_id').val(); + + let data = ''; - if (area_id !== ''){ + if (area_id !== '' ){ data += 'area_id=' + area_id+'&'; } if (range !== ''){ - data += 'range=' + range; + data += 'range=' + range+'&'; } + + if (source1!== ''){ + data += 'source=' + source1+'&'; + } + if (item_id !== '' && item_id !== 'undefined'){ + data +='item_id=' + item_id + '&'; + } + // data = encodeURIComponent(data); $("#table2").bootstrapTable('refresh',{ url:'statistics/item/list?' + data, }); }); + + + + + + /* var _data = items; + $('#select_item').zdCascader({ + data: _data, + onChange: function ($this, data, allPathData) { + // console.log(data,allPathData); + $('#select_item_id').val(data.value); + }, + clear: true, + clickParent: true + });*/ + }, add: function () { @@ -187,10 +232,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t getChartData: function () { // 获取日期范围值 var daterange = $('#daterange').val(); - + /* var source = $('#source').val(); + var city_id = $('#area_id').val(); + var item_id = $('#item_id').val(); +*/ // 构建查询参数 var params = { 'daterange': daterange, + /* 'source': source, + 'area_id': city_id, + 'item_id': item_id,*/ }; $.ajax({ @@ -205,7 +256,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t console.error("图表数据加载失败"); } }); - } + }, + + + } }; return Controller; diff --git a/public/assets/js/backend/statistics/worker.js b/public/assets/js/backend/statistics/worker.js index e6b175a..420d975 100644 --- a/public/assets/js/backend/statistics/worker.js +++ b/public/assets/js/backend/statistics/worker.js @@ -83,8 +83,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t visible: false }, - {field: 'item_id', title: __('工程'), searchList:$.getJSON("ajax/getItems"),operate: 'IN',visible:false}, - + {field: 'item_id', title: __('工种'), searchList:$.getJSON("ajax/getItems"),operate: 'IN',visible:false}, {field: 'operate', title: __('Operate'), table: table2, events: Table.api.events.operate, formatter: Table.api.formatter.operate, buttons: [ diff --git a/public/assets/js/backend/workers/worker.js b/public/assets/js/backend/workers/worker.js index 33845bf..0fa1f03 100644 --- a/public/assets/js/backend/workers/worker.js +++ b/public/assets/js/backend/workers/worker.js @@ -86,8 +86,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree','cascader'], }, visible: false }, { - field: '收款码', - title: __('Images'), + field: 'images', + title: __('收款码'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index a5b537e..74fc902 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -11880,7 +11880,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列 }, pageSize: Config.pagesize || localStorage.getItem("pagesize") || 10, - pageList: [10, 15, 20, 25, 50, 'All'], + pageList: [10, 15, 20, 25, 50, 100], pagination: true, clickToSelect: true, //是否启用点击选中 dblClickToEdit: true, //是否启用双击编辑 diff --git a/public/assets/js/require-frontend.min.js b/public/assets/js/require-frontend.min.js index e908b94..19ea38c 100644 --- a/public/assets/js/require-frontend.min.js +++ b/public/assets/js/require-frontend.min.js @@ -11624,7 +11624,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列 }, pageSize: Config.pagesize || localStorage.getItem("pagesize") || 10, - pageList: [10, 15, 20, 25, 50, 'All'], + pageList: [10, 15, 20, 25, 50, 100], pagination: true, clickToSelect: true, //是否启用点击选中 dblClickToEdit: true, //是否启用双击编辑 diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index 3d8e940..2cc479d 100755 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列 }, pageSize: Config.pagesize || localStorage.getItem("pagesize") || 10, - pageList: [10, 15, 20, 25, 50, 'All'], + pageList: [10, 15, 20, 25, 50, 100], pagination: true, clickToSelect: true, //是否启用点击选中 dblClickToEdit: true, //是否启用双击编辑