factory.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. starter.factory('Audit', function ($resource, $q, $filter, cfg, formatFilter) {
  2. var audit = {};
  3. audit.body = {};
  4. audit.bodyitem = [];
  5. audit.chkdd_tv_arr = ['不限制', '当日', '本周', '上周', '本月', '上月', '本季', '上季', '本年', '去年'];
  6. audit.Audit = function (type) {
  7. return $resource(formatFilter('{0}ext_erp/Audit/{1}/', cfg.api, type))
  8. }
  9. audit.Bills = function (type) {
  10. return $resource(formatFilter('{0}ext_erp/Bills/{1}/', cfg.api, type))
  11. }
  12. audit.getFilter = function () {
  13. var filter = window.localStorage.getItem('auditFilter');
  14. if (filter) {
  15. filter = JSON.parse(filter);
  16. } else {
  17. filter = {
  18. chkdd_tv:0,
  19. bil_id_tv:null,
  20. b_no_tv:null,
  21. e_no_tv:null,
  22. b_cus_tv:null,
  23. e_cus_tv:null,
  24. substitutechk:true
  25. };
  26. window.localStorage['auditFilter'] = JSON.stringify(filter);
  27. }
  28. return filter;
  29. }
  30. audit.setFilter = function (filter) {
  31. window.localStorage['auditFilter'] = JSON.stringify(filter);
  32. }
  33. return audit;
  34. })