VSearchList.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. define([ "require", "utils/Globals", "collection/BaseCollection", "models/VSearch", "utils/UrlLinks" ], function(require, Globals, BaseCollection, VSearch, UrlLinks) {
  2. "use strict";
  3. var VSearchList = BaseCollection.extend({
  4. url: UrlLinks.searchApiUrl(),
  5. model: VSearch,
  6. initialize: function(options) {
  7. _.extend(this, options), this.modelName = "VSearchList", this.modelAttrName = "";
  8. },
  9. parseRecords: function(resp, options) {
  10. if (this.queryType = resp.queryType, this.queryText = resp.queryText, this.referredEntities = resp.referredEntities,
  11. resp.attributes) {
  12. this.dynamicTable = !0;
  13. var entities = [];
  14. return _.each(resp.attributes.values, function(obj) {
  15. var temp = {};
  16. _.each(obj, function(val, index) {
  17. var key = resp.attributes.name[index];
  18. "__guid" == key && (key = "guid"), temp[key] = val;
  19. }), entities.push(temp);
  20. }), entities;
  21. }
  22. return resp.entities ? (this.dynamicTable = !1, resp.entities ? resp.entities : []) : [];
  23. },
  24. getExpimpAudit: function(params, options) {
  25. var url = UrlLinks.expimpAudit(params);
  26. return options = _.extend({
  27. contentType: "application/json",
  28. dataType: "json"
  29. }, options), this.constructor.nonCrudOperation.call(this, url, "GET", options);
  30. },
  31. getBasicRearchResult: function(options) {
  32. var url = UrlLinks.searchApiUrl("basic");
  33. return options = _.extend({
  34. contentType: "application/json",
  35. dataType: "json"
  36. }, options), options.data = JSON.stringify(options.data), this.constructor.nonCrudOperation.call(this, url, "POST", options);
  37. }
  38. }, {
  39. tableCols: {}
  40. });
  41. return VSearchList;
  42. });