work.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. work_parameter = {
  2. first : '(0)',
  3. last : '(0)',
  4. count : 20
  5. };
  6. function work_count_init() {
  7. $('#result').html('');
  8. var str = '<table border="1" width="100%">';
  9. str += '<thead>';
  10. str += '<tr><td colspan="2"><a href="#" id="countWithPerson">countWithPerson</a>&nbsp;<a href="#" id="countWithApplication">countWithApplication</a>&nbsp;<a href="#" id="countWithProcess">countWithProcess</a></td></tr>';
  11. str += '</thead>'
  12. str += '<tbody id="grid">';
  13. str += '<tr><td>person:</td><td><input type="text" id="person" style="width:95%"></td></tr>';
  14. str += '<tr><td>applicationFlag:</td><td><input type="text" id="applicationFlag" style="width:95%"></td></tr>';
  15. str += '</tbody>';
  16. str += '</table>';
  17. $('#content').html(str);
  18. $('#countWithPerson').click(function() {
  19. work_countWithPerson($('#person').val());
  20. });
  21. $('#countWithApplication').click(function() {
  22. work_countWithApplication();
  23. });
  24. $('#countWithProcess').click(function() {
  25. work_countWithProcess($('#applicationFlag').val());
  26. });
  27. }
  28. function work_countWithPerson(person) {
  29. $('#result').html('');
  30. $.ajax({
  31. type : 'get',
  32. dataType : 'json',
  33. url : '../jaxrs/work/count/' + person,
  34. xhrFields : {
  35. 'withCredentials' : true
  36. },
  37. crossDomain : true
  38. }).always(function(json) {
  39. $('#result').html(JSON.stringify(json, null, 4));
  40. });
  41. }
  42. function work_countWithApplication() {
  43. $('#result').html('');
  44. $.ajax({
  45. type : 'get',
  46. dataType : 'json',
  47. url : '../jaxrs/work/list/count/application',
  48. xhrFields : {
  49. 'withCredentials' : true
  50. },
  51. crossDomain : true
  52. }).always(function(json) {
  53. $('#result').html(JSON.stringify(json, null, 4));
  54. });
  55. }
  56. function work_countWithProcess(applicationFlag) {
  57. $('#result').html('');
  58. $.ajax({
  59. type : 'get',
  60. dataType : 'json',
  61. url : '../jaxrs/work/list/count/application/' + applicationFlag + '/process',
  62. xhrFields : {
  63. 'withCredentials' : true
  64. },
  65. crossDomain : true
  66. }).always(function(json) {
  67. $('#result').html(JSON.stringify(json, null, 4));
  68. });
  69. }
  70. function work_get_init() {
  71. $('#result').html('');
  72. var str = '<table border="1" width="100%">';
  73. str += '<thead>';
  74. str += '<tr><td colspan="2"><a href="#" id="complex">complex</a>&nbsp;<a href="#" id="complexMobile">complexMobile</a>&nbsp;<a href="#" id="complexAppointForm">complexAppointForm</a>&nbsp;<a href="#" id="complexAppointFormMobile">complexAppointFormMobile</a></td></tr>';
  75. str += '<tr><td colspan="2"><a href="#" id="processing">processing</a>&nbsp;<a href="#" id="reroute">reroute</a>&nbsp;<a href="#" id="retract">retract</a>&nbsp;<a href="#" id="delete">delete</a></td></tr>';
  76. str += '</thead>';
  77. str += '<tbody id="grid">';
  78. str += '<tr><td>workId:</td><td><input type="text" id="workId" style="width:95%"></td></tr>';
  79. str += '<tr><td>formFlag:</td><td><input type="text" id="formFlag" style="width:95%"></td></tr>';
  80. str += '<tr><td>activityId:</td><td><input type="text" id="activityId" style="width:95%"></td></tr>';
  81. str += '<tr><td>activityType:</td><td><input type="text" id="activityType" style="width:95%"></td></tr>';
  82. str += '</tbody>';
  83. str += '</table>';
  84. $('#content').html(str);
  85. $('#complex').click(function() {
  86. work_complex($('#workId').val());
  87. });
  88. $('#complexMobile').click(function() {
  89. work_complexMobile($('#workId').val());
  90. });
  91. $('#complexAppointForm').click(function() {
  92. work_complexAppointForm($('#workId').val(), $('#formFlag').val());
  93. });
  94. $('#complexAppointFormMobile').click(function() {
  95. work_complexAppointFormMobile($('#workId').val(), $('#formFlag').val());
  96. });
  97. $('#processing').click(function() {
  98. work_processing($('#workId').val());
  99. });
  100. $('#reroute').click(function() {
  101. work_reroute($('#workId').val(), $('#activityId').val(), $('#activityType').val());
  102. });
  103. $('#retract').click(function() {
  104. work_retract($('#workId').val());
  105. });
  106. $('#delete').click(function() {
  107. work_retract($('#delete').val());
  108. });
  109. }
  110. function work_complex(workId) {
  111. $('#result').html('');
  112. $.ajax({
  113. type : 'get',
  114. dataType : 'json',
  115. url : '../jaxrs/work/' + workId + '/complex',
  116. xhrFields : {
  117. 'withCredentials' : true
  118. },
  119. crossDomain : true
  120. }).always(function(json) {
  121. $('#result').html(JSON.stringify(json, null, 4));
  122. });
  123. }
  124. function work_complexMobile(workId) {
  125. $('#result').html('');
  126. $.ajax({
  127. type : 'get',
  128. dataType : 'json',
  129. url : '../jaxrs/work/' + workId + '/complex/mobile',
  130. xhrFields : {
  131. 'withCredentials' : true
  132. },
  133. crossDomain : true
  134. }).always(function(json) {
  135. $('#result').html(JSON.stringify(json, null, 4));
  136. });
  137. }
  138. function work_complexAppointForm(workId, formFlag) {
  139. $('#result').html('');
  140. $.ajax({
  141. type : 'get',
  142. dataType : 'json',
  143. url : '../jaxrs/work/' + workId + '/complex/appoint/form/' + formFlag,
  144. xhrFields : {
  145. 'withCredentials' : true
  146. },
  147. crossDomain : true
  148. }).always(function(json) {
  149. $('#result').html(JSON.stringify(json, null, 4));
  150. });
  151. }
  152. function work_complexAppointFormMobile(workId, formFlag) {
  153. $('#result').html('');
  154. $.ajax({
  155. type : 'get',
  156. dataType : 'json',
  157. url : '../jaxrs/work/' + workId + '/complex/appoint/form/' + formFlag + '/mobile',
  158. xhrFields : {
  159. 'withCredentials' : true
  160. },
  161. crossDomain : true
  162. }).always(function(json) {
  163. $('#result').html(JSON.stringify(json, null, 4));
  164. });
  165. }
  166. function work_processing(workId) {
  167. $('#result').html('');
  168. $.ajax({
  169. type : 'put',
  170. dataType : 'json',
  171. url : '../jaxrs/work/' + workId + '/processing',
  172. xhrFields : {
  173. 'withCredentials' : true
  174. },
  175. crossDomain : true
  176. }).always(function(json) {
  177. $('#result').html(JSON.stringify(json, null, 4));
  178. });
  179. }
  180. function work_reroute(workId, activityId, activityType) {
  181. $('#result').html('');
  182. $.ajax({
  183. type : 'put',
  184. dataType : 'json',
  185. url : '../jaxrs/work/' + workId + '/reroute/activity/' + activityId + '/activitytype/' + activityType,
  186. xhrFields : {
  187. 'withCredentials' : true
  188. },
  189. crossDomain : true
  190. }).always(function(json) {
  191. $('#result').html(JSON.stringify(json, null, 4));
  192. });
  193. }
  194. function work_retract(workId) {
  195. $('#result').html('');
  196. $.ajax({
  197. type : 'put',
  198. dataType : 'json',
  199. url : '../jaxrs/work/' + workId + '/retract',
  200. xhrFields : {
  201. 'withCredentials' : true
  202. },
  203. crossDomain : true
  204. }).always(function(json) {
  205. $('#result').html(JSON.stringify(json, null, 4));
  206. });
  207. }
  208. function work_delete(workId) {
  209. $('#result').html('');
  210. $.ajax({
  211. type : 'delete',
  212. dataType : 'json',
  213. url : '../jaxrs/work/' + workId,
  214. xhrFields : {
  215. 'withCredentials' : true
  216. },
  217. crossDomain : true
  218. }).always(function(json) {
  219. $('#result').html(JSON.stringify(json, null, 4));
  220. });
  221. }
  222. function work_list_init() {
  223. $('#result').html('');
  224. str = '<table border="1" width="100%">';
  225. str += '<thead>';
  226. str += '<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>';
  227. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr>';
  228. str += '</thead>';
  229. str += '<tbody id="gird">';
  230. str += '</tbody>';
  231. str += '</table>';
  232. $('#content').html(str);
  233. $('#next').click(function() {
  234. work_list_next();
  235. });
  236. $('#prev').click(function() {
  237. work_list_prev();
  238. });
  239. work_parameter.first = '(0)';
  240. work_parameter.last = '(0)';
  241. work_list_next();
  242. }
  243. function work_list_next(id) {
  244. var id = (id ? id : work_parameter.last);
  245. $.ajax({
  246. type : 'get',
  247. dataType : 'json',
  248. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count,
  249. xhrFields : {
  250. 'withCredentials' : true
  251. },
  252. crossDomain : true
  253. }).done(function(json) {
  254. if (json.type == 'success') {
  255. if (json.data.length > 0) {
  256. work_parameter.first = json.data[0].id;
  257. work_parameter.last = json.data[json.data.length - 1].id;
  258. } else {
  259. work_parameter.first = '(0)';
  260. }
  261. work_list_grid(json);
  262. }
  263. }).always(function(json) {
  264. $('#result').html(JSON.stringify(json, null, 4));
  265. });
  266. }
  267. function work_list_prev(id) {
  268. var id = (id ? id : work_parameter.first);
  269. $.ajax({
  270. type : 'get',
  271. dataType : 'json',
  272. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count,
  273. xhrFields : {
  274. 'withCredentials' : true
  275. },
  276. crossDomain : true
  277. }).done(function(json) {
  278. if (json.type == 'success') {
  279. if (json.data.length > 0) {
  280. work_parameter.first = json.data[0].id;
  281. work_parameter.last = json.data[json.data.length - 1].id;
  282. } else {
  283. work_parameter.last = '(0)';
  284. }
  285. work_list_grid(json);
  286. }
  287. }).always(function(json) {
  288. $('#result').html(JSON.stringify(json, null, 4));
  289. });
  290. }
  291. function work_listWithApplication_init() {
  292. $('#result').html('');
  293. str = '<table border="1" width="100%">';
  294. str += '<thead>';
  295. str += '<tr><th colspan="4"><a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<span id="total">0</span></th></tr>';
  296. str += '<tr><th>applicationFlag:</th><th colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></th></tr>';
  297. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  298. str += '</thead>';
  299. str += '<tbody id="gird">';
  300. str += '</tbody>';
  301. str += '</table>';
  302. $('#content').html(str);
  303. $('#next').click(function() {
  304. work_listWithApplication_next(null, $('#applicationFlag').val());
  305. });
  306. $('#prev').click(function() {
  307. work_listWithApplication_prev(null, $('#applicationFlag').val());
  308. });
  309. work_parameter.first = '(0)';
  310. work_parameter.last = '(0)';
  311. }
  312. function work_listWithApplication_next(id, applicationFlag) {
  313. var id = (id ? id : work_parameter.last);
  314. $.ajax({
  315. type : 'get',
  316. dataType : 'json',
  317. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/{applicationFlag}',
  318. xhrFields : {
  319. 'withCredentials' : true
  320. },
  321. crossDomain : true
  322. }).done(function(json) {
  323. if (json.type == 'success') {
  324. if (json.data.length > 0) {
  325. work_parameter.first = json.data[0].id;
  326. work_parameter.last = json.data[json.data.length - 1].id;
  327. } else {
  328. work_parameter.first = '(0)';
  329. }
  330. work_list_grid(json);
  331. }
  332. }).always(function(json) {
  333. $('#result').html(JSON.stringify(json, null, 4));
  334. });
  335. }
  336. function work_listWithApplication_prev(id, applicationFlag) {
  337. var id = (id ? id : work_parameter.first);
  338. $.ajax({
  339. type : 'get',
  340. dataType : 'json',
  341. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/{applicationFlag}',
  342. xhrFields : {
  343. 'withCredentials' : true
  344. },
  345. crossDomain : true
  346. }).done(function(json) {
  347. if (json.type == 'success') {
  348. if (json.data.length > 0) {
  349. work_parameter.first = json.data[0].id;
  350. work_parameter.last = json.data[json.data.length - 1].id;
  351. } else {
  352. work_parameter.last = '(0)';
  353. }
  354. work_list_grid(json);
  355. }
  356. }).always(function(json) {
  357. $('#result').html(JSON.stringify(json, null, 4));
  358. });
  359. }
  360. function work_listWithProcess_init() {
  361. $('#result').html('');
  362. str = '<table border="1" width="100%">';
  363. str += '<thead>';
  364. str += '<tr><th colspan="4"><a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<span id="total">0</span></th></tr>';
  365. str += '<tr><th>processFlag:</th><th colspan="3"><input type="text" id="processFlag" style="width:95%"/></th></tr>';
  366. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  367. str += '</thead>';
  368. str += '<tbody id="gird">';
  369. str += '</tbody>';
  370. str += '</table>';
  371. $('#content').html(str);
  372. $('#next').click(function() {
  373. work_listWithProcess_next(null, $('#processFlag').val());
  374. });
  375. $('#prev').click(function() {
  376. work_listWithProcess_prev(null, $('#processFlag').val());
  377. });
  378. work_parameter.first = '(0)';
  379. work_parameter.last = '(0)';
  380. }
  381. function work_listWithProcess_next(id, processFlag) {
  382. var id = (id ? id : work_parameter.last);
  383. $.ajax({
  384. type : 'get',
  385. dataType : 'json',
  386. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/process/{processFlag}',
  387. xhrFields : {
  388. 'withCredentials' : true
  389. },
  390. crossDomain : true
  391. }).done(function(json) {
  392. if (json.type == 'success') {
  393. if (json.data.length > 0) {
  394. work_parameter.first = json.data[0].id;
  395. work_parameter.last = json.data[json.data.length - 1].id;
  396. } else {
  397. work_parameter.first = '(0)';
  398. }
  399. work_list_grid(json);
  400. }
  401. }).always(function(json) {
  402. $('#result').html(JSON.stringify(json, null, 4));
  403. });
  404. }
  405. function work_listWithProcess_prev(id, processFlag) {
  406. var id = (id ? id : work_parameter.first);
  407. $.ajax({
  408. type : 'get',
  409. dataType : 'json',
  410. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/process/{processFlag}',
  411. xhrFields : {
  412. 'withCredentials' : true
  413. },
  414. crossDomain : true
  415. }).done(function(json) {
  416. if (json.type == 'success') {
  417. if (json.data.length > 0) {
  418. work_parameter.first = json.data[0].id;
  419. work_parameter.last = json.data[json.data.length - 1].id;
  420. } else {
  421. work_parameter.last = '(0)';
  422. }
  423. work_list_grid(json);
  424. }
  425. }).always(function(json) {
  426. $('#result').html(JSON.stringify(json, null, 4));
  427. });
  428. }
  429. function work_list_grid(json) {
  430. if (json.data && json.data.length > 0) {
  431. str = '';
  432. $.each(json.data, function(index, item) {
  433. str += '<tr>';
  434. str += '<td>' + item.rank + '</td>';
  435. str += '<td>' + item.id + '</td>';
  436. str += '<td>' + item.title + '</td>';
  437. str += '<td>' + item.processName + '</td>';
  438. str += '</tr>';
  439. });
  440. $('#total').html(json.count);
  441. $('#grid').html(str);
  442. } else {
  443. $('#total').html('0');
  444. $('#grid').html('');
  445. }
  446. }
  447. function work_manage_get_init() {
  448. $('#result').html('');
  449. var str = '<table border="1" width="100%">';
  450. str += '<thead>';
  451. str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp;<a href="#" id="assignment">assignment</a>&nbsp;<a href="#" id="listRelative">listRelative</a>&nbsp;<a href="#" id="deleteSingle">deleteSingle</a>&nbsp;<a href="#" id="deleteRelative">deleteRelative</a></td></tr>';
  452. str += '<tr><td>workId:</td><td><input type="text" id="workId" style="width:95%"/></td></tr>';
  453. str += '</thead>';
  454. str += '</table>';
  455. $('#content').html(str);
  456. $('#get').click(function() {
  457. work_manage_get($('#workId').val());
  458. });
  459. $('#assignment').click(function() {
  460. work_manage_assignment($('#workId').val());
  461. });
  462. $('#listRelative').click(function() {
  463. work_manage_listRelative($('#workId').val());
  464. });
  465. $('#deleteSingle').click(function() {
  466. work_manage_deleteSingle($('#workId').val());
  467. });
  468. $('#deleteRelative').click(function() {
  469. work_manage_deleteRelative($('#workId').val());
  470. });
  471. }
  472. function work_manage_get(workId) {
  473. $('#result').html('');
  474. $.ajax({
  475. type : 'get',
  476. dataType : 'json',
  477. url : '../jaxrs/work/' + workId + '/manage',
  478. xhrFields : {
  479. 'withCredentials' : true
  480. },
  481. crossDomain : true
  482. }).always(function(json) {
  483. $('#result').html(JSON.stringify(json, null, 4));
  484. });
  485. }
  486. function work_manage_assignment(workId) {
  487. $('#result').html('');
  488. $.ajax({
  489. type : 'get',
  490. dataType : 'json',
  491. url : '../jaxrs/work/' + workId + '/assignment/manage',
  492. xhrFields : {
  493. 'withCredentials' : true
  494. },
  495. crossDomain : true
  496. }).always(function(json) {
  497. $('#result').html(JSON.stringify(json, null, 4));
  498. });
  499. }
  500. function work_manage_listRelative(workId) {
  501. $('#result').html('');
  502. $.ajax({
  503. type : 'get',
  504. dataType : 'json',
  505. url : '../jaxrs/work/' + workId + '/relative/manage',
  506. xhrFields : {
  507. 'withCredentials' : true
  508. },
  509. crossDomain : true
  510. }).always(function(json) {
  511. $('#result').html(JSON.stringify(json, null, 4));
  512. });
  513. }
  514. function work_manage_deleteSingle(workId) {
  515. $('#result').html('');
  516. $.ajax({
  517. type : 'delete',
  518. dataType : 'json',
  519. url : '../jaxrs/work/' + workId + '/single/manage',
  520. xhrFields : {
  521. 'withCredentials' : true
  522. },
  523. crossDomain : true
  524. }).always(function(json) {
  525. $('#result').html(JSON.stringify(json, null, 4));
  526. });
  527. }
  528. function work_manage_deleteRelative(workId) {
  529. $('#result').html('');
  530. $.ajax({
  531. type : 'delete',
  532. dataType : 'json',
  533. url : '../jaxrs/work/' + workId + '/relative/manage',
  534. xhrFields : {
  535. 'withCredentials' : true
  536. },
  537. crossDomain : true
  538. }).always(function(json) {
  539. $('#result').html(JSON.stringify(json, null, 4));
  540. });
  541. }
  542. function work_manage_countWithProcess_init() {
  543. $('#result').html('');
  544. str = '<table border="1" width="100%">';
  545. str += '<thead>';
  546. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  547. str += '<tr><td>applicationFlag:</td><td colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  548. str += '</thead>';
  549. str += '</table>';
  550. $('#content').html(str);
  551. $('#get').click(function() {
  552. $.ajax({
  553. type : 'get',
  554. dataType : 'json',
  555. url : '../jaxrs/work/list/count/application/' + $('#applicationFlag').val() + '/process/manage',
  556. xhrFields : {
  557. 'withCredentials' : true
  558. },
  559. crossDomain : true
  560. }).always(function(json) {
  561. $('#result').html(JSON.stringify(json, null, 4));
  562. });
  563. });
  564. }
  565. function work_manage_list_init() {
  566. $('#result').html('');
  567. str = '<table border="1" width="100%">';
  568. str += '<thead>';
  569. str += '<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>';
  570. str += '<tr><td>applicationFlag:</td><td colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  571. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr>';
  572. str += '</thead>';
  573. str += '<tbody id="gird">';
  574. str += '</tbody>';
  575. str += '</table>';
  576. $('#content').html(str);
  577. $('#next').click(function() {
  578. work_manage_list_next(null, $('#applicationFlag').val());
  579. });
  580. $('#prev').click(function() {
  581. work_manage_list_prev(null, $('#applicationFlag').val());
  582. });
  583. work_parameter.first = '(0)';
  584. work_parameter.last = '(0)';
  585. }
  586. function work_manage_list_next(id, applicationFlag) {
  587. var id = (id ? id : work_parameter.last);
  588. $.ajax({
  589. type : 'get',
  590. dataType : 'json',
  591. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/' + applicationFlag + '/manage',
  592. xhrFields : {
  593. 'withCredentials' : true
  594. },
  595. crossDomain : true
  596. }).done(function(json) {
  597. if (json.type == 'success') {
  598. if (json.data.length > 0) {
  599. work_parameter.first = json.data[0].id;
  600. work_parameter.last = json.data[json.data.length - 1].id;
  601. } else {
  602. work_parameter.first = '(0)';
  603. }
  604. work_list_grid(json);
  605. }
  606. }).always(function(json) {
  607. $('#result').html(JSON.stringify(json, null, 4));
  608. });
  609. }
  610. function work_manage_list_prev(id, applicationFlag) {
  611. var id = (id ? id : work_parameter.first);
  612. $.ajax({
  613. type : 'get',
  614. dataType : 'json',
  615. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/' + applicationFlag + '/manage',
  616. xhrFields : {
  617. 'withCredentials' : true
  618. },
  619. crossDomain : true
  620. }).done(function(json) {
  621. if (json.type == 'success') {
  622. if (json.data.length > 0) {
  623. work_parameter.first = json.data[0].id;
  624. work_parameter.last = json.data[json.data.length - 1].id;
  625. } else {
  626. work_parameter.last = '(0)';
  627. }
  628. work_list_grid(json);
  629. }
  630. }).always(function(json) {
  631. $('#result').html(JSON.stringify(json, null, 4));
  632. });
  633. }
  634. function work_manage_filter_init() {
  635. $('#result').html('');
  636. str = '<table border="1" width="100%">';
  637. str += '<thead>';
  638. str += '<tr><td colspan="4"><a href="#" id="filterAttribute">filterAttribute</a>&nbsp;<a href="#" id="clear">clear</a>&nbsp;<a href="#" id="prev">prev</a>&nbsp;<a href="#" id="next">next</a>&nbsp;<span id="total">0</span></td></tr>';
  639. str += '<tr><td>applicationFlag:</td><td colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  640. str += '<tr><td>processFilter:</td><td colspan="3"><select id="processFilter"/></td></tr>';
  641. str += '<tr><td>creatorCompanyFilter:</td><td colspan="3"><select id="creatorCompanyFilter"/></td></tr>';
  642. str += '<tr><td>creatorDepartment:</td><td colspan="3"><select id="creatorDepartment"/></td></tr>';
  643. str += '<tr><td>activityName:</td><td colspan="3"><select id="activityName"/></td></tr>';
  644. str += '<tr><td>startTimeMonth:</td><td colspan="3"><select id="startTimeMonth"/></td></tr>';
  645. str += '<tr><td>workStatus:</td><td colspan="3"><select id="workStatus"/></td></tr>';
  646. str += '<tr><td>key:</td><td colspan="3"><input type="text" id = "keyFilter" style="width:95%"/></td></tr>';
  647. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr>';
  648. str += '</thead>';
  649. str += '<tbody id="gird">';
  650. str += '</tbody>';
  651. str += '</table>';
  652. $('#content').html(str);
  653. $('#next').click(function() {
  654. work_manage_filter_list_next(null, $('#applicationFlag').val());
  655. });
  656. $('#prev').click(function() {
  657. work_manage_filter_list_prev(null, $('#applicationFlag').val());
  658. });
  659. $('#clear').click(function() {
  660. work_parameter.first = '(0)';
  661. work_parameter.last = '(0)';
  662. });
  663. $('#filterAttribute').click(function() {
  664. $.ajax({
  665. type : 'get',
  666. dataType : 'json',
  667. url : '../jaxrs/work/filter/attribute/application/' + $('#applicationFlag').val() + '/manage',
  668. xhrFields : {
  669. 'withCredentials' : true
  670. },
  671. crossDomain : true
  672. }).done(function(json) {
  673. if (json.type == 'success') {
  674. var txt = '<option value="">all</option>';
  675. if (json.data.processList) {
  676. $.each(json.data.processList, function(index, item) {
  677. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  678. });
  679. }
  680. $('#processFilter').html(txt);
  681. txt = '<option value="">all</option>';
  682. if (json.data.creatorCompanyList) {
  683. $.each(json.data.creatorCompanyList, function(index, item) {
  684. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  685. });
  686. }
  687. $('#creatorCompanyFilter').html(txt);
  688. txt = '<option value="">all</option>';
  689. if (json.data.creatorDepartmentList) {
  690. $.each(json.data.creatorDepartmentList, function(index, item) {
  691. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  692. });
  693. }
  694. $('#creatorDepartmentFilter').html(txt);
  695. txt = '<option value="">all</option>';
  696. if (json.data.creatorDepartmentList) {
  697. $.each(json.data.creatorDepartmentList, function(index, item) {
  698. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  699. });
  700. }
  701. $('#creatorDepartmentFilter').html(txt);
  702. txt = '<option value="">all</option>';
  703. if (json.data.activityNameList) {
  704. $.each(json.data.activityNameList, function(index, item) {
  705. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  706. });
  707. }
  708. $('#activityNameFilter').html(txt);
  709. txt = '<option value="">all</option>';
  710. if (json.data.startTimeMonthList) {
  711. $.each(json.data.startTimeMonthList, function(index, item) {
  712. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  713. });
  714. }
  715. $('#startTimeMonthFilter').html(txt);
  716. txt = '<option value="">all</option>';
  717. if (json.data.workStatusList) {
  718. $.each(json.data.workStatusList, function(index, item) {
  719. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  720. });
  721. }
  722. $('#workStatusFilter').html(txt);
  723. }
  724. }).always(function(json) {
  725. $('#result').html(JSON.stringify(json, null, 4));
  726. });
  727. });
  728. work_parameter.first = '(0)';
  729. work_parameter.last = '(0)';
  730. }
  731. function work_manage_filter_list_next(id, applicationFlag) {
  732. var id = (id ? id : work_parameter.last);
  733. $.ajax({
  734. type : 'post',
  735. dataType : 'json',
  736. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/{applicationFlag}/filter/manage',
  737. xhrFields : {
  738. 'withCredentials' : true
  739. },
  740. data : JSON.stringify({
  741. process : $('#processFilter').val(),
  742. creatorCompany : $('#creatorCompanyFilter').val(),
  743. creatorDepartment : $('#creatorDepartmentFilter').val(),
  744. activityName : $('#activityNameFilter').val(),
  745. startTimeMonth : $('#startTimeMonthFilter').val(),
  746. workStatus : $('#workStatusFilter').val(),
  747. key : $('#keyFilter').val()
  748. }),
  749. crossDomain : true
  750. }).done(function(json) {
  751. if (json.type == 'success') {
  752. if (json.data.length > 0) {
  753. work_parameter.first = json.data[0].id;
  754. work_parameter.last = json.data[json.data.length - 1].id;
  755. } else {
  756. work_parameter.first = '(0)';
  757. }
  758. work_list_grid(json);
  759. }
  760. }).always(function(json) {
  761. $('#result').html(JSON.stringify(json, null, 4));
  762. });
  763. }
  764. function work_manage_filter_list_prev(id, applicationFlag) {
  765. var id = (id ? id : work_parameter.first);
  766. $.ajax({
  767. type : 'post',
  768. dataType : 'json',
  769. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/{applicationFlag}/filter/manage',
  770. xhrFields : {
  771. 'withCredentials' : true
  772. },
  773. data : JSON.stringify({
  774. process : $('#processFilter').val(),
  775. creatorCompany : $('#creatorCompanyFilter').val(),
  776. creatorDepartment : $('#creatorDepartmentFilter').val(),
  777. activityName : $('#activityNameFilter').val(),
  778. startTimeMonth : $('#startTimeMonthFilter').val(),
  779. workStatus : $('#workStatusFilter').val(),
  780. key : $('#keyFilter').val()
  781. }),
  782. crossDomain : true
  783. }).done(function(json) {
  784. if (json.type == 'success') {
  785. if (json.data.length > 0) {
  786. work_parameter.first = json.data[0].id;
  787. work_parameter.last = json.data[json.data.length - 1].id;
  788. } else {
  789. work_parameter.last = '(0)';
  790. }
  791. work_list_grid(json);
  792. }
  793. }).always(function(json) {
  794. $('#result').html(JSON.stringify(json, null, 4));
  795. });
  796. }