sysQueryFieldService.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. var sysQuerySqlFieldServiceApp = angular.module('sysQuerySqlFieldServiceApp', []);
  2. sysQuerySqlFieldServiceApp.service('sysQuerySqlFieldService', ['$http', 'dataRightsService', function($http, dataRightsService) {
  3. var service = {
  4. initCtrlTypeSetting:function(scope){
  5. this.scope = scope;
  6. scope.dialog = frameElement.dialog;
  7. var conf =scope.dialog.get('conf');
  8. scope.sysQueryField = conf.field;
  9. scope.globalTypes = conf.dicList;
  10. scope.selectList = [];
  11. scope.sysQueryField.ctrlCon = {};
  12. if(scope.sysQueryField.controlType == 11){
  13. scope.selectList = parseToJson(scope.sysQueryField.controlContent);
  14. }else if(scope.sysQueryField.controlType == 3){
  15. scope.sysQueryField.dicType = scope.sysQueryField.controlContent;
  16. }else if(scope.sysQueryField.controlType == 12){
  17. scope.sysQueryField.ctrlCon = parseToJson(scope.sysQueryField.controlContent);
  18. }
  19. var url = __ctx + '/platform/form/bpmFormDialog/getAllDialogs.ht';
  20. $.ajax({
  21. type:"get",
  22. async:false,
  23. url:url,
  24. success:function(data){
  25. for(var i = 0 ; i < data.length ; i++){
  26. data[i].resultfield = parseToJson(data[i].resultfield);
  27. }
  28. scope.dialogList = data;
  29. scope.currentDialog=scope.getCurrentDialog();
  30. if(!scope.sysQueryField.ctrlCon.dialog){
  31. scope.sysQueryField.ctrlCon.dialog = data[0].alias;
  32. scope.sysQueryField.ctrlCon.resultField = data[0].resultfield[0].field;
  33. }
  34. scope.$$phase?"":scope.$digest();
  35. }
  36. });
  37. },
  38. initVirtual:function(scope){
  39. this.scope = scope;
  40. scope.dialog = frameElement.dialog;
  41. var conf =scope.dialog.get('conf');
  42. scope.sysQueryField = conf.field;
  43. scope.sysQueryFields = conf.sysQueryFields;
  44. scope.globalTypes = conf.dicList;
  45. scope.selectList = [];
  46. },
  47. initAlarm:function(scope){
  48. this.scope = scope;
  49. this.util = dataRightsService;
  50. scope.dialog = frameElement.dialog;
  51. var conf =scope.dialog.get('conf');
  52. scope.sysQueryField = conf.field;
  53. scope.alarmSetting = scope.sysQueryField.alarmSetting;
  54. if(scope.alarmSetting){
  55. if(typeof scope.alarmSetting =="string")
  56. scope.alarmSetting = parseToJson(scope.sysQueryField.alarmSetting)
  57. }else{
  58. scope.alarmSetting = [{condition:[{op:">",val:""}],color:"red"}];
  59. }
  60. },
  61. getVirtualFromType : function(type){
  62. var list = {1:"数据字典",2:"sql",3:"下拉框"};
  63. return list[type];
  64. },
  65. getCtrCon:function(ctrlType){
  66. if(ctrlType == 3)
  67. return this.scope.sysQueryField.dicType;
  68. else if(ctrlType == 11)
  69. return dataRightsService.listToString(this.scope.selectList);
  70. else if(ctrlType == 12 )
  71. return dataRightsService.listToString(this.scope.sysQueryField.ctrlCon);
  72. }
  73. };
  74. return service;
  75. }])
  76. //<select-table></select-table>
  77. .directive('selectTable', function($compile) {
  78. return {
  79. restrict : 'E',
  80. replace : true,
  81. scope:{
  82. list:"="
  83. },
  84. template : '<table style="width:100%;">'+
  85. '<thead>'+
  86. '<tr>'+
  87. '<td colspan="4">'+
  88. '<a href="javascript:;" class="link add" ng-click="list.push({})">添加</a>'+
  89. '</td>'+
  90. '</tr>'+
  91. '</thead>'+
  92. '<tbody>'+
  93. '<tr ng-repeat="sl in list">'+
  94. '<td>'+
  95. '<div >'+
  96. '<label>'+
  97. '值:'+
  98. '<input ng-model="sl.optionKey" type="text" style="height:21px;width:150px" class="ht-input"/>'+
  99. '</label>'+
  100. '<label style="margin:0 0 0 10px;">'+
  101. '选项:'+
  102. '<input ng-model="sl.optionValue" style="height:21px;width:150px" class="ht-input" type="text"/>'+
  103. '</label>'+
  104. '</div>'+
  105. '</td>'+
  106. '<td>'+
  107. '<div >'+
  108. '<tool-buttons type="4" list="list" index="{{$index}}" ></tool-buttons>'+
  109. '</div>'+
  110. '</td>'+
  111. '</tr>'+
  112. '</tbody>'+
  113. '</table>'
  114. };
  115. })