|
|
@@ -5,6 +5,7 @@ use app\adminapi\lists\BaseAdminDataLists;
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
|
use app\common\model\master_worker\MasterWorker;
|
|
|
+use app\common\model\master_worker_register\MasterWorkerRegister;
|
|
|
use app\common\model\works\ServiceWorkAllocateWorkerLog;
|
|
|
use think\facade\Db;
|
|
|
use think\facade\Log;
|
|
|
@@ -136,10 +137,13 @@ class MasterWorkerServiceOrderLists extends BaseAdminDataLists implements ListsS
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
->select()->toArray();
|
|
|
$categoryData = GoodsCategory::select()->toArray();
|
|
|
+ $ids = array_column($lists,'id');
|
|
|
+ $masterWorkerRegisters = array_column(MasterWorkerRegister::with(['sale'])->whereIn('worker_id',$ids)->select()->toArray(), null,'worker_id');
|
|
|
foreach ($lists as &$item) {
|
|
|
$item['labels'] = $item['labels']?array_map(function ($item) { return intval($item); },explode(',',$item['labels'])):'';
|
|
|
$item['category_name'] = $item['category_ids']?implode('、',array_column(get_parent_info($categoryData,explode(',',$item['category_ids'])),'name')):'';
|
|
|
$item['allocate_num'] = ServiceWorkAllocateWorkerLog::where(['master_worker_id'=>$item['id']])->count();
|
|
|
+ $item['register_info'] = $masterWorkerRegisters[$item['id']]??[];
|
|
|
}
|
|
|
return $lists;
|
|
|
}
|