recordInfoAccountCtrl.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. angular.module('push')
  2. .controller('recordInfoAccountCtrl', function ($scope,ActivityService,$stateParams,$timeout, $rootScope, $ionicSlideBoxDelegate,$ionicScrollDelegate,
  3. UtilService, UserService, ConfigService, ModelService, $ionicListDelegate, DockingService,
  4. TechnicalBrokerPublishTrainService, roleService) {
  5. //TODO
  6. if($scope.app){
  7. $scope.setStatusBar(1);
  8. }
  9. // $scope.userid = 653;
  10. $scope.userid = UserService.id;
  11. $scope.orgid = 0;//再次录入需要
  12. // $scope.userid = 1;
  13. // 搜索关键词
  14. $scope.keyword = "";
  15. // 我的数据库分页索引值,默认第一页:1
  16. $scope.pagenum = 1;
  17. // 我的当前页,分页加载用
  18. $scope.isload = false;
  19. // 我的录入记录总数
  20. $scope.totalCount = 0;
  21. // 所有云录入,默认文件夹0
  22. $scope.claid = 0;
  23. // 我的录入记录列表
  24. $scope.recordList = [];
  25. // 所有数据库分页索引值,默认第一页:1
  26. $scope.pagenumall = 1;
  27. // 所有当前页,分页加载用
  28. $scope.isloadall = false;
  29. // 初始化文件夹列表
  30. $scope.folderlist = [];
  31. // 云录入记录列表
  32. $scope.allVisitTaskRecordList = [];
  33. // 我的录入记录总数
  34. $scope.allTotalCount = 0;
  35. // 获取模版列表的传参
  36. $scope.roleModel=
  37. {
  38. //TODO
  39. funid: 2,//所属功能:1走访、2录入等
  40. roleidList: []// 角色数组
  41. };
  42. /*参数设置*/
  43. /*========================================================================================================================*/
  44. /*逻辑操作*/
  45. //根据角色获取所有模版
  46. $scope.rolePageList = [];
  47. $scope.roleModel.roleidList.push(0);// 角色默认一笔0,否则后台 in查询会报错
  48. var getRolePageList = function () {
  49. if (UtilService.isDefined(UserService.role)) {
  50. angular.forEach(UserService.role, function (value, index) {
  51. $scope.roleModel.roleidList.push(value.roleid);
  52. });
  53. }
  54. $scope.roleModel.node=UserService.node;
  55. roleService.getRolePageList($scope.roleModel).then(function (response) {
  56. // console.log("==============================");
  57. // console.log(response);
  58. // 模版列表
  59. $scope.rolePageList = response.data;
  60. angular.forEach($scope.rolePageList,function(val){
  61. val.logo=val.pagename=='基本信息'?'iconfont-basic-info'
  62. :val.pagename=='需求信息'?'iconfont-demand'
  63. :val.pagename=='成果信息'?'iconfont-achievement'
  64. :val.pagename=='产品信息'?'iconfont-product'
  65. :val.pagename=='专利信息'?'iconfont-patents'
  66. :val.pagename=='人才信息'?'iconfont-talents'
  67. :val.pagename=='月报表'?'iconfont-report-form'
  68. :val.pagename=='项目转化'?'iconfont-transform'
  69. :val.pagename=='对接录入'?'iconfont-butt-joint'
  70. :'ion-compose';
  71. })
  72. }, function () {
  73. })
  74. };
  75. getRolePageList();
  76. // 获取我的录入列表
  77. var getMyInterviewList = function () {
  78. $scope.showLoadingToast();
  79. TechnicalBrokerPublishTrainService.getMyInterviewList($scope.keyword, $scope.userid, $scope.pagenum, 2,UserService.node).then(function (response) {
  80. console.log(response);
  81. $scope.recordList = response.data;
  82. // page分页信息
  83. var temppage = angular.fromJson(response.page);
  84. // 记录总数
  85. $scope.totalCount = temppage.totalCount;
  86. var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize);
  87. var trHtml = "<div class='refresh_tip_div'>更新了" + $scope.recordList.length + "条内容</div>";
  88. $timeout(function () {
  89. $(".resourcelistDiv .list").prepend(trHtml);
  90. $(".refresh_tip_div").animate({width: 100 + "%"}, 150);
  91. }, 800);
  92. $timeout(function () {
  93. $(".refresh_tip_div").slideUp();
  94. }, 1200);
  95. //判断是否有下一页
  96. $timeout(function () {
  97. $timeout(function () {
  98. if (temppage.currentPage >= totalPage) {
  99. $scope.isload = false;
  100. } else {
  101. $scope.isload = true;
  102. }
  103. $scope.pagenum = 2;
  104. }, 1000);
  105. $scope.hideLoadingToast();
  106. $ionicSlideBoxDelegate.update();
  107. $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0);
  108. }, 50);
  109. }, function () {
  110. $scope.hideLoadingToast();
  111. }).finally(function () {
  112. $scope.$broadcast('scroll.refreshComplete');
  113. });
  114. };
  115. getMyInterviewList();
  116. // 加载更多我的录入列表
  117. $scope.loadMore = function () {
  118. $scope.showLoadingToast();
  119. $scope.isload = false;
  120. $scope.loadmore = true;
  121. TechnicalBrokerPublishTrainService.getMyInterviewList($scope.keyword, $scope.userid, $scope.pagenum, 2,UserService.node).then(function (response) {
  122. // console.log(response);
  123. var tempreslib = angular.fromJson(response.data);
  124. // page分页信息
  125. var temppage = angular.fromJson(response.page);
  126. var totalPage = Math.ceil(temppage.totalCount / temppage.pageSize);
  127. //加载数据,更新当前页数
  128. $timeout(function () {
  129. if ($scope.recordList.length > 0) {
  130. $scope.recordList = $scope.recordList.concat(tempreslib);
  131. }
  132. $scope.loadmore = false;
  133. }, 1000);
  134. //判断是否有下一页
  135. $timeout(function () {
  136. if (temppage.currentPage >= totalPage) {
  137. $scope.isload = false;
  138. } else {
  139. $scope.isload = true;
  140. }
  141. $scope.pagenum++;
  142. $scope.hideLoadingToast();
  143. }, 1000);
  144. }, function () {
  145. $scope.hideLoadingToast();
  146. $scope.loadmore = false;
  147. }).finally(function () {
  148. $scope.$broadcast('scroll.infiniteScrollComplete');
  149. });
  150. };
  151. $scope.goDetail = function (pagecode,connid,node,templettype,orgid,name,orgtype,resource) {
  152. // $scope.go('resourceCommonInfoDetailsPage',{orgtype:orgtype,pagecode:pagecode,pagename:pagename,id:id,isedit:isedit,connid:connid,node:node})
  153. console.log(node);
  154. if(templettype==10){
  155. $scope.go('reportDetail',{pageTitle:name,pageid:templettype,orgid:orgid,isedit:true})
  156. // }else if(templettype==4){
  157. // $scope.go('taskDetail',{
  158. // // resid:,
  159. // node:node,
  160. // title:name,
  161. // restype:1,
  162. // comefrom:'myTask',
  163. // // actions:
  164. // });
  165. }else{
  166. $scope.go('resourceCommonInfoDetailsPage', {
  167. resid: connid,
  168. isAllVisitor: 0,
  169. pagecode: pagecode,
  170. node: node,
  171. comfrom: 'typein',//录入信息
  172. orgtype:orgtype,
  173. templettype:templettype,
  174. label:JSON.stringify(resource.otherObj),
  175. });
  176. }
  177. };
  178. //弹出各类按钮
  179. $scope.showAnthorBtnWrap=false;
  180. $scope.goEnterCompanyInfo=function () {
  181. $scope.showAnthorBtnWrap=true;
  182. };
  183. //隐藏各类按钮
  184. $scope.hideAnthorBtnWrap=function () {
  185. $scope.showAnthorBtnWrap=false;
  186. };
  187. var hideAnthorBtnf=function () {
  188. $scope.showAnthorBtnWrap=false;
  189. $("ion-nav-view[name='tab-activityIndex']").css("z-index","1");
  190. };
  191. // $scope.jumpQuick=function (ind) {
  192. // switch (ind){
  193. // case 3:
  194. // $scope.go("unitOrPersonalBaseInfo", {pageid: ind, isedit: 0});
  195. // break;
  196. // case 4:
  197. // $scope.go("recordDemandInfo", {pageid: ind, isedit: 0});
  198. // break;
  199. // case 5:
  200. // $scope.go("recordAchievementsInfo", {pageid: ind, isedit: 0});
  201. // break;
  202. // case 6:
  203. // $scope.go("recordProductInfo", {pageid: ind, isedit: 0});
  204. // break;
  205. // case 7:
  206. // $scope.go("recordPatentInfo", {pageid: ind, isedit: 0});
  207. // break;
  208. // case 8:
  209. // $scope.go("recordTalentInfo", {pageid: ind, isedit: 0});
  210. // break;
  211. // default: return;
  212. // }
  213. // hideAnthorBtnf();
  214. // };
  215. $scope.jumpQuick=function (orgtype,pagecode,pagename,id,isedit) {
  216. // console.log(1);
  217. // $scope.go('typeinAllModal', {companyid: 0, pageid: id, orgtype: orgtype,pagecode:pagecode, isedit: isedit,node:UserService.node});
  218. if(id==10){
  219. $scope.go('reportEditModal',{pageTitle:'报表录入',pageid:id})
  220. }else if(id==16){
  221. $scope.go('dockingInput',{comfrom: "dockingInput",companyName: "",companyid: 0,taskId: "",taskTitle: ""})
  222. }else{
  223. if (UserService.node == '330122000' && id == 4) {
  224. $scope.go('visitModularFormDemand', {
  225. companyid: 0,
  226. pageid: id,
  227. orgtype: orgtype,
  228. pagecode: pagecode,
  229. isedit: isedit,
  230. node: UserService.node,
  231. pageTitle: '新建录入'
  232. });
  233. } else {
  234. $scope.go('visitModularForm', {
  235. companyid: 0,
  236. pageid: id,
  237. orgtype: orgtype,
  238. pagecode: pagecode,
  239. isedit: isedit,
  240. node: UserService.node,
  241. pageTitle: '新建录入'
  242. });
  243. }
  244. }
  245. hideAnthorBtnf();
  246. };
  247. //共享文件夹
  248. //展开按钮
  249. $scope.showAction = function () {
  250. $scope.showMoreAction = !$scope.showMoreAction;
  251. };
  252. //关闭按钮
  253. $scope.actionButton_three = function () {
  254. $scope.showMoreAction = !$scope.showMoreAction;
  255. };
  256. //进入设置资源库页面
  257. $scope.goAutoritySet = function (reclib) {
  258. $timeout(function () {
  259. $ionicListDelegate.closeOptionButtons();
  260. }, 10);
  261. if (UtilService.isDefined(reclib.localid)) {
  262. $scope.go("authorityLocalSet", {authoritydata: angular.toJson(reclib), type: 0, goflg: 0});
  263. } else {
  264. $scope.go("authoritySet", {
  265. reclibid: reclib.id,
  266. authorityid: reclib.authorityid,
  267. authoritycomefrom: reclib.authoritycomefrom,
  268. name: reclib.name,
  269. content: reclib.content,
  270. sort: reclib.sort,
  271. type: 0,
  272. parentid: reclib.parentid
  273. });
  274. }
  275. };
  276. //新建记录
  277. $scope.addRecord = function () {
  278. if ($scope.folderlist.length < 1) {
  279. UtilService.showMess("您还没有文件夹,去新建文件夹吧");
  280. return;
  281. }
  282. ModelService.setCreateType(0);
  283. ModelService.setCheckdeFolder($scope.folderlist[0]);
  284. $scope.go('cloudAddConnInfo');
  285. };
  286. //新建文件夹
  287. $scope.buildNewFolder = function () {
  288. $scope.go("authorityCreate", {templettype: 2});
  289. };
  290. //进入分类详情,记录列表
  291. $scope.queryFolder = function (folder) {
  292. $scope.go('cloudFolderDetail', {folder: angular.toJson(folder)});
  293. };
  294. //再次录入
  295. $scope.repeatVisit = function (companyid, pageid, orgtype) {
  296. $scope.orgid = companyid;
  297. //弹出新建录入按钮
  298. $scope.goEnterCompanyInfo();
  299. };
  300. // 各模版快捷入口页面跳转
  301. $scope.jumpPage = function (companyid, pageid, orgtype) {
  302. $scope.go('visitModularForm', {companyid: companyid, pageid: pageid, orgtype: orgtype, isedit: 0, pageTitle:'新建走访'});
  303. };
  304. //虚拟搜索框
  305. $scope.isShowSearchButton = true;
  306. $scope.keyfilter = {key: ""};//搜索关键词
  307. $scope.showSearchButtonLeft = function () {
  308. $scope.isShowSearchButton = false;
  309. $(".showSearchInput").focus();
  310. };
  311. //清空搜索内容
  312. $scope.clearSearch = function () {
  313. $scope.isShowSearchButton = true;
  314. $scope.keyfilter.key = "";
  315. };
  316. //TODO 放开注释
  317. if($scope.app){
  318. if (device.platform != "Android") {
  319. $scope.isIos=true;
  320. }else{
  321. $scope.isIos=false;
  322. }
  323. }
  324. $scope.defaultLan = UserService.defaultLan;
  325. $scope.gobackFromBack=function(){
  326. $scope.goback();
  327. }
  328. });