|
@@ -1,24 +1,24 @@
|
|
|
$.event.special.valuechange = {
|
|
|
- teardown: function (namespaces) {
|
|
|
- $(this).unbind('.valuechange');
|
|
|
- },
|
|
|
-
|
|
|
- handler: function (e) {
|
|
|
- $.event.special.valuechange.triggerChanged($(this));
|
|
|
- },
|
|
|
-
|
|
|
- add: function (obj) {
|
|
|
- $(this).on('keyup.valuechange cut.valuechange paste.valuechange input.valuechange', obj.selector, $.event.special.valuechange.handler)
|
|
|
- },
|
|
|
-
|
|
|
- triggerChanged: function (element) {
|
|
|
- var current = element[0].contentEditable === 'true' ? element.html() : element.val()
|
|
|
- , previous = typeof element.data('previous') === 'undefined' ? element[0].defaultValue : element.data('previous');
|
|
|
- if (current !== previous) {
|
|
|
- element.trigger('valuechange', [element.data('previous')]);
|
|
|
- element.data('previous', current);
|
|
|
- }
|
|
|
+teardown: function (namespaces) {
|
|
|
+ $(this).unbind('.valuechange');
|
|
|
+},
|
|
|
+
|
|
|
+handler: function (e) {
|
|
|
+ $.event.special.valuechange.triggerChanged($(this));
|
|
|
+},
|
|
|
+
|
|
|
+add: function (obj) {
|
|
|
+ $(this).on('keyup.valuechange cut.valuechange paste.valuechange input.valuechange', obj.selector, $.event.special.valuechange.handler)
|
|
|
+},
|
|
|
+
|
|
|
+triggerChanged: function (element) {
|
|
|
+ var current = element[0].contentEditable === 'true' ? element.html() : element.val()
|
|
|
+ , previous = typeof element.data('previous') === 'undefined' ? element[0].defaultValue : element.data('previous');
|
|
|
+ if (current !== previous) {
|
|
|
+ element.trigger('valuechange', [element.data('previous')]);
|
|
|
+ element.data('previous', current);
|
|
|
}
|
|
|
+}
|
|
|
};
|
|
|
|
|
|
function escapeTags( str ) {
|
|
@@ -255,7 +255,8 @@ $(function(){
|
|
|
var name = $(this).attr('data-uname');
|
|
|
var company = $(this).attr('data-ucompany');
|
|
|
var jobs = $(this).attr('data-ujobs');
|
|
|
- var adduser = uid+'_'+name+'_'+company+'_'+jobs;
|
|
|
+ var email = $(this).attr('data-uemail');
|
|
|
+ var adduser = uid+'_'+name+'_'+company+'_'+jobs+'_'+email;
|
|
|
|
|
|
|
|
|
//添加到form中
|
|
@@ -271,7 +272,7 @@ $(function(){
|
|
|
$('#reductionAudit').val(uid);
|
|
|
}
|
|
|
}
|
|
|
- approvallist();
|
|
|
+ //approvallist();
|
|
|
});
|
|
|
|
|
|
//添加到审批流程中
|
|
@@ -288,7 +289,13 @@ $(function(){
|
|
|
var name = vmsg[1];
|
|
|
var company = vmsg[2];
|
|
|
var jobs = vmsg[3];
|
|
|
- var addusertr = '<tr id="user_'+ uid +'" userid="'+ uid +'"><td width="100">'+sort+' 审</td><td width="250"><h4 class="media-heading">'+ jobs +' '+ name +'</h4>'+ company +'</td> <td width="100"></td> <td></td> </tr>';
|
|
|
+ var email = vmsg[4];
|
|
|
+ var addusertr = '<tr>' +
|
|
|
+ '<td width="100">'+(sort != auditlist.length ? '<i class="glyphicon glyphicon-arrow-down text-muted"></i> 审批': '<i class="glyphicon glyphicon-stop text-muted"></i> 终审') +'</td>' +
|
|
|
+ '<td width="150"><h4 class="media-heading">'+ name +' </h4>'+ jobs +'</td> ' +
|
|
|
+ '<td width="200">'+ email +'<br>'+ company +'</td> ' +
|
|
|
+ '<td width=""><a href="javascript:void(0);" class="btn btn-default btn-sm remove-select-audit" uid="'+ uid +'" title="移除审批人"><span class="glyphicon glyphicon-remove text-danger"></span></a></td>' +
|
|
|
+ ' </tr>';
|
|
|
$('#usertableshow').append(addusertr);
|
|
|
auditarray.push(uid);
|
|
|
sort++;
|
|
@@ -314,6 +321,7 @@ $(function(){
|
|
|
// return false;
|
|
|
// }
|
|
|
//}
|
|
|
+ $('#searchshow').html('');
|
|
|
$.ajax({
|
|
|
type: 'post',
|
|
|
url: '/change/user/search?name='+username,
|
|
@@ -325,12 +333,17 @@ $(function(){
|
|
|
}else{
|
|
|
var userlist = result.userlist;
|
|
|
var adduserhtml = '';
|
|
|
+ var reductionAudit = $('#reductionAudit').val().split(',');
|
|
|
for(var i in userlist){
|
|
|
- useridlist.push(userlist[i].userid);
|
|
|
- adduserhtml += '<div class="col-md-3 alert alert-pnone"><div class="radio" data-uid="'+ userlist[i].userid +'" data-uname="'+ userlist[i].name +'" data-ucompany="'+ userlist[i].company +'" data-ujobs="'+ userlist[i].jobs +'"><label><input type="radio" value="'+ userlist[i].userid +'">'+ userlist[i].name +'</label><div>'+userlist[i].jobs +'<br>'+ userlist[i].email +'</div></div></div>';
|
|
|
+ //useridlist.push(userlist[i].userid);
|
|
|
+ if(in_array(reductionAudit,userlist[i].userid)){
|
|
|
+ adduserhtml += '<div class="col-md-3 alert alert-pnone alert-success"><div class="radio" data-uid="'+ userlist[i].userid +'" data-uname="'+ userlist[i].name +'" data-ucompany="'+ userlist[i].company +'" data-ujobs="'+ userlist[i].jobs +'" data-uemail="'+ userlist[i].email +'"><label><input type="radio" value="'+ userlist[i].userid +'" checked>'+ userlist[i].name +'</label><div>'+userlist[i].jobs +'<br>'+ userlist[i].email +'</div></div></div>';
|
|
|
+ }else{
|
|
|
+ adduserhtml += '<div class="col-md-3 alert alert-pnone"><div class="radio" data-uid="'+ userlist[i].userid +'" data-uname="'+ userlist[i].name +'" data-ucompany="'+ userlist[i].company +'" data-ujobs="'+ userlist[i].jobs +'" data-uemail="'+ userlist[i].email +'"><label><input type="radio" value="'+ userlist[i].userid +'">'+ userlist[i].name +'</label><div>'+userlist[i].jobs +'<br>'+ userlist[i].email +'</div></div></div>';
|
|
|
+ }
|
|
|
}
|
|
|
$('#useridlist').val(useridlist.join(','));
|
|
|
- $('#searchshow').append(adduserhtml);
|
|
|
+ $('#searchshow').html(adduserhtml);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -508,7 +521,7 @@ $(function(){
|
|
|
if(changeaudit !== reductionaudit){
|
|
|
//不相同则要还原
|
|
|
$('#selectauditlist').val('');
|
|
|
- var $rowdiv = $('#addshenpi').find('.col-md-8').children('.row').children('div');
|
|
|
+ var $rowdiv = $('#addshenpi').find('.modal-body').children('.row').children('div');
|
|
|
$rowdiv.removeClass('alert-success');
|
|
|
$rowdiv.find('input').prop('checked',false);
|
|
|
|
|
@@ -524,7 +537,8 @@ $(function(){
|
|
|
var name = $rowdivdiv.attr('data-uname');
|
|
|
var company = $rowdivdiv.attr('data-ucompany');
|
|
|
var jobs = $rowdivdiv.attr('data-ujobs');
|
|
|
- var adduser = uid+'_'+name+'_'+company+'_'+jobs;
|
|
|
+ var email = $rowdivdiv.attr('data-uemail');
|
|
|
+ var adduser = uid+'_'+name+'_'+company+'_'+jobs+'_'+email;
|
|
|
if($('#selectauditlist').val() != ''){
|
|
|
var auditlist2 = $('#selectauditlist').val().split('->');
|
|
|
auditlist2.push(adduser);
|
|
@@ -538,7 +552,7 @@ $(function(){
|
|
|
}
|
|
|
$('#reductionAudit').val(changeaudit);
|
|
|
}
|
|
|
- approvallist();
|
|
|
+ //approvallist();
|
|
|
$('#addshenpi').modal('hide');
|
|
|
});
|
|
|
|
|
@@ -549,16 +563,19 @@ $(function(){
|
|
|
//移除审批流程
|
|
|
$('body').on('click', '.remove-select-audit', function() {
|
|
|
var reductionlist = $('#reductionAudit').val().split(',');
|
|
|
+ var changeaudit = $('#changeaudit').val().split(',');
|
|
|
var selectlist = $('#selectauditlist').val().split('->');
|
|
|
for(var i in reductionlist){
|
|
|
if(reductionlist[i] == $(this).attr('uid')){
|
|
|
reductionlist.splice(i,1);
|
|
|
+ changeaudit.splice(i,1);
|
|
|
selectlist.splice(i,1);
|
|
|
}
|
|
|
}
|
|
|
$('#reductionAudit').val(reductionlist.join(','));
|
|
|
+ $('#changeaudit').val(changeaudit.join(','));
|
|
|
$('#selectauditlist').val(selectlist.join('->'));
|
|
|
- var $rowdiv = $('#addshenpi').find('.col-md-8').children('.row').children('.alert-success');
|
|
|
+ var $rowdiv = $('#addshenpi').find('.modal-body').children('.row').children('.alert-success');
|
|
|
for(var j in $rowdiv){
|
|
|
if($rowdiv.eq(j).children('div').attr('data-uid') == $(this).attr('uid')){
|
|
|
$rowdiv.eq(j).removeClass('alert-success');
|
|
@@ -566,7 +583,9 @@ $(function(){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- approvallist();
|
|
|
+ $(this).parents('tr').remove();
|
|
|
+
|
|
|
+ //approvallist();
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -798,17 +817,28 @@ function totalamount(decimal){
|
|
|
$('.otatalamount').eq(1).text(ototalnum != 0 ? ototalnum : zero);
|
|
|
}
|
|
|
|
|
|
-//显示并更新审批流程
|
|
|
-function approvallist(){
|
|
|
- $('#selectlist .approval-audit-li').remove();
|
|
|
- if($('#selectauditlist').val() != ''){
|
|
|
- var auditlist = $('#selectauditlist').val().split('->');
|
|
|
- var lihtml = '';
|
|
|
- for(var i in auditlist){
|
|
|
- var auditArr = auditlist[i].split('_');
|
|
|
- var iclass = parseInt(i)+1 == auditlist.length ? ' glyphicon-stop' : ' glyphicon-arrow-down';
|
|
|
- lihtml += '<li class="list-group-item approval-audit-li"><i class="glyphicon'+ iclass +' text-muted"></i>'+ auditArr[1] +'<a class="fR text-danger remove-select-audit" uid="'+ auditArr[0] +'" title="移除"><i class="glyphicon glyphicon-remove"></i></a></li>';
|
|
|
+//判断元素是否在数组中,相当于php的in_array();
|
|
|
+function in_array(arr, obj) {
|
|
|
+ var i = arr.length;
|
|
|
+ while (i--) {
|
|
|
+ if (arr[i] == obj) {
|
|
|
+ return true;
|
|
|
}
|
|
|
- $('#selectlist').append(lihtml);
|
|
|
}
|
|
|
-}
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+//显示并更新审批流程
|
|
|
+//function approvallist(){
|
|
|
+// $('#selectlist .approval-audit-li').remove();
|
|
|
+// if($('#selectauditlist').val() != ''){
|
|
|
+// var auditlist = $('#selectauditlist').val().split('->');
|
|
|
+// var lihtml = '';
|
|
|
+// for(var i in auditlist){
|
|
|
+// var auditArr = auditlist[i].split('_');
|
|
|
+// var iclass = parseInt(i)+1 == auditlist.length ? ' glyphicon-stop' : ' glyphicon-arrow-down';
|
|
|
+// lihtml += '<li class="list-group-item approval-audit-li"><i class="glyphicon'+ iclass +' text-muted"></i>'+ auditArr[1] +'<a class="fR text-danger remove-select-audit" uid="'+ auditArr[0] +'" title="移除"><i class="glyphicon glyphicon-remove"></i></a></li>';
|
|
|
+// }
|
|
|
+// $('#selectlist').append(lihtml);
|
|
|
+// }
|
|
|
+//}
|