|
@@ -6,6 +6,7 @@ use App\Model\ConstructionInfo;
|
|
|
use App\Model\CustomerInfo;
|
|
|
use App\Model\Depart;
|
|
|
use App\Model\Employee;
|
|
|
+use App\Model\Product;
|
|
|
use App\Model\SalesOrderInfo;
|
|
|
use App\Model\SeeRange;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -79,23 +80,32 @@ class RangeService extends Service
|
|
|
$depart = $employee = $depart2 = [];
|
|
|
foreach ($see as $value){
|
|
|
if ($value['type'] == SeeRange::data_one){
|
|
|
- $tmp = [
|
|
|
- 'id' => $value['param_id'],
|
|
|
- 'name' => $depart_map[$value['param_id']] ?? "",
|
|
|
- ];
|
|
|
- $depart[] = $tmp;
|
|
|
+ $name = $depart_map[$value['param_id']] ?? "";
|
|
|
+ if(! empty($name)){
|
|
|
+ $tmp = [
|
|
|
+ 'id' => $value['param_id'],
|
|
|
+ 'name' => $depart_map[$value['param_id']] ?? "",
|
|
|
+ ];
|
|
|
+ $depart[] = $tmp;
|
|
|
+ }
|
|
|
}elseif ($value['type'] == SeeRange::data_two){
|
|
|
- $tmp = [
|
|
|
- 'id' => $value['param_id'],
|
|
|
- 'name' => $emp_map[$value['param_id']] ?? '',
|
|
|
- ];
|
|
|
- $employee[] = $tmp;
|
|
|
+ $name = $emp_map[$value['param_id']] ?? '';
|
|
|
+ if(! empty($name)){
|
|
|
+ $tmp = [
|
|
|
+ 'id' => $value['param_id'],
|
|
|
+ 'name' => $emp_map[$value['param_id']] ?? '',
|
|
|
+ ];
|
|
|
+ $employee[] = $tmp;
|
|
|
+ }
|
|
|
}elseif ($value['type'] == SeeRange::data_three){
|
|
|
- $tmp = [
|
|
|
- 'id' => $value['param_id'],
|
|
|
- 'name' => $depart_map[$value['param_id']] ?? '',
|
|
|
- ];
|
|
|
- $depart2[] = $tmp;
|
|
|
+ $name = $depart_map[$value['param_id']] ?? '';
|
|
|
+ if(! empty($name)) {
|
|
|
+ $tmp = [
|
|
|
+ 'id' => $value['param_id'],
|
|
|
+ 'name' => $depart_map[$value['param_id']] ?? '',
|
|
|
+ ];
|
|
|
+ $depart2[] = $tmp;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -315,4 +325,30 @@ class RangeService extends Service
|
|
|
|
|
|
return $return_id;
|
|
|
}
|
|
|
+
|
|
|
+ //产品可见部门
|
|
|
+ public static function productSeeRange($product_id){
|
|
|
+ $return = [];
|
|
|
+ $product = Product::whereIn('id',$product_id)
|
|
|
+ ->select('id','top_depart_id','depart_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ foreach ($product as $value){
|
|
|
+ $return[$value['id']][] = $value['depart_id'];
|
|
|
+ $return[$value['id']][] = $value['top_depart_id'];
|
|
|
+ $return[$value['id']] = array_unique($return[$value['id']]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = SeeRange::where('del_time',0)
|
|
|
+ ->where('data_type', SeeRange::type_four)
|
|
|
+ ->whereIn('data_id',$product_id)
|
|
|
+ ->where('type',SeeRange::data_one)
|
|
|
+ ->select('param_id as depart_id','data_id as product_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ foreach ($result as $value){
|
|
|
+ $return[$value['product_id']][] = $value['depart_id'];
|
|
|
+ $return[$value['product_id']] = array_unique($return[$value['product_id']]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $return;
|
|
|
+ }
|
|
|
}
|