taskCompleted.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. taskCompleted_parameter = {
  2. first : '(0)',
  3. last : '(0)',
  4. count : 20
  5. };
  6. function taskCompleted_list_init() {
  7. var str = '<table border="1" width="100%">';
  8. str += '<thead><tr><td colspan="6"><a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<span id="total">0</span></td></tr>';
  9. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  10. str += '<tbody id="grid"></tbody>'
  11. str += '</table>';
  12. $('#content').html(str);
  13. $('#next').click(function() {
  14. taskCompleted_list_next();
  15. });
  16. $('#prev').click(function() {
  17. taskCompleted_list_prev();
  18. });
  19. taskCompleted_parameter.first = '(0)';
  20. taskCompleted_parameter.last = '(0)';
  21. taskCompleted_list_next();
  22. }
  23. function taskCompleted_list_next(id) {
  24. var id = (id ? id : taskCompleted_parameter.last);
  25. $.ajax({
  26. type : 'get',
  27. dataType : 'json',
  28. contentType : 'application/json; charset=utf-8',
  29. url : '../jaxrs/taskcompleted/list/' + id + '/next/' + taskCompleted_parameter.count,
  30. xhrFields : {
  31. 'withCredentials' : true
  32. },
  33. crossDomain : true
  34. }).done(function(json) {
  35. if (json.type == 'success') {
  36. if (json.data.length > 0) {
  37. taskCompleted_parameter.first = json.data[0].id;
  38. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  39. } else {
  40. taskCompleted_parameter.first = '(0)';
  41. }
  42. taskCompleted_list_grid(json);
  43. }
  44. }).always(function(json) {
  45. $('#result').html(JSON.stringify(json, null, 4));
  46. });
  47. }
  48. function taskCompleted_list_prev(id) {
  49. var id = (id ? id : taskCompleted_parameter.first);
  50. $.ajax({
  51. type : 'get',
  52. dataType : 'json',
  53. contentType : 'application/json; charset=utf-8',
  54. url : '../jaxrs/taskcompleted/list/' + id + '/prev/' + taskCompleted_parameter.count,
  55. xhrFields : {
  56. 'withCredentials' : true
  57. },
  58. crossDomain : true
  59. }).done(function(json) {
  60. if (json.type == 'success') {
  61. if (json.data.length > 0) {
  62. taskCompleted_parameter.first = json.data[0].id;
  63. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  64. } else {
  65. taskCompleted_parameter.last = '(0)';
  66. }
  67. taskCompleted_list_grid(json);
  68. }
  69. }).always(function(json) {
  70. $('#result').html(JSON.stringify(json, null, 4));
  71. });
  72. }
  73. function taskCompleted_listWithApplication_init() {
  74. $('#result').html('');
  75. var str = '<table border="1" width="100%">';
  76. str += '<thead><tr><td colspan="4"><a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<span id="total">0</span></td></tr>';
  77. str += '<tr><th>applicationFlag</th><th colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></th></tr>';
  78. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  79. str += '<tbody id="grid"></tbody>'
  80. str += '</table>';
  81. $('#content').html(str);
  82. $('#next').click(function() {
  83. taskCompleted_listWithApplication_next();
  84. });
  85. $('#prev').click(function() {
  86. taskCompleted_listWithApplication_prev();
  87. });
  88. taskCompleted_parameter.first = '(0)';
  89. taskCompleted_parameter.last = '(0)';
  90. }
  91. function taskCompleted_listWithApplication_next(id) {
  92. var id = (id ? id : taskCompleted_parameter.last);
  93. $.ajax({
  94. type : 'get',
  95. dataType : 'json',
  96. contentType : 'application/json; charset=utf-8',
  97. url : '../jaxrs/taskcompleted/list/' + taskCompleted_parameter.last + '/next/' + taskCompleted_parameter.count + '/application/' + $('#applicationFlag').val(),
  98. xhrFields : {
  99. 'withCredentials' : true
  100. },
  101. crossDomain : true
  102. }).done(function(json) {
  103. if (json.type == 'success') {
  104. if (json.data.length > 0) {
  105. taskCompleted_parameter.first = json.data[0].id;
  106. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  107. } else {
  108. taskCompleted_parameter.first = '(0)';
  109. }
  110. taskCompleted_list_grid(json);
  111. }
  112. }).always(function(json) {
  113. $('#result').html(JSON.stringify(json, null, 4));
  114. });
  115. }
  116. function taskCompleted_listWithApplication_prev(id) {
  117. var id = (id ? id : taskCompleted_parameter.first);
  118. $.ajax({
  119. type : 'get',
  120. dataType : 'json',
  121. contentType : 'application/json; charset=utf-8',
  122. url : '../jaxrs/taskcompleted/list/' + id + '/prev/' + taskCompleted_parameter.count + '/application/' + $('#applicationFlag').val(),
  123. xhrFields : {
  124. 'withCredentials' : true
  125. },
  126. crossDomain : true
  127. }).done(function(json) {
  128. if (json.type == 'success') {
  129. if (json.data.length > 0) {
  130. taskCompleted_parameter.first = json.data[0].id;
  131. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  132. } else {
  133. taskCompleted_parameter.last = '(0)';
  134. }
  135. taskCompleted_list_grid(json);
  136. }
  137. }).always(function(json) {
  138. $('#result').html(JSON.stringify(json, null, 4));
  139. });
  140. }
  141. function taskCompleted_listWithProcess_init() {
  142. $('#result').html('');
  143. var str = '<table border="1" width="100%">';
  144. str += '<thead><tr><td colspan="4"><a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<span id="total">0</span></td></tr>';
  145. str += '<tr><th>processFlag</th><th colspan="3"><input type="text" id="processFlag" style="width:95%"/></th></tr>';
  146. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  147. str += '<tbody id="grid"></tbody>'
  148. str += '</table>';
  149. $('#content').html(str);
  150. $('#next').click(function() {
  151. taskCompleted_listWithProcess_next();
  152. });
  153. $('#prev').click(function() {
  154. taskCompleted_listWithProcess_prev();
  155. });
  156. taskCompleted_parameter.first = '(0)';
  157. taskCompleted_parameter.last = '(0)';
  158. }
  159. function taskCompleted_listWithProcess_next(id) {
  160. var id = (id ? id : taskCompleted_parameter.last);
  161. $.ajax({
  162. type : 'get',
  163. dataType : 'json',
  164. contentType : 'application/json; charset=utf-8',
  165. url : '../jaxrs/taskcompleted/list/' + id + '/next/' + taskCompleted_parameter.count + '/process/' + $('#processFlag').val(),
  166. xhrFields : {
  167. 'withCredentials' : true
  168. },
  169. crossDomain : true
  170. }).done(function(json) {
  171. if (json.type == 'success') {
  172. if (json.data.length > 0) {
  173. taskCompleted_parameter.first = json.data[0].id;
  174. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  175. } else {
  176. taskCompleted_parameter.first = '(0)';
  177. }
  178. taskCompleted_list_grid(json);
  179. }
  180. }).always(function(json) {
  181. $('#result').html(JSON.stringify(json, null, 4));
  182. });
  183. }
  184. function taskCompleted_listWithProcess_prev(id) {
  185. var id = (id ? id : taskCompleted_parameter.first);
  186. $.ajax({
  187. type : 'get',
  188. dataType : 'json',
  189. contentType : 'application/json; charset=utf-8',
  190. url : '../jaxrs/taskcompleted/list/' + id + '/prev/' + taskCompleted_parameter.count + '/process/' + $('#processFlag').val(),
  191. xhrFields : {
  192. 'withCredentials' : true
  193. },
  194. crossDomain : true
  195. }).done(function(json) {
  196. if (json.type == 'success') {
  197. if (json.data.length > 0) {
  198. taskCompleted_parameter.first = json.data[0].id;
  199. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  200. } else {
  201. taskCompleted_parameter.last = '(0)';
  202. }
  203. taskCompleted_list_grid(json);
  204. }
  205. }).always(function(json) {
  206. $('#result').html(JSON.stringify(json, null, 4));
  207. });
  208. }
  209. function taskCompleted_list_grid(json) {
  210. if (json.data && json.data.length > 0) {
  211. str = '';
  212. $.each(json.data, function(index, item) {
  213. str += '<tr>';
  214. str += '<td>' + item.rank + '</td>';
  215. str += '<td>' + item.id + '</td>';
  216. str += '<td>' + item.title + '</td>';
  217. str += '<td>' + item.processName + '</td>';
  218. str += '</tr>';
  219. });
  220. $('#total').html(json.count);
  221. $('#grid').html(str);
  222. } else {
  223. $('#total').html('0');
  224. $('#grid').html('');
  225. }
  226. }
  227. function taskCompleted_listCountWithApplication() {
  228. $('#result').html('');
  229. $('#content').html('');
  230. $.ajax({
  231. type : 'get',
  232. dataType : 'json',
  233. contentType : 'application/json; charset=utf-8',
  234. url : '../jaxrs/taskcompleted/list/count/application',
  235. xhrFields : {
  236. 'withCredentials' : true
  237. },
  238. crossDomain : true
  239. }).always(function(json) {
  240. $('#result').html(JSON.stringify(json, null, 4));
  241. });
  242. }
  243. function taskCompleted_listCountWithProcess_init() {
  244. $('#result').html('');
  245. str = '<table border="1" width="100%">';
  246. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  247. str += '<tr><td>applicationFlag:</td><td><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  248. str += '</table>';
  249. $('#content').html(str);
  250. $('#get').click(function() {
  251. taskCompleted_listCountWithProcess($('#applicationFlag').val());
  252. });
  253. }
  254. function taskCompleted_listCountWithProcess(applicationFlag) {
  255. $('#result').html('');
  256. $.ajax({
  257. type : 'get',
  258. dataType : 'json',
  259. contentType : 'application/json; charset=utf-8',
  260. url : '../jaxrs/taskcompleted/list/count/application/' + applicationFlag + '/process',
  261. xhrFields : {
  262. 'withCredentials' : true
  263. },
  264. crossDomain : true
  265. }).always(function(json) {
  266. $('#result').html(JSON.stringify(json, null, 4));
  267. });
  268. }
  269. function taskCompleted_countWithPerson_init() {
  270. $('#result').html('');
  271. str = '<table border="1" width="100%">';
  272. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  273. str += '<tr><td>person:</td><td><input type="text" id="person" style="width:95%"/></td></tr>';
  274. str += '</table>';
  275. $('#content').html(str);
  276. $('#get').click(function() {
  277. taskCompleted_countWithPerson($('#person').val());
  278. });
  279. }
  280. function taskCompleted_countWithPerson(person) {
  281. $('#result').html('');
  282. $.ajax({
  283. type : 'get',
  284. dataType : 'json',
  285. contentType : 'application/json; charset=utf-8',
  286. url : '../jaxrs/taskcompleted/count/' + person,
  287. xhrFields : {
  288. 'withCredentials' : true
  289. },
  290. crossDomain : true
  291. }).always(function(json) {
  292. $('#result').html(JSON.stringify(json, null, 4));
  293. });
  294. }
  295. function taskCompleted_reference_init() {
  296. $('#result').html('');
  297. str = '<table border="1" width="100%">';
  298. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  299. str += '<tr><td>id:</td><td><input type="text" id="id" style="width:95%"/></td></tr>';
  300. str += '</table>';
  301. $('#content').html(str);
  302. $('#get').click(function() {
  303. taskCompleted_reference($('#id').val());
  304. });
  305. }
  306. function taskCompleted_reference(id) {
  307. $('#result').html('');
  308. $.ajax({
  309. type : 'get',
  310. dataType : 'json',
  311. contentType : 'application/json; charset=utf-8',
  312. url : '../jaxrs/taskcompleted/' + id + '/reference',
  313. xhrFields : {
  314. 'withCredentials' : true
  315. },
  316. crossDomain : true
  317. }).always(function(json) {
  318. $('#result').html(JSON.stringify(json, null, 4));
  319. });
  320. }
  321. function taskCompleted_listFilter_init() {
  322. $('#result').html('');
  323. var str = '<table border="1" width="100%">';
  324. str += '<thead><tr><td colspan="4"><a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<a href="#" id="clear">clear</a>&nbsp;<span id="total">0</span></td></tr>';
  325. str += '<tr><td>application</td><td colspan="3"><select id="applicationFilter"></select></td></tr>';
  326. str += '<tr><td>process</td><td colspan="3"><select id="processFilter"></select></td></tr>';
  327. str += '<tr><td>creatorCompany</td><td colspan="3"><select id="creatorCompanyFilter"></select></td></tr>';
  328. str += '<tr><td>creatorDepartment</td><td colspan="3"><select id="creatorDepartmentFilter"></select></td></tr>';
  329. str += '<tr><td>completedTimeMonth</td><td colspan="3"><select id="completedTimeMonthFilter"></select></td></tr>';
  330. str += '<tr><td>activityName</td><td colspan="3"><select id="activityNameFilter"></select></td></tr>';
  331. str += '<tr><td>key</td><td colspan="3"><input type="text" id="keyFilter" style="width:95%"/></td></tr>';
  332. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  333. str += '<tbody id="grid"></tbody>';
  334. str += '</table>';
  335. $('#content').html(str);
  336. $('#next').click(function() {
  337. taskCompleted_listFilter_next();
  338. });
  339. $('#prev').click(function() {
  340. taskCompleted_listFilter_prev();
  341. });
  342. $('#clear').click(function() {
  343. taskCompleted_parameter.first = '(0)';
  344. taskCompleted_parameter.last = '(0)';
  345. });
  346. taskCompleted_parameter.first = '(0)';
  347. taskCompleted_parameter.last = '(0)';
  348. $.ajax({
  349. type : 'get',
  350. dataType : 'json',
  351. contentType : 'application/json; charset=utf-8',
  352. url : '../jaxrs/taskcompleted/filter/attribute',
  353. xhrFields : {
  354. 'withCredentials' : true
  355. },
  356. crossDomain : true
  357. }).done(function(json) {
  358. if (json.type == 'success') {
  359. txt = '<option value="">all</option>';
  360. if (json.data.applicationList) {
  361. $.each(json.data.applicationList, function(index, item) {
  362. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  363. });
  364. }
  365. $('#applicationFilter').html(txt);
  366. txt = '<option value="">all</option>';
  367. if (json.data.processList) {
  368. $.each(json.data.processList, function(index, item) {
  369. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  370. });
  371. }
  372. $('#processFilter').html(txt);
  373. txt = '<option value="">all</option>';
  374. if (json.data.creatorCompanyList) {
  375. $.each(json.data.creatorCompanyList, function(index, item) {
  376. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  377. });
  378. }
  379. $('#creatorCompanyFilter').html(txt);
  380. txt = '<option value="">all</option>';
  381. if (json.data.creatorDepartmentList) {
  382. $.each(json.data.creatorDepartmentList, function(index, item) {
  383. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  384. });
  385. }
  386. $('#creatorDepartmentFilter').html(txt);
  387. txt = '<option value="">all</option>';
  388. if (json.data.completedTimeMonthList) {
  389. $.each(json.data.completedTimeMonthList, function(index, item) {
  390. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  391. });
  392. }
  393. $('#completedTimeMonthFilter').html(txt);
  394. txt = '<option value="">all</option>';
  395. if (json.data.activityNameList) {
  396. $.each(json.data.activityNameList, function(index, item) {
  397. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  398. });
  399. }
  400. $('#activityNameFilter').html(txt);
  401. }
  402. }).always(function(json) {
  403. $('#result').html(JSON.stringify(json, null, 4));
  404. });
  405. }
  406. function taskCompleted_listFilter_next(id) {
  407. var id = (id ? id : taskCompleted_parameter.last);
  408. $.ajax({
  409. type : 'post',
  410. dataType : 'json',
  411. contentType : 'application/json; charset=utf-8',
  412. url : '../jaxrs/taskcompleted/list/' + id + '/next/' + taskCompleted_parameter.count + '/filter',
  413. xhrFields : {
  414. 'withCredentials' : true
  415. },
  416. data : JSON.stringify({
  417. application : $('#applicationFilter').val(),
  418. process : $('#processFilter').val(),
  419. creatorCompany : $('#creatorCompanyFilter').val(),
  420. creatorDepartment : $('#creatorDepartmentFilter').val(),
  421. completedTimeMonth : $('#completedTimeMonthFilter').val(),
  422. activityName : $('#activityNameFilter').val(),
  423. key : $('#keyFilter').val()
  424. }),
  425. crossDomain : true
  426. }).done(function(json) {
  427. if (json.type == 'success') {
  428. if (json.data.length > 0) {
  429. taskCompleted_parameter.first = json.data[0].id;
  430. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  431. } else {
  432. taskCompleted_parameter.first = '(0)';
  433. }
  434. taskCompleted_list_grid(json);
  435. }
  436. }).always(function(json) {
  437. $('#result').html(JSON.stringify(json, null, 4));
  438. });
  439. }
  440. function taskCompleted_listFilter_prev(id) {
  441. var id = (id ? id : taskCompleted_parameter.first);
  442. $.ajax({
  443. type : 'post',
  444. dataType : 'json',
  445. contentType : 'application/json; charset=utf-8',
  446. url : '../jaxrs/taskcompleted/list/' + id + '/prev/' + taskCompleted_parameter.count + '/filter',
  447. xhrFields : {
  448. 'withCredentials' : true
  449. },
  450. data : JSON.stringify({
  451. application : $('#applicationFilter').val(),
  452. process : $('#processFilter').val(),
  453. creatorCompany : $('#creatorCompanyFilter').val(),
  454. creatorDepartment : $('#creatorDepartmentFilter').val(),
  455. completedTimeMonth : $('#completedTimeMonthFilter').val(),
  456. activityName : $('#activityNameFilter').val(),
  457. key : $('#keyFilter').val()
  458. }),
  459. crossDomain : true
  460. }).done(function(json) {
  461. if (json.type == 'success') {
  462. if (json.data.length > 0) {
  463. taskCompleted_parameter.first = json.data[0].id;
  464. taskCompleted_parameter.last = json.data[json.data.length - 1].id;
  465. } else {
  466. taskCompleted_parameter.last = '(0)';
  467. }
  468. taskCompleted_list_grid(json);
  469. }
  470. }).always(function(json) {
  471. $('#result').html(JSON.stringify(json, null, 4));
  472. });
  473. }