Commit a86ffc53 by cwy

指标详情修改完成

parent f0ccd835
...@@ -61,6 +61,24 @@ class CommonBus extends BaseBus ...@@ -61,6 +61,24 @@ class CommonBus extends BaseBus
} }
/** /**
* 根据条件查询多条信息分页
* 示例:['id'=>1,'name'=>'测试']
* @return array|false
*/
public function getConditionalQueryAllPaging($where,$page,$limit)
{
try{
$info = $this->model->getConditionalQueryAllPaging($where,$page,$limit);
if(empty($info)){
return false;
}
return $info->toArray();
} catch(\Exception $e) {
exception($e,$this->className.'.getConditionalQueryAll');
}
}
/**
* 获取多个数据 * 获取多个数据
* @return void * @return void
*/ */
......
...@@ -221,6 +221,144 @@ class Norm ...@@ -221,6 +221,144 @@ class Norm
public function detail() public function detail()
{ {
$id = input("param.id"); $id = input("param.id");
$page = input("param.page")?input("param.page"):-1;
$limit = input("param.limit")?input("param.limit"):10;
if(empty($id)){
return returnResult(config("config.code.error"),'填写信息错误,请检查!');
}
$normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类
$data = [];
// 指标详情
$res = $normBus->getConditionalQuery(['id'=>$id]);
// 指标扩展详情
$data['addItem']=$res;
$normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$id]);
$data['custom']=$res;
// 领取信息
$NormReceivesBus = new CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类
if($page == -1){
$data['receivesList'] = $NormReceivesBus->getConditionalQueryAll(['norm_id'=>$id]);
}else{
$list= $NormReceivesBus->getConditionalQueryAllPaging(['norm_id'=>$id],$page,$limit);
// var_dump($list);
$data['receivesList'] = $list['data'];
$data['total'] = $list['total'];
}
if (!empty($data['receivesList'])){
foreach ($data['receivesList'] as $index => $vlues){
$TaskPackageBus = new CommonBus('TaskPackageBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['task_info'] = $TaskPackageBus->getConditionalQuery(['id'=>$vlues['task_id']]);
$NormListBus = new CommonBus('NormListBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['norm_list_info'] = $NormListBus->getConditionalQuery(['id'=>$vlues['norm_list_id']]);
$NormListExtendBus = new CommonBus('NormListExtendBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['norm_list_extend'] = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$vlues['norm_list_id']]);
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$collectsInfo = $NormCollectsBus->getConditionalQuery(['norm_receive_id'=>$vlues['id']]);
if ($collectsInfo){
$NormCollectsExtendBus = new CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化指标类
$normCollectsExtend = $NormCollectsExtendBus->getConditionalQueryAll(['norm_collects_id'=>$collectsInfo['id']]);
$data['receivesList'][$index]['refer_type'] = $collectsInfo['refer_type'];
$data['receivesList'][$index]['remark'] = $collectsInfo['remark'];
$data['receivesList'][$index]['imgPath'] = $collectsInfo['imgPath'];
$data['receivesList'][$index]['fileListPdf'] = $collectsInfo['fileListPdf'];
$data['receivesList'][$index]['file_name'] = $collectsInfo['file_name'];
$data['receivesList'][$index]['normCollectsExtend'] = $normCollectsExtend;
}else{
$normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$id,'user_filled'=>1]);
$data['receivesList'][$index]['refer_type'] = '';
$data['receivesList'][$index]['remark'] = '';
$data['receivesList'][$index]['imgPath'] = '';
$data['receivesList'][$index]['fileListPdf'] = $collectsInfo['fileListPdf'];
$data['receivesList'][$index]['file_name'] = $collectsInfo['file_name'];
$data['receivesList'][$index]['normCollectsExtend'] =$res;
}
}
}
if($data){
return returnResult(config("config.code.success"),config("config.describe.success"),$data);
}else{
return returnResult(config("config.code.success"),config("config.describe.null_data"),[]);
}
}
/**
* 返回指标完整详情信息
* @return \josn
*/
public function whole()
{
$id = input("param.id");
$page = input("param.page")?input("param.page"):-1;
$limit = input("param.limit")?input("param.limit"):10;
if(empty($id)){
return returnResult(config("config.code.error"),'填写信息错误,请检查!');
}
$normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类
$data = [];
// 指标详情
$res = $normBus->getConditionalQuery(['id'=>$id]);
// 指标扩展详情
$data['addItem']=$res;
$normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$id]);
$data['custom']=$res;
// 领取信息
$NormReceivesBus = new CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类
if($page == -1){
$data['receivesList'] = $NormReceivesBus->getConditionalQueryAll(['norm_id'=>$id]);
}else{
$list= $NormReceivesBus->getConditionalQueryAllPaging(['norm_id'=>$id],$page,$limit);
// var_dump($list);
$data['receivesList'] = $list['data'];
$data['total'] = $list['total'];
}
if (!empty($data['receivesList'])){
foreach ($data['receivesList'] as $index => $vlues){
$TaskPackageBus = new CommonBus('TaskPackageBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['task_info'] = $TaskPackageBus->getConditionalQuery(['id'=>$vlues['task_id']]);
$NormListBus = new CommonBus('NormListBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['norm_list_info'] = $NormListBus->getConditionalQuery(['id'=>$vlues['norm_list_id']]);
$NormListExtendBus = new CommonBus('NormListExtendBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['norm_list_extend'] = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$vlues['norm_list_id']]);
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$collectsInfo = $NormCollectsBus->getConditionalQuery(['norm_receive_id'=>$vlues['id']]);
if ($collectsInfo){
$NormCollectsExtendBus = new CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化指标类
$normCollectsExtend = $NormCollectsExtendBus->getConditionalQueryAll(['norm_collects_id'=>$collectsInfo['id']]);
$data['receivesList'][$index]['refer_type'] = $collectsInfo['refer_type'];
$data['receivesList'][$index]['remark'] = $collectsInfo['remark'];
$data['receivesList'][$index]['imgPath'] = $collectsInfo['imgPath'];
$data['receivesList'][$index]['fileListPdf'] = $collectsInfo['fileListPdf'];
$data['receivesList'][$index]['file_name'] = $collectsInfo['file_name'];
$data['receivesList'][$index]['normCollectsExtend'] = $normCollectsExtend;
}else{
$normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$id,'user_filled'=>1]);
$data['receivesList'][$index]['refer_type'] = '';
$data['receivesList'][$index]['remark'] = '';
$data['receivesList'][$index]['imgPath'] = '';
$data['receivesList'][$index]['fileListPdf'] = $collectsInfo['fileListPdf'];
$data['receivesList'][$index]['file_name'] = $collectsInfo['file_name'];
$data['receivesList'][$index]['normCollectsExtend'] =$res;
}
}
}
if($data){
return returnResult(config("config.code.success"),config("config.describe.success"),$data);
}else{
return returnResult(config("config.code.success"),config("config.describe.null_data"),[]);
}
}
/**
* 返回指标详情
* @return \josn
*/
public function detail1()
{
$id = input("param.id");
if(empty($id)){ if(empty($id)){
return returnResult(config("config.code.error"),'填写信息错误,请检查!'); return returnResult(config("config.code.error"),'填写信息错误,请检查!');
} }
......
...@@ -61,6 +61,7 @@ Route::rule("taskPackage/delete","TaskPackage/delete"); // 删除任务列表 ...@@ -61,6 +61,7 @@ Route::rule("taskPackage/delete","TaskPackage/delete"); // 删除任务列表
Route::rule("norm/add","Norm/add"); // 新增指标 Route::rule("norm/add","Norm/add"); // 新增指标
Route::rule("norm/list","Norm/list"); // 指标列表 Route::rule("norm/list","Norm/list"); // 指标列表
Route::rule("norm/detail","Norm/detail"); // 指标详情 Route::rule("norm/detail","Norm/detail"); // 指标详情
Route::rule("norm/whole","Norm/whole"); // 指标完整详情信息
Route::rule("norm/edit","Norm/edit"); // 指标详情 Route::rule("norm/edit","Norm/edit"); // 指标详情
Route::rule("norm/finalData","Norm/finalData"); // 返回最后的ID Route::rule("norm/finalData","Norm/finalData"); // 返回最后的ID
Route::rule("norm/delete","Norm/delete"); // 删除详情 Route::rule("norm/delete","Norm/delete"); // 删除详情
......
...@@ -145,6 +145,31 @@ class NormReceives extends Model ...@@ -145,6 +145,31 @@ class NormReceives extends Model
} }
/** /**
* 根据用户条件返回多条信息分页
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*
*/
public function getConditionalQueryAllPaging($where,$page,$limit)
{
try{
return $this->with([
'userInfo' => function($query){
$query->field("id,name");
},
])->where($where)->paginate([
'list_rows'=>$limit,
'page'=>$page
]);
}catch (\Exception $e){
exception($e,'mysql.NormReceives.getFindModel');
}
}
/**
* 根据条件获取多个值 * 根据条件获取多个值
* @param $where * @param $where
* @return Menu[]|array|\think\Collection|void * @return Menu[]|array|\think\Collection|void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment