WorkRole.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\bug\model;
  3. use app\user\model\Headquarters;
  4. use think\model\concern\SoftDelete;
  5. class WorkRole extends Base
  6. {
  7. use SoftDelete;
  8. protected $schema = [
  9. 'id' =>'int',//
  10. 'role_name' =>'varchar',//角色名称
  11. 'companyNo' =>'varchar',//归属业务公司
  12. 'work_id' =>'int',//采购的功能模板
  13. 'belong' =>'tinyint',//系统归属1采销2结算3数据统计
  14. 'action' =>'text',//权限集合
  15. 'process' =>'text',//流程节点
  16. 'status' =>'tinyint',//状态
  17. 'apply_id' =>'int',//
  18. 'apply_name' =>'varchar',//创建人
  19. 'createTime' =>'datetime',//
  20. 'updateTime' =>'datetime',//
  21. 'delete_time' =>'datetime',//
  22. ];
  23. protected $updateTime='updateTime';
  24. protected $createTime='createTime';
  25. protected $deleteTime = 'delete_time';
  26. public function companyInfo(){
  27. return $this->belongsTo(Headquarters::class,"companyNo","code")->bind(["companyName"=>"name"]);
  28. }
  29. public function WorkInfo(){
  30. return $this->belongsTo(Work::class,"work_id","id")->bind(["work_name"]);
  31. }
  32. public function GetActionAttr($v){
  33. return json_decode($v,true);
  34. }
  35. public function SetActionAttr($v){
  36. return json_encode($v,JSON_UNESCAPED_UNICODE);
  37. }
  38. public function GetProcessAttr($v){
  39. return json_decode($v,true);
  40. }
  41. public function SetProcessAttr($v){
  42. return json_encode($v,JSON_UNESCAPED_UNICODE);
  43. }
  44. }