component.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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/info',
  170. method : 'GET',
  171. isArray : true
  172. },
  173. getSimpleInfoByWeight: {
  174. url : 'api/product/component/searchWeight',
  175. method : 'GET',
  176. isArray : true
  177. },
  178. setSimpleInfoWeight: {
  179. url : 'api/product/component/searchWeight',
  180. method : 'PUT'
  181. },
  182. //获取ComponentInfo的分页数据
  183. getInfoPage: {
  184. url: 'produce/component/list',
  185. method: 'GET'
  186. },
  187. // 根据UUid获取单个器件的简要信息
  188. getSimpleInfoByUuid: {
  189. url: 'api/product/component/Info/:uuid',
  190. method: 'GET'
  191. },
  192. // 根据原厂型号(code)获得ComponentActive
  193. getByCode : {
  194. url : 'api/product/component/byCode/:code',
  195. method : 'GET',
  196. isArray : true
  197. },
  198. // 根据UUId获取器件详情
  199. getComponentListByUuid: {
  200. url: 'api/product/component/byUuids',
  201. method: 'GET',
  202. isArray: true
  203. },
  204. // 禁用ComponentActive
  205. disable : {
  206. url : 'produce/component/:uuid/disable',
  207. method : 'PUT'
  208. },
  209. // 根据UUid 获取列表
  210. getByUuid: {
  211. url : 'api/product/component/byUuid',
  212. method : 'GET',
  213. isArray : true
  214. },
  215. //根据批次号获取器件信息
  216. getByBatchCode: {
  217. url : 'produce/component/:batchCode/detail',
  218. method : 'GET'
  219. },//根据原厂型号和品牌获取器件信息
  220. getByCodeAndBrandId: {
  221. url: 'produce/component/codeAndBrandId/:code',
  222. method: 'GET',
  223. isArray: true
  224. },//根据原厂型号和类目获取器件信息
  225. getByCodeAndKindId: {
  226. url: 'produce/component/codeAndKindId/:code',
  227. method: 'GET',
  228. isArray: true
  229. },
  230. /*样品*/
  231. getProofCompon: {
  232. url: 'api/product/component/list/proofing',
  233. method: 'GET'
  234. },
  235. hasSamples: {
  236. url: 'api/product/component/proofing/hasSample',
  237. method: 'POST'
  238. },
  239. recommendProofing: {
  240. url: 'api/product/component/:qty/recommend/proofing',
  241. method: 'GET',
  242. isArray: true
  243. },
  244. /*现货*/
  245. getOriginalCompon: {
  246. url: 'api/product/component/list/original',
  247. method: 'GET'
  248. },
  249. recommendOriginal: {
  250. url: 'api/product/component/:qty/recommend/original',
  251. method: 'GET',
  252. isArray: true
  253. },
  254. // 根据类目id获取封装规格
  255. getPackagingByKindid: {
  256. url: 'produce/component/packaging/:kindid',
  257. method: 'GET',
  258. isArray: true
  259. },
  260. // 批量修改器件类目
  261. moveCmp: {
  262. url: 'produce/component/moveCmp',
  263. method: 'PUT',
  264. isArray : true
  265. },
  266. // 获取每月器件增长数量
  267. getIncreaseCount: {
  268. url: 'produce/component/increaseCount',
  269. method: 'GET',
  270. isArray: true
  271. }
  272. });
  273. }]).factory('ComponentDisable', ['$resource', function($resource) {
  274. return $resource('produce/componentDisable/:uuid', {}, {
  275. /*
  276. * get 根据uuid获得ComponentDisable
  277. */
  278. // 分页获取全部已禁用器件的简要信息
  279. getSimpleInfoPage : {
  280. url: 'produce/componentDisable/info/ByPage',
  281. method: 'GET'
  282. }
  283. })
  284. }]).factory('Compare', ['$resource', function($resource) {
  285. // 产品对比数据处理
  286. return $resource('api/product/compare', {}, {
  287. add: {
  288. url: 'api/product/compare',
  289. method: 'POST',
  290. isArray: true
  291. },
  292. remove: {
  293. url: 'api/product/compare',
  294. method: 'DELETE',
  295. isArray: true
  296. },
  297. get: {
  298. url: 'api/product/compare',
  299. method: 'GET',
  300. isArray: true
  301. },
  302. removeAll: {
  303. url: 'api/product/compare/all',
  304. method: 'DELETE',
  305. isArray: true
  306. }
  307. });
  308. }]).factory('ComponentTest', ['$resource', function($resource) {
  309. return $resource('produce/component/:uuid', {}, {
  310. /*
  311. * get 获ComponentsActive的分页数据,根据uuid获得ComponentActive
  312. */
  313. //获取ComponentActive的分页数据
  314. getInfoPage: {
  315. url: 'produce/component/info',
  316. method: 'GET'
  317. }
  318. });
  319. }]).factory('ComponentActiveAPI', ['$resource', function($resource){
  320. return $resource('api/product/component', {},{
  321. //TEST
  322. getOneComp: {
  323. url: 'api/product/component/list/test',
  324. method: 'GET'
  325. },
  326. //获取ComponentInfo的分页数据
  327. getInfoPage: {
  328. url: 'api/product/component/list',
  329. method: 'GET'
  330. },
  331. //根据uuid获取器件信息
  332. get: {
  333. url: 'api/product/component/:uuid',
  334. method: 'GET'
  335. },// 根据UUid获取单个器件的简要信息
  336. getSimpleInfoByUuid: {
  337. url: 'api/product/component/Info/:uuid',
  338. method: 'GET'
  339. },
  340. getByUuids: {
  341. url: 'api/product/component/byUuids',
  342. method: 'GET',
  343. isArray: true
  344. },
  345. // 分页获取简要信息
  346. getInfo: {
  347. url: 'api/product/component/info',
  348. method: 'GET'
  349. }
  350. });
  351. }]);
  352. });