FireManage_VC.m 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. //
  2. // FireManage_VC.m
  3. // Haishenghai-master
  4. //
  5. // Created by GG on 2019/1/6.
  6. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
  7. //
  8. #import "FireManage_VC.h"
  9. #import "Header.h"
  10. @interface FireManage_VC ()<UITableViewDataSource,UITableViewDelegate>
  11. {
  12. UIButton *selectedBtn;
  13. UIButton *selectedBtn2;
  14. NSString *checkType;
  15. }
  16. @end
  17. @implementation FireManage_VC
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. // Do any additional setup after loading the view.
  21. self.view.backgroundColor =[UIColor whiteColor];
  22. self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:60/255.0 green:114/255.0 blue:255/255.0 alpha:1];
  23. [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
  24. UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  25. [backBtn setImage:[UIImage imageNamed:@"hsh_return"] forState:UIControlStateNormal];
  26. backBtn.frame = CGRectMake(0, 0, 44, 44);
  27. [backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  28. backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  29. self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
  30. [self setupUI];
  31. }
  32. -(void)backClick{
  33. [self.navigationController popViewControllerAnimated:YES];
  34. }
  35. -(void)setupUI{
  36. _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH,HEIGHT/2+50 ) style:UITableViewStylePlain];
  37. _tableView.delegate = self;
  38. _tableView.dataSource = self;
  39. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  40. _tableView.userInteractionEnabled = YES;
  41. _tableView.showsHorizontalScrollIndicator=NO;
  42. _tableView.scrollEnabled =NO;
  43. [self.view addSubview:_tableView];
  44. for (int i =0; i<3; i++) {
  45. UIButton *_FireTestBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  46. _FireTestBtn.frame = CGRectMake(20+(WIDTH-40)*(i/3), (HEIGHT/2+60)+(44+5)*(i%3), WIDTH-40, 44);
  47. _FireTestBtn.tag =i;
  48. _FireTestBtn.layer.cornerRadius = 18;
  49. if (_FireTestBtn.tag==0) {
  50. //记录状态
  51. _FireTestBtn.backgroundColor =[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
  52. // [_FireTestBtn setBackgroundImage:[UIImage imageNamed:@"blue"] forState:UIControlStateNormal];
  53. [_FireTestBtn setTitleColor:[UIColor whiteColor]forState:UIControlStateNormal];
  54. selectedBtn = _FireTestBtn;
  55. }else {
  56. _FireTestBtn.backgroundColor = [UIColor whiteColor];
  57. [_FireTestBtn setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]forState:UIControlStateNormal];
  58. }
  59. NSArray *titles = @[@"火警测试",@"火警误报",@"真实火警"];
  60. [_FireTestBtn setTitle:titles[i] forState:UIControlStateNormal];
  61. _FireTestBtn.titleLabel.font = [UIFont systemFontOfSize:18];
  62. _FireTestBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
  63. // self.loginButton.clipsToBounds = YES;
  64. [_FireTestBtn addTarget:self action:@selector(fireTestClick:) forControlEvents:UIControlEventTouchUpInside];
  65. [self.view addSubview:_FireTestBtn];
  66. }
  67. for (int i =0; i<2; i++) {
  68. UIButton *checkBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  69. checkBtn.frame = CGRectMake((WIDTH/2)*(i%2), (HEIGHT-44)+(44)*(i/2), WIDTH/2, 44);
  70. checkBtn.tag =i;
  71. if (checkBtn.tag==1) {
  72. [checkBtn setTitleColor:[UIColor whiteColor]forState:UIControlStateNormal];
  73. [checkBtn setBackgroundColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]];
  74. selectedBtn2 = checkBtn;
  75. }else {
  76. [checkBtn setBackgroundColor:[UIColor whiteColor]];
  77. [checkBtn setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]forState:UIControlStateNormal];
  78. }
  79. NSArray *titles = @[@"稍后处理",@"确认"];
  80. [checkBtn setTitle:titles[i] forState:UIControlStateNormal];
  81. checkBtn.titleLabel.font = [UIFont systemFontOfSize:18];
  82. checkBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
  83. // self.loginButton.clipsToBounds = YES;
  84. [checkBtn addTarget:self action:@selector(confirmClick:) forControlEvents:UIControlEventTouchUpInside];
  85. [self.view addSubview:checkBtn];
  86. }
  87. }
  88. #pragma mark-- tableviewDelegate
  89. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  90. return 7;
  91. }
  92. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  93. return 1;
  94. }
  95. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  96. return 44;
  97. }
  98. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  99. static NSString *cellId = @"cell";
  100. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  101. if (!cell) {
  102. cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
  103. }
  104. switch (indexPath.row) {
  105. case 0:
  106. {
  107. cell.textLabel.text = [NSString stringWithFormat:@"场所名称:%@",_siteName];
  108. break;
  109. }
  110. case 1:
  111. {
  112. cell.textLabel.text = [NSString stringWithFormat:@"设备类型:%@",_deviceType];
  113. break;
  114. }
  115. case 2:
  116. {
  117. cell.textLabel.text = [NSString stringWithFormat:@"安装位置:%@",_location];
  118. cell.textLabel.numberOfLines =0;
  119. cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
  120. break;
  121. }
  122. case 3:
  123. {
  124. cell.textLabel.text = [NSString stringWithFormat:@"CPU温度:%@",_CPuTemp];
  125. break;
  126. }
  127. case 4:
  128. {
  129. cell.textLabel.text = [NSString stringWithFormat:@"烟雾浓度:%@",_smokeCount];
  130. break;
  131. }
  132. case 5:
  133. {
  134. cell.textLabel.text = @"警情类型:火警";
  135. break;
  136. }
  137. case 6:
  138. {
  139. cell.textLabel.text = [NSString stringWithFormat:@"发生时间:%@",_inputTime];
  140. break;
  141. }
  142. default:
  143. break;
  144. }
  145. return cell;
  146. }
  147. #pragma mark-----Event
  148. -(void)fireTestClick:(UIButton *)fireBtn{
  149. checkType = [NSString stringWithFormat:@"%d",fireBtn.tag];
  150. if (selectedBtn ==fireBtn) {
  151. }else{
  152. fireBtn.backgroundColor = [UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
  153. // [fireBtn setBackgroundImage:[UIImage imageNamed:@"blue"] forState:UIControlStateNormal];
  154. [fireBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  155. selectedBtn.backgroundColor = [UIColor whiteColor];
  156. [selectedBtn setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1] forState:UIControlStateNormal];
  157. }
  158. selectedBtn = fireBtn;
  159. }
  160. -(void)confirmClick:(UIButton *)confirmBtn{
  161. if (selectedBtn2 ==confirmBtn) {
  162. }else{
  163. confirmBtn.backgroundColor =[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
  164. [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  165. selectedBtn2.backgroundColor = [UIColor whiteColor];
  166. [selectedBtn2 setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1] forState:UIControlStateNormal];
  167. [self.navigationController popViewControllerAnimated:YES];
  168. }
  169. selectedBtn2 = confirmBtn;
  170. if (confirmBtn.tag ==1) {
  171. //请求数据
  172. [DataSourceManager reCheckTroubleUrlWithProcessID:_processID RecheckType:checkType completionBlock:^(NSDictionary *dic) {
  173. [[NSNotificationCenter defaultCenter]postNotificationName:@"refreshData" object:nil];
  174. SubmitInformation_VC *subnit = [[SubmitInformation_VC alloc]init];
  175. subnit.navigationItem.title = @"信息上报";
  176. subnit.processID = _processID;
  177. [self.navigationController pushViewController:subnit animated:YES];
  178. }];
  179. }else{
  180. //稍后处理
  181. }
  182. }
  183. - (void)didReceiveMemoryWarning {
  184. [super didReceiveMemoryWarning];
  185. // Dispose of any resources that can be recreated.
  186. }
  187. /*
  188. #pragma mark - Navigation
  189. // In a storyboard-based application, you will often want to do a little preparation before navigation
  190. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  191. // Get the new view controller using [segue destinationViewController].
  192. // Pass the selected object to the new view controller.
  193. }
  194. */
  195. @end