recordInfoDetailCtrl.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. angular.module('push')
  2. .controller('recordInfoDetailCtrl', function ($scope, $timeout, $stateParams,roleService,dataToolsService,
  3. UtilService,UserService, $ionicActionSheet,ConstantService, TechnicalBrokerPublishTrainService ) {
  4. //TODO
  5. var connid = $stateParams.connid;
  6. // var connid = 314;
  7. //切换到对应页面
  8. $scope.activity=[];
  9. $scope.imagelist = [];
  10. $scope.recordDetailInfo={
  11. /*className:'demandInfo',
  12. name:'',
  13. achieveMentsInfoList:[{}, {}], //成果信息
  14. patentInfoList:[{}],//专利信息
  15. produceInfoList:[{},{}],//产品信息
  16. talentInfoList:[{},{}],//人才信息
  17. demandInfoList:[{},{}]//需求信息*/
  18. };
  19. //录入历史
  20. $scope.recordHistoryInfoList=[];
  21. $scope.act = "";
  22. $scope.headerName = "";
  23. // $scope.recordDetailInfo={
  24. // className:'',
  25. // name:'',
  26. // achieveMentsInfoList:[], //成果信息
  27. // patentInfoList:[],//专利信息
  28. // produceInfoList:[],//产品信息
  29. // talentInfoList:[],//人才信息
  30. // demandInfoList:[]//需求信息
  31. // };
  32. //根据模版获取所有模块
  33. var getRolePageSectionList = function () {
  34. roleService.getRolePageSectionList($scope.rolePageModel).then(function (response) {
  35. //console.log("==============获取所有模块================");
  36. //console.log(response.data);
  37. // 基本信息
  38. $scope.sectionList = response.data.sectionList;
  39. if (UtilService.isDefined($scope.sectionList)) {
  40. angular.forEach($scope.sectionList, function (value) {
  41. var baseactivity = {
  42. className:'',
  43. headerName:''
  44. };
  45. baseactivity.className = value.seccode;// 模块编号
  46. baseactivity.headerName = value.secname;// 模块名称
  47. $scope.activity.push(baseactivity);
  48. if ($scope.activity.length > 0) {
  49. $scope.act = $scope.activity[0].className;
  50. $scope.headerName = $scope.activity[0].headerName;
  51. }
  52. });
  53. }
  54. //console.log($scope.activity);
  55. }, function () {
  56. })
  57. };
  58. //获取录入历史履历
  59. var getHistoryInterviewList = function (orgid, userid) {
  60. TechnicalBrokerPublishTrainService.getHistoryInterviewList("", userid, orgid, 1, 2).then(function (response) {
  61. if(UtilService.isDefined(response.data)){
  62. // 获取走访录入界面的传参
  63. $scope.rolePageModel=
  64. {
  65. //TODO
  66. id: response.data.templettype,// 模版id
  67. orgtype: 0// 走访对应的机构类型
  68. };
  69. //console.log("==============================");
  70. //console.log(response);
  71. // 录入历史
  72. $scope.historyInterviewList = response.data;
  73. }
  74. }, function () {
  75. });
  76. };
  77. //获取录入详情
  78. var getPublicResourceList = function () {
  79. dataToolsService.getConnectioninfoDetailByConnid(connid).then(function (response) {
  80. if(UtilService.isDefined(response.data)){
  81. //模版编号
  82. $scope.pageid = response.data.templettype;
  83. // 获取录入界面的传参
  84. $scope.rolePageModel=
  85. {
  86. //TODO
  87. id: response.data.templettype,// 模版id
  88. orgtype: 0// 走访对应的机构类型
  89. };
  90. //console.log("===============录入详情===============");
  91. //console.log(response);
  92. // 录入信息
  93. $scope.recordDetailInfo = response.data;
  94. $scope.imagelist = response.data.imagelist;
  95. var orgid = 0;
  96. if(UtilService.isDefined($scope.recordDetailInfo.organizationInfo)){
  97. orgid = $scope.recordDetailInfo.organizationInfo.id;
  98. }
  99. if($scope.recordDetailInfo.ishigh == 1){
  100. $scope.recordDetailInfo.ishighInfo="是";
  101. }else{
  102. $scope.recordDetailInfo.ishighInfo="否";
  103. }
  104. // 获取录入时的模版对应的模块列表,详情页只显示对应的模块
  105. $timeout(function () {
  106. getRolePageSectionList();
  107. //1:云走访,传递用户id=0,0是我的走访,传递登录用户
  108. var userid = UserService.id;
  109. getHistoryInterviewList(orgid, userid);
  110. }, 300);
  111. }
  112. }, function () {
  113. });
  114. };
  115. getPublicResourceList();
  116. //打开操作表:设置/编辑
  117. $scope.openActionSheet = function () {
  118. // isedit:是否可以编辑资源,isset:是否可以设置权限
  119. var buttonlist = [];
  120. if ($scope.recordDetailInfo.ishasset) {
  121. buttonlist.push({text: '设置'});
  122. buttonlist.push({text: '编辑'});
  123. }
  124. $ionicActionSheet.show({
  125. buttons: buttonlist,
  126. cancelText: '取消',
  127. buttonClicked: function (index) {
  128. if (index == 0) {
  129. console.log($scope.recordDetailInfo.typecodemap);
  130. $scope.go("selectFieldsToSet", {
  131. typecodemap: $scope.recordDetailInfo.typecodemap,
  132. resid: connid,
  133. typecode: ConstantService.TABLE_CODE_300031
  134. });
  135. }
  136. else if (index = 1) {
  137. console.log('编辑');
  138. switch ($scope.pageid) {
  139. case 3:
  140. $scope.go("unitOrPersonalBaseInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  141. break;
  142. case 4:
  143. $scope.go("recordDemandInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  144. break;
  145. case 5:
  146. $scope.go("recordAchievementsInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  147. break;
  148. case 6:
  149. $scope.go("recordProductInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  150. break;
  151. case 7:
  152. $scope.go("recordPatentInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  153. break;
  154. case 8:
  155. $scope.go("recordTalentInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  156. break;
  157. case 9:
  158. $scope.go("unitOrPersonalBaseInfo", {pageid: $scope.pageid, connid: connid, isedit: 1});
  159. break;
  160. default:
  161. return;
  162. }
  163. return true;
  164. }
  165. }
  166. });
  167. };
  168. //进入资源详情
  169. $scope.jumpResourceDetail = function (company) {
  170. // 再跳转到资源详情页
  171. $scope.go('resourceCommonDetailsPage', {
  172. recourceid: company.resourcelibrary.id,
  173. recourcetype: company.resourcelibrary.restype,
  174. recourcecomefrom: company.resourcelibrary.comefrom,
  175. creator: company.resourcelibrary.creator
  176. });
  177. };
  178. // 点击录入历史进入录入详情页
  179. $scope.goDetail = function (historyconnid) {
  180. $scope.go("recordInfoDetail", {connid: historyconnid});
  181. };
  182. // 点击头像或名字进入个人主页
  183. $scope.goPublisher = function (userid) {
  184. if (userid != 0) {
  185. $scope.go('publisher', {Id: userid});
  186. }
  187. };
  188. });