| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- //
- // FireManage_VC.m
- // Haishenghai-master
- //
- // Created by GG on 2019/1/6.
- // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
- //
- #import "FireManage_VC.h"
- #import "Header.h"
- @interface FireManage_VC ()<UITableViewDataSource,UITableViewDelegate>
- {
- UIButton *selectedBtn;
- UIButton *selectedBtn2;
- NSString *checkType;
- }
- @end
- @implementation FireManage_VC
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.view.backgroundColor =[UIColor whiteColor];
- self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:60/255.0 green:114/255.0 blue:255/255.0 alpha:1];
- [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
- UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [backBtn setImage:[UIImage imageNamed:@"hsh_return"] forState:UIControlStateNormal];
- backBtn.frame = CGRectMake(0, 0, 44, 44);
- [backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
- backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
-
- [self setupUI];
- }
- -(void)backClick{
- [self.navigationController popViewControllerAnimated:YES];
- }
- -(void)setupUI{
- _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH,HEIGHT/2+50 ) style:UITableViewStylePlain];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
- _tableView.userInteractionEnabled = YES;
- _tableView.showsHorizontalScrollIndicator=NO;
- _tableView.scrollEnabled =NO;
- [self.view addSubview:_tableView];
-
- for (int i =0; i<3; i++) {
- UIButton *_FireTestBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _FireTestBtn.frame = CGRectMake(20+(WIDTH-40)*(i/3), (HEIGHT/2+60)+(44+5)*(i%3), WIDTH-40, 44);
- _FireTestBtn.tag =i;
- _FireTestBtn.layer.cornerRadius = 18;
- if (_FireTestBtn.tag==0) {
- //记录状态
- _FireTestBtn.backgroundColor =[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
- // [_FireTestBtn setBackgroundImage:[UIImage imageNamed:@"blue"] forState:UIControlStateNormal];
- [_FireTestBtn setTitleColor:[UIColor whiteColor]forState:UIControlStateNormal];
- selectedBtn = _FireTestBtn;
- }else {
- _FireTestBtn.backgroundColor = [UIColor whiteColor];
- [_FireTestBtn setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]forState:UIControlStateNormal];
- }
-
- NSArray *titles = @[@"火警测试",@"火警误报",@"真实火警"];
- [_FireTestBtn setTitle:titles[i] forState:UIControlStateNormal];
- _FireTestBtn.titleLabel.font = [UIFont systemFontOfSize:18];
- _FireTestBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
- // self.loginButton.clipsToBounds = YES;
- [_FireTestBtn addTarget:self action:@selector(fireTestClick:) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:_FireTestBtn];
- }
- for (int i =0; i<2; i++) {
- UIButton *checkBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- checkBtn.frame = CGRectMake((WIDTH/2)*(i%2), (HEIGHT-44)+(44)*(i/2), WIDTH/2, 44);
- checkBtn.tag =i;
- if (checkBtn.tag==1) {
- [checkBtn setTitleColor:[UIColor whiteColor]forState:UIControlStateNormal];
- [checkBtn setBackgroundColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]];
- selectedBtn2 = checkBtn;
- }else {
- [checkBtn setBackgroundColor:[UIColor whiteColor]];
- [checkBtn setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]forState:UIControlStateNormal];
- }
-
- NSArray *titles = @[@"稍后处理",@"确认"];
- [checkBtn setTitle:titles[i] forState:UIControlStateNormal];
-
- checkBtn.titleLabel.font = [UIFont systemFontOfSize:18];
- checkBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
- // self.loginButton.clipsToBounds = YES;
- [checkBtn addTarget:self action:@selector(confirmClick:) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:checkBtn];
- }
- }
- #pragma mark-- tableviewDelegate
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return 7;
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 44;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- static NSString *cellId = @"cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
- if (!cell) {
- cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
- }
- switch (indexPath.row) {
- case 0:
- {
- cell.textLabel.text = [NSString stringWithFormat:@"场所名称:%@",_siteName];
- break;
- }
- case 1:
- {
- cell.textLabel.text = [NSString stringWithFormat:@"设备类型:%@",_deviceType];
-
- break;
- }
- case 2:
- {
- cell.textLabel.text = [NSString stringWithFormat:@"安装位置:%@",_location];
- cell.textLabel.numberOfLines =0;
- cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
- break;
- }
- case 3:
- {
- cell.textLabel.text = [NSString stringWithFormat:@"CPU温度:%@",_CPuTemp];
- break;
- }
- case 4:
- {
- cell.textLabel.text = [NSString stringWithFormat:@"烟雾浓度:%@",_smokeCount];
-
- break;
- }
- case 5:
- {
- cell.textLabel.text = @"警情类型:火警";
-
- break;
- }
- case 6:
- {
- cell.textLabel.text = [NSString stringWithFormat:@"发生时间:%@",_inputTime];
- break;
- }
- default:
- break;
- }
- return cell;
- }
- #pragma mark-----Event
- -(void)fireTestClick:(UIButton *)fireBtn{
- checkType = [NSString stringWithFormat:@"%d",fireBtn.tag];
- if (selectedBtn ==fireBtn) {
-
- }else{
- fireBtn.backgroundColor = [UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
- // [fireBtn setBackgroundImage:[UIImage imageNamed:@"blue"] forState:UIControlStateNormal];
- [fireBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- selectedBtn.backgroundColor = [UIColor whiteColor];
- [selectedBtn setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1] forState:UIControlStateNormal];
- }
- selectedBtn = fireBtn;
- }
- -(void)confirmClick:(UIButton *)confirmBtn{
- if (selectedBtn2 ==confirmBtn) {
-
- }else{
-
- confirmBtn.backgroundColor =[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
- [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- selectedBtn2.backgroundColor = [UIColor whiteColor];
- [selectedBtn2 setTitleColor:[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1] forState:UIControlStateNormal];
- [self.navigationController popViewControllerAnimated:YES];
- }
- selectedBtn2 = confirmBtn;
- if (confirmBtn.tag ==1) {
- //请求数据
- [DataSourceManager reCheckTroubleUrlWithProcessID:_processID RecheckType:checkType completionBlock:^(NSDictionary *dic) {
-
- [[NSNotificationCenter defaultCenter]postNotificationName:@"refreshData" object:nil];
- SubmitInformation_VC *subnit = [[SubmitInformation_VC alloc]init];
- subnit.navigationItem.title = @"信息上报";
- subnit.processID = _processID;
- [self.navigationController pushViewController:subnit animated:YES];
- }];
-
-
- }else{
- //稍后处理
- }
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|