recordModalCtrl.js 8.5 KB

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