component.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. define([ 'ngResource' ], function() {
  2. angular.module('componentServices', [ 'ngResource' ]).factory('ComponentsSubmit', ['$resource', function($resource) {
  3. //获取ComponentSubmit的分页数据
  4. return $resource('produce/componentSubmit', {}, {
  5. //未审核
  6. getUnAudited : {
  7. params : { _state : 'unAudited'}
  8. },
  9. //已通过
  10. getAllow : {
  11. params : { _state : 'allow'}
  12. },
  13. //未通过
  14. getNotAllow : {
  15. params : { _state : 'notAllow'}
  16. }
  17. });
  18. }]).factory('ComponentSubmit', ['$resource', function($resource) {
  19. //对单个ComponentSubmit的操作
  20. return $resource('produce/componentSubmit/:id', {}, {
  21. /**
  22. * get,根据uuid查找ComponentSubmit详细信息
  23. */
  24. //审核通过
  25. valid : {
  26. url : 'produce/componentSubmit/audit',
  27. method : 'PUT',
  28. params : {
  29. valid : true
  30. }
  31. },
  32. //审核不通过
  33. invalid : {
  34. url : 'produce/componentSubmit/audit/:id',
  35. method : 'PUT',
  36. params : {
  37. valid : false
  38. }
  39. },
  40. // 下载批量器件建档模板
  41. downloadExcel : {
  42. url : 'produce/componentSubmit/template',
  43. method : 'POST'
  44. },
  45. // 未审核批量申请(用户)
  46. unAuditedBatch : {
  47. url : 'produce/componentSubmit/batch',
  48. method : 'GET',
  49. params : { _status : 'unAudited'}
  50. },
  51. // 已通过批量申请(用户)
  52. passBatch : {
  53. url : 'produce/componentSubmit/batch',
  54. method : 'GET',
  55. params : { _status : 'pass'}
  56. },
  57. // 全部批量申请(用户)
  58. allBatch : {
  59. url : 'produce/componentSubmit/batch',
  60. method : 'GET',
  61. params : { _status : 'all'}
  62. },
  63. // 未通过批量申请(用户)
  64. forbiddenBatch : {
  65. url : 'produce/componentSubmit/batch',
  66. method : 'GET',
  67. params : { _status : 'forbidden'}
  68. },
  69. // 全部批量申请(后台)
  70. allBatchManage : {
  71. url : 'produce/componentSubmit/manage/batch',
  72. method : 'GET',
  73. params : { _status : 'all'}
  74. },
  75. // 未审核批量申请(后台)
  76. unAuditedBatchManage : {
  77. url : 'produce/componentSubmit/manage/batch',
  78. method : 'GET',
  79. params : { _status : 'unAudited'}
  80. },
  81. // 已通过批量申请(后台)
  82. passBatchManage : {
  83. url : 'produce/componentSubmit/manage/batch',
  84. method : 'GET',
  85. params : { _status : 'pass'}
  86. },
  87. // 未通过批量申请(后台)
  88. forbiddenBatchManage : {
  89. url : 'produce/componentSubmit/manage/batch',
  90. method : 'GET',
  91. params : { _status : 'forbidden'}
  92. },
  93. // 获取批量申请详情
  94. getBatchDetails : {
  95. url : 'produce/componentSubmit/batch/:submitId',
  96. method : 'GET'
  97. },
  98. // 批量器件建档审核通过
  99. auditBatch : {
  100. url : 'produce/componentSubmit/audit/batch',
  101. method : 'PUT'
  102. },
  103. // 批量器件建档审核不通过
  104. unAuditBatch : {
  105. url : 'produce/componentSubmit/unAudit/batch',
  106. method : 'PUT'
  107. },
  108. // 获取尚未处理的建档申请
  109. tobe_handleTask : {
  110. url : 'produce/componentSubmit/getDetail/batch',
  111. method : 'GET',
  112. params : {_status : 'tobe_handle'}
  113. },
  114. // 获取任务中的建档申请
  115. pendingTask : {
  116. url : 'produce/componentSubmit/getDetail/batch',
  117. method : 'GET',
  118. params : {_status : 'pending'}
  119. },
  120. // 获取已完成的建档申请
  121. completeTask : {
  122. url : 'produce/componentSubmit/getDetail/batch',
  123. method : 'GET',
  124. params : {_status : 'complete'}
  125. },
  126. // 获取爬取失败的建档申请
  127. failedTask : {
  128. url : 'produce/componentSubmit/getDetail/batch',
  129. method : 'GET',
  130. params : {_status : 'failed'}
  131. },
  132. // 选取用户申请发起任务
  133. saveTask : {
  134. url : 'produce/componentSubmit/task',
  135. method : 'POST'
  136. },
  137. // 用户直接提交批量建档申请
  138. saveSubmits : {
  139. url : 'produce/componentSubmit/submitBatch',
  140. method : 'POST'
  141. }
  142. });
  143. }]).factory('ComponentVersion', ['$resource', function($resource) {
  144. //获取根据uuid获取ComponentVersion列表
  145. return $resource('produce/componentVersion/:uuid', {}, {
  146. /**
  147. * get,根据uuid,version获取ComponentVersion对象
  148. */
  149. //根据uuid获取ComponentVersion列表
  150. getList : {
  151. url : 'produce/componentVersion/list/:uuid',
  152. method : 'GET',
  153. isArray : true
  154. },
  155. //根据uuid获取ComponentVersion数量
  156. getCount : {
  157. url : 'produce/componentVersion/count/:uuid',
  158. method : 'GET'
  159. }
  160. });
  161. }]).factory('ComponentActive', ['$resource', function($resource) {
  162. //获取ComponentActive的分页数据
  163. return $resource('api/product/component/:uuid', {}, {
  164. /*
  165. * get 获ComponentsActive的分页数据,根据uuid获得ComponentActive
  166. */
  167. //根据kindid获得ComponentsActiveSimpleInfo的分页数据
  168. getSimpleInfo : {
  169. url : 'api/product/component/simpleInfo',
  170. method : 'GET'
  171. },
  172. //获取ComponentInfo的分页数据
  173. getInfoPage: {
  174. url: 'produce/component/list',
  175. method: 'GET'
  176. },
  177. // 根据UUid获取单个器件的简要信息
  178. getSimpleInfoByUuid: {
  179. url: 'api/product/component/Info/:uuid',
  180. method: 'GET'
  181. },
  182. // 根据原厂型号(code)获得ComponentActive
  183. getByCode : {
  184. url : 'api/product/component/byCode/:code',
  185. method : 'GET',
  186. isArray : true
  187. },
  188. // 根据UUId获取器件详情
  189. getComponentListByUuid: {
  190. url: 'api/product/component/byUuids',
  191. method: 'GET',
  192. isArray: true
  193. },
  194. // 禁用ComponentActive
  195. disable : {
  196. url : 'produce/component/:uuid/disable',
  197. method : 'PUT'
  198. },
  199. // 根据UUid 获取列表
  200. getByUuid: {
  201. url : 'api/product/component/byUuid',
  202. method : 'GET',
  203. isArray : true
  204. },
  205. //根据批次号获取器件信息
  206. getByBatchCode: {
  207. url : 'produce/component/:batchCode/detail',
  208. method : 'GET'
  209. },//根据原厂型号和品牌获取器件信息
  210. getByCodeAndBrandId: {
  211. url: 'produce/component/codeAndBrandId/:code',
  212. method: 'GET',
  213. isArray: true
  214. },//根据原厂型号和类目获取器件信息
  215. getByCodeAndKindId: {
  216. url: 'produce/component/codeAndKindId/:code',
  217. method: 'GET',
  218. isArray: true
  219. },
  220. /*样品*/
  221. getProofCompon: {
  222. url: 'api/product/component/list/proofing',
  223. method: 'GET'
  224. },
  225. hasSamples: {
  226. url: 'api/product/component/proofing/hasSample',
  227. method: 'POST'
  228. },
  229. recommendProofing: {
  230. url: 'api/product/component/:qty/recommend/proofing',
  231. method: 'GET',
  232. isArray: true
  233. },
  234. /*现货*/
  235. getOriginalCompon: {
  236. url: 'api/product/component/list/original',
  237. method: 'GET'
  238. },
  239. recommendOriginal: {
  240. url: 'api/product/component/:qty/recommend/original',
  241. method: 'GET',
  242. isArray: true
  243. },
  244. // 根据类目id获取封装规格
  245. getPackagingByKindid: {
  246. url: 'produce/component/packaging/:kindid',
  247. method: 'GET',
  248. isArray: true
  249. },
  250. // 批量修改器件类目
  251. moveCmp: {
  252. url: 'produce/component/moveCmp',
  253. method: 'PUT',
  254. isArray : true
  255. },
  256. // 获取每月器件增长数量
  257. getIncreaseCount: {
  258. url: 'produce/component/increaseCount',
  259. method: 'GET',
  260. isArray: true
  261. }
  262. });
  263. }]).factory('ComponentDisable', ['$resource', function($resource) {
  264. return $resource('produce/componentDisable/:uuid', {}, {
  265. /*
  266. * get 根据uuid获得ComponentDisable
  267. */
  268. // 分页获取全部已禁用器件的简要信息
  269. getSimpleInfoPage : {
  270. url: 'produce/componentDisable/info/ByPage',
  271. method: 'GET'
  272. }
  273. })
  274. }]).factory('Compare', ['$resource', function($resource) {
  275. // 产品对比数据处理
  276. return $resource('api/product/compare', {}, {
  277. add: {
  278. url: 'api/product/compare',
  279. method: 'POST',
  280. isArray: true
  281. },
  282. remove: {
  283. url: 'api/product/compare',
  284. method: 'DELETE',
  285. isArray: true
  286. },
  287. get: {
  288. url: 'api/product/compare',
  289. method: 'GET',
  290. isArray: true
  291. },
  292. removeAll: {
  293. url: 'api/product/compare/all',
  294. method: 'DELETE',
  295. isArray: true
  296. }
  297. });
  298. }]).factory('ComponentTest', ['$resource', function($resource) {
  299. return $resource('produce/component/:uuid', {}, {
  300. /*
  301. * get 获ComponentsActive的分页数据,根据uuid获得ComponentActive
  302. */
  303. //获取ComponentActive的分页数据
  304. getInfoPage: {
  305. url: 'produce/component/info',
  306. method: 'GET'
  307. }
  308. });
  309. }]).factory('ComponentActiveAPI', ['$resource', function($resource){
  310. return $resource('api/product/component', {},{
  311. //TEST
  312. getOneComp: {
  313. url: 'api/product/component/list/test',
  314. method: 'GET'
  315. },
  316. //获取ComponentInfo的分页数据
  317. getInfoPage: {
  318. url: 'api/product/component/list',
  319. method: 'GET'
  320. },
  321. //根据uuid获取器件信息
  322. get: {
  323. url: 'api/product/component/:uuid',
  324. method: 'GET'
  325. },// 根据UUid获取单个器件的简要信息
  326. getSimpleInfoByUuid: {
  327. url: 'api/product/component/Info/:uuid',
  328. method: 'GET'
  329. },
  330. getByUuids: {
  331. url: 'api/product/component/byUuids',
  332. method: 'GET',
  333. isArray: true
  334. },
  335. // 分页获取简要信息
  336. getInfo: {
  337. url: 'api/product/component/info',
  338. method: 'GET'
  339. }
  340. });
  341. }]);
  342. });