repair_faultModel.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. class repair_faultClassModel extends Model
  3. {
  4. public $repair_type;
  5. public function initModel()
  6. {
  7. // $this->repair_type = $this->getType();
  8. }
  9. public function getType() {
  10. // $typePid = m("option")->getone("num='repair_type'", 'id');
  11. // $typeArr = m("option")->getall("pid=".$typePid['id']);
  12. //
  13. // for ($i = 0; $i < count($typeArr); $i++) {
  14. // $list = $typeArr[$i];
  15. // $arr[] = [
  16. // "name" => $list['name'],
  17. // "value" => $list['id'],
  18. // "subname" => $list['id'],
  19. // ];
  20. // }
  21. // return $arr;
  22. }
  23. public function typeList()
  24. {
  25. $listArr = m("repair_type")->getall("1=1");
  26. for ($i = 0; $i < count($listArr); $i++) {
  27. $list = $listArr[$i];
  28. $arr[] = [
  29. "name"=>$list['name'],
  30. "value"=>$list['id'],
  31. "subname"=>$list['dept']
  32. ];
  33. }
  34. return $arr ?? [["name"=>"第一个下拉框","value"=>"0"]];
  35. }
  36. }