work_parameter = {
first : '(0)',
last : '(0)',
count : 20
};
function work_count_init() {
$('#result').html('');
var str = '
';
$('#content').html(str);
$('#countWithPerson').click(function() {
work_countWithPerson($('#person').val());
});
$('#countWithApplication').click(function() {
work_countWithApplication();
});
$('#countWithProcess').click(function() {
work_countWithProcess($('#applicationFlag').val());
});
}
function work_countWithPerson(person) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/count/' + person,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_countWithApplication() {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/count/application',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_countWithProcess(applicationFlag) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/count/application/' + applicationFlag + '/process',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_get_init() {
$('#result').html('');
var str = '';
$('#content').html(str);
$('#complex').click(function() {
work_complex($('#workId').val());
});
$('#complexMobile').click(function() {
work_complexMobile($('#workId').val());
});
$('#complexAppointForm').click(function() {
work_complexAppointForm($('#workId').val(), $('#formFlag').val());
});
$('#complexAppointFormMobile').click(function() {
work_complexAppointFormMobile($('#workId').val(), $('#formFlag').val());
});
$('#processing').click(function() {
work_processing($('#workId').val());
});
$('#reroute').click(function() {
work_reroute($('#workId').val(), $('#activityId').val(), $('#activityType').val());
});
$('#retract').click(function() {
work_retract($('#workId').val());
});
$('#delete').click(function() {
work_retract($('#delete').val());
});
}
function work_complex(workId) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/complex',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_complexMobile(workId) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/complex/mobile',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_complexAppointForm(workId, formFlag) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/complex/appoint/form/' + formFlag,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_complexAppointFormMobile(workId, formFlag) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/complex/appoint/form/' + formFlag + '/mobile',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_processing(workId) {
$('#result').html('');
$.ajax({
type : 'put',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/processing',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_reroute(workId, activityId, activityType) {
$('#result').html('');
$.ajax({
type : 'put',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/reroute/activity/' + activityId + '/activitytype/' + activityType,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_retract(workId) {
$('#result').html('');
$.ajax({
type : 'put',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/retract',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_delete(workId) {
$('#result').html('');
$.ajax({
type : 'delete',
dataType : 'json',
url : '../jaxrs/work/' + workId,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_listWithApplication_init() {
$('#result').html('');
str = '';
$('#content').html(str);
$('#next').click(function() {
work_listWithApplication_next(null, $('#applicationFlag').val());
});
$('#prev').click(function() {
work_listWithApplication_prev(null, $('#applicationFlag').val());
});
work_parameter.first = '(0)';
work_parameter.last = '(0)';
}
function work_listWithApplication_next(id, applicationFlag) {
var id = (id ? id : work_parameter.last);
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/{applicationFlag}',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.first = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_listWithApplication_prev(id, applicationFlag) {
var id = (id ? id : work_parameter.first);
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/{applicationFlag}',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.last = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_listWithProcess_init() {
$('#result').html('');
str = '';
$('#content').html(str);
$('#next').click(function() {
work_listWithProcess_next(null, $('#processFlag').val());
});
$('#prev').click(function() {
work_listWithProcess_prev(null, $('#processFlag').val());
});
work_parameter.first = '(0)';
work_parameter.last = '(0)';
}
function work_listWithProcess_next(id, processFlag) {
var id = (id ? id : work_parameter.last);
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/process/{processFlag}',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.first = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_listWithProcess_prev(id, processFlag) {
var id = (id ? id : work_parameter.first);
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/process/{processFlag}',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.last = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_list_grid(json) {
if (json.data && json.data.length > 0) {
str = '';
$.each(json.data, function(index, item) {
str += '';
str += '| ' + item.rank + ' | ';
str += '' + item.id + ' | ';
str += '' + item.title + ' | ';
str += '' + item.processName + ' | ';
str += '
';
});
$('#total').html(json.count);
$('#grid').html(str);
} else {
$('#total').html('0');
$('#grid').html('');
}
}
function work_manage_get_init() {
$('#result').html('');
var str = '';
$('#content').html(str);
$('#get').click(function() {
work_manage_get($('#workId').val());
});
$('#assignment').click(function() {
work_manage_assignment($('#workId').val());
});
$('#listRelative').click(function() {
work_manage_listRelative($('#workId').val());
});
$('#deleteSingle').click(function() {
work_manage_deleteSingle($('#workId').val());
});
$('#deleteRelative').click(function() {
work_manage_deleteRelative($('#workId').val());
});
}
function work_manage_get(workId) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_assignment(workId) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/assignment/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_listRelative(workId) {
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/relative/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_deleteSingle(workId) {
$('#result').html('');
$.ajax({
type : 'delete',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/single/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_deleteRelative(workId) {
$('#result').html('');
$.ajax({
type : 'delete',
dataType : 'json',
url : '../jaxrs/work/' + workId + '/relative/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_countWithProcess_init() {
$('#result').html('');
str = '';
$('#content').html(str);
$('#get').click(function() {
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/count/application/' + $('#applicationFlag').val() + '/process/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
});
}
function work_manage_list_init() {
$('#result').html('');
str = '';
$('#content').html(str);
$('#next').click(function() {
work_manage_list_next(null, $('#applicationFlag').val());
});
$('#prev').click(function() {
work_manage_list_prev(null, $('#applicationFlag').val());
});
work_parameter.first = '(0)';
work_parameter.last = '(0)';
}
function work_manage_list_next(id, applicationFlag) {
var id = (id ? id : work_parameter.last);
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/' + applicationFlag + '/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.first = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_list_prev(id, applicationFlag) {
var id = (id ? id : work_parameter.first);
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/' + applicationFlag + '/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.last = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_filter_init() {
$('#result').html('');
str = '';
$('#content').html(str);
$('#next').click(function() {
work_manage_filter_list_next(null, $('#applicationFlag').val());
});
$('#prev').click(function() {
work_manage_filter_list_prev(null, $('#applicationFlag').val());
});
$('#clear').click(function() {
work_parameter.first = '(0)';
work_parameter.last = '(0)';
});
$('#filterAttribute').click(function() {
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/work/filter/attribute/application/' + $('#applicationFlag').val() + '/manage',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
var txt = '';
if (json.data.processList) {
$.each(json.data.processList, function(index, item) {
txt += '';
});
}
$('#processFilter').html(txt);
txt = '';
if (json.data.creatorCompanyList) {
$.each(json.data.creatorCompanyList, function(index, item) {
txt += '';
});
}
$('#creatorCompanyFilter').html(txt);
txt = '';
if (json.data.creatorDepartmentList) {
$.each(json.data.creatorDepartmentList, function(index, item) {
txt += '';
});
}
$('#creatorDepartmentFilter').html(txt);
txt = '';
if (json.data.creatorDepartmentList) {
$.each(json.data.creatorDepartmentList, function(index, item) {
txt += '';
});
}
$('#creatorDepartmentFilter').html(txt);
txt = '';
if (json.data.activityNameList) {
$.each(json.data.activityNameList, function(index, item) {
txt += '';
});
}
$('#activityNameFilter').html(txt);
txt = '';
if (json.data.startTimeMonthList) {
$.each(json.data.startTimeMonthList, function(index, item) {
txt += '';
});
}
$('#startTimeMonthFilter').html(txt);
txt = '';
if (json.data.workStatusList) {
$.each(json.data.workStatusList, function(index, item) {
txt += '';
});
}
$('#workStatusFilter').html(txt);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
});
work_parameter.first = '(0)';
work_parameter.last = '(0)';
}
function work_manage_filter_list_next(id, applicationFlag) {
var id = (id ? id : work_parameter.last);
$.ajax({
type : 'post',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/next/' + work_parameter.count + '/application/{applicationFlag}/filter/manage',
xhrFields : {
'withCredentials' : true
},
data : JSON.stringify({
process : $('#processFilter').val(),
creatorCompany : $('#creatorCompanyFilter').val(),
creatorDepartment : $('#creatorDepartmentFilter').val(),
activityName : $('#activityNameFilter').val(),
startTimeMonth : $('#startTimeMonthFilter').val(),
workStatus : $('#workStatusFilter').val(),
key : $('#keyFilter').val()
}),
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.first = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function work_manage_filter_list_prev(id, applicationFlag) {
var id = (id ? id : work_parameter.first);
$.ajax({
type : 'post',
dataType : 'json',
url : '../jaxrs/work/list/' + id + '/prev/' + work_parameter.count + '/application/{applicationFlag}/filter/manage',
xhrFields : {
'withCredentials' : true
},
data : JSON.stringify({
process : $('#processFilter').val(),
creatorCompany : $('#creatorCompanyFilter').val(),
creatorDepartment : $('#creatorDepartmentFilter').val(),
activityName : $('#activityNameFilter').val(),
startTimeMonth : $('#startTimeMonthFilter').val(),
workStatus : $('#workStatusFilter').val(),
key : $('#keyFilter').val()
}),
crossDomain : true
}).done(function(json) {
if (json.type == 'success') {
if (json.data.length > 0) {
work_parameter.first = json.data[0].id;
work_parameter.last = json.data[json.data.length - 1].id;
} else {
work_parameter.last = '(0)';
}
work_list_grid(json);
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}