Approval.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class Approval extends Base
  6. {
  7. // 新增
  8. public function save(){
  9. model('Approval')->add();
  10. HelpHander::success([],'操作成功');
  11. }
  12. // 编辑
  13. public function update(){
  14. model('Approval')->add();
  15. HelpHander::success([],'操作成功');
  16. }
  17. // 列表
  18. public function list(){
  19. $ret = model('Approval')->lists($this->orgId);
  20. HelpHander::success($ret);
  21. }
  22. // 详情
  23. public function detail(){
  24. $id = input('id/d',0);
  25. $ret = model('Approval')->info($id,$this->userId,$this->orgId);
  26. HelpHander::success($ret);
  27. }
  28. // 删除
  29. public function del(){
  30. $id = input('id/d',0);
  31. model('Approval')->del($id);
  32. HelpHander::success([],'操作成功');
  33. }
  34. // 修改状态
  35. public function changeStatus(){
  36. $id = input('id/d',0);
  37. $enable = input('enable/d',0);
  38. model('Approval')->changeStatus($id,$enable);
  39. HelpHander::success([],'操作成功');
  40. }
  41. // 获取用户
  42. public function queryApprovalCateList(){
  43. $ret = model('Approval')->queryApprovalCateList($this->userId,$this->orgId);
  44. HelpHander::success($ret);
  45. }
  46. // 自定义选择聚合接口
  47. public function customSelect(){
  48. $defaultApi = input('defaultApi/d',0);
  49. $lists = [];
  50. switch ($defaultApi){
  51. case 1: // 会议室
  52. $lists = model('MeetingRoom')->all($this->orgId);
  53. break;
  54. case 2: // 公司
  55. $lists = model('Company')->lists($this->orgId);
  56. break;
  57. case 3: // 项目
  58. $lists = model('Program')->allLists($this->orgId);
  59. break;
  60. case 4: // 印花税
  61. $lists = model('StampDuty')->allLists($this->orgId);
  62. break;
  63. case 5: // 车辆
  64. $lists = model('Car')->all($this->orgId);
  65. break;
  66. case 6: // 预算项目
  67. $list = model('Budget')->alllist($this->userId,$this->orgId);
  68. $lists = [];
  69. foreach ($list as $k=>$v){
  70. foreach ($v['items'] as $kk=>$vv){
  71. $lists[] = $vv;
  72. }
  73. }
  74. break;
  75. }
  76. HelpHander::success($lists);
  77. }
  78. }