|
|
@@ -17,6 +17,7 @@ namespace app\adminapi\lists\training;
|
|
|
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
|
use app\adminapi\logic\training\TrainingBlockConfigLogic;
|
|
|
+use app\common\model\master_worker\MasterWorker;
|
|
|
use app\common\model\training\TrainingWorkerTask;
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
use app\workerapi\service\MasterWokerTaskRequiredService;
|
|
|
@@ -45,6 +46,43 @@ class TrainingWorkerTaskLists extends BaseAdminDataLists implements ListsSearchI
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ public function queryWhere()
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ $whereWorker = [];
|
|
|
+ if(isset($this->params['province']) && !empty($this->params['province'])){
|
|
|
+ $whereWorker[] = ['province','=' ,$this->params['province']];
|
|
|
+ }
|
|
|
+ if(isset($this->params['city']) && !empty($this->params['city'])){
|
|
|
+ $whereWorker[] = ['city','=' ,$this->params['city']];
|
|
|
+ }
|
|
|
+ if(!empty($whereWorker)){
|
|
|
+ $worker_ids = MasterWorker::where($whereWorker)->column('id')??[0];
|
|
|
+ $where = [['master_worker_id','in' ,$worker_ids]];
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取数据权限
|
|
|
+ * $this->adminInfo['data_rules']
|
|
|
+ * province city admin_id sale_group_id sale_id property_head_id
|
|
|
+ */
|
|
|
+ public function queryDataWhere(){
|
|
|
+ $where = [];
|
|
|
+ $data_rules = $this->adminInfo['data_rules'];
|
|
|
+ if (isset($data_rules['province']) && !empty($data_rules['province'])) {
|
|
|
+ $where[] = ['province','in' ,$data_rules['province']];
|
|
|
+ }
|
|
|
+ if (isset($data_rules['city']) && !empty($data_rules['city'])) {
|
|
|
+ $where[] = ['city','in' ,$data_rules['city']];
|
|
|
+ }
|
|
|
+ if(!empty($where)){
|
|
|
+ $worker_ids = MasterWorker::where($where)->column('id')??[0];
|
|
|
+ $where = [['master_worker_id','in' ,$worker_ids]];
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @notes 获取列表
|
|
|
@@ -63,7 +101,7 @@ class TrainingWorkerTaskLists extends BaseAdminDataLists implements ListsSearchI
|
|
|
'LeadMasterWorker',
|
|
|
'ShopGoods',
|
|
|
'ShopOrders',
|
|
|
- ])->where($this->searchWhere)
|
|
|
+ ])->where($this->searchWhere)->where($this->queryWhere())->where($this->queryDataWhere())
|
|
|
->field(['id', 'task_list','master_worker_id', 'shop_goods_id', 'shop_orders_id', 'training_task_id', 'training_status', 'lead_master_worker_id', 'operate_status'])
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
->order(['id' => 'desc'])
|