angular.module('push')
.controller('recordInfoAccountCtrl', function ($scope,ActivityService,$stateParams,$timeout, $rootScope, $ionicSlideBoxDelegate,$ionicScrollDelegate,
UtilService, UserService, ConfigService, ModelService, $ionicListDelegate, DockingService,
TechnicalBrokerPublishTrainService, roleService) {
//TODO
if($scope.app){
$scope.setStatusBar(1);
}
// $scope.userid = 653;
$scope.userid = UserService.id;
$scope.orgid = 0;//再次录入需要
// $scope.userid = 1;
// 搜索关键词
$scope.keyword = "";
// 我的数据库分页索引值,默认第一页:1
$scope.pagenum = 1;
// 我的当前页,分页加载用
$scope.isload = false;
// 我的录入记录总数
$scope.totalCount = 0;
// 所有云录入,默认文件夹0
$scope.claid = 0;
// 我的录入记录列表
$scope.recordList = [];
// 所有数据库分页索引值,默认第一页:1
$scope.pagenumall = 1;
// 所有当前页,分页加载用
$scope.isloadall = false;
// 初始化文件夹列表
$scope.folderlist = [];
// 云录入记录列表
$scope.allVisitTaskRecordList = [];
// 我的录入记录总数
$scope.allTotalCount = 0;
// 获取模版列表的传参
$scope.roleModel=
{
//TODO
funid: 2,//所属功能:1走访、2录入等
roleidList: []// 角色数组
};
/*参数设置*/
/*========================================================================================================================*/
/*逻辑操作*/
//根据角色获取所有模版
$scope.rolePageList = [];
$scope.roleModel.roleidList.push(0);// 角色默认一笔0,否则后台 in查询会报错
var getRolePageList = function () {
if (UtilService.isDefined(UserService.role)) {
angular.forEach(UserService.role, function (value, index) {
$scope.roleModel.roleidList.push(value.roleid);
});
}
$scope.roleModel.node=UserService.node;
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-basic-info'
:val.pagename=='需求信息'?'iconfont-demand'
:val.pagename=='成果信息'?'iconfont-achievement'
:val.pagename=='产品信息'?'iconfont-product'
:val.pagename=='专利信息'?'iconfont-patents'
:val.pagename=='人才信息'?'iconfont-talents'
:val.pagename=='月报表'?'iconfont-report-form'
:val.pagename=='项目转化'?'iconfont-transform'
:val.pagename=='对接录入'?'iconfont-butt-joint'
:'ion-compose';
})
}, function () {
})
};
getRolePageList();
// 获取我的录入列表
var getMyInterviewList = function () {
$scope.showLoadingToast();
TechnicalBrokerPublishTrainService.getMyInterviewList($scope.keyword, $scope.userid, $scope.pagenum, 2,UserService.node).then(function (response) {
console.log(response);
$scope.recordList = response.data;
// page分页信息
var temppage = angular.fromJson(response.page);
// 记录总数
$scope.totalCount = temppage.totalCount;
var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize);
var trHtml = "
更新了" + $scope.recordList.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;
}, 1000);
$scope.hideLoadingToast();
$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.keyword, $scope.userid, $scope.pagenum, 2,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);
//加载数据,更新当前页数
$timeout(function () {
if ($scope.recordList.length > 0) {
$scope.recordList = $scope.recordList.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');
});
};
$scope.goDetail = function (pagecode,connid,node,templettype,orgid,name,orgtype,resource) {
// $scope.go('resourceCommonInfoDetailsPage',{orgtype:orgtype,pagecode:pagecode,pagename:pagename,id:id,isedit:isedit,connid:connid,node:node})
console.log(node);
if(templettype==10){
$scope.go('reportDetail',{pageTitle:name,pageid:templettype,orgid:orgid,isedit:true})
// }else if(templettype==4){
// $scope.go('taskDetail',{
// // resid:,
// node:node,
// title:name,
// restype:1,
// comefrom:'myTask',
// // actions:
// });
}else{
$scope.go('resourceCommonInfoDetailsPage', {
resid: connid,
isAllVisitor: 0,
pagecode: pagecode,
node: node,
comfrom: 'typein',//录入信息
orgtype:orgtype,
templettype:templettype,
label:JSON.stringify(resource.otherObj),
});
}
};
//弹出各类按钮
$scope.showAnthorBtnWrap=false;
$scope.goEnterCompanyInfo=function () {
$scope.showAnthorBtnWrap=true;
};
//隐藏各类按钮
$scope.hideAnthorBtnWrap=function () {
$scope.showAnthorBtnWrap=false;
};
var hideAnthorBtnf=function () {
$scope.showAnthorBtnWrap=false;
$("ion-nav-view[name='tab-activityIndex']").css("z-index","1");
};
// $scope.jumpQuick=function (ind) {
// switch (ind){
// case 3:
// $scope.go("unitOrPersonalBaseInfo", {pageid: ind, isedit: 0});
// break;
// case 4:
// $scope.go("recordDemandInfo", {pageid: ind, isedit: 0});
// break;
// case 5:
// $scope.go("recordAchievementsInfo", {pageid: ind, isedit: 0});
// break;
// case 6:
// $scope.go("recordProductInfo", {pageid: ind, isedit: 0});
// break;
// case 7:
// $scope.go("recordPatentInfo", {pageid: ind, isedit: 0});
// break;
// case 8:
// $scope.go("recordTalentInfo", {pageid: ind, isedit: 0});
// break;
// default: return;
// }
// hideAnthorBtnf();
// };
$scope.jumpQuick=function (orgtype,pagecode,pagename,id,isedit) {
// console.log(1);
// $scope.go('typeinAllModal', {companyid: 0, pageid: id, orgtype: orgtype,pagecode:pagecode, isedit: isedit,node:UserService.node});
if(id==10){
$scope.go('reportEditModal',{pageTitle:'报表录入',pageid:id})
}else if(id==16){
$scope.go('dockingInput',{comfrom: "dockingInput",companyName: "",companyid: 0,taskId: "",taskTitle: ""})
}else{
if (UserService.node == '330122000' && id == 4) {
$scope.go('visitModularFormDemand', {
companyid: 0,
pageid: id,
orgtype: orgtype,
pagecode: pagecode,
isedit: isedit,
node: UserService.node,
pageTitle: '新建录入'
});
} else {
$scope.go('visitModularForm', {
companyid: 0,
pageid: id,
orgtype: orgtype,
pagecode: pagecode,
isedit: isedit,
node: UserService.node,
pageTitle: '新建录入'
});
}
}
hideAnthorBtnf();
};
//共享文件夹
//展开按钮
$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) {
$scope.orgid = companyid;
//弹出新建录入按钮
$scope.goEnterCompanyInfo();
};
// 各模版快捷入口页面跳转
$scope.jumpPage = function (companyid, pageid, orgtype) {
$scope.go('visitModularForm', {companyid: companyid, pageid: pageid, orgtype: orgtype, isedit: 0, pageTitle:'新建走访'});
};
//虚拟搜索框
$scope.isShowSearchButton = true;
$scope.keyfilter = {key: ""};//搜索关键词
$scope.showSearchButtonLeft = function () {
$scope.isShowSearchButton = false;
$(".showSearchInput").focus();
};
//清空搜索内容
$scope.clearSearch = function () {
$scope.isShowSearchButton = true;
$scope.keyfilter.key = "";
};
//TODO 放开注释
if($scope.app){
if (device.platform != "Android") {
$scope.isIos=true;
}else{
$scope.isIos=false;
}
}
$scope.defaultLan = UserService.defaultLan;
$scope.gobackFromBack=function(){
$scope.goback();
}
});