Merge branch 'feature/stock_next' into develop
# Conflicts: # app/admin/controller/SysDictController.php # app/admin/controller/VehColorController.php # app/admin/service/SysDictService.php # app/common/model/SysCurrency.php # app/controller/IndexController.php # config/route.php
This commit is contained in:
@@ -51,4 +51,28 @@ class SysDictController extends BaseController
|
||||
$data['sysDictItem'] = SysDictItem::where('dict_id',$data['id'])->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function listScopeFormat($data)
|
||||
{
|
||||
$rdata = [];
|
||||
foreach ($data as $item) {
|
||||
$rdata[$item['dict_code']] = $item['sysDictItem'];
|
||||
}
|
||||
return $rdata;
|
||||
}
|
||||
|
||||
public function listScope(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceListAllScope($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'listScopeFormat')
|
||||
? [$this, 'listScopeFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,36 @@ class SysDictService
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'scope':
|
||||
$config['order']['id'] = 'desc';
|
||||
if (isset($p['scope']) && !empty($p['scope'])) {
|
||||
$config['where']['id'] = ['in', explode(',', $p['scope'])];
|
||||
}
|
||||
$config['with']['sysDictItem'][] = 'dict_id';
|
||||
$config['with']['sysDictItem'][] = 'item_label';
|
||||
$config['with']['sysDictItem'][] = 'item_value';
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
public function serviceListAllScope(Request $request)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'scope');
|
||||
$result = $this->logicListAll($config);
|
||||
return $this->postProcess('ListAllScope', $result);
|
||||
}
|
||||
|
||||
|
||||
public function afterServiceListAllScope($data)
|
||||
{
|
||||
|
||||
// $data->each(function (&$item) {
|
||||
|
||||
// });
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user