|
|
@@ -18,6 +18,7 @@ namespace app\adminapi\lists\works;
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
|
use app\common\model\master_worker\MasterWorker;
|
|
|
+use app\common\model\property\PropertyOrder;
|
|
|
use app\common\model\works\ServiceWork;
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
use think\db\Query;
|
|
|
@@ -32,7 +33,34 @@ use think\facade\Log;
|
|
|
class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
|
{
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 获取数据权限
|
|
|
+ * $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 (isset($data_rules['sale_group_id']) && !empty($data_rules['sale_group_id'])) {
|
|
|
+ $work_ids = PropertyOrder::where('sale_group_id','in',$data_rules['sale_group_id'])->column('work_id')??[];
|
|
|
+ $where[] = ['id','in' ,$work_ids];
|
|
|
+ }
|
|
|
+ if (isset($data_rules['sale_id']) && !empty($data_rules['sale_id'])) {
|
|
|
+ $work_ids = PropertyOrder::where('sale_id','in',$data_rules['sale_id'])->column('work_id')??[];
|
|
|
+ $where[] = ['id','in' ,$work_ids];
|
|
|
+ }
|
|
|
+ if (isset($data_rules['property_head_id']) && !empty($data_rules['property_head_id'])) {
|
|
|
+ $work_ids = PropertyOrder::where('property_head_id','in',$data_rules['property_head_id'])->column('work_id')??[];
|
|
|
+ $where[] = ['id','in' ,$work_ids];
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
/**
|
|
|
* @notes 设置搜索条件
|
|
|
* @return \string[][]
|
|
|
@@ -140,6 +168,7 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
|
|
|
])
|
|
|
->where($this->searchWhere)
|
|
|
->where($this->queryWhere())
|
|
|
+ ->where($this->queryDataWhere())
|
|
|
->field(['id', 'work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'goods_category_ids', 'goods_category_id', 'base_service_fee', 'service_fee', 'work_status','work_pay_status', 'service_status', 'dispatch_time', 'receive_time', 'appointment_time', 'finished_images', 'finished_time', 'master_worker_id', 'work_amount', 'work_type', 'create_time', 'update_time','lon', 'lat','appoint_approval','refund_approval','finally_door_time'])
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
->order(['id' => 'desc'])
|
|
|
@@ -156,7 +185,7 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
|
|
|
*/
|
|
|
public function count(): int
|
|
|
{
|
|
|
- return ServiceWork::where($this->searchWhere)->where($this->queryWhere())->count();
|
|
|
+ return ServiceWork::where($this->searchWhere)->where($this->queryWhere())->where($this->queryDataWhere())->count();
|
|
|
}
|
|
|
|
|
|
}
|