$(function(){
$(document).on('click','.create-actions', function () {
var buttons1 = [
{
text: '请假类型',
label: true
},
{
text: '事假',
bold: true,
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 事假 ]');
$('#holidaytypeshow').val('事假');
$('#otherholiday').hide();
$('#holidaytype').val(1);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('事假');
$('#typenum').val(1);
}
},
{
text: '病假',
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 病假 ]');
$('#holidaytypeshow').val('病假');
$('#otherholiday').hide();
$('#holidaytype').val(2);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('病假');
$('#typenum').val(1);
}
},
{
text: '年假',
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 年假 ]');
$('#holidaytypeshow').val('年假');
$('#otherholiday').hide();
$('#holidaytype').val(12);
$('#holidayshow').hide();
$('.tab').removeClass('active');
//$('.haveholidaynum').show();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab5').addClass('active');
$('#tab5').find('input').removeAttr('disabled');
//$('#tab5').find('textarea').removeAttr('disabled');
//$('.tabtitle').text('年假');
//$('.holidayname').text('年假');
//$('#holidaynum').val('你的年假 '+$('#nianjia').val()+' 天');
//$('.align-top').hide();
//$('.align-top').find('textarea').attr('disabled',true);
$('#typenum').val(1);
if($('#nianjia').val() == 0){
$('#holidayshow span').text('年假');
$('#holidayshow').show();
}
}
},
{
text: '加班(计假)',
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 加班(计假) ]');
$('#holidaytypeshow').val('加班(计假)');
$('#otherholiday').hide();
$('#holidaytype').val(4);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('加班(计假)');
$('#typenum').val(1);
}
},
{
text: '加班(计薪)',
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 加班(计薪) ]');
$('#holidaytypeshow').val('加班(计薪)');
$('#otherholiday').hide();
$('#holidaytype').val(4);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('加班(计薪)');
$('#typenum').val(1);
}
},
{
text: '补休',
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 补休 ]');
$('#holidaytypeshow').val('补休');
$('#otherholiday').hide();
$('#holidaytype').val(10);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').show();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('补休');
$('.holidayname').text('存假');
$('#holidaynum').val('你的存假 '+$('#cunjia').val()+' 天');
$('#typenum').val(1);
if($('#cunjia').val() == 0){
$('#holidayshow span').text('存假');
$('#holidayshow').show();
}
}
},
//{
// text: '其他',
// onClick: function() {
// $('#holidaytypeshow').attr('placeholder','假期类型 [ 其他 ]');
// $('#holidaytypeshow').val('其他');
// $('#otherholiday').show();
// $('#otherholidayshow').attr('placeholder','其他类型 [ 调休 ]');
// $('#otherholidayshow').val('调休');
// $('#holidaytype').val(11);
// $('.align-top').show();
// $('#holidayshow').hide();
// $('.tab').removeClass('active');
// $('.tab').find('input').attr('disabled',true);
// $('.tab').find('textarea').attr('disabled',true);
// $('#tab2').addClass('active');
// $('#tab2').find('input').removeAttr('disabled');
// $('#tab2').find('textarea').removeAttr('disabled');
// $('#typenum').val(2);
// }
//}
{
text: '其他',
onClick: function() {
$('#holidaytypeshow').attr('placeholder','假期类型 [ 其他 ]');
$('#holidaytypeshow').val('其他');
$('#otherholiday').show();
$('#otherholidayshow').attr('placeholder','其他类型 [ 值班 ]');
$('#otherholidayshow').val('值班');
$('#holidaytype').val(5);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('值班');
$('#typenum').val(1);
}
}
];
var buttons2 = [
{
text: '取消'
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
$(document).on('click','.create-actionsTwo', function () {
var buttons1 = [
{
text: '其他类型',
label: true
},
//{
// text: '调休',
// bold: true,
// onClick: function() {
// $('#otherholidayshow').attr('placeholder','其他类型 [ 调休 ]');
// $('#otherholidayshow').val('调休');
// $('#holidaytype').val(11);
// $('.align-top').show();
// $('#holidayshow').hide();
// $('.tab').removeClass('active');
// $('.tab').find('input').attr('disabled',true);
// $('.tab').find('textarea').attr('disabled',true);
// $('#tab2').addClass('active');
// $('#tab2').find('input').removeAttr('disabled');
// $('#tab2').find('textarea').removeAttr('disabled');
// $('#typenum').val(2);
// }
//},
{
text: '值班',
onClick: function() {
$('#otherholidayshow').attr('placeholder','假期类型 [ 值班 ]');
$('#otherholidayshow').val('值班');
$('#holidaytype').val(5);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.haveholidaynum').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab1').addClass('active');
$('#tab1').find('input').removeAttr('disabled');
$('#tab1').find('textarea').removeAttr('disabled');
$('.tabtitle').text('值班');
$('#typenum').val(1);
}
},
{
text: '婚假',
onClick: function() {
$('#otherholidayshow').attr('placeholder','其他类型 [ 婚假 ]');
$('#otherholidayshow').val('婚假');
$('#holidaytype').val(6);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab3').addClass('active');
$('#tab3').find('input').removeAttr('disabled');
$('#tab3').find('textarea').removeAttr('disabled');
$('.tabtitle').text('婚假');
$('#typenum').val(3);
$('#othernumshow').val('您的假期 '+$('#hunjia').val()+' 天');
$('#othernum').val($('#hunjia').val());
if($('#hunjia').val() == 0){
$('#holidayshow span').text('婚假');
$('#holidayshow').show();
}
}
},
{
text: '产假',
onClick: function() {
$('#otherholidayshow').attr('placeholder','其他类型 [ 产假 ]');
$('#otherholidayshow').val('产假');
$('#holidaytype').val(7);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab3').addClass('active');
$('#tab3').find('input').removeAttr('disabled');
$('#tab3').find('textarea').removeAttr('disabled');
$('.tabtitle').text('产假');
$('#typenum').val(3);
$('#othernumshow').val('您的假期 '+$('#chanjia').val()+' 天');
$('#othernum').val($('#chanjia').val());
if($('#chanjia').val() == 0){
$('#holidayshow span').text('产假');
$('#holidayshow').show();
}
}
},
{
text: '丧假',
onClick: function() {
$('#otherholidayshow').attr('placeholder','其他类型 [ 丧假 ]');
$('#otherholidayshow').val('丧假');
$('#holidaytype').val(8);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab3').addClass('active');
$('#tab3').find('input').removeAttr('disabled');
$('#tab3').find('textarea').removeAttr('disabled');
$('.tabtitle').text('丧假');
$('#typenum').val(3);
$('#othernumshow').val('您的假期 '+$('#sangjia').val()+' 天');
$('#othernum').val($('#sangjia').val());
if($('#sangjia').val() == 0){
$('#holidayshow span').text('丧假');
$('#holidayshow').show();
}
}
},
{
text: '工伤假',
onClick: function() {
$('#otherholidayshow').attr('placeholder','其他类型 [ 工伤假 ]');
$('#otherholidayshow').val('工伤假');
$('#holidaytype').val(9);
$('.tab').removeClass('active');
$('.align-top').show();
$('#holidayshow').hide();
$('.tab').find('input').attr('disabled',true);
$('.tab').find('textarea').attr('disabled',true);
$('#tab3').addClass('active');
$('#tab3').find('input').removeAttr('disabled');
$('#tab3').find('textarea').removeAttr('disabled');
$('.tabtitle').text('工伤假');
$('#typenum').val(3);
$('#othernumshow').val('您的假期 '+$('#gongjia').val()+' 天');
$('#othernum').val($('#gongjia').val());
if($('#gongjia').val() == 0){
$('#holidayshow span').text('工伤假');
$('#holidayshow').show();
}
}
}
];
var buttons2 = [
{
text: '取消'
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
// var date = new Date();
// var year = date.getFullYear();
// var month = date.getMonth() + 1;
// var day = date.getDate();
//$("#datetime-picker-star").datetimePicker({
// toolbarTemplate: '',
// value: [year, month, day, '8', '30']
//});
$("#datetime-picker-star").calendar({
onChange : function(e,value,day){
$.alert(e);
}
});
$("#datetime-picker-end").calendar({
onChange : function(e,value){
}
});
//$("#datetime-picker-end").datetimePicker({
// toolbarTemplate: '',
//});
$(document).on('click','.confirm-ok', function () {
$.prompt('填写你的审批意见', function (value) {
$.alert('你的审批意见: ' + value , function(){
ajaxapproval(2,value);
});
});
});
$(document).on('click','.confirm-cancel', function () {
$.prompt('不同意原因', function (value) {
$.alert('你的审批意见:' + value , function(){
ajaxapproval(3,value);
});
});
});
function ajaxapproval(isagree,value){
$.ajax({
type: 'post',
url: '/approvalrequest/'+$('#hid').val(),
data: {isagree: isagree, description: value},
dataType: 'json',
success: function(data){
if(data.code == 200){
if(isagree == 2){
var text = '同意';
}else{
var text = '不同意';
}
$('#thisapprover').children('.item-after').text(text);
if(value.length > 10){
$('#thisapprover').children('.itemView').text(value.substring(0,10)+"...");
}else{
$('#thisapprover').children('.itemView').text(value);
}
$('#thisapprover').children('.itemView').attr('longmsg',value);
$('.barBig').remove();
$.toast('已审批');
if(parseInt($('.badge').text())-1 == 0){
$('.badge').remove();
}else{
$('.badge').text(parseInt($('.badge').text())-1);
}
}else{
$.alert(data.msg);
}
}
});
}
//$(document).on('click','.open-about', function () {
// $.popup('.popup-aboutTime');
//});
$(document).on('click','.itemView',function () {
$.alert($(this).attr('longmsg'));
});
$(document).on("pageInit", "#page-city-picker", function(e) {
$("#city-picker").cityPicker({
value: ['广东', '珠海','香洲区']
});
});
$.init();
$("#pickerOffice").picker({
toolbarTemplate: '',
cols: [
{
textAlign: 'center',
values: category
}
]
});
$("#pickerInvoice").picker({
toolbarTemplate: '',
cols: [
{
textAlign: 'center',
values: element
}
]
});
$(document).on('click','.invoiceType', function () {
var buttons1 = [
{
text: '发票类型',
label: true,
},
{
text: '增值税普通发票',
bold: true,
onClick: function() {
$('#plainInvoice_box').show();
$('#specialInvoice_box').hide();
$('#invoiceTypeName').val('增值税普通发票');
$('#invoiceType').val(0);
}
},
{
text: '增值税专用发票',
onClick: function() {
$('#plainInvoice_box').hide();
$('#specialInvoice_box').show();
$('#invoiceTypeName').val('增值税专用发票');
$('#invoiceType').val(1);
}
}
];
var buttons2 = [
{
text: '取消',
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
$(document).on('click','.invoiceMail', function () {
var buttons1 = [
{
text: '是否邮寄',
label: true,
},
{
text: '是 ',
bold: true,
onClick: function() {
$('#mail_box').show();
$('#doPostName').val('是 ');
$('#doPost').val(1);
}
},
{
text: '否',
onClick: function() {
$('#mail_box').hide();
$('#doPostName').val('否 ');
$('#doPost').val(0);
}
}
];
var buttons2 = [
{
text: '取消',
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
});
$(document).on('click','.invoiceExpress', function () {
var buttons1 = [
{
text: '选择快递公司',
label: true,
},
{
text: 'EMS快递',
bold: true,
onClick: function() {
$('#untreadCompanyName').val('EMS快递');
$('#untreadCompany').val('EMS快递:ems');
}
},
{
text: '顺丰快递',
onClick: function() {
$('#untreadCompanyName').val('顺丰速运');
$('#untreadCompany').val('顺丰速运:shunfeng');
}
}
];
var buttons2 = [
{
text: '取消',
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
$(function(){
var t = $('#myinput');
t.css("color","#A9A9A9");
t.val("请输入内容");
var default_value = t.val();
t.focus(function() {
t.css("color","black");
if (t.val() == default_value) {
t.val('');
}
});
t.blur(function() {
t.css("color","black");
if (t.val() == '') {
t.val(default_value);
t.css("color","#A9A9A9");
}
});
});
$(function(){
var k = $('#myinput1');
k.css("color","#A9A9A9");
k.val("请输入内容");
var default_value = k.val();
k.focus(function() {
k.css("color","black");
if (k.val() == default_value) {
k.val('');
}
});
k.blur(function() {
k.css("color","black");
if (k.val() == '') {
k.val(default_value);
k.css("color","#A9A9A9");
}
});
});
$(function(){
var p = $('#myinput2');
p.css("color","#A9A9A9");
p.val("请输入内容");
var default_value = p.val();
p.focus(function() {
p.css("color","black");
if (p.val() == default_value) {
p.val('');
}
});
p.blur(function() {
p.css("color","black");
if (p.val() == '') {
p.val(default_value);
p.css("color","#A9A9A9");
}
});
$(document).on('click','.button-end', function () {
$.confirm('终止审批', function () {
$.alert('您终止审批');
});
});
$(document).on('click','.button-return', function () {
$.confirm('退回审批', function () {
$.alert('您退回审批');
});
});
$(document).on('click','.button-agree', function () {
$.confirm('同意审批', function () {
$.alert('您同意审批');
});
});
});
$(document).on('click','.invoiceaccounts', function () {
var buttons1 = [
{
text: '请选择',
label: true
},
{
text: '软件销售',
},
{
text: '培训班',
}
];
var buttons2 = [
{
text: '取消',
bg: 'danger'
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
$(document).on('click','.invoicetrainexpenses', function () {
var buttons1 = [
{
text: '请选择',
label: true
},
{
text: '交通费',
},
{
text: '讲课费',
},
{
text: '住宿费',
},
{
text: '场租费',
},
{
text: '办公费',
},
{
text: '电话费',
},
{
text: '邮寄费',
},
{
text: '公关费',
},
{
text: '其他',
},
{
text: '税款',
},
{
text: '研究中心经费',
}
];
var buttons2 = [
{
text: '取消',
bg: 'danger'
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
$(document).ready(function(){
//加的效果
$(".add").click(function(){
var n=$(this).prev().val();
var num=parseInt(n)+1;
if(num==0){ return;}
$(this).prev().val(num);
});
//减的效果
$(".jian").click(function(){
var n=$(this).next().val();
var num=parseInt(n)-1;
if(num==0){ return}
$(this).next().val(num);
});
});