Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

datalistmanager.js 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Unibase;
  11. (function (Unibase) {
  12. let Platform;
  13. (function (Platform) {
  14. let DataSources;
  15. (function (DataSources) {
  16. let Managers;
  17. (function (Managers) {
  18. class DataListManager extends Platform.Core.BaseManager {
  19. getDataSourceProviders() {
  20. return __awaiter(this, void 0, void 0, function* () {
  21. const url = 'apis/v4/unibase/platform/datasources/getdatasourceproviders';
  22. return yield this.dataHelper().getAsync(url).then(function (response) {
  23. if (response.result !== null)
  24. response.result = JSON.parse(response.result);
  25. return response;
  26. });
  27. });
  28. }
  29. getDataSources(dataSourceProviderId) {
  30. return __awaiter(this, void 0, void 0, function* () {
  31. const url = 'apis/v4/unibase/platform/datasources/get/providerid/' + dataSourceProviderId;
  32. return yield this.dataHelper().getAsync(url).then(function (response) {
  33. if (response.result !== null)
  34. response.result = JSON.parse(response.result);
  35. return response;
  36. });
  37. });
  38. }
  39. getDataSource(datasourceId) {
  40. return __awaiter(this, void 0, void 0, function* () {
  41. const url = 'apis/v4/unibase/platform/datasources/get/' + datasourceId;
  42. return yield this.dataHelper().getAsync(url).then(function (response) {
  43. if (response.result !== null)
  44. response.result = JSON.parse(response.result);
  45. return response;
  46. });
  47. });
  48. }
  49. saveDataSource(obj) {
  50. return __awaiter(this, void 0, void 0, function* () {
  51. const url = 'apis/v4/unibase/platform/datasources/save';
  52. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  53. if (response.result !== null)
  54. response.result = JSON.parse(response.result);
  55. return response;
  56. });
  57. });
  58. }
  59. getDataList(datalistId) {
  60. return __awaiter(this, void 0, void 0, function* () {
  61. const url = 'apis/v4/unibase/platform/datalists/get/' + datalistId;
  62. return yield this.dataHelper().getAsync(url).then(function (response) {
  63. if (response.result !== null)
  64. response.result = JSON.parse(response.result);
  65. return response;
  66. });
  67. });
  68. }
  69. saveDataList(obj) {
  70. return __awaiter(this, void 0, void 0, function* () {
  71. const url = 'apis/v4/unibase/platform/datalists/savedatalist';
  72. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  73. if (response.result !== null)
  74. response.result = JSON.parse(response.result);
  75. return response;
  76. });
  77. });
  78. }
  79. buildQuery(obj) {
  80. return __awaiter(this, void 0, void 0, function* () {
  81. const url = 'apis/v4/unibase/platform/datalist/buildquery';
  82. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  83. var message = response;
  84. return message;
  85. }).fail(function () {
  86. MessageHelper.Instance();
  87. });
  88. });
  89. }
  90. saveDataSourceSetting(obj) {
  91. return __awaiter(this, void 0, void 0, function* () {
  92. const url = 'apis/v4/DataList/DataSourceSetting/Save';
  93. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  94. return response;
  95. }).fail(function () {
  96. });
  97. });
  98. }
  99. refreshDataLists() {
  100. return __awaiter(this, void 0, void 0, function* () {
  101. const url = 'apis/v4/unibase/platform/datasources/refreshdatalists/np';
  102. return yield this.dataHelper().postAsync(url, "{}").then(function (response) {
  103. return response.message;
  104. });
  105. });
  106. }
  107. getTable(querystring, iscommon, datasourceid) {
  108. return __awaiter(this, void 0, void 0, function* () {
  109. const url = 'apis/v4/unibase/platform/datalist/getdata/querystring/' + querystring + '/iscommon/' + iscommon + '/datasourceid/' + datasourceid;
  110. return yield this.dataHelper().getAsync(url).then(function (response) {
  111. if (response.result !== null)
  112. response.result = JSON.parse(response.result);
  113. return response;
  114. }).fail(function () {
  115. MessageHelper.Instance();
  116. });
  117. });
  118. }
  119. getdatafromapi(datalistid) {
  120. return __awaiter(this, void 0, void 0, function* () {
  121. const url = 'apis/v4/unibase/platform/datalist/GetDataFromApi/datalistid/' + datalistid;
  122. return yield this.dataHelper().getAsync(url).then(function (response) {
  123. if (response.result == '') {
  124. response.result = null;
  125. }
  126. else if (response.result !== null)
  127. response.result = JSON.parse(response.result);
  128. return response;
  129. }).fail(function () {
  130. MessageHelper.Instance();
  131. });
  132. });
  133. }
  134. getprimarykey(datalistid) {
  135. return __awaiter(this, void 0, void 0, function* () {
  136. const url = 'apis/v4/unibase/platform/datalists/Getprimarykeycolumn/' + datalistid;
  137. return yield this.dataHelper().getAsync(url).then(function (response) {
  138. if (response.result == "") {
  139. response.result = null;
  140. }
  141. else {
  142. response.result = JSON.parse(response.result);
  143. }
  144. return response;
  145. });
  146. });
  147. }
  148. getdatalistcolumns(datalistid) {
  149. return __awaiter(this, void 0, void 0, function* () {
  150. const url = 'apis/v4/unibase/platform/datalist/getdatalistcolumns/datalistid/' + datalistid;
  151. return yield this.dataHelper().getAsync(url).then(function (response) {
  152. if (response.result == '') {
  153. response.result = null;
  154. }
  155. else if (response.result !== null)
  156. response.result = JSON.parse(response.result);
  157. return response;
  158. }).fail(function () {
  159. MessageHelper.Instance();
  160. });
  161. });
  162. }
  163. static Instance() {
  164. if (this._instance === undefined)
  165. this._instance = new DataListManager();
  166. return this._instance;
  167. }
  168. }
  169. Managers.DataListManager = DataListManager;
  170. })(Managers = DataSources.Managers || (DataSources.Managers = {}));
  171. })(DataSources = Platform.DataSources || (Platform.DataSources = {}));
  172. })(Platform = Unibase.Platform || (Unibase.Platform = {}));
  173. })(Unibase || (Unibase = {}));