angular.module('push') .controller('technicalBrokerEnterCompanyInfoCtrl', function ($scope, $state, ActivityService, $ionicPopup, $stateParams, $timeout, $rootScope, $ionicSlideBoxDelegate, $ionicScrollDelegate, UtilService, UserService, ConfigService, ModelService, $ionicListDelegate, DockingService, TechnicalBrokerPublishTrainService, roleService) { $scope.defaultLan = UserService.defaultLan; $scope.user = UserService.user; var loadflg = false; //TODO if ($scope.app) { $scope.setStatusBar(1); } $scope.noData = false; $scope.userid = UserService.id; $scope.orgid = 0;//再次走访需要 // $scope.userid = 1; // 搜索关键词 // $scope.keyfilter.key = ""; $scope.keyfilter = { key: '' } // 我的数据库分页索引值,默认第一页:1 $scope.pagenum = 1; // 我的当前页,分页加载用 $scope.isload = false; // 我的走访记录总数 $scope.totalCount = 0; // 所有云走访,默认文件夹0 $scope.claid = 0; // 我的走访记录列表 $scope.visitTaskRecordList = []; // 所有数据库分页索引值,默认第一页:1 $scope.pagenumall = 1; // 所有当前页,分页加载用 $scope.isloadall = false; // 初始化文件夹列表 $scope.folderlist = []; // 云走访记录列表 $scope.allVisitTaskRecordList = []; // 我的走访记录总数 $scope.allTotalCount = 0; // 获取评论列表的传参 $scope.roleModel = { //TODO funid: 1,//所属功能:1走访、2录入等 roleidList: []// 角色数组 }; // 走访录入回跳 $scope.gobackFromBack = function () { if ($stateParams.comfrom == 'homepageOfNode') { // location.href=localStorage.url; $scope.go('homepageOfNode'); } else if ($stateParams.comfrom == 'tab.account') { $scope.go('tab.account'); } else { $scope.go('tab.activityIndex'); } } /*参数设置*/ /*========================================================================================================================*/ /*逻辑操作*/ //根据角色获取所有模版 $scope.rolePageList = []; $scope.roleModel.roleidList.push(0);// 角色默认一笔0,否则后台 in查询会报错 // $scope.showLoadingToast(); var getRolePageList = function () { if (UtilService.isDefined(UserService.role)) { angular.forEach(UserService.role, function (value, index) { $scope.roleModel.roleidList.push(value.roleid); }); } // console.log($scope.roleModel); $scope.roleModel.node = UserService.node; // $scope.roleModel.uId = UserService.id; // console.log( $scope.roleModel) roleService.getRolePageList($scope.roleModel).then(function (response) { // console.log("=============================="); console.log(response); // 模版列表 $scope.rolePageList = response.data; angular.forEach($scope.rolePageList, function (val) { val.logo = val.pagename == '走企业' ? 'iconfont-enterprise' : val.pagename == '走高校' ? 'iconfont-colleges' : val.pagename == '走访' ? 'iconfont-interview' : val.pagename == '数据导入' ? 'iconfont-import' : 'ion-compose'; }) // console.log(response.data); }, function () { }) }; getRolePageList(); //进入云文件夹详情 $scope.goSpecifyFolder = function (folder) { $scope.go('cloudFolderDetail', {folder: angular.toJson(folder)}); }; // 获取我的走访列表 var getMyInterviewList = function () { // $scope.showLoadingToast(); TechnicalBrokerPublishTrainService.getMyInterviewList($scope.keyfilter.key, $scope.userid, $scope.pagenum, 1,UserService.node).then(function (response) { // console.log(response); $scope.visitTaskRecordList = response.data; angular.forEach($scope.visitTaskRecordList, function (val) { angular.forEach(val.userlist, function (value) { if (!/http/g.test(value.photo)) { value.photo = ConfigService.imgurl + value.photo; } }) val.allLables = val.otherObj ? val.otherObj.slice(0, 3) : []; }) // page分页信息 var temppage = angular.fromJson(response.page); // 记录总数 $scope.totalCount = temppage.totalCount; var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize); var trHtml = "
更新了" + $scope.visitTaskRecordList.length + "条内容
"; $timeout(function () { $(".resourcelistDiv .list").prepend(trHtml); $(".refresh_tip_div").animate({width: 100 + "%"}, 150); }, 800); $timeout(function () { $(".refresh_tip_div").slideUp(); }, 1200); //判断是否有下一页 $timeout(function () { // $timeout(function () { if (temppage.currentPage >= totalPage) { $scope.isload = false; } else { $scope.isload = true; } $scope.pagenum = 2; // $scope.noData=true; $scope.hideLoadingToast(); // }, 1000); $ionicSlideBoxDelegate.update(); $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0); }, 50); }, function () { $scope.hideLoadingToast(); }).finally(function () { $scope.$broadcast('scroll.refreshComplete'); }); }; getMyInterviewList(); // 加载更多我的走访列表 $scope.loadMore = function () { // $scope.showLoadingToast(); $scope.isload = false; $scope.loadmore = true; TechnicalBrokerPublishTrainService.getMyInterviewList($scope.keyfilter.key, $scope.userid, $scope.pagenum, 1,UserService.node).then(function (response) { // console.log(response); var tempreslib = angular.fromJson(response.data); // page分页信息 var temppage = angular.fromJson(response.page); var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize); //加载数据,更新当前页数 angular.forEach(tempreslib, function (val) { angular.forEach(val.userlist, function (value) { if (!/http/g.test(value.photo)) { value.photo = ConfigService.imgurl + value.photo; } }) val.allLables = val.otherObj ? val.otherObj.slice(0, 3) : []; }) $timeout(function () { if ($scope.visitTaskRecordList.length > 0) { $scope.visitTaskRecordList = $scope.visitTaskRecordList.concat(tempreslib); } $scope.loadmore = false; }, 1000); //判断是否有下一页 $timeout(function () { if (temppage.currentPage >= totalPage) { $scope.isload = false; } else { $scope.isload = true; } $scope.pagenum++; $scope.hideLoadingToast(); }, 1000); }, function () { $scope.hideLoadingToast(); $scope.loadmore = false; }).finally(function () { $scope.$broadcast('scroll.infiniteScrollComplete'); }); }; // 获取全部走访列表: // 列表模式(默认) // 第一页是文件夹列表,文件夹分页 // 第二页是文件夹+走访记录列表,文件夹不分页,记录分页 var getAllInterviewList = function () { $scope.showLoadingToast(); TechnicalBrokerPublishTrainService.getAllInterviewListByList($scope.keyfilter.key, $scope.userid, $scope.pagenumall, 1).then(function (response) { // console.log(response); if (UtilService.isDefined(response.data)) { $scope.allVisitTaskRecordList = response.data; } else { $scope.allVisitTaskRecordList = []; } if ($scope.allVisitTaskRecordList.length > 0) { $scope.noData = false; } else { $scope.noData = true; } angular.forEach($scope.allVisitTaskRecordList, function (val) { angular.forEach(val.userlist, function (value) { if (!/http/g.test(value.photo)) { value.photo = ConfigService.imgurl + value.photo; } }) val.allLables = val.otherObj ? val.otherObj.slice(0, 3) : []; }) console.log($scope.allVisitTaskRecordList); // page分页信息 var temppage = angular.fromJson(response.page); // 记录总数 $scope.allTotalCount = (temppage == null ? 0 : temppage.totalCount); var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize); var trHtml = "
更新了" + $scope.allVisitTaskRecordList.length + "条内容
"; $timeout(function () { $(".resourcelistDiv .list").prepend(trHtml); $(".refresh_tip_div").animate({width: 100 + "%"}, 150); }, 800); $timeout(function () { $(".refresh_tip_div").slideUp(); }, 1200); //判断是否有下一页 $timeout(function () { $timeout(function () { if (temppage.currentPage >= totalPage) { $scope.isloadall = false; } else { $scope.isloadall = true; } $scope.pagenumall = 2; $scope.hideLoadingToast(); }, 1000); $ionicSlideBoxDelegate.update(); $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0); }, 50); }, function () { $scope.hideLoadingToast(); }).finally(function () { $scope.$broadcast('scroll.refreshComplete'); }); }; getAllInterviewList(); // 加载更多全部走访列表 // 列表模式(默认) $scope.allloadMore = function () { // $scope.showLoadingToast(); $scope.isloadall = false; $scope.allloadmore = true; TechnicalBrokerPublishTrainService.getAllInterviewListByList($scope.keyfilter.key, $scope.userid, $scope.pagenumall, 1).then(function (response) { // console.log(response); var tempreslib = angular.fromJson(response.data); // page分页信息 var temppage = angular.fromJson(response.page); var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize); //加载数据,更新当前页数 angular.forEach(tempreslib, function (val) { angular.forEach(val.userlist, function (value) { if (!/http/g.test(value.photo)) { value.photo = ConfigService.imgurl + value.photo; } }) val.allLables = val.otherObj ? val.otherObj.slice(0, 3) : []; }) $timeout(function () { if ($scope.allVisitTaskRecordList.length > 0) { $scope.allVisitTaskRecordList = $scope.allVisitTaskRecordList.concat(tempreslib); } $scope.allloadmore = false; }, 1000); //判断是否有下一页 $timeout(function () { if (temppage.currentPage >= totalPage) { $scope.isloadall = false; } else { $scope.isloadall = true; } $scope.pagenumall++; $scope.hideLoadingToast(); }, 1000); }, function () { $scope.hideLoadingToast(); $scope.allloadmore = false; }).finally(function () { $scope.$broadcast('scroll.infiniteScrollComplete'); }); }; /*// 获取全部走访列表: // 文件夹模式 暂时不显示 // 第一页是文件夹列表,文件夹分页 // 第二页是文件夹+走访记录列表,文件夹不分页,记录分页 var getAllInterviewList = function () { $scope.showLoadingToast(); TechnicalBrokerPublishTrainService.getAllInterviewListByFold($scope.keyfilter.key, $scope.userid, $scope.pagenumall, $scope.claid).then(function (response) { console.log(response); $scope.folderlist = response.arrayList; /!* if(UtilService.isDefined(response.data)){ $scope.allVisitTaskRecordList = response.data; }*!/ // page分页信息 var temppage = angular.fromJson(response.page); // 记录总数 $scope.allTotalCount = temppage.totalCount; var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize); var trHtml = "
更新了" + $scope.folderlist.length + "条内容
"; $timeout(function () { $(".resourcelistDiv .list").prepend(trHtml); $(".refresh_tip_div").animate({width: 100 + "%"}, 150); }, 800); $timeout(function () { $(".refresh_tip_div").slideUp(); }, 1200); //判断是否有下一页 $timeout(function () { $timeout(function () { if (temppage.currentPage >= totalPage) { $scope.isloadall = false; } else { $scope.isloadall = true; } $scope.pagenumall = 2; }, 1000); $scope.hideLoadingToast(); $ionicSlideBoxDelegate.update(); $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0); }, 50); }, function () { $scope.hideLoadingToast(); }).finally(function () { $scope.$broadcast('scroll.refreshComplete'); }); }; getAllInterviewList(); // 加载更多全部走访列表 // 文件夹模式 $scope.allloadMore = function () { $scope.showLoadingToast(); $scope.isloadall = false; $scope.allloadmore = true; TechnicalBrokerPublishTrainService.getAllInterviewListByFold($scope.keyfilter.key, $scope.userid, $scope.pagenumall, $scope.claid).then(function (response) { console.log(response); var tempreslib = angular.fromJson(response.arrayList); // page分页信息 var temppage = angular.fromJson(response.page); var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize); //加载数据,更新当前页数 $timeout(function () { if ($scope.folderlist.length > 0) { $scope.folderlist = $scope.folderlist.concat(tempreslib); } $scope.allloadmore = false; }, 1000); //判断是否有下一页 $timeout(function () { if (temppage.currentPage >= totalPage) { $scope.isloadall = false; } else { $scope.isloadall = true; } $scope.pagenumall++; $scope.hideLoadingToast(); }, 1000); }, function () { $scope.hideLoadingToast(); $scope.allloadmore = false; }).finally(function () { $scope.$broadcast('scroll.infiniteScrollComplete'); }); };*/ //获取企业信息列表 $scope.companylist = [ { logo: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2102756011,2989429775&fm=27&gp=0.jpg", companyname: "企业A", ishigh: "1", industry: "产业领域" }, { logo: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2427437564,310554570&fm=27&gp=0.jpg", companyname: "企业B", ishigh: "0", industry: "产业领域" }, { logo: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=733963650,3633348335&fm=27&gp=0.jpg", companyname: "企业C", ishigh: "1", industry: "产业领域" }, { logo: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1477507599,2478418295&fm=27&gp=0.jpg", companyname: "企业D", ishigh: "0", industry: "产业领域" }, { logo: "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=376390060,3966999180&fm=27&gp=0.jpg", companyname: "企业E", ishigh: "1", industry: "产业领域" } ]; $scope.islogin = ConfigService.islogin; $scope.goDetail = function (connid) { $scope.go("technicalBrokerCompanyInfo", {connid: connid}); }; //弹出各类按钮 $scope.showAnthorBtnWrap = false; $scope.goEnterCompanyInfo = function () { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.showAnthorBtnWrap = true; } }; //隐藏各类按钮 $scope.hideAnthorBtnWrap = function () { $scope.showAnthorBtnWrap = false; }; //切换到对应页面 var activity = ['selfDetailList', 'groupDetailList']; $scope.act = activity[1];//默认是全部走访记录 $scope.changeAct = function (num) { $scope.islogin = ConfigService.islogin; if (num == 0) { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.act = activity[num]; if ($scope.allVisitTaskRecordList.length > 0) { $scope.noData = false; } else { $scope.noData = true; } } } else if (num == 1) { $scope.act = activity[num]; if ($scope.allVisitTaskRecordList.length > 0) { $scope.noData = false; } else { $scope.noData = true; } } }; if ($stateParams.comfrom == 'tab.account') { $scope.changeAct(0);//默认是全部走访记录 } //共享文件夹 //展开按钮 $scope.showAction = function () { $scope.showMoreAction = !$scope.showMoreAction; }; //关闭按钮 $scope.actionButton_three = function () { $scope.showMoreAction = !$scope.showMoreAction; }; //进入设置资源库页面 $scope.goAutoritySet = function (reclib) { $timeout(function () { $ionicListDelegate.closeOptionButtons(); }, 10); if (UtilService.isDefined(reclib.localid)) { $scope.go("authorityLocalSet", {authoritydata: angular.toJson(reclib), type: 0, goflg: 0}); } else { $scope.go("authoritySet", { reclibid: reclib.id, authorityid: reclib.authorityid, authoritycomefrom: reclib.authoritycomefrom, name: reclib.name, content: reclib.content, sort: reclib.sort, type: 0, parentid: reclib.parentid }); } }; //新建记录 $scope.addRecord = function () { if ($scope.folderlist.length < 1) { UtilService.showMess("您还没有文件夹,去新建文件夹吧"); return; } ModelService.setCreateType(0); ModelService.setCheckdeFolder($scope.folderlist[0]); $scope.go('cloudAddConnInfo'); }; //新建文件夹 $scope.buildNewFolder = function () { $scope.go("authorityCreate", {templettype: 2}); }; //进入分类详情,记录列表 $scope.queryFolder = function (folder) { $scope.go('cloudFolderDetail', {folder: angular.toJson(folder)}); }; //再次走访 $scope.repeatVisit = function (companyid, pageid, orgtype, name, pagecode, templettype, node) { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); return; } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } $scope.orgid = companyid; //弹出新建走访按钮 // $scope.goEnterCompanyInfo(); console.log({ companyid: companyid, pageid: templettype, orgtype: orgtype, pagecode: pagecode, isedit: 0, node: node, pageTitle: '新建走访', title: name }) $scope.go('visitModularForm', { companyid: companyid, pageid: templettype, orgtype: orgtype, pagecode: pagecode, isedit: 0, node: node, pageTitle: '新建走访', title: name }); }; // 各模版快捷入口页面跳转 $scope.jumpPage = function (companyid, pageid, orgtype, pagecode) { console.log(orgtype) if(orgtype=='10106'){ $scope.go('technicalBrokerExportCompanyInfo') }else { if ($scope.defaultLan == "Chinese") { $scope.go('visitModularForm', { companyid: companyid, pageid: pageid, orgtype: orgtype, pagecode: pagecode, isedit: 0, node: UserService.node, pageTitle: '新建走访' }); } else { $scope.go('visitModularForm', { companyid: companyid, pageid: pageid, orgtype: orgtype, pagecode: pagecode, isedit: 0, node: UserService.node, pageTitle: 'New Interview' }); } } // if(UserService.node=='320117005'||UserService.node=='320117003'||UserService.node=='320117002'||UserService.node=='320117001'||UserService.node=='320117004'){ // $scope.go('typeinAllModal', {companyid: 0, pageid: id, orgtype: orgtype,pagecode:pagecode, isedit: isedit,node:UserService.node}); // }else{ // $scope.go('typeinInformation',{orgtype:orgtype,pagecode:pagecode,pagename:pagename,id:id,isedit:isedit}) // } }; // 点击企业名称进入该企业的最新履历页面 $scope.gotoConnInfoDetail = function (resid, pagecode, node, orgtype, templettype, resource) { // console.log(resid,pagecode,node,orgtype,templettype); $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { switch ($scope.act) { case "selfDetailList": $scope.isAllVisitor = 0; break; case "groupDetailList": $scope.isAllVisitor = 1; break; } $scope.go('resourceCommonInfoDetailsPage', { resid: resid, isAllVisitor: $scope.isAllVisitor, pagecode: pagecode, node: node, orgtype: orgtype, templettype: templettype, label: JSON.stringify(resource.otherObj), }); } }; //返回至首页 $scope.gotoHome = function () { $(".tab_hide").hide(); $state.go('tab.activityIndex'); }; //进入资源库发布者列表 $scope.goResourcePublisher = function (userlist) { $scope.go('resourcePublisherAccount', {userlist: userlist}); }; //虚拟搜索框 $scope.isShowSearchButton = true; $scope.keyfilter = {key: ""};//搜索关键词 $scope.showSearchButtonLeft = function () { $scope.isShowSearchButton = false; $timeout(function () { $(".showSearchInput").focus(); }, 300) }; //清空搜索内容 $scope.clearSearch = function () { $scope.isShowSearchButton = true; $scope.keyfilter.key = ""; $scope.searchList(); }; //TODO 放开注释 if ($scope.app) { if (device.platform != "Android") { $scope.isIos = true; } else { $scope.isIos = false; } } $scope.searchList = function () { // $scope.showLoadingToast(); if ($scope.act == 'selfDetailList') { $scope.pagenum = 1; getMyInterviewList(); } else { $scope.pagenumall = 1; getAllInterviewList(); } } });