Merge remote-tracking branch 'origin/develop' into feature/hant

This commit is contained in:
hant 2025-06-16 23:12:12 +08:00
commit a00c55b8ee
11 changed files with 96 additions and 25 deletions

View File

@ -2,6 +2,7 @@
namespace app\admin\controller;
use app\admin\model\OrderDispatch;
use app\common\controller\Backend;
use app\common\exception\UploadException;
use app\common\library\Upload;
@ -324,4 +325,46 @@ class Ajax extends Backend
$response = Response::create($data, '', 200, $header);
return $response;
}
public function get_config(){
$order = new \app\admin\model\Order();
$user = \model('admin')->find($this->auth->id);
$group = \model('auth_group_access')->where('uid',$this->auth->id)->find()->group_id ?? 0;
if ($group == 2 || $group == 6) {
// 生成 SQL 语句
$ids = $user->area_ids??'';
if ($ids == ''){
$to_dispatch = 0;
}else{
$ids = explode(',',$ids);
$area_codes = $this->filterAreaCodes($ids);
$order->where(function ($q) use ($area_codes) {
foreach ($area_codes as $area_code) {
$q->whereOr('area_id', 'like', $area_code . '%');
}
});
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
}
}else{
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
}
//待跟进
$to_follow = OrderDispatch::where('follow',0)->auth($this->auth)->count();
// return [
// 'order/index' => $to_dispatch,
// 'orders/dispatch2' => $to_follow
// ];
$rs = [
'order/index' => [$to_dispatch, 'red', 'badge'], //待派单
'orders/dispatch2' => [$to_follow, 'yellow', 'badge'], //待跟进
];
return json_encode($rs);
}
}

View File

@ -131,10 +131,12 @@ class Auditorder extends Backend
$row->validateFailException()->validate($validate);
}
$txt = '审核通过';
if($audit_status){
$params['status'] = Order::STATUS_FINISHED;
}else{
$params['status'] = Order::STATUS_CHECKONCE;
$txt = '审核未通过';
}
$params['audit_admin_id'] = $this->auth->id;
@ -145,7 +147,7 @@ class Auditorder extends Backend
$hookParams['order'] = $row;
$hookParams['role'] = 1;
$hookParams['auth'] = $this->auth;
$hookParams['remark'] = $params['audit_remark'];
$hookParams['remark'] = $txt.'审核备注:'.$params['audit_remark'];
Hook::listen('order_change',$hookParams);
if($params['status'] == Order::STATUS_CHECKONCE){
@ -154,7 +156,7 @@ class Auditorder extends Backend
'to_id' => $row->dispatch_admin_id,
'type' => 1,
'title' => '订单结算审核未通过',
'content' => '【订单结算未通过】订单编号:'.$row->order_no.',审核说明:'.$params['audit_remark'].',审核人:'.$this->auth->nickname
'content' => '【订单结算未通过】订单编号:'.$row->order_no.',审核备注:'.$params['audit_remark'].',审核人:'.$this->auth->nickname
]);
}

View File

@ -153,7 +153,7 @@ class Configorder extends Backend
$params['order'] = $row;
$params['role'] = 1;
$params['auth'] = $this->auth;
$params['remark'] = '';
$params['remark'] = '完成订单配置';
Hook::listen('order_change', $params);

View File

@ -87,16 +87,18 @@ class Dispatch2 extends Backend
if(!in_array($row->status, $this->model->btnActiveStatusList('btn_record')) ){
//正常情况,执行不到这里来,不用担心循环执行问题
$row->follow = 2;
OrderDispatch::where('id',$row->id)->update(['follow'=>2]);
if($row->follow != 2){
$row->follow = 2;
OrderDispatch::where('id',$row->id)->update(['follow'=>2]);
}
}
if($row->btn_record){
if($row->btn_record != 2){
$row->btn_record = true;
}else{
if($row->btn_record ){
if($row->follow == 2){
$row->btn_record = false;
}
}
/*if($row->follow == 0 ){
$row->btn_record = true;
@ -125,7 +127,7 @@ class Dispatch2 extends Backend
// }
// }
// }
}
// $row->btn_income = (in_array($row->status, $this->model->btnActiveStatusList('btn_income')) && in_array($row->order->status, $orderModel->incomeBtnStatus())) ? true : false;
if($row->status == -10){ //拒绝

View File

@ -72,6 +72,7 @@ class Dispatchlog extends Backend
}
}
$this->view->assign('logs',json_encode($orderLogs));
$this->view->assign('cdnurl',config('upload.cdnurl'));
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage

View File

@ -156,7 +156,7 @@ class Dispatchrecord extends Backend
$dispatch->record_count ++;
//$params['admin_id'] = $this->auth->id;
$result = $this->model->allowField(true)->save($params);
$dispatch->save();
$dispatch->allowField(true)->save();
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();

View File

@ -185,7 +185,7 @@ class Worker extends Backend
$viewSubsql->where('create_time','>=',$filter['start_time']);
}
if(!empty($filter['end_time'])){
$viewSubsql->where('create_time','<=',$filter['start_time']);
$viewSubsql->where('create_time','<=',$filter['end_time']);
}
return $viewSubsql->group('worker_id')->buildSql();
}
@ -215,7 +215,7 @@ class Worker extends Backend
$builder->where('create_time','>=',$filter['start_time']);
}
if(!empty($filter['end_time'])){
$builder->where('create_time','<=',$filter['start_time']);
$builder->where('create_time','<=',$filter['end_time']);
}
$builder->group('worker_id');
@ -258,7 +258,7 @@ class Worker extends Backend
$builder->where('create_time','>=',$filter['start_time']);
}
if(!empty($filter['end_time'])){
$builder->where('create_time','<=',$filter['start_time']);
$builder->where('create_time','<=',$filter['end_time']);
}
//->where('dispatch_admin_id','>',0);

View File

@ -113,6 +113,8 @@
<script>
const logs = {$logs}; // 后端传入的数据,格式保持和你的一致
const cdnurl = '{$cdnurl}';
function getRoleLabel(role) {
return '';
}
@ -197,11 +199,14 @@
return `
<div class="progress-images" style="margin-top: 6px;">
${imageList.map(img => `
<img src="${img}" data-preview="true"
style="width:40px;height:40px;border-radius:4px;border:1px solid #ccc;margin-right:5px;"
onerror="this.style.display='none'" />
`).join('')}
${imageList.map(img => {
const fullUrl = img.startsWith('http') ? img : cdnurl + img;
return `
<img src="${fullUrl}" data-preview="true"
style="width:40px;height:40px;border-radius:4px;border:1px solid #ccc;margin-right:5px;"
onerror="this.style.display='none'" />
`;
}).join('')}
</div>
`;
}

View File

@ -444,5 +444,19 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
},60*1000);
var s =5;//几秒刷新
setInterval(f5,s*1000);
//定时器刷新
function f5() {
$.post("/admin/ajax/get_config?",{field:'addr2'},function(data,status){
// alert("Data: " + data.data + "nStatus: " + status);
// console.log(data);
Backend.api.sidebar(JSON.parse(data));
});
}
return Controller;
});

View File

@ -105,6 +105,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
}
}},
{field: 'worker_remark', title: __('师傅备注'), operate: false},
{
field: 'is_finish_today',
@ -119,7 +120,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
'1': 'success',
},
},
{field: 'estimated_finish_time', title: __('师傅预估完成时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'work_progress', title: __('当前施工进度'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
//{field: 'order.source_shop', title: __('Order.source_shop'), operate: '='},
@ -152,6 +152,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'admin_user', title: __('Admin_user'), operate: 'LIKE'},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
//{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
{field: 'estimated_finish_time', title: __('预估完成时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'area', title: __('地区'), searchList: function (column) {
@ -221,10 +223,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-warning btn-dialog',
visible:function(row){
if(row.btn_record){
/*if(row.btn_record){
return true;
}
return false;
return false;*/
return row.btn_record;
}
},

View File

@ -62,7 +62,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
}
},
*/
{field: 'area2.merge_name', title: __('地区'),operate: false},
//{field: 'area2.merge_name', title: __('地区'),operate: false},
{field: 'daterange', title: __('时间筛选'), addclass:'datetimerange',
autocomplete:false,
@ -78,7 +78,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
return Template('categorytpl', {});
}, formatter: function (value, row, index) {
return '无';
}, visible: false
},
visible: false
},
{field: 'operate', title: __('Operate'), table: table2, events: Table.api.events.operate, formatter: Table.api.formatter.operate,