162 lines
5.5 KiB
Objective-C
162 lines
5.5 KiB
Objective-C
//
|
|
// ShouYeLiShiJiLuPGTableViewController.m
|
|
// ProductApp
|
|
//
|
|
// Created by 工作 on 2024/9/26.
|
|
//
|
|
|
|
#import "ShouYeLiShiJiLuPGTableViewController.h"
|
|
#import "ShouYeLiShiJiLuPGTableViewCell.h"
|
|
#import "NetWorkManager.h"
|
|
|
|
@interface ShouYeLiShiJiLuPGTableViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetDelegate,DZNEmptyDataSetSource>
|
|
///
|
|
@property (nonatomic , strong) UITableView *tableView;
|
|
///
|
|
@property (nonatomic , strong) NSMutableArray *arrdata;
|
|
@end
|
|
|
|
@implementation ShouYeLiShiJiLuPGTableViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self.view setBackgroundColor:RGBCOLOR(242, 242, 242)];
|
|
|
|
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
|
[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
|
|
[tableView setBackgroundColor:[UIColor clearColor]];
|
|
[tableView setDelegate:self];
|
|
[tableView setDataSource:self];
|
|
[self.view addSubview:tableView];
|
|
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.view);
|
|
}];
|
|
_tableView = tableView;
|
|
[self.tableView setEmptyDataSetDelegate:self];
|
|
[self.tableView setEmptyDataSetSource:self];
|
|
[self getdata];
|
|
}
|
|
|
|
-(void)getdata
|
|
{
|
|
[LoadAlterView show];
|
|
if(self.type==1)
|
|
{
|
|
[NetWorkManager requestCorrectSaveHestoryData:self.view Callback:^(BOOL state, CorrectSaveModel *responseObject, NSString * _Nullable describle) {
|
|
[LoadAlterView dismiss];
|
|
if(state)
|
|
{
|
|
self.arrdata = [[NSMutableArray alloc] initWithArray:responseObject.data.items];
|
|
}
|
|
else
|
|
{
|
|
[HXHud showMessage:responseObject.message afterDelayType:1];
|
|
}
|
|
[self.tableView reloadData];
|
|
}];
|
|
}
|
|
else
|
|
{
|
|
[NetWorkManager requestPicAiSaveHestoryData:self.view Callback:^(BOOL state, CorrectSaveModel *responseObject, NSString * _Nullable describle) {
|
|
[LoadAlterView dismiss];
|
|
if(state)
|
|
{
|
|
self.arrdata = [[NSMutableArray alloc] initWithArray:responseObject.data.items];
|
|
}
|
|
else
|
|
{
|
|
[HXHud showMessage:responseObject.message afterDelayType:1];
|
|
}
|
|
[self.tableView reloadData];
|
|
}];
|
|
}
|
|
|
|
}
|
|
|
|
#pragma mark - Table view data source
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
|
{
|
|
return self.arrdata.count;
|
|
}
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
static NSString *strcell = @"ShouYeLiShiJiLuPGTableViewCell";
|
|
ShouYeLiShiJiLuPGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell];
|
|
if(!cell)
|
|
{
|
|
cell = [[ShouYeLiShiJiLuPGTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strcell];
|
|
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
|
[cell setBackgroundColor:[UIColor clearColor]];
|
|
}
|
|
cell.type = self.type;
|
|
cell.model = self.arrdata[indexPath.row];
|
|
[cell setBackValue:^(id _Nonnull model) {
|
|
[self.arrdata removeObject:model];
|
|
[self.tableView reloadData];
|
|
}];
|
|
return cell;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
|
{
|
|
return 10;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
|
{
|
|
return 10;
|
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
float fheight = (UISCREEN_WIDTH-96)/3.0+92;
|
|
if(self.type==2)fheight+=20;
|
|
return fheight;
|
|
}
|
|
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
|
{
|
|
return [UIView new];
|
|
}
|
|
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
|
|
{
|
|
return [UIView new];
|
|
}
|
|
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
|
|
}
|
|
#pragma mark - DZNEmptyDataSetSource
|
|
- (UIView *)customViewForEmptyDataSet:(UIScrollView *)scrollView
|
|
{
|
|
UIView *viewback = [[UIView alloc] init];
|
|
NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:viewback attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:UISCREEN_HEIGHT-NavHeight-50];
|
|
[viewback addConstraint:heightConstraint];
|
|
[viewback setBackgroundColor:[UIColor clearColor]];
|
|
[viewback setUserInteractionEnabled:YES];
|
|
|
|
NSString *strimg = @"fanwen_noinfo";
|
|
|
|
UIImageView *imgvback = [[UIImageView alloc] init];
|
|
[imgvback setImage:[UIImage imageNamed:strimg]];
|
|
[imgvback setContentMode:UIViewContentModeScaleAspectFit];
|
|
[viewback addSubview:imgvback];
|
|
[imgvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.offset(UISCREEN_WIDTH*0.6);
|
|
make.centerX.equalTo(viewback);
|
|
make.top.offset(50);
|
|
}];
|
|
|
|
NSString *str = @"暂无数据";
|
|
UILabel *lbname = [[UILabel alloc] init];
|
|
[lbname setText:str];
|
|
[lbname setTextColor:RGBCOLOR(51, 51, 51)];
|
|
[lbname setTextAlignment:NSTextAlignmentCenter];
|
|
[lbname setFont:[UIFont boldSystemFontOfSize:20]];
|
|
[viewback addSubview:lbname];
|
|
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(imgvback.mas_bottom).offset(20);
|
|
make.centerX.equalTo(viewback);
|
|
}];
|
|
|
|
return viewback;
|
|
}
|
|
|
|
@end
|