12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160 |
- //
- // VersionDataVC.m
- // smartRhino
- //
- // Created by tederen on 2019/11/28.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "VersionDataVC.h"
- #import "UILabel+RightAndLeft.h"
- #import "DepartureController.h"
- #import "NoteBookShareVC.h"
- @interface VersionDataVC ()<NoteBookShareVCDelegate>
- @property (weak, nonatomic) IBOutlet UILabel *yearMonthDaylabel;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- #pragma mark - 财务数据 属性
- #pragma mark - 收入
- @property (weak, nonatomic) IBOutlet UIView *incomeHeader;
- @property (weak, nonatomic) IBOutlet UILabel *incomKeyLabel;
- @property (weak, nonatomic) IBOutlet UILabel *incomValueLabel;
- @property (weak, nonatomic) IBOutlet UILabel *incomeScaleKeyLabel;
- @property (weak, nonatomic) IBOutlet UILabel *incomeScaleValueLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *incomeScaleValueImage;
- @property (weak, nonatomic) IBOutlet UIView *incomeTableView;
- @property (weak, nonatomic) IBOutlet UIButton *incomeDayBtn;
- @property (weak, nonatomic) IBOutlet UIButton *incomeWeekBtn;
- @property (weak, nonatomic) IBOutlet UIButton *incomeMonthBtn;
- @property (weak, nonatomic) IBOutlet UIButton *incomeYearBtn;
- @property (nonatomic, strong) WKEchartsView *incomeEchartsView;
- #pragma mark - 支出
- @property (weak, nonatomic) IBOutlet UIView *expensesHeader;
- @property (weak, nonatomic) IBOutlet UILabel *expensesKeyLabel;
- @property (weak, nonatomic) IBOutlet UILabel *expensesValueLabel;
- @property (weak, nonatomic) IBOutlet UILabel *expensesScaleKeyLabel;
- @property (weak, nonatomic) IBOutlet UILabel *expensesScaleValueLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *expensesScaleValueImage;
- @property (weak, nonatomic) IBOutlet UIView *expensesTableView;
- @property (weak, nonatomic) IBOutlet UIButton *expensesDayBtn;
- @property (weak, nonatomic) IBOutlet UIButton *expensesWeekBtn;
- @property (weak, nonatomic) IBOutlet UIButton *expensesMonthBtn;
- @property (weak, nonatomic) IBOutlet UIButton *expensesYearBtn;
- @property (nonatomic, strong) WKEchartsView *expensesEchartsView;
- #pragma mark - 利润
- @property (weak, nonatomic) IBOutlet UIView *profitHeader;
- @property (weak, nonatomic) IBOutlet UILabel *profitKeyLabel;
- @property (weak, nonatomic) IBOutlet UILabel *profitValueLabel;
- @property (weak, nonatomic) IBOutlet UILabel *profitScaleKeyLabel;
- @property (weak, nonatomic) IBOutlet UILabel *profitScaleValueLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *profitScaleValueImage;
- @property (weak, nonatomic) IBOutlet UIView *profitTableView;
- @property (weak, nonatomic) IBOutlet UIButton *profitDayBtn;
- @property (weak, nonatomic) IBOutlet UIButton *profitWeekBtn;
- @property (weak, nonatomic) IBOutlet UIButton *profitMonthBtn;
- @property (weak, nonatomic) IBOutlet UIButton *profitYearBtn;
- @property (nonatomic, strong) WKEchartsView *profitEchartsView;
- @property (nonatomic, strong) VersionDataModel *incomeModel;
- @property (nonatomic, strong) VersionDataModel *expensesModel;
- @property (nonatomic, strong) VersionDataModel *profitModel;
- #pragma mark - 出版数据 属性
- /// 出版
- /// 本年累计出版册数
- @property (weak, nonatomic) IBOutlet UILabel *yearVersionNumberLabel;
- /// 本年累计印费
- @property (weak, nonatomic) IBOutlet UILabel *yearPrintNuberLabel;
- /// 月出版种类
- @property (weak, nonatomic) IBOutlet UILabel *monthVersionKindLabel;
- /// 月出版数量
- @property (weak, nonatomic) IBOutlet UILabel *monthVerionNumberLabel;
- /// 月印费
- @property (weak, nonatomic) IBOutlet UILabel *monthPrintNumberlael;
- @property (weak, nonatomic) IBOutlet UILabel *monthMoneyScaleLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *monthPrintScaleImageView;
- /// 发行
- @property (weak, nonatomic) IBOutlet UILabel *pubilshMonthLabel;
- @property (weak, nonatomic) IBOutlet UILabel *publisScaleLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *publisScaleImageView;
- /// 库存
- @property (weak, nonatomic) IBOutlet UILabel *storeLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *storeScaleImageView;
- #pragma mark - 人事数据 属性
- ///人员工资总额
- @property (weak, nonatomic) IBOutlet UILabel *allPersonMoneyLabel;
- /// 人员工资上月同比
- @property (weak, nonatomic) IBOutlet UILabel *allPersonScaleValueLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *allPersonScaleImageView;
- /// 入职人员工资
- @property (weak, nonatomic) IBOutlet UILabel *addPersonMoneyLabel;
- /// 入职人员工资上月同比
- @property (weak, nonatomic) IBOutlet UILabel *addPersonScaleValueLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *addPersonScaleImageView;
- /// 离职人员工资
- @property (weak, nonatomic) IBOutlet UILabel *movePersonLabel;
- @property (weak, nonatomic) IBOutlet UIView *movePersonView;
- @property (nonatomic, assign) NSInteger netFlag;
- @end
- @implementation VersionDataVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.view addSubview:self.noteBookShareVC.view];
- self.fd_prefersNavigationBarHidden = YES;
- self.netFlag = 1;
- [self getData];
- [self setingUI];
- self.movePersonView.hidden = YES;
- }
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
-
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
- }
- - (UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleLightContent;
- }
- #pragma mark - 查看离职人员详情
- - (IBAction)movePersonHander:(UIButton *)sender {
- DepartureController *departureController = [[DepartureController alloc] init];
- [self.navigationController pushViewController:departureController animated:YES];
- }
- - (IBAction)backButton:(UIButton *)sender {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (IBAction)sencondBackButton:(UIButton *)sender {
- [super menuAction:sender];
- }
- #pragma mark - 保存数据
- - (IBAction)versionDownLoadHander:(UIButton *)sender {
- [self shareHander];
- }
- /// 转发正文
- - (void)shareHander{
- [self.noteBookShareVC initNoteBookShareData];
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
-
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
-
- }else if ([typeName isEqualToString:@"发到微博"]){
-
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
-
- }else if ([typeName isEqualToString:@"发到消息"]){
-
- }else if ([typeName isEqualToString:@"发到小组"]){
-
- }else if ([typeName isEqualToString:@"发到笔记"]){
-
- }else if ([typeName isEqualToString:@"发到话题"]){
-
- }else{
-
- }
- }
- #pragma mark - 收入 点击事件
- - (IBAction)incomeHander:(UIButton *)sender {
- NSInteger date = 0;
- if ([[sender titleLabel].text isEqualToString:@"日"]) {
- self.incomeDayBtn.selected = YES;
- self.incomeWeekBtn.selected = NO;
- self.incomeMonthBtn.selected = NO;
- self.incomeYearBtn.selected = NO;
- date = 1;
- }
- if ([[sender titleLabel].text isEqualToString:@"周"]) {
- self.incomeDayBtn.selected = NO;
- self.incomeWeekBtn.selected = YES;
- self.incomeMonthBtn.selected = NO;
- self.incomeYearBtn.selected = NO;
- date = 2;
-
- }
- if ([[sender titleLabel].text isEqualToString:@"月"]) {
- self.incomeDayBtn.selected = NO;
- self.incomeWeekBtn.selected = NO;
- self.incomeMonthBtn.selected = YES;
- self.incomeYearBtn.selected = NO;
- date = 3;
-
- }
- if ([[sender titleLabel].text isEqualToString:@"年"]) {
- self.incomeDayBtn.selected = NO;
- self.incomeWeekBtn.selected = NO;
- self.incomeMonthBtn.selected = NO;
- self.incomeYearBtn.selected = YES;
- date = 4;
-
- }
- SHOWLOADING
- switch (self.pageType) {
- case 1:{
- [VersionDataVC getDataWithDataType:2 withDateType:date success:^(id _Nonnull responseObject) {
- self.incomeModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"收入%@",self.incomeModel);
- REMOVESHOW
- [self updateIncomeView:self.incomeModel];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
-
- }];
- }break;
- case 2:{
- [VersionDataVC getDataWithVersisonType:1 withDateType:date success:^(id _Nonnull responseObject) {
- self.incomeModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"收入%@",self.incomeModel);
- REMOVESHOW
- [self updateIncomeView:self.incomeModel];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }break;
- case 3:{
- [VersionDataVC getDataWithHumanType:1 withDateType:date success:^(id _Nonnull responseObject) {
-
- self.incomeModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
-
- NSLog(@"人事%@",self.incomeModel);
-
- REMOVESHOW
-
- [self updateIncomeView:self.incomeModel];
-
- } failure:^(NSError * _Nonnull error) {
-
- SHOWERROR([ZYCTool handerResultData:error])
-
- }];
- }break;
- default:
- break;
- }
-
-
- }
- #pragma mark - 支出 点击事件
- - (IBAction)expensesHander:(UIButton *)sender {
- NSInteger date = 0;
- if ([[sender titleLabel].text isEqualToString:@"日"]) {
-
- self.expensesDayBtn.selected = YES;
- self.expensesWeekBtn.selected = NO;
- self.expensesMonthBtn.selected = NO;
- self.expensesYearBtn.selected = NO;
- date = 1;
- }
- if ([[sender titleLabel].text isEqualToString:@"周"]) {
- self.expensesDayBtn.selected = NO;
- self.expensesWeekBtn.selected = YES;
- self.expensesMonthBtn.selected = NO;
- self.expensesYearBtn.selected = NO;
- date = 2;
- }
- if ([[sender titleLabel].text isEqualToString:@"月"]) {
-
- self.expensesDayBtn.selected = NO;
- self.expensesWeekBtn.selected = NO;
- self.expensesMonthBtn.selected = YES;
- self.expensesYearBtn.selected = NO;
- date = 3;
- }
- if ([[sender titleLabel].text isEqualToString:@"年"]) {
- self.expensesDayBtn.selected = NO;
- self.expensesWeekBtn.selected = NO;
- self.expensesMonthBtn.selected = NO;
- self.expensesYearBtn.selected = YES;
- date = 4;
- }
- SHOWLOADING
- switch (self.pageType) {
- case 2:
- {
- [VersionDataVC getDataWithDataType:2 withDateType:date success:^(id _Nonnull responseObject) {
- self.expensesModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"支出%@",self.expensesModel);
- REMOVESHOW
- [self updateExpensesView:self.expensesModel];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
-
- }];
- }break;
- case 1:{
- [VersionDataVC getDataWithPublishType:2 withDateType:date success:^(id _Nonnull responseObject) {
-
- self.expensesModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
-
- NSLog(@"支出%@",self.expensesModel);
- REMOVESHOW
- [self updateExpensesView:self.expensesModel];
-
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }break;
- case 3:{
- [VersionDataVC getDataWithHumanType:2 withDateType:date success:^(id _Nonnull responseObject) {
-
- self.expensesModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
-
- NSLog(@"人事 入职数据%@",self.expensesModel);
-
- REMOVESHOW
-
- [self updateExpensesView:self.expensesModel];
-
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
-
- }];
- }break;
- default:
- break;
- }
-
- }
- #pragma mark - 利润 点击事件
- - (IBAction)profitHander:(UIButton *)sender {
- NSInteger date = 0;
- if ([[sender titleLabel].text isEqualToString:@"日"]) {
- self.profitDayBtn.selected = YES;
- self.profitWeekBtn.selected = NO;
- self.profitMonthBtn.selected = NO;
- self.profitYearBtn.selected = NO;
- date = 1;
- }
- if ([[sender titleLabel].text isEqualToString:@"周"]) {
- self.profitDayBtn.selected = NO;
- self.profitWeekBtn.selected = YES;
- self.profitMonthBtn.selected = NO;
- self.profitYearBtn.selected = NO;
- date = 2;
- }
- if ([[sender titleLabel].text isEqualToString:@"月"]) {
- self.profitDayBtn.selected = NO;
- self.profitWeekBtn.selected = NO;
- self.profitMonthBtn.selected = YES;
- self.profitYearBtn.selected = NO;
- date = 3;
- }
- if ([[sender titleLabel].text isEqualToString:@"年"]) {
- self.profitDayBtn.selected = NO;
- self.profitWeekBtn.selected = NO;
- self.profitMonthBtn.selected = NO;
- self.profitYearBtn.selected = YES;
- date = 4;
- }
- switch (self.pageType) {
- case 1:{
- SHOWLOADING
- [VersionDataVC getDataWithDataType:3 withDateType:date success:^(id _Nonnull responseObject) {
- self.profitModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"利润%@",self.profitModel);
- REMOVESHOW
- [self updateProfitView:self.profitModel];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }break;
- case 2:{
- [VersionDataVC getDataWithStoreType:3 withDateType:date success:^(id _Nonnull responseObject) {
- self.profitModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"库存%@",self.profitModel);
- REMOVESHOW
- [self updateProfitView:self.profitModel];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }break;
- case 3:{
- [VersionDataVC getDataWithHumanType:3 withDateType:date success:^(id _Nonnull responseObject) {
- self.profitModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"人事数据离职%@",self.profitModel);
-
- REMOVESHOW
- [self updateProfitView:self.profitModel];
- } failure:^(NSError * _Nonnull error) {
-
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }break;
- default:
- break;
- }
- }
- #pragma mark - init
- +(VersionDataVC *)initVersionDataVC{
- VersionDataVC *controller = [StoryboardManager.shared.verisonData instantiateViewControllerWithIdentifier:@"VersionData"];
- return controller;
- }
- +(VersionDataVC *)initVersionData2VC{
- VersionDataVC *controller = [StoryboardManager.shared.verisonData instantiateViewControllerWithIdentifier:@"VersionData2"];
- return controller;}
- +(VersionDataVC *)initVersionData3VC{
- VersionDataVC *controller = [StoryboardManager.shared.verisonData instantiateViewControllerWithIdentifier:@"VersionData3"];
- return controller;
-
- }
- #pragma mark - seting UI
- - (void)setingUI{
-
- self.yearMonthDaylabel.text = [ZYCTool getYearAndMonthAndDay];
-
- [self setConrerWith:self.incomeHeader];
- [self setConrerWith:self.expensesHeader];
- [self setConrerWith:self.profitHeader];
-
- self.incomeEchartsView = [self createEchartsView:self.incomeEchartsView withSuperView:self.incomeTableView];
-
- self.expensesEchartsView = [self createEchartsView:self.expensesEchartsView withSuperView:self.expensesTableView];
-
- self.profitEchartsView = [self createEchartsView:self.profitEchartsView withSuperView:self.profitTableView];
- switch (self.pageType) {
- case 1:{
- // 设置收入
- [self.incomKeyLabel textAlignmentLeftAndRight];
- [self.incomeScaleKeyLabel textAlignmentLeftAndRight];
-
- // 设置支出
-
- [self.expensesKeyLabel textAlignmentLeftAndRight];
- [self.expensesScaleKeyLabel textAlignmentLeftAndRight];
-
- // 设置收入
-
- [self.profitKeyLabel textAlignmentLeftAndRight];
- [self.profitScaleKeyLabel textAlignmentLeftAndRight];
-
-
-
- }break;
- case 2:{
-
-
- }break;
- case 3:{
-
-
- }break;
- default:
- break;
- }
-
-
- }
- #pragma mark - 设置圆角
- - (UIView *)setConrerWith:(UIView *)view{
- view.layer.cornerRadius = 2.5;
- view.layer.masksToBounds = YES;
- view.layer.borderColor = UIColorHex(#7FE8E3).CGColor;
- view.layer.borderWidth = 2;
- return view;
- }
- - (WKEchartsView *)createEchartsView:(WKEchartsView *)echartsView withSuperView:(UIView *)superView{
-
- echartsView = [[WKEchartsView alloc] initWithFrame:superView.bounds];
-
- [superView addSubview:echartsView];
-
- [echartsView addHandlerForAction:PYEchartActionClick withBlock:^(NSDictionary *params) {
- NSLog(@"The params from Echarts:\n%@", params);
- }];
- NSArray *xArray = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7"];
- NSArray *yArray =@[@100,@500,@180,@1200,@900,@1400,@700];
- [echartsView setOption:[VersionDataVC addOptionxArray:xArray withYArray:yArray]];
- [echartsView loadEcharts];
- return echartsView;
-
- }
- #pragma mark - 根据网络数据 刷新视图
- - (void)updateIncomeView:(VersionDataModel *)model{
- NSMutableArray *xArray = [NSMutableArray array];
- NSMutableArray *yArray = [NSMutableArray array];
- for (VersionDataSub *tempModel in model.HumanAffairsChartDataResult) {
- [xArray addObject:[NSString stringWithFormat:@"%ld",(long)tempModel.NavigationNumber]];
- [yArray addObject:@(tempModel.ResultParameter)];
- }
- [self.incomeEchartsView setOption:[VersionDataVC addOptionxArray:xArray withYArray:yArray]];
- [self.incomeEchartsView loadEcharts];
- switch (self.pageType) {
- case 1:{
- if (model.ToDayIncome == 0) {
- self.incomValueLabel.text = @"--";
- }else{
- self.incomValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ToDayIncome];
- }
- if (model.ComparedMonthAmount == 0) {
- self.incomeScaleValueLabel.text = @"--";
- self.incomeScaleValueImage.hidden = YES;
- }
- else if (model.ComparedMonthAmount > 0){
-
- self.incomeScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- self.incomeScaleValueImage.hidden = NO;
- }
- else{
- self.incomeScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- self.incomeScaleValueImage.hidden = YES;
- }
- }break;
- case 2:{
- if (model.YearPressAmount == 0) {
- self.incomValueLabel.text = @"--";
- }else{
- self.incomValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.YearPressAmount];
- }
-
- if (model.YearPrintCount == 0) {
- self.yearVersionNumberLabel.text = @"--";
- }else{
- self.yearVersionNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.YearPrintCount];
- }
-
- if (model.YearPressAmount == 0) {
- self.yearPrintNuberLabel.text = @"--";
- }else{
- self.yearPrintNuberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.YearPressAmount];
- }
-
-
- if (model.MonthPressAmount == 0) {
- self.monthPrintNumberlael.text = @"--";
- }else{
- self.monthPrintNumberlael.text = [NSString stringWithFormat:@"%ld",(long)model.MonthPressAmount];
- }
-
- if (model.MonthPrintCount == 0) {
- self.monthVerionNumberLabel.text = @"--";
- }else{
- self.monthVerionNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.MonthPrintCount];
-
- }
- if (model.ComparedMonthCount == 0) {
-
- self.monthMoneyScaleLabel.text = @"--";
- self.monthPrintScaleImageView.hidden = YES;
-
- }else{
-
- self.monthMoneyScaleLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthCount];
- if (model.ComparedMonthCount > 0) {
- self.monthPrintScaleImageView.hidden = NO;
- }else{
- self.monthPrintScaleImageView.hidden = YES;
- }
-
- }
-
- if (model.ComparedMonthAmount == 0) {
- self.incomeScaleValueLabel.text = @"--";
- self.incomeScaleValueImage.hidden = YES;
- }else{
- self.incomeScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- if (model.ComparedMonthAmount > 0) {
- self.incomeScaleValueImage.hidden = NO;
- }else{
- self.incomeScaleValueImage.hidden = YES;
- }
- }
- if (model.MonthPrintAmount == 0) {
- self.monthVersionKindLabel.text = @"--";
- }else{
- self.monthVersionKindLabel.text = [NSString stringWithFormat:@"%ld",(long)model.MonthPrintAmount];
- }
-
-
-
- }break;
- case 3:{
- if(model.PersonCount == 0){
-
- self.incomValueLabel.text = @"--";
-
- }else{
-
- self.incomValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.PersonCount];
-
- }
- if(model.Salary == 0){
-
- self.allPersonMoneyLabel.text = @"--";
-
- }else{
-
- self.allPersonMoneyLabel.text = [NSString stringWithFormat:@"%ld",(long)model.Salary];
-
- }
- if(model.ComparedMonthAmount == 0){
-
- self.allPersonScaleValueLabel.text = @"--";
- self.allPersonScaleImageView.hidden = YES;
- }else{
-
- self.allPersonScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- if (model.ComparedMonthAmount > 0) {
- self.allPersonScaleImageView.hidden = NO;
- }else{
- self.allPersonScaleImageView.hidden = YES;
- }
-
- }
- if(model.ComparedMonthCount == 0){
-
- self.incomeScaleValueLabel.text = @"--";
- self.incomeScaleValueImage.hidden = YES;
- }else{
-
- self.incomeScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.PersonCount];
- if (model.ComparedMonthCount > 0) {
- self.incomeScaleValueImage.hidden = NO;
- }else{
- self.incomeScaleValueImage.hidden = YES;
- }
- }
-
- }break;
- default:
- break;
- }
-
-
-
-
-
-
-
- }
- - (void)updateExpensesView:(VersionDataModel *)model{
- NSMutableArray *xArray = [NSMutableArray array];
- NSMutableArray *yArray = [NSMutableArray array];
- for (VersionDataSub *tempModel in model.HumanAffairsChartDataResult) {
- [xArray addObject:[NSString stringWithFormat:@"%ld",(long)tempModel.NavigationNumber]];
- [yArray addObject:@(tempModel.ResultParameter)];
- }
- [self.expensesEchartsView setOption:[VersionDataVC addOptionxArray:xArray withYArray:yArray]];
- [self.expensesEchartsView loadEcharts];
- switch (self.pageType) {
- case 1:
- {
- if (model.ToDayIncome == 0) {
- self.expensesValueLabel.text = @"--";;
- }else{
- self.expensesValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ToDayIncome];
- }
- if (model.ComparedMonthAmount == 0) {
- self.expensesScaleValueLabel.text = @"--";
- self.expensesScaleValueImage.hidden = YES;
- }
- else if (model.ComparedMonthAmount > 0){
-
- self.expensesScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- self.expensesScaleValueImage.hidden = NO;
- }
- else{
- self.expensesScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- self.expensesScaleValueImage.hidden = YES;
- }
- }break;
- case 2:{
- if (model.MonthSellCount == 0) {
-
- self.expensesValueLabel.text = @"--";;
-
- }else{
-
- self.expensesValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.MonthSellCount];
-
- }
- if (model.MonthSellAmount == 0) {
-
- self.pubilshMonthLabel.text = @"--";;
-
- }else{
-
- self.pubilshMonthLabel.text = [NSString stringWithFormat:@"%ld",(long)model.MonthSellAmount];
-
- }
- if (model.ComparedMonthAmount == 0) {
-
- self.publisScaleLabel.text = @"--";;
- self.publisScaleImageView.hidden = YES;
- }else{
-
- self.publisScaleLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- if(model.ComparedMonthAmount > 0){
- self.publisScaleImageView.hidden = NO;
- }else{
- self.publisScaleImageView.hidden = YES;
- }
- }
- if (model.ComparedMonthCount == 0) {
-
- self.expensesScaleValueLabel.text = @"--";;
- self.expensesScaleValueImage.hidden = YES;
- }else{
-
- self.expensesScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- if (model.ComparedMonthCount == 0) {
- self.expensesScaleValueImage.hidden = NO;
- }else{
- self.expensesScaleValueImage.hidden = YES;
- }
- }
- }break;
- case 3:{
- if (model.PersonCount == 0) {
-
-
- self.expensesValueLabel.text = @"--";;
-
-
- }else{
- self.expensesValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.PersonCount];
- }
- if (model.Salary == 0) {
-
-
- self.addPersonMoneyLabel.text = @"--";;
-
-
- }else{
- self.addPersonMoneyLabel.text = [NSString stringWithFormat:@"%ld",(long)model.Salary];
- }
- if (model.ComparedMonthCount == 0) {
-
-
- self.expensesScaleValueLabel.text = @"--";;
- self.expensesScaleValueImage.hidden = YES;
-
- }else{
- self.expensesScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthCount];
- if (model.ComparedMonthCount > 0) {
- self.expensesScaleValueImage.hidden = NO;
- }else{
- self.expensesScaleValueImage.hidden = YES;
- }
- }
- if (model.ComparedMonthAmount == 0) {
-
- self.addPersonScaleImageView.hidden = YES;
- self.addPersonScaleValueLabel.text = @"--";;
-
-
- }else{
- self.addPersonScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- if (model.ComparedMonthAmount > 0) {
- self.addPersonScaleImageView.hidden = NO;
- }else{
- self.addPersonScaleImageView.hidden = YES;
- }
- }
- }break;
-
- default:
- break;
- }
- }
- - (void)updateProfitView:(VersionDataModel *)model{
- NSMutableArray *xArray = [NSMutableArray array];
- NSMutableArray *yArray = [NSMutableArray array];
- for (VersionDataSub *tempModel in model.HumanAffairsChartDataResult) {
- [xArray addObject:[NSString stringWithFormat:@"%ld",(long)tempModel.NavigationNumber]];
- [yArray addObject:@(tempModel.ResultParameter)];
- }
- [self.profitEchartsView setOption:[VersionDataVC addOptionxArray:xArray withYArray:yArray]];
- [self.profitEchartsView loadEcharts];
- switch (self.pageType) {
- case 1:
- {
- if (model.ToDayIncome == 0) {
- self.profitValueLabel.text = @"--";
- }else{
- self.profitValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ToDayIncome];
- }
- if (model.ComparedMonthAmount == 0) {
- self.profitScaleValueLabel.text = @"--";
- self.profitScaleValueImage.hidden = YES;
- }
- else if (model.ComparedMonthAmount > 0){
-
- self.profitScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- self.profitScaleValueImage.hidden = NO;
- }
- else{
- self.profitScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthAmount];
- self.profitScaleValueImage.hidden = YES;
- }
- }break;
- case 2:{
- if (model.StorehouseAllCount == 0) {
- self.profitValueLabel.text = @"--";
- }else{
- self.profitValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.StorehouseAllCount];
- }
- if (model.Monthcount == 0) {
- self.profitScaleValueLabel.text = @"--";
- self.profitScaleValueImage.hidden = YES;
- }else{
- self.profitScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.Monthcount];
- if (model.Monthcount > 0) {
- self.profitScaleValueImage.hidden = NO;
- }else{
- self.profitScaleValueImage.hidden = YES;
- }
- }
- if (model.ComparedMonthCount == 0) {
- self.storeLabel.text = @"--";
- self.storeScaleImageView.hidden = YES;
- }else{
- self.storeLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthCount];
- if (model.ComparedMonthCount > 0) {
- self.storeScaleImageView.hidden = NO;
- }else{
- self.storeScaleImageView.hidden = YES;
- }
- }
- }break;
-
- case 3:{
-
- if (model.PersonCount == 0) {
- self.profitValueLabel.text = @"--";;
- }else{
- self.profitValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.PersonCount];
- }
-
- if (model.Salary == 0) {
- self.movePersonLabel.text = @"--";;
- }else{
-
- self.movePersonLabel.text = [NSString stringWithFormat:@"%ld",(long)model.Salary];
-
- }
-
- if (model.ComparedMonthCount == 0) {
- self.profitScaleValueLabel.text = @"--";;
- self.profitScaleValueImage.hidden = YES;
- }else{
-
- self.profitScaleValueLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ComparedMonthCount];
-
- if (model.ComparedMonthCount > 0) {
- self.profitScaleValueImage.hidden = NO;
- }else{
- self.profitScaleValueImage.hidden = YES;
- }
- }
- }break;
- default:
- break;
- }
-
- }
- #pragma mark - 网络访问
- - (void)getData{
- SHOWLOADING
- switch (self.pageType) {
- case 1:
- [self getMoneyData];
- break;
- case 2:
- [self getVersionData];
- break;
- case 3:
- [self getHumanData];
- break;
- default:
- break;
- }
- }
- #pragma mark - 财务数据请求网络
- - (void)getMoneyData{
- [VersionDataVC getDataWithDataType:1 withDateType:1 success:^(id _Nonnull responseObject) {
- self.incomeModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"收入%@",self.incomeModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateIncomeView:self.incomeModel];
-
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
- }];
- [VersionDataVC getDataWithDataType:2 withDateType:1 success:^(id _Nonnull responseObject) {
- self.expensesModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"支出%@",self.expensesModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateExpensesView:self.expensesModel];
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
- }];
- [VersionDataVC getDataWithDataType:3 withDateType:1 success:^(id _Nonnull responseObject) {
- self.profitModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"利润%@",self.profitModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateProfitView:self.profitModel];
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
-
- }];
- }
- + (void)getDataWithDataType:(NSInteger)DataType withDateType:(NSInteger)DateType success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- [[HttpManager sharedHttpManager ] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowlistData_Post] parameters:@{@"DataType":@(DataType),@"DateType":@(DateType)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- successful(responseObject);
- } failure:^(NSError * _Nonnull error) {
- failure(error);
- }];
- }
- #pragma mark - 出版数据请求网络
- - (void)getVersionData{
- [VersionDataVC getDataWithVersisonType:1 withDateType:1 success:^(id _Nonnull responseObject) {
- self.incomeModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"出版%@",self.incomeModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateIncomeView:self.incomeModel];
-
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
- }];
- [VersionDataVC getDataWithPublishType:2 withDateType:1 success:^(id _Nonnull responseObject) {
- self.expensesModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"发行%@",self.expensesModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateExpensesView:self.expensesModel];
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
- }];
- [VersionDataVC getDataWithStoreType:3 withDateType:1 success:^(id _Nonnull responseObject) {
- self.profitModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"库存%@",self.profitModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateProfitView:self.profitModel];
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
-
- }];
- }
- // 库存
- + (void)getDataWithStoreType:(NSInteger)DataType withDateType:(NSInteger)DateType success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- [[HttpManager sharedHttpManager ] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowlistData_Store_Post] parameters:@{@"DateType":@(DateType)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- successful(responseObject);
- } failure:^(NSError * _Nonnull error) {
- failure(error);
- }];
- }
- // 发行
- + (void)getDataWithPublishType:(NSInteger)DataType withDateType:(NSInteger)DateType success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- [[HttpManager sharedHttpManager ] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowlistData_Store_Post] parameters:@{@"DateType":@(DateType)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- successful(responseObject);
- } failure:^(NSError * _Nonnull error) {
- failure(error);
- }];
- }
- // 出版
- + (void)getDataWithVersisonType:(NSInteger)DataType withDateType:(NSInteger)DateType success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- [[HttpManager sharedHttpManager ] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowlistData_Version_Post] parameters:@{@"DateType":@(DateType)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- successful(responseObject);
- } failure:^(NSError * _Nonnull error) {
- failure(error);
- }];
- }
- #pragma mark - 人事数据请求网络
- - (void)getHumanData{
- [VersionDataVC getDataWithHumanType:1 withDateType:1 success:^(id _Nonnull responseObject) {
- self.incomeModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"人事数据%@",self.incomeModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateIncomeView:self.incomeModel];
-
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
- }];
- [VersionDataVC getDataWithHumanType:2 withDateType:1 success:^(id _Nonnull responseObject) {
- self.expensesModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"人事数据 入职 %@",self.expensesModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateExpensesView:self.expensesModel];
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
- }];
- [VersionDataVC getDataWithHumanType:3 withDateType:1 success:^(id _Nonnull responseObject) {
- self.profitModel = [[VersionDataModel alloc]initWithDictionary:responseObject error:nil];
- NSLog(@"人事数据 离职%@",self.profitModel);
- self.netFlag += 1;
- if (self.netFlag == 4) {
- REMOVESHOW
- }
- [self updateProfitView:self.profitModel];
- } failure:^(NSError * _Nonnull error) {
- self.netFlag += 1;
- if (self.netFlag == 4) {
- SHOWERROR([ZYCTool handerResultData:error])
- }
-
- }];
-
- }
- + (void)getDataWithHumanType:(NSInteger)DataType withDateType:(NSInteger)DateType success:(void (^) (id responseObject))successful failure:(void (^) (NSError *error))failure{
- [[HttpManager sharedHttpManager ] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowlistData_HR_Post] parameters:@{@"DataType":@(DataType),@"DateType":@(DateType)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- successful(responseObject);
- } failure:^(NSError * _Nonnull error) {
- failure(error);
- }];
- }
- #pragma mark - 图表样式
- + (PYOption *)addOptionxArray:(NSArray *)xArray withYArray:(NSArray *)yArray{
- return [PYOption initPYOptionWithBlock:^(PYOption *option) {
- option.titleEqual([PYTitle initPYTitleWithBlock:^(PYTitle *title) {
- }])
- .gridEqual([PYGrid initPYGridWithBlock:^(PYGrid *grid) {
- grid.xEqual(@40).x2Equal(@50)
- .yEqual(@10)
- .y2Equal(@30);
- }])
- .addXAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
- axis.typeEqual(PYAxisTypeCategory)
- .addDataArr(xArray)
- .splitLine.showEqual(NO)
- ;
- }])
- .addYAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
- axis.typeEqual(PYAxisTypeValue)
- .axisLabelEqual([PYAxisLabel initPYAxisLabelWithBlock:^(PYAxisLabel *axisLabel) {
- axisLabel.formatterEqual(@"{value}");
- }])
- .splitLine.showEqual(YES);
- }])
- .addSeries([PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
- series.symbolEqual(PYSymbolNone)
- .typeEqual(PYSeriesTypeLine)
- .itemStyleEqual([PYItemStyle initPYItemStyleWithBlock:^(PYItemStyle *itemStyle) {
- itemStyle.normalEqual([PYItemStyleProp initPYItemStylePropWithBlock:^(PYItemStyleProp *normal) {
- normal.lineStyleEqual([PYLineStyle initPYLineStyleWithBlock:^(PYLineStyle *lineStyle) {
- lineStyle.colorEqual([PYColor colorWithHexString:@"#5576AB"]);
- }]);
- }]).emphasisEqual([PYItemStyleProp initPYItemStylePropWithBlock:^(PYItemStyleProp *emphasis) {
- emphasis.labelEqual([PYLabel initPYLabelWithBlock:^(PYLabel *label) {
- label.showEqual(YES);
- }]);
- }]);
- }])
- .dataEqual(yArray);
-
- }]);
- }];
- }
- @end
|