| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517 |
- //
- // JONewMeetingTableViewController.m
- // shiku_im
- //
- // Created by 周兵 on 16/6/29.
- // Copyright © 2016年 Reese. All rights reserved.
- //
- #import "JONewMeetingTableViewController.h"
- #import "ZQDayPickerViewController.h"
- #import "JOGETNameTableViewController.h"
- #import "JONavigationController.h"
- #import "JOGETAddressTableViewController.h"
- #import "JOGETLabelTableViewController.h"
- #import "JOShowMessageFromNavi.h"
- #import "JOHYTableViewController.h"
- #import "iflyMSC/IFlyMSC.h"
- #import "ISRDataHelper.h"
- #import "IATConfig.h"
- #import "YPCalendarVC.h"
- #define balckColor [UIColor blackColor]
- #define UNblack Color(71,71,71,1.0)
- #define beijingyanse Color(160,160,160,0.5)
- #pragma mark -- 自定义的cell
- @interface HYcell : UITableViewCell
- {
- /**cell标题名字*/
- UILabel * _labelName;
-
-
- }
- /**数据接口*/
- @property (nonatomic , strong) NSMutableAttributedString * nameString;
- /** 会议编号*/
- /**
- 设置模型
- */
- -(void)setModel;
- @end
- @implementation HYcell
- -(void)setModel
- {
- _labelName=[[UILabel alloc]init];
- _labelName.font=FONT_SIZE(14);
- _labelName.textColor=UNblack;
- _labelName.frame=CGRectMake(10,10,90,20);
- _labelName.attributedText=_nameString;
- [self.contentView addSubview:_labelName];
-
- }
- @end
- @interface JONewMeetingTableViewController ()<ZQDayPickerViewControllerDelegate,UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource,IFlySpeechRecognizerDelegate>
- {
- NSArray * numOfSection;
-
- /**会议名称*/
- UITextField * _huiyiName;
- /**开始时间*/
- UILabel * _beginTime;
- /**结束时间*/
- UILabel * _closeTime;
- /**会议地址*/
- UITextField * _huiyiAddress;
-
- /**参会人员*/
- UILabel * _canhui;
- /**参会人员IMID*/
- NSString * _canhuiImId;
- /**管理人员*/
- UILabel * _guanli;
-
- /**会议标签*/
- UITextField * _huiyiLabel;
- /**会议介绍*/
- UITextField * _huiyijiesao;
-
- /**会议日程*/
- UISwitch * _rcSwitch;
-
- UITableView * _tableView;
-
- int yaobuyaoricheng;
-
- ZQDayPickerViewController * _dayPickerViewController01;
-
- ZQDayPickerViewController * _dayPickerViewController02;
-
- MBProgressHUD * HUD;
-
- UIButton * _uploadBtn;//上传按钮.
-
- }
- @property (nonatomic, copy) NSString *Str;
- @property(nonatomic,strong)UIView * uv;
- @property(nonatomic,strong) IFlySpeechRecognizer * iFlySpeechRecognizer;//带视图的语音识别器
- @property(nonatomic,strong)UIImageView * imageV;
- @property(nonatomic,strong)UIView * MyView;
- @end
- @implementation JONewMeetingTableViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
-
- self.view.backgroundColor=[UIColor whiteColor];
-
- _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0,0,self_width, self_height) style:UITableViewStylePlain];
- _tableView.backgroundColor= BGB_COLOR;
- _tableView.delegate=self;
- _tableView.dataSource=self;
- [self.view addSubview:_tableView];
-
- [self setNavi];
- //去掉多余分割线
- [self setExtraCellLineHidden:_tableView];
- [self initRecognizer1];
- [self initCYBL];
- //判断从那个页面返回
- // self.block(@"创建会议");
-
-
-
- }
- /**
- 设置导航栏
- */
- - (void)setNavi
- {
-
- //1,设置title
- UILabel * titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0,0,80,30)];
- titleLabel.font=FONT_SIZE(18);
- titleLabel.text=Localized(@"UU_work_OA_ManagementOfMeetings_CreateMeeting");
- titleLabel.textColor=[UIColor whiteColor];
-
- self.navigationItem.titleView=titleLabel;
-
-
- //2,保存按钮
- UIButton *rigntBtn = [UIButton buttonWithType:UIButtonTypeSystem];
- rigntBtn.frame = CGRectMake(0, 0, 20, 20);
- rigntBtn.tintColor = [UIColor whiteColor];
- [rigntBtn setImage:[UIImage imageNamed:@"1xlist"] forState:UIControlStateNormal];
- [rigntBtn addTarget:self action:@selector(createHYB) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *creatBtn = [[UIBarButtonItem alloc]initWithCustomView:rigntBtn];
- [self.navigationItem setRightBarButtonItem:creatBtn];
-
-
- UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeSystem];
- btn2.frame = CGRectMake(0, 5, 22, 22);
- UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, iOS11?5:0, 22, 22)];
- image.image = [UIImage imageNamed:@"icon_back_nor3"];
- btn2.tintColor = [UIColor whiteColor];
- [btn2 addSubview:image];
- [btn2 addTarget:self action:@selector(cancel) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *bbi2 = [[UIBarButtonItem alloc]initWithCustomView:btn2];
- self.navigationItem.leftBarButtonItems = @[bbi2];
- }
- /**
- 创建会议
- */
- - (void)createHYB
- {
- // JONewMeetingTableViewController * newMeeting=[[JONewMeetingTableViewController alloc]init];
- //
- // [newMeeting setBlock:^(NSString *str) {
- //
- // _CJStr = str;
- //
- // }];
-
- // [self.navigationController pushViewController:newMeeting animated:YES];
- JOHYTableViewController * vc=[[JOHYTableViewController alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
-
- }
- /**
- 初始化成员变量
- */
- - (void)initCYBL
- {
-
- NSString * qingshuru=Localized(@"UU_custom_pleaseInput");
- NSString * qingxuanze=Localized(@"UU_custom_pleaseSelect");
- CGFloat wigth=100;
-
- numOfSection=@[@[Localized(@"UU_work_OA_MM_CreateMeeting_ConferenceName"),Localized(@"UU_work_OA_MM_CreateMeeting_StartTime"),Localized(@"UU_work_OA_MM_CreateMeeting_EndTime"),Localized(@"UU_work_OA_ManagementOfMeetings_Meetingplace")],@[Localized(@"UU_work_OA_MM_CreateMeeting_Participants"),Localized(@"UU_work_OA_MM_CreateMeeting_Administrators")],@[Localized(@"UU_work_OA_MM_MeetingDetail_ConferenceTab"),Localized(@"UU_work_OA_MM_MeetingDetail_ConferencePresentation")],@[Localized(@"UU_work_OA_MM_CreateMeeting_CreateSchedulesForAttendees")]];
-
-
- /**1,初始化会议标题*/
- _huiyiName = [[UITextField alloc] initWithFrame:CGRectMake(wigth,5,SCREEN_WIDTH-135,30)];
- [_huiyiName setBorderStyle:UITextBorderStyleNone]; //外框类型
- _huiyiName.placeholder =qingshuru; //默认显示的字
- _huiyiName.textColor=balckColor;
- _huiyiName.autocorrectionType = UITextAutocorrectionTypeNo;
- _huiyiName.autocapitalizationType = UITextAutocapitalizationTypeNone;
- _huiyiName.returnKeyType = UIReturnKeyDone;
- _huiyiName.font =FONT_SIZE(13);
- _huiyiName.delegate=self;
- _huiyiName.textAlignment = NSTextAlignmentRight;
- /**
- 会议开始和结束时间默认当前时间和之后两小时
- */
-
- NSDateFormatter * formatter=[[NSDateFormatter alloc]init];
- [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- NSDate * date=[NSDate date];
- NSString * strNow=[formatter stringFromDate:date];
-
-
- /**2,会议开始时间*/
-
- _beginTime =[[UILabel alloc]initWithFrame:CGRectMake(wigth,5,SCREEN_WIDTH-135,30)];
- _beginTime.textColor=balckColor;
- _beginTime.font =FONT_SIZE(14);
- _beginTime.text=strNow;
- _beginTime.textAlignment = NSTextAlignmentRight;
-
- NSDate * dates=[NSDate dateWithTimeIntervalSinceNow:7200];
- NSString * strgan=[formatter stringFromDate:dates];
-
- /**3,会议结束时间*/
- _closeTime =[[UILabel alloc]initWithFrame:CGRectMake(wigth,5,SCREEN_WIDTH-135,30)];
- _closeTime.font =FONT_SIZE(14);
- _closeTime.textColor=balckColor;
- _closeTime.text=strgan;
- _closeTime.textAlignment = NSTextAlignmentRight;
-
- /**4,会议地址*/
- _huiyiAddress = [[UITextField alloc] initWithFrame:CGRectMake(wigth,5,SCREEN_WIDTH-135,30)];
- [_huiyiAddress setBorderStyle:UITextBorderStyleNone]; //外框类型
- _huiyiAddress.placeholder = qingxuanze; //默认显示的字
- _huiyiAddress.autocorrectionType = UITextAutocorrectionTypeNo;
- _huiyiAddress.autocapitalizationType = UITextAutocapitalizationTypeNone;
- _huiyiAddress.font =FONT_SIZE(14);
- _huiyiAddress.returnKeyType = UIReturnKeyDone;
- _huiyiAddress.userInteractionEnabled=NO;
- _huiyiAddress.delegate=self;
- _huiyiAddress.textAlignment = NSTextAlignmentRight;
-
- /**5,参会人员*/
- _canhui=[[UILabel alloc]initWithFrame:CGRectMake(wigth,5,SCREEN_WIDTH-135,30)];
- _canhui.textColor=beijingyanse;
- _canhui.font =FONT_SIZE(14);
- _canhui.text=qingxuanze;
- _canhui.textAlignment = NSTextAlignmentRight;
- /**6,管理人员*/
-
- /**7,会议标签*/
- _huiyiLabel=[[UITextField alloc] initWithFrame:CGRectMake(wigth,5, SCREEN_WIDTH-135, 30)];
- [_huiyiLabel setBorderStyle:UITextBorderStyleNone]; //外框类型
- _huiyiLabel.placeholder =qingxuanze ; //默认显示的字
- _huiyiLabel.autocorrectionType = UITextAutocorrectionTypeNo;
- _huiyiLabel.autocapitalizationType = UITextAutocapitalizationTypeNone;
- _huiyiLabel.returnKeyType = UIReturnKeyDone;
- _huiyiLabel.delegate=self;
- _huiyiLabel.font =FONT_SIZE(14);
-
- _huiyiLabel.userInteractionEnabled=NO;
- _huiyiLabel.textAlignment = NSTextAlignmentRight;
-
-
- /**8,会议介绍*/
- _huiyijiesao = [[UITextField alloc] initWithFrame:CGRectMake(wigth,5,SCREEN_WIDTH-135,30)];
- [_huiyijiesao setBorderStyle:UITextBorderStyleNone]; //外框类型
- _huiyijiesao.placeholder = qingshuru; //默认显示的字
- _huiyijiesao.autocorrectionType = UITextAutocorrectionTypeNo;
- _huiyijiesao.autocapitalizationType = UITextAutocapitalizationTypeNone;
- _huiyijiesao.returnKeyType = UIReturnKeyDone;
- _huiyijiesao.font =FONT_SIZE(14);
- _huiyijiesao.delegate=self;
- _huiyijiesao.textAlignment = NSTextAlignmentRight;
-
-
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textFiledEditChanged:)name:@"UITextFieldTextDidChangeNotification"
- object:nil];
- }
- -(void)initMyButton:(UITableViewCell * )Mycell andIndexPath:(NSIndexPath *)indexPath{
- UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-21, 12, 16,16 )];
- [btn setImage:[UIImage imageNamed:@"icon-searcher-custom"] forState:UIControlStateNormal];
- [btn addTarget:self action:@selector(clickVoiceSearch:) forControlEvents:UIControlEventTouchUpInside];
- btn.tag = indexPath.row + indexPath.section;
- [Mycell.contentView addSubview:btn];
-
- }
- -(void)clickVoiceSearch:(id)sender{
-
- [self.view endEditing:YES];
- UIView * view = (UIView * )sender;
- UIView * MyView =[[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
- MyView.backgroundColor =[UIColor colorWithRed:1 green:1 blue:1 alpha:0.5];
- self.MyView = MyView;
- self.MyView.tag = view.tag;
- [self.view addSubview:MyView];
- UIImageView * imageV =[[UIImageView alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-60)/2, 200, 60, 60)];
- imageV.image = [UIImage imageNamed:@"uu_voice_search1"];
- imageV.userInteractionEnabled = YES;
- self.imageV = imageV;
-
- [MyView addSubview:imageV];
- [_iFlySpeechRecognizer startListening];
-
-
- }
- -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [super touchesBegan:touches withEvent:event];
- [self.MyView removeFromSuperview];
- [_iFlySpeechRecognizer cancel];
-
- }
- -(void)initRecognizer1
- {
- DLog(@"%s",__func__);
-
- //单例模式,无UI的实例
- if (_iFlySpeechRecognizer == nil) {
- _iFlySpeechRecognizer = [IFlySpeechRecognizer sharedInstance];
-
- [_iFlySpeechRecognizer setParameter:@"" forKey:[IFlySpeechConstant PARAMS]];
-
- //设置听写模式
- [_iFlySpeechRecognizer setParameter:@"iat" forKey:[IFlySpeechConstant IFLY_DOMAIN]];
- }
- _iFlySpeechRecognizer.delegate = self;
-
- if (_iFlySpeechRecognizer != nil) {
- IATConfig *instance = [IATConfig sharedInstance];
-
- //设置最长录音时间
- [_iFlySpeechRecognizer setParameter:instance.speechTimeout forKey:[IFlySpeechConstant SPEECH_TIMEOUT]];
- //设置后端点
- [_iFlySpeechRecognizer setParameter:instance.vadEos forKey:[IFlySpeechConstant VAD_EOS]];
- //设置前端点
- [_iFlySpeechRecognizer setParameter:instance.vadBos forKey:[IFlySpeechConstant VAD_BOS]];
- //网络等待时间
- [_iFlySpeechRecognizer setParameter:@"20000" forKey:[IFlySpeechConstant NET_TIMEOUT]];
-
- //设置采样率,推荐使用16K
- [_iFlySpeechRecognizer setParameter:instance.sampleRate forKey:[IFlySpeechConstant SAMPLE_RATE]];
-
- if ([instance.language isEqualToString:[IATConfig chinese]]) {
- //设置语言
- [_iFlySpeechRecognizer setParameter:instance.language forKey:[IFlySpeechConstant LANGUAGE]];
- //设置方言
- [_iFlySpeechRecognizer setParameter:instance.accent forKey:[IFlySpeechConstant ACCENT]];
- }else if ([instance.language isEqualToString:[IATConfig english]]) {
- [_iFlySpeechRecognizer setParameter:instance.language forKey:[IFlySpeechConstant LANGUAGE]];
- }
- //设置是否返回标点符号
- [_iFlySpeechRecognizer setParameter:instance.dot forKey:[IFlySpeechConstant ASR_PTT]];
-
- }
- }
- #pragma mark 下面是语音识别的回调函数
- - (void) onError:(IFlySpeechError *) error
- {
- if (error.errorCode == 20001) {
- [KPromptBox showKPromptBoxWithMassage:@"请检查网络连接"];
- }else if(error.errorCode == 20006){
- [KPromptBox showKPromptBoxWithMassage:@"请检查麦克风权限是否开启"];
- }
-
- [self.MyView removeFromSuperview];
-
- }
- - (void) onVolumeChanged: (int)volume{
-
- int ff = volume;
- if (ff>=0&&ff<3) {
- [self.imageV setImage:GetImage(@"uu_voice_search1")];
- } else if (ff>=3 && ff<6) {
- [self.imageV setImage:GetImage(@"uu_voice_search2")];
- } else if (ff >=6 &&ff<9) {
- [self.imageV setImage:GetImage(@"uu_voice_search3")];
- } else if (ff >=9 &&ff<12) {
- [self.imageV setImage:GetImage(@"uu_voice_search4")];
- } else if (ff >=12 &&ff<15) {
- [self.imageV setImage:GetImage(@"uu_voice_search5")];
- } else if (ff >= 15 && ff < 18) {
- [self.imageV setImage:GetImage(@"uu_voice_search6")];
- } else if (ff >= 18 && ff < 21) {
- [self.imageV setImage:GetImage(@"uu_voice_search7")];
- } else if(ff>=21){
- [self.imageV setImage:GetImage(@"uu_voice_search8")];
- }
- }
- //听写结果回调
- // resultArray:听写结果
- // isLast:表示最后一次
- - (void) onResults:(NSArray *) results isLast:(BOOL)isLast
- {
-
-
- NSMutableString *result = [[NSMutableString alloc] init];
- NSDictionary *dic = [results objectAtIndex:0];
-
- for (NSString *key in dic) {
- [result appendFormat:@"%@",key];
- }
-
- NSString * resultFromJson = [ISRDataHelper stringFromJson:result];
-
- NSString * searchText = [NSString stringWithFormat:@"%@",resultFromJson];
- if (self.MyView.tag == 0) {
- _huiyiName.text = searchText;
- }
- else{
- _huiyijiesao.text = searchText;
- }
- [_iFlySpeechRecognizer cancel];
- }
- - (BOOL)textFieldShouldReturn:(UITextField *)textField
- {
- [_huiyiName resignFirstResponder];
- [_huiyiAddress resignFirstResponder];
- [_huiyijiesao resignFirstResponder];
- [_huiyiLabel resignFirstResponder];
- return YES;
- }
- #pragma mark -- 点击事件
- /**取消返回*/
- - (void)cancel
- {
- [self.navigationController popViewControllerAnimated:YES];
-
- }
- /**
- 保存发布
- 先获取code
- */
- - (void)preserve:(UIButton *)btn
- {
-
- if ([_huiyiName.text isEqualToString:@""])
- {
-
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_work_OA_MM_CreateMeeting_FillMeetingName") ToNavi:self.navigationController withColor:nil];
- return;
-
- }else if ([_huiyiAddress.text isEqualToString:@""])
- {
-
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_work_OA_MM_CreateMeeting_FillMeetingAddress") ToNavi:self.navigationController withColor:nil];
-
-
- return;
- }else if ([_beginTime.text isEqualToString:Localized(@"UU_custom_pleaseSelect")]||[_closeTime.text isEqualToString:Localized(@"UU_custom_pleaseSelect")])
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_work_OA_MM_CreateMeeting_FillMeetingTime") ToNavi:self.navigationController withColor:nil];
-
- return;
- }else if ([_canhui.text isEqualToString:Localized(@"UU_custom_pleaseSelect")])
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_work_OA_MM_CreateMeeting_ParticipantsCanNoteEmpty") ToNavi:self.navigationController withColor:nil];
-
- return;
- }else{
-
- [self sethuiyiMrCode];
-
- //btn.userInteractionEnabled=NO;
-
- DLog(@"要不要日程啊%d",yaobuyaoricheng);
-
- HUD = [[MBProgressHUD alloc] initWithView:self.view];
- [self.view addSubview:HUD];
- HUD.labelText = @"";
- HUD.mode = MBProgressHUDModeIndeterminate;
- if (_uploadBtn.selected) {
-
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_work_OA_MM_CreateMeeting_Creating") ToNavi:self.navigationController withColor:nil];
-
- return;
-
- }
- _uploadBtn.selected = YES;
- [HUD showAnimated:YES whileExecutingBlock:^{
-
-
- for (int i=0; i<yaobuyaoricheng; i++)
- {
- //1,创建一个网络请求管理对象
- UASNetworkManager *manager1=[UASNetworkManager shareManager];
- manager1.responseSerializer=[AFHTTPResponseSerializer serializer];
-
-
- //2,取出sessionID和IP
- NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
-
- NSString *sessionId=[userDefault stringForKey:@"sessionId"];
-
- NSString * ips=[UASUserInfo shareManager].urlIp;
-
- NSString * userID=[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"];
- NSString *master=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_user"];
-
-
- //3.拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //4.设置cookie
- [manager1.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
- //5,接口
- NSString * urlAddress1=@"common/getCodeString.action";
- //6,Caller
- NSString * caller1=@"Meetingroomapply";
-
- //url
- NSString * url2=[@"" stringByAppendingFormat:@"%@%@?type=2&caller=%@&master=%@&sessionUser=%@",ips,urlAddress1,caller1,master,userID];
- [manager1 request:url2 method:GET parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- NSData *data=responseObject;
- id rootDic =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
- DLog(@"请求成功");
- DLog(@"返回的是什么鬼:%@",rootDic);
-
- NSString * code=[rootDic objectForKey:@"code"];
- if (i==0)
- {
- [self getMa_idFromServer:code];
- }else{
- [self confirmAction:code];
-
- }
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
-
- ErrorInfomation
- // [self dismissViewControllerAnimated:YES completion:nil];
- }];
-
- }
-
-
- } completionBlock:^{
-
-
- // HUD.mode=MBProgressHUDModeIndeterminate;
- // HUD.labelText=Localized(@"UU_custom_netWorking");
- // [HUD show:YES];
-
-
- }];
-
- }
-
-
- }
- /**
- 获取ma_id接口
- */
- - (void)getMa_idFromServer:(NSString *)code
- {
-
-
- //2,取出sessionID和IP
- NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
-
- NSString *sessionId=[userDefault stringForKey:@"sessionId"];
-
- NSString * ips=[UASUserInfo shareManager].urlIp;
-
- NSString * userID=[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"];
- NSString *master=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_user"];
-
- //3.拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //5,接口
- NSString * urlAddress1=@"common/getId.action";
- //6,Caller
- NSString * seq=@"Meetingroomapply_SEQ";
-
- //url
- NSString * url2=[@"" stringByAppendingFormat:@"%@%@?&seq=%@&master=%@&sessionUser=%@",ips,urlAddress1,seq,master,userID];
- DLog(@"url2=%@",url2);
- url2 = [url2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-
- [[UASNetworkManager shareManager] request:url2 method:GET parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- // NSData *data=responseObject;
- // id rootDic =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
- NSDictionary *rootDic = responseObject;
- DLog(@"返回的是什么鬼:%@",rootDic);
-
- if (rootDic.count != 0) {
- [self postDataToServerWith:code andWithMa_id:[rootDic objectForKey:@"id"]];
- }else{
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_work_OA_MM_CreateMeeting_NewCreateFailed") ToNavi:self.navigationController withColor:nil];
- [self dismissViewControllerAnimated:YES completion:nil];
- }
-
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
- ErrorInfomation
- }];
- }
- //创建日程
- - (void)confirmAction:(NSString *)code
- {
- NSString *sessionId=[[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
- NSString *ip=[UASUserInfo shareManager].urlIp;
- NSString * userID=[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"];
- NSString *master=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_user"];
-
-
- NSDictionary * params;
-
- params = @{
- @"name":_huiyiName.text,
- @"resourcename":_canhui.text,
- @"enddate":_closeTime.text,
- @"tasklevel":@"紧急",
- @"taskorschedule":@"Schedule",
- @"custname":@"",
- @"timealert":@"",
- @"description":_huiyiLabel.text,
- @"SOURCECODE":@"",
- @"taskcode":code,
- @"startdate":_beginTime.text
- // @"handstatus":@"未完成",
- // @"handstatuscode":@"UNFINISHED"
- };
- DLog(@"里面时什么啊,怎么会崩%@",params);
-
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:NSJSONWritingPrettyPrinted error:nil];
-
- NSString *str=[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
-
-
- NSDictionary * dic11 = @{
- @"formStore":str,
- @"sessionId":sessionId,
- @"master":master,
- @"sessionUser":userID,
-
-
- };
- NSString *url = [NSString stringWithFormat:@"%@plm/task/addbilltask.action",ip];
-
-
-
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-
- [[UASNetworkManager shareManager]request:url method:POST parameters:dic11 progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
-
- DLog(@"chenggong---:%@",responseObject);
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
-
- ErrorInfomation
- }];
- }
- #pragma mark 获取会议编号
- - (void)sethuiyiMrCode
- {
- NSString *sessionId=[[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
- NSString *ip=[UASUserInfo shareManager].urlIp;
- NSString *emcode = [[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"];
-
- int pageSize = 30;
- int page = 1;
- NSString *url = [NSString stringWithFormat:@"%@/mobile/common/list.action?master=%@&sessionUser=%@&emcode=%@&pageSize=%d&condition=mr_statuscode='AUDITED'&caller=MeetingRoom&page=%d¤tMaster=%@&sessionId=%@",ip,g_master,g_sessionUser,emcode,pageSize,page,g_master,sessionId];
-
- DLog(@"aaaaaaaa==:%@",url);
-
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-
- UASNetworkManager *manager = [UASNetworkManager shareManager];
- manager.responseSerializer = [AFJSONResponseSerializer serializer];
-
- //拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //设置cookie
- [manager.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
- [manager.requestSerializer setValue:[NSString stringWithFormat:@"%@",g_sessionUser] forHTTPHeaderField:@"sessionUser"];
-
- [manager request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- NSString * sessionId = [NSString stringWithFormat:@"%@",responseObject[@"sessionId"]];
- if (![sessionId isEqualToString:@"(null)"]) {
- [[NSUserDefaults standardUserDefaults] setObject:sessionId forKey:@"sessionId"];
- }
-
-
-
-
- SLog(@"=====%@",responseObject[@"listdata"]);
- NSArray *arr = responseObject[@"listdata"];
- for (NSDictionary *dic in arr) {
- if ([dic[@"mr_name"] isEqualToString:_huiyiAddress.text]) {
- _Str = [NSString stringWithFormat:@"%@",dic[@"mr_code"]];
- SLog(@"======%@",_Str);
- }
- }
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
- [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlert:Localized(@"UU_work_OA_MM_CreateMeeting_title5")];
- SLog(@"请求失败:%@",error);
- }];
- }
- #pragma mark 上传会议 数据
- //上传会议
- - (void)postDataToServerWith:(NSString *)code andWithMa_id:(NSString *)maid
- {
- //1,创建一个网络请求管理对象
- UASNetworkManager *manager = [UASNetworkManager shareManager];
- manager.responseSerializer = [AFJSONResponseSerializer serializer];
-
-
- //2,取出sessionID和IP
- NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
-
- NSString *sessionId=[userDefault stringForKey:@"sessionId"];
-
- NSString * ips=[UASUserInfo shareManager].urlIp;
-
-
-
- NSString * userID = [userDefault objectForKey:@"erpaccount"];
-
- DLog(@"%@",_Str);
-
- NSString *master=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_user"];
-
-
- //3.拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //4.设置cookie
- [manager.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
- //5,接口
- NSString * urlAddress=@"oa/meeting/saveMeetingroomapply.action";
- //6,Caller
- NSString * caller=@"Meetingroomapply";//MeetingroomapplyDetail //Meetingroomapply
-
- //当前时间
- NSDateFormatter * formatter=[[NSDateFormatter alloc]init];
- [formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
- NSDate * date=[NSDate date];
- NSString * currentTime=[formatter stringFromDate:date];
- DLog(@"当前时间是%@",currentTime);
-
- /**
- 会议开始和结束时间处理
- */
- DLog(@"开始时间%@ 结束时间%@",_beginTime.text,_closeTime.text);
-
-
-
-
- //7,字段组合
- NSDictionary *formStore = @{
- @"ma_code":FORMAT(@"%@",code),
- @"ma_mrcode":FORMAT(@"%@",_Str),
- @"ma_mrname":FORMAT(@"%@",_huiyiAddress.text),
- @"ma_theme":FORMAT(@"%@",_huiyiName.text),
- @"ma_status":FORMAT(@"%@",@"已提交"),
- @"ma_recorder":FORMAT(@"%@",[[NSUserDefaults standardUserDefaults] stringForKey:@"personName"]),
- @"ma_recorddate":FORMAT(@"%@",currentTime),
- @"ma_starttime":FORMAT(@"%@",_beginTime.text),
- @"ma_isturndoc":FORMAT(@"%@",@"否"),
- @"ma_tag":FORMAT(@"%@",_huiyiLabel.text),
- @"ma_remark":FORMAT(@"%@",_huiyijiesao.text),
- @"ma_group":FORMAT(@"%@",_canhui.text),
- @"ma_groupid":FORMAT(@"%@",_canhuiImId),
- @"ma_endtime":FORMAT(@"%@",_closeTime.text),
- @"ma_statuscode":FORMAT(@"%@",@"ENTERING"),
- @"ma_id":FORMAT(@"%@",maid),
- };
-
-
- DLog(@" ==%@",formStore);
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:formStore options:NSJSONWritingPrettyPrinted error:nil];
-
- NSString *dataStr=[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
-
- NSDictionary * dic11 = @{
- @"caller":caller,
- @"sessionId":sessionId,
- @"master":master,
- @"sessionUser":userID,
- @"param":@"[]",
- @"formStore":dataStr,
- };
- DLog(@"%@",dic11);
-
- NSString *url=[@"" stringByAppendingFormat:@"%@%@",ips,urlAddress];
-
- DLog(@"新建会议URL=%@",url);
-
- NSString * urlStringUTF8 = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-
-
- //发送请求
- [manager request:urlStringUTF8 method:POST parameters:dic11 progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- NSDictionary *rootDic = responseObject;
-
- DLog(@"请求参会人员成功:%@",rootDic);
-
- if ([[rootDic allKeys] containsObject:@"sessionId"]==YES)
- {
- NSString * sessionId=[NSString stringWithFormat:@"%@",[rootDic objectForKey:@"sessionId"]];
- [[NSUserDefaults standardUserDefaults] setObject:sessionId forKey:@"sessionId"];
- }
-
- [self applyHuiyishi:maid];
- [MBProgressHUD showSuccess:Localized(@"UU_work_OA_MM_CreateMeeting_CreateSuccess")];
- // [self.navigationController popViewControllerAnimated:YES];
- _uploadBtn.selected = NO;
- JOHYTableViewController * vc=[[JOHYTableViewController alloc]init];
- vc.popStr = @"Commit";//提交后跳转
- [self.navigationController pushViewController:vc animated:YES];
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
- _uploadBtn.selected = NO;
- DLog(@"失败%@",error);
- ErrorInfomation
-
- // [self.navigationController popViewControllerAnimated:YES];
- }];
-
- }
- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- {
- if (buttonIndex==1)
- {
-
- [MBProgressHUD showSuccess:Localized(@"UU_work_OA_MM_CreateMeeting_CreateSuccess")];
- [self dismissViewControllerAnimated:YES completion:nil];
-
- }else{
-
-
- [MBProgressHUD showSuccess:Localized(@"UU_work_OA_MM_CreateMeeting_CreateSuccess")];
- [self dismissViewControllerAnimated:YES completion:nil];
-
- }
- }
- - (void)swicthOn:(id)sender
- {
-
- UISwitch *switchButton = (UISwitch*)sender;
-
- if (switchButton.isOn==YES)
- {
- yaobuyaoricheng=2;
-
-
- }else
- {
- yaobuyaoricheng=1;
-
- }
-
-
- }
- #pragma mark - Table view data source
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return numOfSection.count;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-
- NSArray *subArr = numOfSection[section];
-
- return subArr.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 40;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- if (section==0)
- {
- return 0;
- }else{
- return 10;
- }
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return section == numOfSection.count-1? 120:0;
-
-
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- //1.cell初始化
- static NSString *identifier = @"cell";
- HYcell * cell=[[HYcell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
-
- cell.backgroundColor=[UIColor whiteColor];
-
-
-
- if (indexPath.section==3)
- {
- UILabel * label=[[UILabel alloc]init];
- label.textColor=UNblack;
- label.text=numOfSection[indexPath.section][indexPath.row];
- label.frame=CGRectMake(10,5,200,30);
- label.textAlignment=0;
- label.font=FONT_SIZE(14);
- [cell addSubview:label];
-
- _rcSwitch=[[UISwitch alloc]init];
- _rcSwitch.frame=CGRectMake(self_width-70,5,60,30);
- _rcSwitch.on=YES;
- _rcSwitch.onTintColor= Color(76,217,100,1.0);
- [_rcSwitch addTarget:self action:@selector(swicthOn:) forControlEvents:UIControlEventValueChanged];
- [cell addSubview:_rcSwitch];
- yaobuyaoricheng=2;//默认为2
-
- }
- else
- {
- NSString *titleName = FORMAT(@"%@",numOfSection[indexPath.section][indexPath.row]);
- NSMutableAttributedString *AttributedStr ;
-
-
- if (indexPath.section==0||(indexPath.section==1&&indexPath.row==0)) {
- AttributedStr = [[NSMutableAttributedString alloc]initWithString:FORMAT(@"%@*",titleName)];
- [AttributedStr addAttribute:NSForegroundColorAttributeName
- value:[UIColor redColor]
- range:NSMakeRange(titleName.length, 1)];
- }else{
- AttributedStr = [[NSMutableAttributedString alloc]initWithString:FORMAT(@"%@",titleName)];
- }
- cell.nameString=AttributedStr ;
-
- [cell setModel];
-
- }
-
- #pragma mark----------------------------
-
- if (indexPath.section==0&&indexPath.row==0)
- {
- [cell.contentView addSubview:_huiyiName];
- [self initMyButton:cell andIndexPath:indexPath];
-
- }
- else if (indexPath.section==0&&indexPath.row==1)
- {
-
- UIButton * beginBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- beginBtn.frame=CGRectMake(0, 0,self_width,40);
- beginBtn.tag = 10000;
- [beginBtn addTarget:self action:@selector(beginBtn:) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:beginBtn];
-
- [cell.contentView addSubview:_beginTime];
- }
- else if (indexPath.section==0&&indexPath.row==2)
- {
-
- UIButton * closeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- closeBtn.frame=CGRectMake(0, 0,self_width,40);
- closeBtn.tag = 10001;
- [closeBtn addTarget:self action:@selector(closeBtn:) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:closeBtn];
-
- [cell.contentView addSubview:_closeTime];
-
-
- }
- else if (indexPath.section==0&&indexPath.row==3)
- {
-
- [cell.contentView addSubview:_huiyiAddress];
-
- UIButton * addressBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- addressBtn.frame=CGRectMake(0,0,self_width,30);
- [addressBtn setTitle:@"" forState:UIControlStateNormal];
- [addressBtn addTarget:self action:@selector(gotoGETAddress) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:addressBtn];
-
- }else if (indexPath.section==2&&indexPath.row==1)
- {
- [cell.contentView addSubview:_huiyijiesao];
- [self initMyButton:cell andIndexPath:indexPath];
- }else if (indexPath.section==1&&indexPath.row==0)
- {
-
- UIButton * closeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- closeBtn.frame=CGRectMake(0, 0,self_width,40);
- [closeBtn addTarget:self action:@selector(chooesName) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:closeBtn];
-
- [cell.contentView addSubview:_canhui];
- }
- else if (indexPath.section==1&&indexPath.row==1)//会议管理员
- {
- UILabel * label=[[UILabel alloc]init];
- label.frame=CGRectMake(100,5,SCREEN_WIDTH-135,30);
- label.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"personName"];
- label.textAlignment = NSTextAlignmentRight;
- label.font=FONT_SIZE(14);
- [cell.contentView addSubview:label];
-
- }else if (indexPath.section==2&&indexPath.row==0)
- {
- // UIButton * closeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- // closeBtn.frame=CGRectMake(0, 0,self_width,40);
- // [closeBtn addTarget:self action:@selector(huiyibiaoqian:) forControlEvents:UIControlEventTouchUpInside];
- // closeBtn.tag=11111;
- [cell.contentView addSubview:_huiyiLabel];
-
-
- // [cell.contentView addSubview:closeBtn];
- UIButton * LabelBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- LabelBtn.frame = CGRectMake(0,0,self_width,30);
- [LabelBtn setTitle:@"" forState:UIControlStateNormal];
- [LabelBtn addTarget:self action:@selector(gotoGETLabel) forControlEvents:UIControlEventTouchUpInside];
- [cell.contentView addSubview:LabelBtn];
-
-
- }
-
-
- return cell;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- UIView * view=[[UIView alloc]init];
- if (section==0)
- {
-
- }else{
- view.frame=CGRectMake(0,0,self_width,10);
- view.backgroundColor=[UIColor clearColor];
- }
-
- return view;
- }
- -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
-
- UIView *footerView = [[UIView alloc] init];
- footerView.userInteractionEnabled = YES;
- footerView.backgroundColor = [UIColor clearColor];
-
- _uploadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _uploadBtn.frame = CGRectMake(20,40, self_width-40, 40);
- _uploadBtn.layer.cornerRadius = 5;
- _uploadBtn.layer.masksToBounds = YES;
- [_uploadBtn addTarget:self action:@selector(preserve:) forControlEvents:UIControlEventTouchUpInside];
- [_uploadBtn setBackgroundColor:HexColor(@"#33A2EE") forState:UIControlStateNormal];
- [_uploadBtn setBackgroundColor:HexColor(@"#2D84C0") forState:UIControlStateHighlighted];
- [_uploadBtn setTitleColor:HexColor(@"#FFFFFF") forState:UIControlStateNormal];
- [_uploadBtn setTitle:@"提交" forState:UIControlStateNormal];
- _uploadBtn.titleLabel.font = FONT_SIZE(18);
- [footerView addSubview:_uploadBtn];
-
- return section==(numOfSection.count-1)? footerView:nil;
-
-
-
- }
- //会议标签选择
- - (void)huiyibiaoqian:(UIButton *)btn
- {
-
- if ([[[UIDevice currentDevice] systemVersion] floatValue]<8.0)
- {
- [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlertController:self withMessage:Localized(@"UU_custom_iphoneLow")];
- btn.userInteractionEnabled=NO;
- _huiyiLabel.userInteractionEnabled=YES;
-
- return;
-
- }
-
- UIAlertController * alertController = [UIAlertController alertControllerWithTitle: nil message: nil preferredStyle:UIAlertControllerStyleActionSheet];
-
- UIButton * Btn=[self.view viewWithTag:btn.tag];
-
-
- //添加Button
-
- [alertController addAction: [UIAlertAction actionWithTitle: Localized(@"UU_work_OA_MM_CreateMeeting_TrainMeeting") style: UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
- _huiyiLabel.text=Localized(@"UU_work_OA_MM_CreateMeeting_TrainMeeting");
- }]];
- [alertController addAction: [UIAlertAction actionWithTitle: Localized(@"UU_work_OA_MM_CreateMeeting_departmentMeeting") style: UIAlertActionStyleDefault handler:^(UIAlertAction *action){
-
- _huiyiLabel.text=Localized(@"UU_work_OA_MM_CreateMeeting_departmentMeeting");
- }]];
- [alertController addAction: [UIAlertAction actionWithTitle: Localized(@"UU_work_OA_MM_CreateMeeting_monthMeeting") style: UIAlertActionStyleDefault handler:^(UIAlertAction *action){
-
- _huiyiLabel.text=Localized(@"UU_work_OA_MM_CreateMeeting_monthMeeting");
- }]];
- [alertController addAction: [UIAlertAction actionWithTitle: Localized(@"UU_work_OA_MM_CreateMeeting_weekMeeting") style: UIAlertActionStyleDefault handler:^(UIAlertAction *action){
-
- _huiyiLabel.text=Localized(@"UU_work_OA_MM_CreateMeeting_weekMeeting");
- }]];
-
- [alertController addAction: [UIAlertAction actionWithTitle: Localized(@"UU_work_OA_MM_CreateMeeting_custom") style: UIAlertActionStyleDefault handler:^(UIAlertAction *action){
-
- _huiyiLabel.userInteractionEnabled=YES;
- if (btn.tag==11111)
- {
- Btn.userInteractionEnabled=NO;
- _huiyiLabel.placeholder=Localized(@"UU_custom_pleaseInput");
- _huiyiLabel.text=@"";
- }
-
- }]];
-
- [alertController addAction: [UIAlertAction actionWithTitle: Localized(@"UU_custom_cancle") style: UIAlertActionStyleCancel handler:nil]];
-
- [self presentViewController: alertController animated: YES completion: nil];
- }
- - (void)gotoGETLabel
- {
- JOGETLabelTableViewController * vc=[[JOGETLabelTableViewController alloc]init];
- // vc.naviColor= Color(215,145,71,1.0);
- JONavigationController * navi = [[JONavigationController alloc]initWithRootViewController:vc];
-
- [self presentViewController:navi animated:YES completion:^{
-
- [vc backLabelName:^(NSString *lableName) {
- _huiyiLabel.text=lableName;
- }];
-
-
-
- }];
-
-
- }
- - (void)gotoGETAddress
- {
- JOGETAddressTableViewController * vc=[[JOGETAddressTableViewController alloc]init];
- vc.naviColor= Color(215,145,71,1.0);
- UASBasNavController * navi=[[UASBasNavController alloc]initWithRootViewController:vc];
-
- [self presentViewController:navi animated:YES completion:^{
-
- [vc backAddressName:^(NSString *addressName,NSString * addressId){
-
-
- DLog(@"会议室:%@ 会议室ID:%@",addressName,addressId);
-
- _huiyiAddress.text=addressName;
-
-
-
- }];
- }];
- }
- #pragma mark -- 会议室
- - (void)applyHuiyishi:(NSString *)addressId
- {
- //1,创建一个网络请求管理对象
- UASNetworkManager *manager1=[UASNetworkManager shareManager];
- manager1.responseSerializer=[AFHTTPResponseSerializer serializer];
-
- //2,取出sessionID和IP
- NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
-
- NSString *sessionId=[userDefault stringForKey:@"sessionId"];
-
- NSString * ips=[UASUserInfo shareManager].urlIp;
-
- NSString * userID=[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"];
- NSString *master=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_user"];
-
- /*
- 会议室申请,保存后触犯审批流接口
- 地址:/oa/meeting/submitMeetingroomapply.action
- 参数:caller,id
- */
-
- //3.拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //4.设置cookie
- [manager1.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
- //5,接口
- NSString * urlAddress1 = @"oa/meeting/submitMeetingroomapply.action";
- //6,Caller
- NSString * caller1 = @"Meetingroomapply";
-
- //url
- NSString * url2 = [@"" stringByAppendingFormat:@"%@%@?id=%@&caller=%@&master=%@&sessionUser=%@",ips,urlAddress1,addressId,caller1,master,userID];
-
- DLog(@"url==%@",url2);
- [manager1 request:url2 method:GET parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
-
- NSData *data=responseObject;
- id rootDic =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
- //DLog(@"请求成功");
- // DLog(@"返回的是什么鬼:%@",rootDic);
- DLog(@"申请成功啦:%@",rootDic);
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
- [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlert:@"会议室审批申请失败"];
-
- NSData *returnData = [[error userInfo] objectForKey:@"com.alamofire.serialization.response.error.data"];
- if (returnData) {
- NSDictionary *content = [NSJSONSerialization JSONObjectWithData:returnData options:NSJSONReadingMutableContainers error:nil];//转换数据格式
-
- NSString *errorStr = [NSString stringWithFormat:@"%@",[content objectForKey:@"exceptionInfo"]];
- DLog(@"错误信息是:%@",errorStr);
-
- }
-
-
- [self dismissViewControllerAnimated:YES completion:nil];
- }];
-
- }
- //获取返回的参会成员
- - (void)chooesName
- {
- JOGETNameTableViewController * vc=[[JOGETNameTableViewController alloc]init];
- vc.naviColor= Color(215,145,71,1.0);
- vc.naviTitle=Localized(@"UU_work_OA_MM_CreateMeeting_PleaseSelectParticipants");
- JONavigationController * navi=[[JONavigationController alloc]initWithRootViewController:vc];
- [self presentViewController:navi animated:YES completion:^{
- [vc backname:^(NSMutableArray *arr,NSMutableArray * brr) {
-
- DLog(@"拿回来的是人名嘛%@",arr);
- DLog(@"拉回来的事ID吗%@",brr);
- if (arr.count>=1)
- {
- NSString * str=@"";
- NSString * str2=@"";
- for (int i=0; i<arr.count; i++)
- {
- str=[[str stringByAppendingString:@","] stringByAppendingString:arr[i]];
-
- str2=[[str2 stringByAppendingString:@";employee#"] stringByAppendingString:brr[i]];
-
- }
-
-
- str=[str substringFromIndex:1];
- str2=[str2 substringFromIndex:1];
-
-
- _canhui.text=str;
- _canhui.textColor=balckColor;
- _canhuiImId=str2;
- DLog(@"处理过后呢%@",_canhuiImId);
-
-
- }else if (arr.count==1){
- _canhui.text=arr[0];
- _canhui.textColor=balckColor;
- _canhuiImId=brr[0];
- }
-
-
- }];
-
- }];
-
-
-
- }
- - (void)beginBtn:(UIButton *)btn
- {
- /*_dayPickerViewController01 = [[ZQDayPickerViewController alloc] initWithNibName:NSStringFromClass([ZQDayPickerViewController class]) bundle:nil];
- _dayPickerViewController01.selectedColor = [UIColor blackColor];
- _dayPickerViewController01.hintTitle = Localized(@"UU_custom_pleaseSelect");
- _dayPickerViewController01.delegate = self;
- [self presentViewController:_dayPickerViewController01 animated:YES completion:nil];*/
- YPCalendarVC *ypVC = [[YPCalendarVC alloc]init];
- ypVC.caller = @"NewMeeting";
- ypVC.kaishiTime = _beginTime.text;
- ypVC.jieshuTime = _closeTime.text;
-
- ypVC.block = ^(NSString *start,NSString *end) {
- DLog(@"返回什么东西:%@--%@",start,end);
- _beginTime.text = start;
- _closeTime.text = end;
- };
- [self.navigationController pushViewController:ypVC animated:YES];
-
- }
- - (void)closeBtn:(UIButton * )btn
- {
- // if ([_beginTime.text isEqualToString:@"请选择"])
- // {
- // [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlertController:self withMessage:@"请先选择开始时间"];
- // return ;
- // }
- /*_dayPickerViewController02 = [[ZQDayPickerViewController alloc] initWithNibName:NSStringFromClass([ZQDayPickerViewController class]) bundle:nil];
- _dayPickerViewController02.selectedColor = [UIColor blackColor];
- _dayPickerViewController02.hintTitle = Localized(@"UU_custom_pleaseSelect");
- _dayPickerViewController02.delegate = self;
- [self presentViewController:_dayPickerViewController02 animated:YES completion:nil];*/
-
- YPCalendarVC *ypVC = [[YPCalendarVC alloc]init];
- ypVC.caller = @"NewMeeting";
- ypVC.kaishiTime = _beginTime.text;
- ypVC.jieshuTime = _closeTime.text;
- ypVC.selectDay = @"end";
- ypVC.block = ^(NSString *start,NSString *end) {
- DLog(@"返回什么东西:%@--%@",start,end);
- _beginTime.text = start;
- _closeTime.text = end;
- };
- [self.navigationController pushViewController:ypVC animated:YES];
- }
- //获取时间
- - (void)dayPickerViewControllerChoosedDate:(ZQDayPickerViewController *)dayPickerViewController
- {
- NSString * str = [self dateStringFromDate:dayPickerViewController.date];
- if (dayPickerViewController==_dayPickerViewController01)
- {
-
- if ([self compareDate:_closeTime.text withDate:str]==1||[self compareDate:_closeTime.text withDate:str]==0)
- {
- [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlert:Localized(@"UU_work_OA_MM_CreateMeeting_PleaseSelectStartTimeLessThanEndTime")];
- return;
- }
- _beginTime.text=str;
- //_beginTime.textColor=balckColor;
-
- }
- else if (dayPickerViewController==_dayPickerViewController02)
- {
-
-
- if ([self compareDate:_beginTime.text withDate:str]==-1||[self compareDate:_beginTime.text withDate:str]==0)
- {
- [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlert:Localized(@"UU_work_OA_MM_CreateMeeting_PleaseSelectEndTimeGreaterThanStartTime")];
- return;
- }
- _closeTime.text=str;
- // _closeTime.textColor=balckColor;
-
-
- }
- }
- - (int)compareDate:(NSString*)date01 withDate:(NSString*)date02
- {
- int ci;
- NSDateFormatter *df = [[NSDateFormatter alloc] init];
- [df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- NSDate *dt1 = [[NSDate alloc] init];
- NSDate *dt2 = [[NSDate alloc] init];
- dt1 = [df dateFromString:date01];
- dt2 = [df dateFromString:date02];
- NSComparisonResult result = [dt1 compare:dt2];
- switch (result)
- {
- //date02比date01大
- case NSOrderedAscending: ci=1; break;
- //date02比date01小
- case NSOrderedDescending: ci=-1; break;
- //date02=date01
- case NSOrderedSame: ci=0; break;
- default: DLog(@"erorr dates %@, %@", dt2, dt1); break;
- }
- return ci;
- }
- //设置返回时间的格式
- - (NSString *)dateStringFromDate:(NSDate *)date
- {
- NSDateFormatter *formatter = [NSDateFormatter new];
- formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
- return [formatter stringFromDate:date];
- }
- /**去掉分割线*/
- - (void)setExtraCellLineHidden: (UITableView *)tableView
- {
-
- UIView *view = [UIView new];
-
- view.backgroundColor = [UIColor clearColor];
-
- [tableView setTableFooterView:view];
- }
- - (void)textFieldDidEndEditing:(UITextField *)textField
- {
-
- if (textField==_huiyiLabel||textField==_huiyijiesao)
- {
- _tableView.y=0;
-
- }
-
- }
- - (void)textFieldDidBeginEditing:(UITextField *)textField
- {
- if (textField==_huiyiLabel||textField==_huiyijiesao)
- {
- _tableView.y=-130;
-
- }
-
- }
- - (void)textFiledEditChanged:(NSNotification *)obj
- {
- UITextField *textField = (UITextField *)obj.object;
-
- DLog(@"%@",textField.text);
- NSString *toBeString = textField.text;
-
- if (textField==_huiyiName)
- {
- if (toBeString.length > 17)
- {
- textField.text = [toBeString substringToIndex:17];
- [self.view endEditing: YES];
- [KPromptBox showKPromptBoxWithMassage:Localized(@"UU_work_OA_MM_CreateMeeting_title6")];
- }
- }
- else if (textField==_huiyiAddress )
- {
- if (toBeString.length > 17)
- {
- textField.text = [toBeString substringToIndex:17];
- [self.view endEditing: YES];
- [KPromptBox showKPromptBoxWithMassage:Localized(@"UU_work_OA_MM_CreateMeeting_title6")];
- }
- }
- else if (textField==_huiyiLabel)
- {
- if (toBeString.length > 17)
- {
- textField.text = [toBeString substringToIndex:17];
- [self.view endEditing: YES];
- [KPromptBox showKPromptBoxWithMassage:Localized(@"UU_work_OA_MM_CreateMeeting_title6")];
- }
- }
- else if (textField==_huiyijiesao)
- {
- if (toBeString.length > 17)
- {
- textField.text = [toBeString substringToIndex:17];
- [self.view endEditing: YES];
- [KPromptBox showKPromptBoxWithMassage:Localized(@"UU_work_OA_MM_CreateMeeting_title6")];
- }
- }
-
- }
- -(void)viewWillAppear:(BOOL)animated{
- [[NSNotificationCenter defaultCenter] postNotificationName:@"hiddenTabBar"object:nil];
- }
- @end
|