kind.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. define([ 'ngResource'], function() {
  2. angular.module('common.query.kind', [ 'ngResource' ]).factory('Kind', ['$resource', '$cacheFactory', function($resource, $cacheFactory) {
  3. var cache = $cacheFactory('Kind');
  4. return $resource('produce/kind/:kindIds', {}, {
  5. // 修改分类的属性
  6. updateProperties: {
  7. url: 'produce/kind/:kindId/properties',
  8. method: 'POST',
  9. isArray: true
  10. },
  11. //重置类属性值
  12. resetKindPropertyValues: {
  13. url: 'produce/kind/kindPropertyValues/reset',
  14. method: 'GET'
  15. },
  16. // 编辑修改
  17. update: {
  18. url: 'produce/kind/:kindId',
  19. method: 'POST'
  20. },
  21. // 新增保存
  22. save: {
  23. url: 'produce/kind',
  24. method: 'POST'
  25. },
  26. // 交换序号
  27. exchangeNumber: {
  28. url: 'produce/kind/number',
  29. method: 'POST',
  30. params: {
  31. operate: 'exchange'
  32. }
  33. },
  34. // 删除类目属性
  35. deleteKindProperty: {
  36. url: 'produce/kind/kindProperty/:kindPropertyId',
  37. method: 'DELETE',
  38. },
  39. // 添加类目属性
  40. addKindProperty: {
  41. url: 'produce/kind/kindProperty/add',
  42. method: 'PUT'
  43. },
  44. // 修改类目属性具体值
  45. updateKindProperty: {
  46. url: 'produce/kind/kindProperty/update',
  47. method: 'PUT'
  48. },
  49. // 改变类目属性顺序
  50. changeDetno: {
  51. url: 'produce/kind/kindProperty/changeDetno',
  52. method: 'PUT',
  53. isArray: true
  54. },
  55. // 更换类目属性
  56. changeKindProperty: {
  57. url: 'produce/kind/kindProperty/changeKindProperty',
  58. method: 'PUT'
  59. }
  60. });
  61. }]).factory('KindAPI', ['$resource', '$cacheFactory', function($resource, $cacheFactory) {
  62. var cache = $cacheFactory('KindAPI');
  63. return $resource ('api/product/kind', {}, {
  64. // 根据父级类目获取其子类目,不包含深层
  65. getChildren: {
  66. url: 'api/product/kind/:parentId/children',
  67. method: 'GET',
  68. isArray: true
  69. },
  70. // 获取父级分类的所有子分类,含深层
  71. getAllChildren: {
  72. url: 'api/product/kind/:parentId/children_all',
  73. method: 'GET',
  74. isArray: true
  75. },
  76. // 获取子类目的所有父类目(含每级类目的兄弟类目),返回逐级向下的类目数组
  77. getParentsWithBothers: {
  78. url: 'api/product/kind/:childId/parentsWithBothers',
  79. method: 'GET',
  80. isArray: true
  81. },
  82. // 获取子类目的所有父类目,返回逐级向下的类目数组
  83. getParents: {
  84. url: 'api/product/kind/:childId/parents',
  85. method: 'GET',
  86. isArray: true
  87. },
  88. // 获取类目所属的一级类目
  89. getFirstKind: {
  90. url: 'api/product/kind/:kindId/firstKind',
  91. method: 'GET'
  92. },
  93. // 根据类目id获取结构化类目(从一级到该类目)
  94. getStructingKinds: {
  95. url: 'api/product/kind/structing/:id',
  96. method: 'GET',
  97. isArray: true
  98. },
  99. // 获取分类的所有属性,包括存在的值选项
  100. getPropertiesValues: {
  101. url: 'api/product/kind/:kindId/properties/values',
  102. method: 'GET',
  103. isArray: true
  104. },
  105. // 获取分类的所有属性,不含值选项
  106. getProperties: {
  107. url: 'api/product/kind/:kindId/properties',
  108. method: 'GET',
  109. isArray: true
  110. },
  111. // 获取类目下器件的所属品牌列表
  112. getBrands: {
  113. url: 'api/product/kind/:kindId/brands',
  114. methos: 'GTE',
  115. isArray: true
  116. },
  117. // 获取类目下主要属性存在的值选项
  118. getPropertyOptions: {
  119. url: 'api/product/kind/:kindId/propertyOptions',
  120. method: 'GET',
  121. isArray: true
  122. },
  123. // 根据kindid获取一页ComponentGoods
  124. getCompGoodsByKindid: {
  125. url: 'api/product/product/getCompGoodsByKindid',
  126. method: 'GET'
  127. },
  128. // 根据keyword获取一页ComponentGoods
  129. getCompGoodsBySearch: {
  130. url: 'api/product/component/search/compGoods',
  131. method: 'GET'
  132. },
  133. // 根据kindid获取类目属性
  134. getKindProperties: {
  135. url: 'api/product/kind/:kindId/kindProperties',
  136. method: 'GET',
  137. isArray: true
  138. },
  139. // 根据分类名获取类目信息
  140. getKindByName: {
  141. url: 'api/product/kind/findByName/:name',
  142. method: 'GET'
  143. }
  144. })
  145. }]);
  146. });