| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580 |
- task_parameter = {
- first : '(0)',
- last : '(0)',
- count : 20
- };
- function task_list_init() {
- var str = '<table border="1" width="100%">';
- str += '<thead><tr><td colspan="6"><a href="#" id="prev">prev</a> <a href="#" id="next">next</a> <span id="total">0</span></td></tr>';
- str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
- str += '<tbody id="grid"></tbody>'
- str += '</table>';
- $('#content').html(str);
- $('#next').click(function() {
- task_list_next();
- });
- $('#prev').click(function() {
- task_list_prev();
- });
- task_parameter.first = '(0)';
- task_parameter.last = '(0)';
- task_list_next();
- }
- function task_list_next(id) {
- var id = (id ? id : task_parameter.last);
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/' + id + '/next/' + task_parameter.count,
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.first = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_list_prev(id) {
- var id = (id ? id : task_parameter.first);
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/' + id + '/prev/' + task_parameter.count,
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.last = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listWithApplication_init() {
- var str = '<table border="1" width="100%">';
- str += '<thead><tr><td colspan="4"><a href="#" id="prev">prev</a> <a href="#" id="next">next</a> <span id="total">0</span></td></tr>';
- str += '<tr><th>applicationFlag</th><th colspan="3"><input type="text" id="applicationFlag" style="width:95%"/></th></tr>';
- str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
- str += '<tbody id="grid"></tbody>'
- str += '</table>';
- $('#content').html(str);
- $('#next').click(function() {
- task_listWithApplication_next();
- });
- $('#prev').click(function() {
- task_listWithApplication_prev();
- });
- task_parameter.first = '(0)';
- task_parameter.last = '(0)';
- }
- function task_listWithApplication_next(id) {
- var id = (id ? id : task_parameter.last);
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/' + task_parameter.last + '/next/' + task_parameter.count + '/application/' + $('#applicationFlag').val(),
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.first = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listWithApplication_prev(id) {
- var id = (id ? id : task_parameter.first);
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/' + id + '/prev/' + task_parameter.count + '/application/' + $('#applicationFlag').val(),
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.last = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listWithProcess_init() {
- var str = '<table border="1" width="100%">';
- str += '<thead><tr><td colspan="4"><a href="#" id="prev">prev</a> <a href="#" id="next">next</a> <span id="total">0</span></td></tr>';
- str += '<tr><th>processFlag</th><th colspan="3"><input type="text" id="processFlag" style="width:95%"/></th></tr>';
- str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
- str += '<tbody id="grid"></tbody>'
- str += '</table>';
- $('#content').html(str);
- $('#next').click(function() {
- task_listWithProcess_next();
- });
- $('#prev').click(function() {
- task_listWithProcess_prev();
- });
- task_parameter.first = '(0)';
- task_parameter.last = '(0)';
- }
- function task_listWithProcess_next(id) {
- var id = (id ? id : task_parameter.last);
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/' + id + '/next/' + task_parameter.count + '/process/' + $('#processFlag').val(),
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.first = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listWithProcess_prev(id) {
- var id = (id ? id : task_parameter.first);
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/' + id + '/prev/' + task_parameter.count + '/process/' + $('#processFlag').val(),
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.last = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_list_grid(json) {
- if (json.data && json.data.length > 0) {
- str = '';
- $.each(json.data, function(index, item) {
- str += '<tr>';
- str += '<td>' + item.rank + '</td>';
- str += '<td>' + item.id + '</td>';
- str += '<td>' + item.title + '</td>';
- str += '<td>' + item.processName + '</td>';
- str += '</tr>';
- });
- $('#total').html(json.count);
- $('#grid').html(str);
- } else {
- $('#total').html('0');
- $('#grid').html('');
- }
- }
- function task_listCountWithApplication() {
- $('#result').html('');
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/count/application',
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listCountWithProcess_init() {
- $('#result').html('');
- str = '<table border="1" width="100%">';
- str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
- str += '<tr><td>applicationFlag:</td><td><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
- str += '</table>';
- $('#content').html(str);
- $('#get').click(function() {
- task_listCountWithProcess($('#applicationFlag').val());
- });
- }
- function task_listCountWithProcess(applicationFlag) {
- $('#result').html('');
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/list/count/application/' + applicationFlag + '/process',
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_countWithPerson_init() {
- $('#result').html('');
- str = '<table border="1" width="100%">';
- str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
- str += '<tr><td>person:</td><td><input type="text" id="person" style="width:95%"/></td></tr>';
- str += '</table>';
- $('#content').html(str);
- $('#get').click(function() {
- task_countWithPerson($('#person').val());
- });
- }
- function task_countWithPerson(person) {
- $('#result').html('');
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/count/' + person,
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_get_init() {
- $('#result').html('');
- str = '<table border="1" width="100%">';
- str += '<tr><td colspan="2"><a href="#" id="get">get</a> <a href="#" id="reference">reference</a> <a href="#" id="process">process</a> <a href="#" id="update">update</a> <a href="#" id="reset">reset</a></td></tr>';
- str += '<tr><td>id:</td><td><input type="text" id="id" style="width:95%"/></td></tr>';
- str += '<tr><td>routeName:</td><td><input type="text" id="routeName" style="width:95%"/></td></tr>';
- str += '<tr><td>opinion:</td><td><input type="text" id="opinion" style="width:95%"/></td></tr>';
- str += '<tr><td>identityList:</td><td><textarea id="identityList" style="width:95%"/></td></tr>';
- str += '</table>';
- $('#content').html(str);
- $('#get').click(function() {
- task_get($('#id').val());
- });
- $('#reference').click(function() {
- task_reference($('#id').val());
- });
- $('#process').click(function() {
- task_process($('#id').val());
- });
- $('#update').click(function() {
- task_update($('#id').val());
- });
- $('#reset').click(function() {
- task_reset($('#id').val());
- });
- }
- function task_get(id) {
- $('#result').html('');
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/' + id,
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- $('#routeName').val(json.data.routeName);
- $('#opinion').val(json.data.opinion);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_update(id) {
- $.ajax({
- type : 'put',
- dataType : 'json',
- contentType : 'application/json; charset=utf-8',
- url : '../jaxrs/task/' + id,
- xhrFields : {
- 'withCredentials' : true
- },
- data : JSON.stringify({
- routeName : $('#routeName').val(),
- opinion : $('#opinion').val()
- }),
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_reference(id) {
- $('#result').html('');
- $.ajax({
- type : 'get',
- dataType : 'json',
- url : '../jaxrs/task/' + id + '/reference',
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_process(id) {
- $.ajax({
- type : 'post',
- dataType : 'json',
- contentType : 'application/json; charset=utf-8',
- url : '../jaxrs/task/' + id,
- xhrFields : {
- 'withCredentials' : true
- },
- data : JSON.stringify({
- routeName : $('#routeName').val(),
- opinion : $('#opinion').val()
- }),
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_reset(id) {
- $.ajax({
- type : 'put',
- dataType : 'json',
- contentType : 'application/json; charset=utf-8',
- url : '../jaxrs/task/' + id + '/reset',
- xhrFields : {
- 'withCredentials' : true
- },
- data : JSON.stringify({
- routeName : $('#routeName').val(),
- opinion : $('#opinion').val(),
- identityList : splitValue($('#identityList').val())
- }),
- crossDomain : true
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listFilter_init() {
- $('#result').html('');
- var str = '<table border="1" width="100%">';
- str += '<thead><tr><td colspan="4"><a href="#" id="prev">prev</a> <a href="#" id="next">next</a> <a href="#" id="clear">clear</a> <span id="total">0</span></td></tr>';
- str += '<tr><td>application</td><td colspan="3"><select id="applicationFilter"></select></td></tr>';
- str += '<tr><td>process</td><td colspan="3"><select id="processFilter"></select></td></tr>';
- str += '<tr><td>creatorCompany</td><td colspan="3"><select id="creatorCompanyFilter"></select></td></tr>';
- str += '<tr><td>creatorDepartment</td><td colspan="3"><select id="creatorDepartmentFilter"></select></td></tr>';
- str += '<tr><td>startTimeMonth</td><td colspan="3"><select id="startTimeMonthFilter"></select></td></tr>';
- str += '<tr><td>activityName</td><td colspan="3"><select id="activityNameFilter"></select></td></tr>';
- str += '<tr><td>key</td><td colspan="3"><input type="text" id="keyFilter" style="width:95%"/></td></tr>';
- str += '<tr><th>rank</th><th>id</th><th>title</th><th>processName</th></tr></thead>';
- str += '<tbody id="grid"></tbody>';
- str += '</table>';
- $('#content').html(str);
- $('#next').click(function() {
- task_listFilter_next();
- });
- $('#prev').click(function() {
- task_listFilter_prev();
- });
- $('#clear').click(function() {
- task_parameter.first = '(0)';
- task_parameter.last = '(0)';
- });
- task_parameter.first = '(0)';
- task_parameter.last = '(0)';
- $.ajax({
- type : 'get',
- dataType : 'json',
- contentType : 'application/json; charset=utf-8',
- url : '../jaxrs/task/filter/attribute',
- xhrFields : {
- 'withCredentials' : true
- },
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- txt = '<option value="">all</option>';
- if (json.data.applicationList) {
- $.each(json.data.applicationList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#applicationFilter').html(txt);
- txt = '<option value="">all</option>';
- if (json.data.processList) {
- $.each(json.data.processList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#processFilter').html(txt);
- txt = '<option value="">all</option>';
- if (json.data.creatorCompanyList) {
- $.each(json.data.creatorCompanyList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#creatorCompanyFilter').html(txt);
- txt = '<option value="">all</option>';
- if (json.data.creatorDepartmentList) {
- $.each(json.data.creatorDepartmentList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#creatorDepartmentFilter').html(txt);
- txt = '<option value="">all</option>';
- if (json.data.startTimeMonthList) {
- $.each(json.data.startTimeMonthList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#startTimeMonthFilter').html(txt);
- txt = '<option value="">all</option>';
- if (json.data.startTimeMonthList) {
- $.each(json.data.startTimeMonthList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#startTimeMonthFilter').html(txt);
- txt = '<option value="">all</option>';
- if (json.data.activityNameList) {
- $.each(json.data.activityNameList, function(index, item) {
- txt += '<option value="' + item.value + '">' + item.name + '</option>';
- });
- }
- $('#activityNameFilter').html(txt);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listFilter_next(id) {
- var id = (id ? id : task_parameter.last);
- $.ajax({
- type : 'post',
- dataType : 'json',
- contentType : 'application/json; charset=utf-8',
- url : '../jaxrs/task/list/' + id + '/next/' + task_parameter.count + '/filter',
- xhrFields : {
- 'withCredentials' : true
- },
- data : JSON.stringify({
- application : $('#applicationFilter').val(),
- process : $('#processFilter').val(),
- creatorCompany : $('#creatorCompanyFilter').val(),
- creatorDepartment : $('#creatorDepartmentFilter').val(),
- startTimeMonth : $('#startTimeMonthFilter').val(),
- activityName : $('#activityNameFilter').val(),
- key : $('#keyFilter').val()
- }),
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.first = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
- function task_listFilter_prev(id) {
- var id = (id ? id : task_parameter.first);
- $.ajax({
- type : 'post',
- dataType : 'json',
- contentType : 'application/json; charset=utf-8',
- url : '../jaxrs/task/list/' + id + '/prev/' + task_parameter.count + '/filter',
- xhrFields : {
- 'withCredentials' : true
- },
- data : JSON.stringify({
- application : $('#applicationFilter').val(),
- process : $('#processFilter').val(),
- creatorCompany : $('#creatorCompanyFilter').val(),
- creatorDepartment : $('#creatorDepartmentFilter').val(),
- startTimeMonth : $('#startTimeMonthFilter').val(),
- activityName : $('#activityNameFilter').val(),
- key : $('#keyFilter').val()
- }),
- crossDomain : true
- }).done(function(json) {
- if (json.type == 'success') {
- if (json.data.length > 0) {
- task_parameter.first = json.data[0].id;
- task_parameter.last = json.data[json.data.length - 1].id;
- } else {
- task_parameter.last = '(0)';
- }
- task_list_grid(json);
- }
- }).always(function(json) {
- $('#result').html(JSON.stringify(json, null, 4));
- });
- }
|