Flow.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace app\synth\controller;
  3. use app\common\model\User;
  4. use library\Controller;
  5. use think\Db;
  6. /**
  7. * 流程设置
  8. * Class Flow
  9. * @package app\synth\controller
  10. */
  11. class Flow extends Controller
  12. {
  13. /**
  14. * 绑定数据表
  15. * @var string
  16. */
  17. protected $table = 'ApproveFlow';
  18. /**
  19. * 流程列表
  20. * @auth true
  21. * @menu true
  22. * @throws \think\Exception
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\ModelNotFoundException
  25. * @throws \think\exception\DbException
  26. * @throws \think\exception\PDOException
  27. */
  28. public function index()
  29. {
  30. $this->title = '管理';
  31. $sel_type = input('sel_type');
  32. $module = input('module',1);
  33. $this->module = input('module',1);
  34. $query = $this->_query($this->table)
  35. ->alias('f')
  36. ->field('f.*,u.name,u.headimg')
  37. ->leftJoin('store_member u','u.id = f.user_id')
  38. ->order('sort asc,id desc')
  39. ->where('is_deleted',0)
  40. ->where('module',$module)
  41. ->when($sel_type,function ($query)use ($sel_type){
  42. if($sel_type) $query->where('type',$sel_type);
  43. })->page(false);
  44. }
  45. /**
  46. * 数据列表处理
  47. * @auth true
  48. * @menu true
  49. * @param array $data
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\ModelNotFoundException
  52. * @throws \think\exception\DbException
  53. */
  54. protected function _index_page_filter(&$data)
  55. {
  56. foreach ($data as $k=>&$v){
  57. }
  58. }
  59. /**
  60. * 删除
  61. * @auth true
  62. * @menu true
  63. * @param array $data
  64. * @throws \think\db\exception\DataNotFoundException
  65. * @throws \think\db\exception\ModelNotFoundException
  66. * @throws \think\exception\DbException
  67. */
  68. public function remove()
  69. {
  70. $this->_delete($this->table);
  71. }
  72. /**
  73. * 添加
  74. * @auth true
  75. * @menu true
  76. * @param array $data
  77. * @throws \think\db\exception\DataNotFoundException
  78. * @throws \think\db\exception\ModelNotFoundException
  79. * @throws \think\exception\DbException
  80. */
  81. public function add(){
  82. $this->title = '添加';
  83. $this->_form($this->table, 'form');
  84. }
  85. /**
  86. *
  87. * 编辑
  88. * @auth true
  89. * @menu true
  90. * @param array $data
  91. * @throws \think\db\exception\DataNotFoundException
  92. * @throws \think\db\exception\ModelNotFoundException
  93. * @throws \think\exception\DbException
  94. */
  95. public function edit()
  96. {
  97. $this->title = '编辑';
  98. $this->_form($this->table, 'form');
  99. }
  100. /**
  101. *
  102. * 数据处理
  103. * @auth true
  104. * @menu true
  105. * @param array $data
  106. * @throws \think\db\exception\DataNotFoundException
  107. * @throws \think\db\exception\ModelNotFoundException
  108. * @throws \think\exception\DbException
  109. */
  110. protected function _form_filter(&$data)
  111. {
  112. if($this->request->isGet()) {
  113. $this->all_user = User::where('is_deleted',0)->column('name','id');
  114. }
  115. if($this->request->isPost() && $this->request->action() == 'edit')unset($data['module']);
  116. }
  117. }