work.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  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_listWithApplication_init() {
  223. $('#result').html('');
  224. str = '<table border="1" width="100%">';
  225. str += '<thead>';
  226. 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>';
  227. str += '<tr><th>applicationFlag:</th><th colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></th></tr>';
  228. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
  229. str += '</thead>';
  230. str += '<tbody id="gird">';
  231. str += '</tbody>';
  232. str += '</table>';
  233. $('#content').html(str);
  234. $('#next').click(function() {
  235. work_listWithApplication_next(null, $('#applicationFlag').val());
  236. });
  237. $('#prev').click(function() {
  238. work_listWithApplication_prev(null, $('#applicationFlag').val());
  239. });
  240. work_parameter.first = '(0)';
  241. work_parameter.last = '(0)';
  242. }
  243. function work_listWithApplication_next(id, applicationFlag) {
  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 + '/application/{applicationFlag}',
  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_listWithApplication_prev(id, applicationFlag) {
  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 + '/application/{applicationFlag}',
  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_listWithProcess_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>processFlag:</th><th colspan="3"><input type="text" id="processFlag" 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_listWithProcess_next(null, $('#processFlag').val());
  305. });
  306. $('#prev').click(function() {
  307. work_listWithProcess_prev(null, $('#processFlag').val());
  308. });
  309. work_parameter.first = '(0)';
  310. work_parameter.last = '(0)';
  311. }
  312. function work_listWithProcess_next(id, processFlag) {
  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 + '/process/{processFlag}',
  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_listWithProcess_prev(id, processFlag) {
  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 + '/process/{processFlag}',
  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_list_grid(json) {
  361. if (json.data && json.data.length > 0) {
  362. str = '';
  363. $.each(json.data, function(index, item) {
  364. str += '<tr>';
  365. str += '<td>' + item.rank + '</td>';
  366. str += '<td>' + item.id + '</td>';
  367. str += '<td>' + item.title + '</td>';
  368. str += '<td>' + item.processName + '</td>';
  369. str += '</tr>';
  370. });
  371. $('#total').html(json.count);
  372. $('#grid').html(str);
  373. } else {
  374. $('#total').html('0');
  375. $('#grid').html('');
  376. }
  377. }
  378. function work_manage_get_init() {
  379. $('#result').html('');
  380. var str = '<table border="1" width="100%">';
  381. str += '<thead>';
  382. 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>';
  383. str += '<tr><td>workId:</td><td><input type="text" id="workId" style="width:95%"/></td></tr>';
  384. str += '</thead>';
  385. str += '</table>';
  386. $('#content').html(str);
  387. $('#get').click(function() {
  388. work_manage_get($('#workId').val());
  389. });
  390. $('#assignment').click(function() {
  391. work_manage_assignment($('#workId').val());
  392. });
  393. $('#listRelative').click(function() {
  394. work_manage_listRelative($('#workId').val());
  395. });
  396. $('#deleteSingle').click(function() {
  397. work_manage_deleteSingle($('#workId').val());
  398. });
  399. $('#deleteRelative').click(function() {
  400. work_manage_deleteRelative($('#workId').val());
  401. });
  402. }
  403. function work_manage_get(workId) {
  404. $('#result').html('');
  405. $.ajax({
  406. type : 'get',
  407. dataType : 'json',
  408. url : '../jaxrs/work/' + workId + '/manage',
  409. xhrFields : {
  410. 'withCredentials' : true
  411. },
  412. crossDomain : true
  413. }).always(function(json) {
  414. $('#result').html(JSON.stringify(json, null, 4));
  415. });
  416. }
  417. function work_manage_assignment(workId) {
  418. $('#result').html('');
  419. $.ajax({
  420. type : 'get',
  421. dataType : 'json',
  422. url : '../jaxrs/work/' + workId + '/assignment/manage',
  423. xhrFields : {
  424. 'withCredentials' : true
  425. },
  426. crossDomain : true
  427. }).always(function(json) {
  428. $('#result').html(JSON.stringify(json, null, 4));
  429. });
  430. }
  431. function work_manage_listRelative(workId) {
  432. $('#result').html('');
  433. $.ajax({
  434. type : 'get',
  435. dataType : 'json',
  436. url : '../jaxrs/work/' + workId + '/relative/manage',
  437. xhrFields : {
  438. 'withCredentials' : true
  439. },
  440. crossDomain : true
  441. }).always(function(json) {
  442. $('#result').html(JSON.stringify(json, null, 4));
  443. });
  444. }
  445. function work_manage_deleteSingle(workId) {
  446. $('#result').html('');
  447. $.ajax({
  448. type : 'delete',
  449. dataType : 'json',
  450. url : '../jaxrs/work/' + workId + '/single/manage',
  451. xhrFields : {
  452. 'withCredentials' : true
  453. },
  454. crossDomain : true
  455. }).always(function(json) {
  456. $('#result').html(JSON.stringify(json, null, 4));
  457. });
  458. }
  459. function work_manage_deleteRelative(workId) {
  460. $('#result').html('');
  461. $.ajax({
  462. type : 'delete',
  463. dataType : 'json',
  464. url : '../jaxrs/work/' + workId + '/relative/manage',
  465. xhrFields : {
  466. 'withCredentials' : true
  467. },
  468. crossDomain : true
  469. }).always(function(json) {
  470. $('#result').html(JSON.stringify(json, null, 4));
  471. });
  472. }
  473. function work_manage_countWithProcess_init() {
  474. $('#result').html('');
  475. str = '<table border="1" width="100%">';
  476. str += '<thead>';
  477. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  478. str += '<tr><td>applicationFlag:</td><td colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  479. str += '</thead>';
  480. str += '</table>';
  481. $('#content').html(str);
  482. $('#get').click(function() {
  483. $.ajax({
  484. type : 'get',
  485. dataType : 'json',
  486. url : '../jaxrs/work/list/count/application/' + $('#applicationFlag').val() + '/process/manage',
  487. xhrFields : {
  488. 'withCredentials' : true
  489. },
  490. crossDomain : true
  491. }).always(function(json) {
  492. $('#result').html(JSON.stringify(json, null, 4));
  493. });
  494. });
  495. }
  496. function work_manage_list_init() {
  497. $('#result').html('');
  498. str = '<table border="1" width="100%">';
  499. str += '<thead>';
  500. 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>';
  501. str += '<tr><td>applicationFlag:</td><td colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  502. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr>';
  503. str += '</thead>';
  504. str += '<tbody id="gird">';
  505. str += '</tbody>';
  506. str += '</table>';
  507. $('#content').html(str);
  508. $('#next').click(function() {
  509. work_manage_list_next(null, $('#applicationFlag').val());
  510. });
  511. $('#prev').click(function() {
  512. work_manage_list_prev(null, $('#applicationFlag').val());
  513. });
  514. work_parameter.first = '(0)';
  515. work_parameter.last = '(0)';
  516. }
  517. function work_manage_list_next(id, applicationFlag) {
  518. var id = (id ? id : work_parameter.last);
  519. $.ajax({
  520. type : 'get',
  521. dataType : 'json',
  522. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/' + applicationFlag + '/manage',
  523. xhrFields : {
  524. 'withCredentials' : true
  525. },
  526. crossDomain : true
  527. }).done(function(json) {
  528. if (json.type == 'success') {
  529. if (json.data.length > 0) {
  530. work_parameter.first = json.data[0].id;
  531. work_parameter.last = json.data[json.data.length - 1].id;
  532. } else {
  533. work_parameter.first = '(0)';
  534. }
  535. work_list_grid(json);
  536. }
  537. }).always(function(json) {
  538. $('#result').html(JSON.stringify(json, null, 4));
  539. });
  540. }
  541. function work_manage_list_prev(id, applicationFlag) {
  542. var id = (id ? id : work_parameter.first);
  543. $.ajax({
  544. type : 'get',
  545. dataType : 'json',
  546. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/' + applicationFlag + '/manage',
  547. xhrFields : {
  548. 'withCredentials' : true
  549. },
  550. crossDomain : true
  551. }).done(function(json) {
  552. if (json.type == 'success') {
  553. if (json.data.length > 0) {
  554. work_parameter.first = json.data[0].id;
  555. work_parameter.last = json.data[json.data.length - 1].id;
  556. } else {
  557. work_parameter.last = '(0)';
  558. }
  559. work_list_grid(json);
  560. }
  561. }).always(function(json) {
  562. $('#result').html(JSON.stringify(json, null, 4));
  563. });
  564. }
  565. function work_manage_filter_init() {
  566. $('#result').html('');
  567. str = '<table border="1" width="100%">';
  568. str += '<thead>';
  569. 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>';
  570. str += '<tr><td>applicationFlag:</td><td colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  571. str += '<tr><td>processFilter:</td><td colspan="3"><select id="processFilter"/></td></tr>';
  572. str += '<tr><td>creatorCompanyFilter:</td><td colspan="3"><select id="creatorCompanyFilter"/></td></tr>';
  573. str += '<tr><td>creatorDepartment:</td><td colspan="3"><select id="creatorDepartment"/></td></tr>';
  574. str += '<tr><td>activityName:</td><td colspan="3"><select id="activityName"/></td></tr>';
  575. str += '<tr><td>startTimeMonth:</td><td colspan="3"><select id="startTimeMonth"/></td></tr>';
  576. str += '<tr><td>workStatus:</td><td colspan="3"><select id="workStatus"/></td></tr>';
  577. str += '<tr><td>key:</td><td colspan="3"><input type="text" id = "keyFilter" style="width:95%"/></td></tr>';
  578. str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr>';
  579. str += '</thead>';
  580. str += '<tbody id="gird">';
  581. str += '</tbody>';
  582. str += '</table>';
  583. $('#content').html(str);
  584. $('#next').click(function() {
  585. work_manage_filter_list_next(null, $('#applicationFlag').val());
  586. });
  587. $('#prev').click(function() {
  588. work_manage_filter_list_prev(null, $('#applicationFlag').val());
  589. });
  590. $('#clear').click(function() {
  591. work_parameter.first = '(0)';
  592. work_parameter.last = '(0)';
  593. });
  594. $('#filterAttribute').click(function() {
  595. $.ajax({
  596. type : 'get',
  597. dataType : 'json',
  598. url : '../jaxrs/work/filter/attribute/application/' + $('#applicationFlag').val() + '/manage',
  599. xhrFields : {
  600. 'withCredentials' : true
  601. },
  602. crossDomain : true
  603. }).done(function(json) {
  604. if (json.type == 'success') {
  605. var txt = '<option value="">all</option>';
  606. if (json.data.processList) {
  607. $.each(json.data.processList, function(index, item) {
  608. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  609. });
  610. }
  611. $('#processFilter').html(txt);
  612. txt = '<option value="">all</option>';
  613. if (json.data.creatorCompanyList) {
  614. $.each(json.data.creatorCompanyList, function(index, item) {
  615. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  616. });
  617. }
  618. $('#creatorCompanyFilter').html(txt);
  619. txt = '<option value="">all</option>';
  620. if (json.data.creatorDepartmentList) {
  621. $.each(json.data.creatorDepartmentList, function(index, item) {
  622. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  623. });
  624. }
  625. $('#creatorDepartmentFilter').html(txt);
  626. txt = '<option value="">all</option>';
  627. if (json.data.creatorDepartmentList) {
  628. $.each(json.data.creatorDepartmentList, function(index, item) {
  629. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  630. });
  631. }
  632. $('#creatorDepartmentFilter').html(txt);
  633. txt = '<option value="">all</option>';
  634. if (json.data.activityNameList) {
  635. $.each(json.data.activityNameList, function(index, item) {
  636. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  637. });
  638. }
  639. $('#activityNameFilter').html(txt);
  640. txt = '<option value="">all</option>';
  641. if (json.data.startTimeMonthList) {
  642. $.each(json.data.startTimeMonthList, function(index, item) {
  643. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  644. });
  645. }
  646. $('#startTimeMonthFilter').html(txt);
  647. txt = '<option value="">all</option>';
  648. if (json.data.workStatusList) {
  649. $.each(json.data.workStatusList, function(index, item) {
  650. txt += '<option value="' + item.value + '">' + item.name + '</option>';
  651. });
  652. }
  653. $('#workStatusFilter').html(txt);
  654. }
  655. }).always(function(json) {
  656. $('#result').html(JSON.stringify(json, null, 4));
  657. });
  658. });
  659. work_parameter.first = '(0)';
  660. work_parameter.last = '(0)';
  661. }
  662. function work_manage_filter_list_next(id, applicationFlag) {
  663. var id = (id ? id : work_parameter.last);
  664. $.ajax({
  665. type : 'post',
  666. dataType : 'json',
  667. url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/{applicationFlag}/filter/manage',
  668. xhrFields : {
  669. 'withCredentials' : true
  670. },
  671. data : JSON.stringify({
  672. process : $('#processFilter').val(),
  673. creatorCompany : $('#creatorCompanyFilter').val(),
  674. creatorDepartment : $('#creatorDepartmentFilter').val(),
  675. activityName : $('#activityNameFilter').val(),
  676. startTimeMonth : $('#startTimeMonthFilter').val(),
  677. workStatus : $('#workStatusFilter').val(),
  678. key : $('#keyFilter').val()
  679. }),
  680. crossDomain : true
  681. }).done(function(json) {
  682. if (json.type == 'success') {
  683. if (json.data.length > 0) {
  684. work_parameter.first = json.data[0].id;
  685. work_parameter.last = json.data[json.data.length - 1].id;
  686. } else {
  687. work_parameter.first = '(0)';
  688. }
  689. work_list_grid(json);
  690. }
  691. }).always(function(json) {
  692. $('#result').html(JSON.stringify(json, null, 4));
  693. });
  694. }
  695. function work_manage_filter_list_prev(id, applicationFlag) {
  696. var id = (id ? id : work_parameter.first);
  697. $.ajax({
  698. type : 'post',
  699. dataType : 'json',
  700. url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/{applicationFlag}/filter/manage',
  701. xhrFields : {
  702. 'withCredentials' : true
  703. },
  704. data : JSON.stringify({
  705. process : $('#processFilter').val(),
  706. creatorCompany : $('#creatorCompanyFilter').val(),
  707. creatorDepartment : $('#creatorDepartmentFilter').val(),
  708. activityName : $('#activityNameFilter').val(),
  709. startTimeMonth : $('#startTimeMonthFilter').val(),
  710. workStatus : $('#workStatusFilter').val(),
  711. key : $('#keyFilter').val()
  712. }),
  713. crossDomain : true
  714. }).done(function(json) {
  715. if (json.type == 'success') {
  716. if (json.data.length > 0) {
  717. work_parameter.first = json.data[0].id;
  718. work_parameter.last = json.data[json.data.length - 1].id;
  719. } else {
  720. work_parameter.last = '(0)';
  721. }
  722. work_list_grid(json);
  723. }
  724. }).always(function(json) {
  725. $('#result').html(JSON.stringify(json, null, 4));
  726. });
  727. }