bpmDataTemplateController.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. var bpmDataTemplateApp = angular.module('bpmDataTemplateApp', [ 'baseServices','DataRightsApp' ]);
  2. bpmDataTemplateApp.controller('bpmDataTemplateCtrl',['$scope','BaseService','dataRightsService','$timeout',function($scope,BaseService,dataRightsService,$timeout){
  3. var service = dataRightsService;
  4. $scope.service = service;
  5. $timeout(function(){
  6. $scope.tab =$("#tab").ligerTab({});
  7. $scope.hasInitTab = 124;
  8. },100)
  9. service.init($scope);
  10. $scope.filterUrl = __ctx + "/platform/form/bpmDataTemplate/filterDialog.ht?tableId=";
  11. $scope.save = function(){
  12. if ($scope._validForm()) {
  13. /*if ($scope.dataRightsJson.id) {
  14. $scope.dataRightsJson.resetTemp="1";
  15. $.ligerDialog.confirm("保存会覆盖模板,如果修改了模板请手动保存模板后再进行保存业务数据模板,是否继续保存?","提示信息",function(rtn) {
  16. if (rtn) service.customFormSubmit(showResponse);
  17. });
  18. } else {
  19. service.customFormSubmit(showResponse);
  20. }*/
  21. service.customFormSubmit(showResponse);
  22. }
  23. }
  24. showResponse = function(responseText){
  25. $.ligerDialog.closeWaitting();
  26. var obj = new com.hotent.form.ResultMessage(responseText);
  27. if (obj.isSuccess()) {
  28. $.ligerDialog.confirm( obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
  29. if(rtn){
  30. var url=location.href.getNewUrl();
  31. window.location.href = location.href.getNewUrl();
  32. }else{
  33. $.closeWindow();
  34. }
  35. });
  36. } else {
  37. $.ligerDialog.error(obj.getMessage(),"提示信息");
  38. }
  39. }
  40. $scope._validForm = function (){
  41. var form=$('#dataRightsForm');
  42. if(!form.valid()) return false;
  43. //判断排序字段太多报错问题
  44. if($scope.sortFields&&$scope.sortFields.length>3){
  45. $.ligerDialog.error("排序字段不能设置超过3个,请检查!","提示信息");
  46. $scope.tab.selectTabItem("sortSetting");
  47. return false;
  48. }
  49. //判断管理字段
  50. if(service.manageFieldValid($scope.manageFields)){
  51. $.ligerDialog.error("功能按钮出现重复的类型,请检查!","提示信息");
  52. $scope.tab.selectTabItem("manageSetting");
  53. return false;
  54. }
  55. if($scope.dataRightsJson.templateAlias=="" || $scope.dataRightsJson.needPage ==""){
  56. $scope.tab.selectTabItem("baseSetting");
  57. $scope.form.valid();
  58. return false;
  59. }
  60. return true;
  61. }
  62. //预览
  63. $scope.preview = function (){
  64. var alias = $scope.dataRightsJson.formKey;
  65. if($.isEmpty(alias)){
  66. $.ligerDialog.error("请设置完信息保存后预览!","提示信息");
  67. return ;
  68. }
  69. var url=__ctx+ "/platform/form/bpmDataTemplate/dataList_"+ alias+".ht";
  70. url=url.getNewUrl();
  71. $.openFullWindow(url);
  72. }
  73. //编辑模板
  74. $scope.editTemplate = function (){
  75. var id = $scope.dataRightsJson.id;
  76. if($.isEmpty(id)){
  77. $.ligerDialog.error("请设置完信息保存后编辑模板!","提示信息");
  78. return ;
  79. }
  80. var url=__ctx+ "/platform/form/bpmDataTemplate/editTemplate.ht?id="+id;
  81. url=url.getNewUrl();
  82. $.openFullWindow(url);
  83. }
  84. //添加菜单
  85. $scope.addToResource = function (){
  86. var formKey = $scope.dataRightsJson.formKey;
  87. var url="/platform/form/bpmDataTemplate/dataList_"+ formKey+".ht";
  88. AddResourceDialog({addUrl:url});
  89. }
  90. /**
  91. * 选择流程
  92. */
  93. $scope.selectFlow = function (){
  94. BpmDefinitionDialog({isSingle:true,callback:function(defIds,subjects){
  95. $scope.dataRightsJson.defId = defIds;
  96. $scope.$apply(function(){
  97. $scope.dataRightsJson.subject = subjects;
  98. });
  99. // $scope.dataRightsJson.subject = subjects;
  100. }});
  101. };
  102. $scope.cancel = function (){
  103. $scope.dataRightsJson.defId = "";
  104. $scope.dataRightsJson.subject = "";
  105. }
  106. }]);