RestActions.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. MWF.xApplication.Attendance = MWF.xApplication.Attendance || {};
  2. MWF.xApplication.Attendance.Actions = MWF.xApplication.Attendance.Actions || {};
  3. MWF.require("MWF.xDesktop.Actions.RestActions", null, false);
  4. MWF.require("MWF.widget.UUID", null, false);
  5. MWF.xApplication.Attendance.Actions.RestActions = new Class({
  6. initialize: function(){
  7. this.action = new MWF.xDesktop.Actions.RestActions("/Actions/action.json", "x_attendance_assemble_control", "x_component_Attendance");
  8. this.actionOrg = new MWF.xDesktop.Actions.RestActions("/Actions/action.json", "x_organization_assemble_express", "x_component_Attendance");
  9. this.actionPerson = new MWF.xDesktop.Actions.RestActions("/Actions/action.json", "x_organization_assemble_personal", "x_component_Attendance");
  10. },
  11. getId: function(count, success, failure, async){
  12. this.action.invoke({"name": "getId","async": async, "parameter": {"count": count}, "success": success, "failure": failure});
  13. },
  14. getUUID: function(success){
  15. var id = "";
  16. this.action.invoke({"name": "getId","async": false, "parameter": {"count": "1"}, "success": function(ids){
  17. id = ids.data[0];
  18. if (success) success(id);
  19. }, "failure": null});
  20. return id;
  21. },
  22. getCurrentPerson : function(success, failure, async){
  23. this.actionPerson.invoke({"name": "getCurrentPerson","async": async, "success": success, "failure": failure});
  24. },
  25. listUnitWithPerson: function(success, failure, data, async){
  26. this.actionOrg.invoke({"name": "listUnitWithPerson","async": async, "data": data, "success": success, "failure": failure});
  27. },
  28. listUnitSubDirect: function(success, failure, data, async){
  29. this.actionOrg.invoke({"name": "listUnitSubDirect","data": data, "async": async, "success": success,"failure": failure});
  30. //this.actionOrg.invoke({"name": "listUnitByTopUnit","async": async, "parameter": {"topUnitName": topUnitName}, "success": success, "failure": failure});
  31. },
  32. getPersonAttribute: function(data, success, failure, async){
  33. this.actionOrg.invoke({"name": "getPersonAttribute","async": async, "urlEncode": true, "data": data, "success": success, "failure": failure});
  34. },
  35. listPersonWithIdentity: function(data, success, failure, async){
  36. this.actionOrg.invoke({"name": "listPersonWithIdentity","async": async, "urlEncode": true, "data": data, "success": success, "failure": failure});
  37. },
  38. listIdentityWithUnitWithName: function(data, success, failure, async){
  39. this.actionOrg.invoke({"name": "listIdentityWithUnitWithName","async": async, "urlEncode": true, "data": data, "success": success, "failure": failure});
  40. },
  41. listUnitWithPersonSupNested: function(data, success, failure, async){
  42. this.actionOrg.invoke({"name": "listUnitWithPersonSupNested","async": async, "urlEncode": true, "data": data, "success": success, "failure": failure});
  43. },
  44. listPersonWithPersonSupDirect: function(data, success, failure, async){
  45. this.actionOrg.invoke({"name": "listPersonWithPersonSupDirect","async": async, "urlEncode": true, "data": data, "success": success, "failure": failure});
  46. },
  47. getPermission: function(id, success, failure){
  48. this.action.invoke({"name": "getPermission", "parameter": {"id": id },"success": success,"failure": failure});
  49. },
  50. listPermission: function(success, failure, async){
  51. this.action.invoke({"name": "listPermission","async": async, "success": success, "failure": failure});
  52. },
  53. savePermission: function(data, success, failure){
  54. this.action.invoke({"name": "savePermission","data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  55. },
  56. deletePermission: function(id, success, failure, async){
  57. this.action.invoke({"name": "deletePermission", "async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  58. },
  59. getHoliday: function(id, success, failure){
  60. this.action.invoke({"name": "getHoliday", "parameter": {"id": id },"success": success,"failure": failure});
  61. },
  62. listHolidayAll: function(success, failure, async){
  63. this.action.invoke({"name": "listHolidayAll","async": async, "success": success, "failure": failure});
  64. },
  65. listHolidayFilter : function( filterData, success,failure, async){
  66. this.action.invoke({"name": "listHolidayFilter", "data": filterData, "async": async, "success": success, "failure": failure});
  67. },
  68. listHolidayByYearAndName: function(year,name,success, failure, async){
  69. this.action.invoke({"name": "listHolidayFilter","data": {"q_Year": year, "q_Name" : name },"async": async, "success": success, "failure": failure});
  70. },
  71. listHolidayByYearAndMonth: function(year, month, success, failure, async){
  72. this.action.invoke({"name": "listHolidayFilter","data": {"q_Year": year, "q_Month" : month },"async": async, "success": success, "failure": failure});
  73. },
  74. listHolidayByName: function(name,success, failure, async){
  75. this.action.invoke({"name": "listHolidayFilter","data": {"q_Name": name },"async": async, "success": success, "failure": failure});
  76. },
  77. saveHoliday: function(data, success, failure, async){
  78. this.action.invoke({"name": "saveHoliday","data": data, "async": async,"parameter": {"id": data.id},"success": success,"failure": failure});
  79. },
  80. deleteHoliday: function(id, success, failure, async){
  81. this.action.invoke({"name": "deleteHoliday", "async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  82. },
  83. getSelfHoliday: function(id, success, failure){
  84. this.action.invoke({"name": "getSelfHoliday", "parameter": {"id": id },"success": success,"failure": failure});
  85. },
  86. listSelfHoliday: function(success, failure, async){
  87. this.action.invoke({"name": "listSelfHoliday","async": async, "success": success, "failure": failure});
  88. },
  89. saveSelfHoliday: function(data, success, failure){
  90. this.action.invoke({"name": "saveSelfHoliday","data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  91. },
  92. deleteSelfHoliday: function(id, success, failure, async){
  93. this.action.invoke({"name": "deleteSelfHoliday", "async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  94. },
  95. exportSelfHoliday: function(startdate, enddate, success, failure){
  96. this.action.getActions(function(){
  97. var url = this.action.actions.exportSelfHoliday.uri;
  98. url = url.replace("{startdate}", startdate);
  99. url = url.replace("{enddate}", enddate);
  100. window.open(o2.filterUrl(this.action.address+url) , "_blank");
  101. }.bind(this));
  102. },
  103. listSelfHolidayFilterNext : function( id, count, filterData, success,failure, async){
  104. this.action.invoke({"name": "listSelfHolidayFilterNext","parameter": {"id": id , "count" : count }, "data": filterData, "async": async, "success": success, "failure": failure});
  105. },
  106. getSchedule: function(id, success, failure){
  107. this.action.invoke({"name": "getSchedule", "parameter": {"id": id },"success": success,"failure": failure});
  108. },
  109. listSchedule: function(success, failure, async){
  110. this.action.invoke({"name": "listSchedule","async": async, "success": success, "failure": failure});
  111. },
  112. saveSchedule: function(data, success, failure){
  113. this.action.invoke({"name": "saveSchedule","data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  114. },
  115. deleteSchedule: function(id, success, failure, async){
  116. this.action.invoke({"name": "deleteSchedule", "async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  117. },
  118. listScheduleByUnit: function(unit, success, failure, async){
  119. this.action.invoke({"name": "listScheduleByUnit", "parameter": {"name": unit },"success": success,"failure": failure, "async": async});
  120. },
  121. listScheduleByTopUnit: function(topUnit, success, failure, async){
  122. this.action.invoke({"name": "listScheduleByTopUnit", "parameter": {"name": topUnit },"success": success,"failure": failure, "async": async});
  123. },
  124. getCycle: function(id, success, failure){
  125. this.action.invoke({"name": "getCycle", "parameter": {"id": id },"success": success,"failure": failure});
  126. },
  127. deleteCycle: function(id, success, failure, async){
  128. this.action.invoke({"name": "deleteCycle", "parameter": {"id": id }, "async": async, "success": success, "failure": failure});
  129. },
  130. saveCycle: function(data, success, failure){
  131. this.action.invoke({"name": "saveCycle","data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  132. },
  133. listCycle: function( success, failure, async){
  134. this.action.invoke({"name": "listCycle", "async": async, "success": success, "failure": failure});
  135. },
  136. getCyclePerson: function(year, month, success, failure, async){
  137. this.action.invoke({"name": "getCyclePerson", "parameter": {"year": year, "month": month }, "async": async,"success": success,"failure": failure});
  138. },
  139. listSetting: function(success, failure, async){
  140. this.action.invoke({"name": "listSetting","async": async, "success": success, "failure": failure});
  141. },
  142. getSetting: function(id, success, failure, async){
  143. this.action.invoke({"name": "getSetting","async": async, "parameter": {"id": id },"success": success,"failure": failure});
  144. },
  145. saveSetting: function(data, success, failure,async){
  146. this.action.invoke({"name": "saveSetting","async": async,"data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  147. },
  148. deleteSetting: function(id, success, failure, async){
  149. this.action.invoke({"name": "deleteSetting","async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  150. },
  151. getSettingCode: function(code, success, failure, async){
  152. this.action.invoke({"name": "getSettingCode","async": async, "parameter": {"code": code },"success": success,"failure": failure});
  153. },
  154. listPersonSetting: function(success, failure, async){
  155. this.action.invoke({"name": "listPersonSetting","async": async, "success": success, "failure": failure});
  156. },
  157. getPersonSetting: function(id, success, failure, async){
  158. this.action.invoke({"name": "getPersonSetting","async": async, "parameter": {"id": id },"success": success,"failure": failure});
  159. },
  160. savePersonSetting: function(data, success, failure,async){
  161. this.action.invoke({"name": "savePersonSetting","async": async,"data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  162. },
  163. deletePersonSetting: function(id, success, failure, async){
  164. this.action.invoke({"name": "deletePersonSetting","async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  165. },
  166. listAttachmentInfo: function(success, failure, async){
  167. this.action.invoke({"name": "listAttachmentInfo","async": async, "success": success, "failure": failure});
  168. },
  169. getAttachmentInfo : function(id, success, failure, async){
  170. this.action.invoke({"name": "getAttachmentInfo","async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  171. },
  172. uploadAttachment: function(success, failure, formData, file){
  173. this.action.invoke({"name": "uploadAttachment", "data": formData,"file": file,"success": success,"failure": failure});
  174. },
  175. //getAttachment: function(id, documentid, success, failure, async){
  176. // this.actionAttachment.invoke({"name": "getAttachment","async": async, "parameter": {"id": id, "documentid": documentid}, "success": success, "failure": failure});
  177. //},
  178. deleteAttachment: function(id, success, failure, async){
  179. this.action.invoke({"name": "deleteAttachment","async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  180. },
  181. getAttachmentStream: function(id){
  182. this.action.getActions(function(){
  183. var url = this.action.actions.getAttachmentStream.uri;
  184. url = url.replace("{id}", encodeURIComponent(id));
  185. window.open(o2.filterUrl(this.action.address)+url);
  186. }.bind(this));
  187. },
  188. //importAttachment: function(file_id, success, failure){
  189. // this.action.invoke({"name": "importAttachment", "parameter": {"file_id": file_id },"success": success,"failure": failure});
  190. //},
  191. //checkAttachment: function(file_id, success, failure){
  192. // this.action.invoke({"name": "checkAttachment", "parameter": {"file_id": file_id },"success": success,"failure": failure});
  193. //},
  194. getImportStatus: function(file_id, success, failure){
  195. this.action.invoke({"name": "getImportStatus", "parameter": {"file_id": file_id },"success": success,"failure": failure});
  196. },
  197. getImportStatusAll: function(success, failure){
  198. this.action.invoke({"name": "getImportStatusAll", "success": success,"failure": failure});
  199. },
  200. getImportStatusDetail : function(file_id, success, failure){
  201. this.action.invoke({"name": "getImportStatusDetail", "parameter": {"file_id": file_id },"success": success,"failure": failure});
  202. },
  203. exportAbnormalAttachment: function(year, month, success, failure){
  204. this.action.getActions(function(){
  205. var url = this.action.actions.exportAbnormalAttachment.uri;
  206. url = url.replace("{year}", year);
  207. url = url.replace("{month}", month);
  208. window.open(o2.filterUrl(this.action.address+url) , "_blank");
  209. }.bind(this));
  210. //this.action.invoke({"name": "exportAbnormalAttachment", "parameter": {"year": year, "month": month },"success": success,"failure": failure});
  211. },
  212. getDetail: function(id, success, failure, async){
  213. this.action.invoke({"name": "getDetail","async": async, "parameter": {"id": id },"success": success,"failure": failure});
  214. },
  215. deleteDetail: function(id, success, failure, async){
  216. this.action.invoke({"name": "deleteDetail","async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  217. },
  218. listDetail: function(success, failure, async){
  219. this.action.invoke({"name": "listDetail","async": async, "success": success, "failure": failure});
  220. },
  221. listDetailFilter : function( filterData, success,failure, async){
  222. this.action.invoke({"name": "listDetailFilter", "data": filterData, "async": async, "success": success, "failure": failure});
  223. },
  224. listDetailFilterNext : function( id, count, filterData, success,failure, async){
  225. this.action.invoke({"name": "listDetailFilterNext","parameter": {"id": id , "count" : count }, "data": filterData, "async": async, "success": success, "failure": failure});
  226. },
  227. listDetailFilterPrev : function( id, count, filterData, success,failure, async){
  228. this.action.invoke({"name": "listDetailFilterPrev","parameter": {"id": id , "count" : count }, "data": filterData, "async": async, "success": success, "failure": failure});
  229. },
  230. listDetailFilterUser : function( filterData, success,failure, async){
  231. this.action.invoke({"name": "listDetailFilterUser", "data": filterData, "async": async, "success": success, "failure": failure});
  232. },
  233. listUnitDetailFilter : function( filterData, success,failure, async){
  234. this.action.invoke({"name": "listUnitDetailFilter", "data": filterData, "async": async, "success": success, "failure": failure});
  235. },
  236. listTopUnitDetailFilter : function( filterData, success,failure, async){
  237. this.action.invoke({"name": "listTopUnitDetailFilter", "data": filterData, "async": async, "success": success, "failure": failure});
  238. },
  239. listDetailByAttachment: function(file_id, success, failure){
  240. this.action.invoke({"name": "listDetailByAttachment", "parameter": {"file_id": file_id },"success": success,"failure": failure});
  241. },
  242. checkDetail: function(cycleYear, cycleMonth, success, failure){
  243. this.action.invoke({"name": "checkDetail", "parameter": {"cycleYear": cycleYear , "cycleMonth" : cycleMonth },"success": success,"failure": failure});
  244. },
  245. analyseDetail: function(startDate, endDate, success, failure){
  246. this.action.invoke({"name": "analyseDetail", "parameter": {"startDate": startDate , "endDate" : endDate },"success": success,"failure": failure});
  247. },
  248. staticDetail : function(year, month, success, failure){
  249. this.action.invoke({"name": "staticDetail", "parameter": {"year": year , "month" : month },"success": success,"failure": failure});
  250. },
  251. staticAllDetail : function(success, failure){
  252. this.action.invoke({"name": "staticAllDetail", "success": success,"failure": failure});
  253. },
  254. listStaticMonthPerson: function(person,year, month, success, failure){
  255. this.action.invoke({"name": "listStaticMonthPerson", "parameter": {"name":person,"year": year,"month":month },"success": success,"failure": failure});
  256. },
  257. listStaticDayUnit: function(unit, year, month, success, failure){
  258. this.action.invoke({"name": "listStaticDayUnit", "parameter": {"name":unit,"year": year,"month":month },"success": success,"failure": failure});
  259. },
  260. listStaticDateUnit: function(unit, date, success, failure){
  261. this.action.invoke({"name": "listStaticDateUnit", "parameter": {"name":unit,"date": date },"success": success,"failure": failure});
  262. },
  263. listStaticMonthUnit: function(unit, year, month, success, failure, async ){
  264. this.action.invoke({"name": "listStaticMonthUnit", "parameter": {"name":unit,"year": year,"month":month },"success": success,"failure": failure,"async": async });
  265. },
  266. listStaticMonthUnitSum: function(unit, year, month, success, failure, async ){
  267. this.action.invoke({"name": "listStaticMonthUnitSum", "parameter": {"name":unit,"year": year,"month":month },"success": success,"failure": failure,"async": async });
  268. },
  269. listStaticDayTopUnit: function(topUnit, year, month, success, failure){
  270. this.action.invoke({"name": "listStaticDayTopUnit", "parameter":{"name":topUnit,"year": year,"month":month },"success": success,"failure": failure});
  271. },
  272. listStaticMonthTopUnit: function(topUnit, year, month, success, failure){
  273. this.action.invoke({"name": "listStaticMonthTopUnit", "parameter": {"name":topUnit,"year": year,"month":month },"success": success,"failure": failure});
  274. },
  275. listStaticMonthPersonByUnit: function(unit,year, month, success, failure){
  276. this.action.invoke({"name": "listStaticMonthPersonByUnit", "parameter": {"name":unit, "year": year,"month":month },"success": success,"failure": failure});
  277. },
  278. listStaticMonthPersonByUnitNested : function(unit,year, month, success, failure){
  279. this.action.invoke({"name": "listStaticMonthPersonByUnitNested", "parameter": {"name":unit, "year": year,"month":month },"success": success,"failure": failure});
  280. },
  281. //根据公司查询公司下所有部门的统计数据信息:
  282. //"listUnitDateStaticByTopUnit" : {"uri":"/jaxrs/statisticshow/unit/day/topUnit/{name}/{date}"},
  283. listUnitDateStaticByTopUnit: function(topUnit, date, success, failure){
  284. this.action.invoke({"name": "listUnitDateStaticByTopUnit", "parameter": {"name":topUnit,"date": date },"success": success,"failure": failure});
  285. },
  286. //根据公司查询公司下所有部门的统计数据信息:
  287. //"listUnitMonthStaticByTopUnit" : {"uri":"/jaxrs/statisticshow/unit/topUnit/{name}/{year}/{month}"},
  288. listUnitMonthStaticByTopUnit: function(topUnit, year, month, success, failure, async ){
  289. this.action.invoke({"name": "listUnitMonthStaticByTopUnit", "parameter": {"name":topUnit,"year": year,"month":month },"success": success,"failure": failure,"async": async });
  290. },
  291. //根据部门查询部门下所有员工的统计数据信息:
  292. //"listPersonMonthStaticByUnit" : {"uri":"/jaxrs/statisticshow/persons/unit/subnested/{name}/{year}/{month}"},
  293. listPersonMonthStaticByUnit: function(unit, year, month, success, failure, async ){
  294. this.action.invoke({"name": "listPersonMonthStaticByUnit", "parameter": {"name":unit,"year": year,"month":month },"success": success,"failure": failure,"async": async });
  295. },
  296. createAppeal: function(detailId, data, success, failure){
  297. this.action.invoke({"name": "createAppeal", "parameter": {"detailId": detailId }, "data": data, "success": success,"failure": failure});
  298. },
  299. processAppeal: function( data, success, failure, async){
  300. this.action.invoke({"name": "processAppeal", "async": async, "data": data, "success": success, "failure": failure});
  301. },
  302. process2Appeal: function(data, success, failure, async){
  303. this.action.invoke({"name": "process2Appeal", "async": async, "data": data, "success": success, "failure": failure});
  304. },
  305. getAppeal: function(id, success, failure,async){
  306. this.action.invoke({"name": "getAppeal", "parameter": {"id": id}, "async": async, "success": success,"failure": failure});
  307. },
  308. deleteAppeal: function(id, success, failure, async){
  309. this.action.invoke({"name": "deleteAppeal", "async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  310. },
  311. listAppealFilterNext : function( id, count, filterData, success,failure, async){
  312. this.action.invoke({"name": "listAppealFilterNext","parameter": {"id": id , "count" : count }, "data": filterData, "async": async, "success": success, "failure": failure});
  313. },
  314. listAppealFilterPrev : function( id, count, filterData, success,failure, async){
  315. this.action.invoke({"name": "listAppealFilterPrev","parameter": {"id": id , "count" : count }, "data": filterData, "async": async, "success": success, "failure": failure});
  316. },
  317. listWorkplace: function(success, failure, async){
  318. this.action.invoke({"name": "listWorkplace","async": async, "success": success, "failure": failure});
  319. },
  320. getWorkplace: function(id, success, failure, async){
  321. this.action.invoke({"name": "getWorkplace","async": async, "parameter": {"id": id },"success": success,"failure": failure});
  322. },
  323. saveWorkplace: function(data, success, failure,async){
  324. this.action.invoke({"name": "saveWorkplace","async": async,"data": data,"parameter": {"id": data.id},"success": success,"failure": failure});
  325. },
  326. deleteWorkplace: function(id, success, failure, async){
  327. this.action.invoke({"name": "deleteWorkplace","async": async, "parameter": {"id": id}, "success": success, "failure": failure});
  328. }
  329. });