global.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. $(function(){
  2. $(document).on('click','.create-actions', function () {
  3. var buttons1 = [
  4. {
  5. text: '请假类型',
  6. label: true
  7. },
  8. {
  9. text: '事假',
  10. bold: true,
  11. onClick: function() {
  12. $('#holidaytypeshow').attr('placeholder','假期类型 [ 事假 ]');
  13. $('#holidaytypeshow').val('事假');
  14. $('#otherholiday').hide();
  15. $('#holidaytype').val(1);
  16. $('.tab').removeClass('active');
  17. $('.align-top').show();
  18. $('#holidayshow').hide();
  19. $('.haveholidaynum').hide();
  20. $('.tab').find('input').attr('disabled',true);
  21. $('.tab').find('textarea').attr('disabled',true);
  22. $('#tab1').addClass('active');
  23. $('#tab1').find('input').removeAttr('disabled');
  24. $('#tab1').find('textarea').removeAttr('disabled');
  25. $('.tabtitle').text('事假');
  26. $('#typenum').val(1);
  27. }
  28. },
  29. {
  30. text: '病假',
  31. onClick: function() {
  32. $('#holidaytypeshow').attr('placeholder','假期类型 [ 病假 ]');
  33. $('#holidaytypeshow').val('病假');
  34. $('#otherholiday').hide();
  35. $('#holidaytype').val(2);
  36. $('.tab').removeClass('active');
  37. $('.align-top').show();
  38. $('#holidayshow').hide();
  39. $('.haveholidaynum').hide();
  40. $('.tab').find('input').attr('disabled',true);
  41. $('.tab').find('textarea').attr('disabled',true);
  42. $('#tab1').addClass('active');
  43. $('#tab1').find('input').removeAttr('disabled');
  44. $('#tab1').find('textarea').removeAttr('disabled');
  45. $('.tabtitle').text('病假');
  46. $('#typenum').val(1);
  47. }
  48. },
  49. {
  50. text: '年假',
  51. onClick: function() {
  52. $('#holidaytypeshow').attr('placeholder','假期类型 [ 年假 ]');
  53. $('#holidaytypeshow').val('年假');
  54. $('#otherholiday').hide();
  55. $('#holidaytype').val(12);
  56. $('#holidayshow').hide();
  57. $('.tab').removeClass('active');
  58. //$('.haveholidaynum').show();
  59. $('.tab').find('input').attr('disabled',true);
  60. $('.tab').find('textarea').attr('disabled',true);
  61. $('#tab5').addClass('active');
  62. $('#tab5').find('input').removeAttr('disabled');
  63. //$('#tab5').find('textarea').removeAttr('disabled');
  64. //$('.tabtitle').text('年假');
  65. //$('.holidayname').text('年假');
  66. //$('#holidaynum').val('你的年假 '+$('#nianjia').val()+' 天');
  67. //$('.align-top').hide();
  68. //$('.align-top').find('textarea').attr('disabled',true);
  69. $('#typenum').val(1);
  70. if($('#nianjia').val() == 0){
  71. $('#holidayshow span').text('年假');
  72. $('#holidayshow').show();
  73. }
  74. }
  75. },
  76. {
  77. text: '加班',
  78. onClick: function() {
  79. $('#holidaytypeshow').attr('placeholder','假期类型 [ 加班 ]');
  80. $('#holidaytypeshow').val('加班');
  81. $('#otherholiday').hide();
  82. $('#holidaytype').val(4);
  83. $('.tab').removeClass('active');
  84. $('.align-top').show();
  85. $('#holidayshow').hide();
  86. $('.haveholidaynum').hide();
  87. $('.tab').find('input').attr('disabled',true);
  88. $('.tab').find('textarea').attr('disabled',true);
  89. $('#tab1').addClass('active');
  90. $('#tab1').find('input').removeAttr('disabled');
  91. $('#tab1').find('textarea').removeAttr('disabled');
  92. $('.tabtitle').text('加班');
  93. $('#typenum').val(1);
  94. }
  95. },
  96. {
  97. text: '补休',
  98. onClick: function() {
  99. $('#holidaytypeshow').attr('placeholder','假期类型 [ 补休 ]');
  100. $('#holidaytypeshow').val('补休');
  101. $('#otherholiday').hide();
  102. $('#holidaytype').val(10);
  103. $('.tab').removeClass('active');
  104. $('.align-top').show();
  105. $('#holidayshow').hide();
  106. $('.haveholidaynum').show();
  107. $('.tab').find('input').attr('disabled',true);
  108. $('.tab').find('textarea').attr('disabled',true);
  109. $('#tab1').addClass('active');
  110. $('#tab1').find('input').removeAttr('disabled');
  111. $('#tab1').find('textarea').removeAttr('disabled');
  112. $('.tabtitle').text('补休');
  113. $('.holidayname').text('存假');
  114. $('#holidaynum').val('你的存假 '+$('#cunjia').val()+' 天');
  115. $('#typenum').val(1);
  116. if($('#cunjia').val() == 0){
  117. $('#holidayshow span').text('存假');
  118. $('#holidayshow').show();
  119. }
  120. }
  121. },
  122. //{
  123. // text: '其他',
  124. // onClick: function() {
  125. // $('#holidaytypeshow').attr('placeholder','假期类型 [ 其他 ]');
  126. // $('#holidaytypeshow').val('其他');
  127. // $('#otherholiday').show();
  128. // $('#otherholidayshow').attr('placeholder','其他类型 [ 调休 ]');
  129. // $('#otherholidayshow').val('调休');
  130. // $('#holidaytype').val(11);
  131. // $('.align-top').show();
  132. // $('#holidayshow').hide();
  133. // $('.tab').removeClass('active');
  134. // $('.tab').find('input').attr('disabled',true);
  135. // $('.tab').find('textarea').attr('disabled',true);
  136. // $('#tab2').addClass('active');
  137. // $('#tab2').find('input').removeAttr('disabled');
  138. // $('#tab2').find('textarea').removeAttr('disabled');
  139. // $('#typenum').val(2);
  140. // }
  141. //}
  142. {
  143. text: '其他',
  144. onClick: function() {
  145. $('#holidaytypeshow').attr('placeholder','假期类型 [ 其他 ]');
  146. $('#holidaytypeshow').val('其他');
  147. $('#otherholiday').show();
  148. $('#otherholidayshow').attr('placeholder','其他类型 [ 值班 ]');
  149. $('#otherholidayshow').val('值班');
  150. $('#holidaytype').val(5);
  151. $('.tab').removeClass('active');
  152. $('.align-top').show();
  153. $('#holidayshow').hide();
  154. $('.haveholidaynum').hide();
  155. $('.tab').find('input').attr('disabled',true);
  156. $('.tab').find('textarea').attr('disabled',true);
  157. $('#tab1').addClass('active');
  158. $('#tab1').find('input').removeAttr('disabled');
  159. $('#tab1').find('textarea').removeAttr('disabled');
  160. $('.tabtitle').text('值班');
  161. $('#typenum').val(1);
  162. }
  163. }
  164. ];
  165. var buttons2 = [
  166. {
  167. text: '取消'
  168. }
  169. ];
  170. var groups = [buttons1, buttons2];
  171. $.actions(groups);
  172. });
  173. $(document).on('click','.create-actionsTwo', function () {
  174. var buttons1 = [
  175. {
  176. text: '其他类型',
  177. label: true
  178. },
  179. //{
  180. // text: '调休',
  181. // bold: true,
  182. // onClick: function() {
  183. // $('#otherholidayshow').attr('placeholder','其他类型 [ 调休 ]');
  184. // $('#otherholidayshow').val('调休');
  185. // $('#holidaytype').val(11);
  186. // $('.align-top').show();
  187. // $('#holidayshow').hide();
  188. // $('.tab').removeClass('active');
  189. // $('.tab').find('input').attr('disabled',true);
  190. // $('.tab').find('textarea').attr('disabled',true);
  191. // $('#tab2').addClass('active');
  192. // $('#tab2').find('input').removeAttr('disabled');
  193. // $('#tab2').find('textarea').removeAttr('disabled');
  194. // $('#typenum').val(2);
  195. // }
  196. //},
  197. {
  198. text: '值班',
  199. onClick: function() {
  200. $('#otherholidayshow').attr('placeholder','假期类型 [ 值班 ]');
  201. $('#otherholidayshow').val('值班');
  202. $('#holidaytype').val(5);
  203. $('.tab').removeClass('active');
  204. $('.align-top').show();
  205. $('#holidayshow').hide();
  206. $('.haveholidaynum').hide();
  207. $('.tab').find('input').attr('disabled',true);
  208. $('.tab').find('textarea').attr('disabled',true);
  209. $('#tab1').addClass('active');
  210. $('#tab1').find('input').removeAttr('disabled');
  211. $('#tab1').find('textarea').removeAttr('disabled');
  212. $('.tabtitle').text('值班');
  213. $('#typenum').val(1);
  214. }
  215. },
  216. {
  217. text: '婚假',
  218. onClick: function() {
  219. $('#otherholidayshow').attr('placeholder','其他类型 [ 婚假 ]');
  220. $('#otherholidayshow').val('婚假');
  221. $('#holidaytype').val(6);
  222. $('.tab').removeClass('active');
  223. $('.align-top').show();
  224. $('#holidayshow').hide();
  225. $('.tab').find('input').attr('disabled',true);
  226. $('.tab').find('textarea').attr('disabled',true);
  227. $('#tab3').addClass('active');
  228. $('#tab3').find('input').removeAttr('disabled');
  229. $('#tab3').find('textarea').removeAttr('disabled');
  230. $('.tabtitle').text('婚假');
  231. $('#typenum').val(3);
  232. $('#othernumshow').val('您的假期 '+$('#hunjia').val()+' 天');
  233. $('#othernum').val($('#hunjia').val());
  234. if($('#hunjia').val() == 0){
  235. $('#holidayshow span').text('婚假');
  236. $('#holidayshow').show();
  237. }
  238. }
  239. },
  240. {
  241. text: '产假',
  242. onClick: function() {
  243. $('#otherholidayshow').attr('placeholder','其他类型 [ 产假 ]');
  244. $('#otherholidayshow').val('产假');
  245. $('#holidaytype').val(7);
  246. $('.tab').removeClass('active');
  247. $('.align-top').show();
  248. $('#holidayshow').hide();
  249. $('.tab').find('input').attr('disabled',true);
  250. $('.tab').find('textarea').attr('disabled',true);
  251. $('#tab3').addClass('active');
  252. $('#tab3').find('input').removeAttr('disabled');
  253. $('#tab3').find('textarea').removeAttr('disabled');
  254. $('.tabtitle').text('产假');
  255. $('#typenum').val(3);
  256. $('#othernumshow').val('您的假期 '+$('#chanjia').val()+' 天');
  257. $('#othernum').val($('#chanjia').val());
  258. if($('#chanjia').val() == 0){
  259. $('#holidayshow span').text('产假');
  260. $('#holidayshow').show();
  261. }
  262. }
  263. },
  264. {
  265. text: '丧假',
  266. onClick: function() {
  267. $('#otherholidayshow').attr('placeholder','其他类型 [ 丧假 ]');
  268. $('#otherholidayshow').val('丧假');
  269. $('#holidaytype').val(8);
  270. $('.tab').removeClass('active');
  271. $('.align-top').show();
  272. $('#holidayshow').hide();
  273. $('.tab').find('input').attr('disabled',true);
  274. $('.tab').find('textarea').attr('disabled',true);
  275. $('#tab3').addClass('active');
  276. $('#tab3').find('input').removeAttr('disabled');
  277. $('#tab3').find('textarea').removeAttr('disabled');
  278. $('.tabtitle').text('丧假');
  279. $('#typenum').val(3);
  280. $('#othernumshow').val('您的假期 '+$('#sangjia').val()+' 天');
  281. $('#othernum').val($('#sangjia').val());
  282. if($('#sangjia').val() == 0){
  283. $('#holidayshow span').text('丧假');
  284. $('#holidayshow').show();
  285. }
  286. }
  287. },
  288. {
  289. text: '工伤假',
  290. onClick: function() {
  291. $('#otherholidayshow').attr('placeholder','其他类型 [ 工伤假 ]');
  292. $('#otherholidayshow').val('工伤假');
  293. $('#holidaytype').val(9);
  294. $('.tab').removeClass('active');
  295. $('.align-top').show();
  296. $('#holidayshow').hide();
  297. $('.tab').find('input').attr('disabled',true);
  298. $('.tab').find('textarea').attr('disabled',true);
  299. $('#tab3').addClass('active');
  300. $('#tab3').find('input').removeAttr('disabled');
  301. $('#tab3').find('textarea').removeAttr('disabled');
  302. $('.tabtitle').text('工伤假');
  303. $('#typenum').val(3);
  304. $('#othernumshow').val('您的假期 '+$('#gongjia').val()+' 天');
  305. $('#othernum').val($('#gongjia').val());
  306. if($('#gongjia').val() == 0){
  307. $('#holidayshow span').text('工伤假');
  308. $('#holidayshow').show();
  309. }
  310. }
  311. }
  312. ];
  313. var buttons2 = [
  314. {
  315. text: '取消'
  316. }
  317. ];
  318. var groups = [buttons1, buttons2];
  319. $.actions(groups);
  320. });
  321. // var date = new Date();
  322. // var year = date.getFullYear();
  323. // var month = date.getMonth() + 1;
  324. // var day = date.getDate();
  325. //$("#datetime-picker-star").datetimePicker({
  326. // toolbarTemplate: '<header class="bar bar-nav">\
  327. //<button class="button button-link pull-right close-picker">确定</button>\
  328. //<h1 class="title">请选择开始时间</h1>\
  329. //</header>',
  330. // value: [year, month, day, '8', '30']
  331. //});
  332. $("#datetime-picker-star").calendar({
  333. onChange : function(e,value,day){
  334. $.alert(e);
  335. }
  336. });
  337. $("#datetime-picker-end").calendar({
  338. onChange : function(e,value){
  339. }
  340. });
  341. //$("#datetime-picker-end").datetimePicker({
  342. // toolbarTemplate: '<header class="bar bar-nav">\
  343. //<button class="button button-link pull-right close-picker">确定</button>\
  344. //<h1 class="title">请选择结束时间</h1>\
  345. //</header>',
  346. //});
  347. $(document).on('click','.confirm-ok', function () {
  348. $.prompt('填写你的审批意见', function (value) {
  349. $.alert('你的审批意见: ' + value , function(){
  350. ajaxapproval(2,value);
  351. });
  352. });
  353. });
  354. $(document).on('click','.confirm-cancel', function () {
  355. $.prompt('不同意原因', function (value) {
  356. $.alert('你的审批意见:' + value , function(){
  357. ajaxapproval(3,value);
  358. });
  359. });
  360. });
  361. function ajaxapproval(isagree,value){
  362. $.ajax({
  363. type: 'post',
  364. url: '/approvalrequest/'+$('#hid').val(),
  365. data: {isagree: isagree, description: value},
  366. dataType: 'json',
  367. success: function(data){
  368. if(data.code == 200){
  369. if(isagree == 2){
  370. var text = '同意';
  371. }else{
  372. var text = '不同意';
  373. }
  374. $('#thisapprover').children('.item-after').text(text);
  375. if(value.length > 10){
  376. $('#thisapprover').children('.itemView').text(value.substring(0,10)+"...");
  377. }else{
  378. $('#thisapprover').children('.itemView').text(value);
  379. }
  380. $('#thisapprover').children('.itemView').attr('longmsg',value);
  381. $('.barBig').remove();
  382. $.toast('已审批');
  383. if(parseInt($('.badge').text())-1 == 0){
  384. $('.badge').remove();
  385. }else{
  386. $('.badge').text(parseInt($('.badge').text())-1);
  387. }
  388. }else{
  389. $.alert(data.msg);
  390. }
  391. }
  392. });
  393. }
  394. //$(document).on('click','.open-about', function () {
  395. // $.popup('.popup-aboutTime');
  396. //});
  397. $(document).on('click','.itemView',function () {
  398. $.alert($(this).attr('longmsg'));
  399. });
  400. $(document).on("pageInit", "#page-city-picker", function(e) {
  401. $("#city-picker").cityPicker({
  402. value: ['广东', '珠海','香洲区']
  403. });
  404. });
  405. $.init();
  406. $("#pickerOffice").picker({
  407. toolbarTemplate: '<header class="bar bar-nav">\
  408. <button class="button button-link pull-right close-picker">确定</button>\
  409. <h1 class="title">请选择你的办事处</h1>\
  410. </header>',
  411. cols: [
  412. {
  413. textAlign: 'center',
  414. values: category
  415. }
  416. ]
  417. });
  418. $("#pickerInvoice").picker({
  419. toolbarTemplate: '<header class="bar bar-nav">\
  420. <button class="button button-link pull-right close-picker">确定</button>\
  421. <h1 class="title">请选择开票内容</h1>\
  422. </header>',
  423. cols: [
  424. {
  425. textAlign: 'center',
  426. values: element
  427. }
  428. ]
  429. });
  430. $(document).on('click','.invoiceType', function () {
  431. var buttons1 = [
  432. {
  433. text: '发票类型',
  434. label: true,
  435. },
  436. {
  437. text: '增值税普通发票',
  438. bold: true,
  439. onClick: function() {
  440. $('#plainInvoice_box').show();
  441. $('#specialInvoice_box').hide();
  442. $('#invoiceTypeName').val('增值税普通发票');
  443. $('#invoiceType').val(0);
  444. }
  445. },
  446. {
  447. text: '增值税专用发票',
  448. onClick: function() {
  449. $('#plainInvoice_box').hide();
  450. $('#specialInvoice_box').show();
  451. $('#invoiceTypeName').val('增值税专用发票');
  452. $('#invoiceType').val(1);
  453. }
  454. }
  455. ];
  456. var buttons2 = [
  457. {
  458. text: '取消',
  459. }
  460. ];
  461. var groups = [buttons1, buttons2];
  462. $.actions(groups);
  463. });
  464. $(document).on('click','.invoiceMail', function () {
  465. var buttons1 = [
  466. {
  467. text: '是否邮寄',
  468. label: true,
  469. },
  470. {
  471. text: '是 ',
  472. bold: true,
  473. onClick: function() {
  474. $('#mail_box').show();
  475. $('#doPostName').val('是 ');
  476. $('#doPost').val(1);
  477. }
  478. },
  479. {
  480. text: '否',
  481. onClick: function() {
  482. $('#mail_box').hide();
  483. $('#doPostName').val('否 ');
  484. $('#doPost').val(0);
  485. }
  486. }
  487. ];
  488. var buttons2 = [
  489. {
  490. text: '取消',
  491. }
  492. ];
  493. var groups = [buttons1, buttons2];
  494. $.actions(groups);
  495. });
  496. });
  497. $(document).on('click','.invoiceExpress', function () {
  498. var buttons1 = [
  499. {
  500. text: '选择快递公司',
  501. label: true,
  502. },
  503. {
  504. text: 'EMS快递',
  505. bold: true,
  506. onClick: function() {
  507. $('#untreadCompanyName').val('EMS快递');
  508. $('#untreadCompany').val('EMS快递:ems');
  509. }
  510. },
  511. {
  512. text: '顺丰快递',
  513. onClick: function() {
  514. $('#untreadCompanyName').val('顺丰速运');
  515. $('#untreadCompany').val('顺丰速运:shunfeng');
  516. }
  517. }
  518. ];
  519. var buttons2 = [
  520. {
  521. text: '取消',
  522. }
  523. ];
  524. var groups = [buttons1, buttons2];
  525. $.actions(groups);
  526. });
  527. $(function(){
  528. var t = $('#myinput');
  529. t.css("color","#A9A9A9");
  530. t.val("请输入内容");
  531. var default_value = t.val();
  532. t.focus(function() {
  533. t.css("color","black");
  534. if (t.val() == default_value) {
  535. t.val('');
  536. }
  537. });
  538. t.blur(function() {
  539. t.css("color","black");
  540. if (t.val() == '') {
  541. t.val(default_value);
  542. t.css("color","#A9A9A9");
  543. }
  544. });
  545. });
  546. $(function(){
  547. var k = $('#myinput1');
  548. k.css("color","#A9A9A9");
  549. k.val("请输入内容");
  550. var default_value = k.val();
  551. k.focus(function() {
  552. k.css("color","black");
  553. if (k.val() == default_value) {
  554. k.val('');
  555. }
  556. });
  557. k.blur(function() {
  558. k.css("color","black");
  559. if (k.val() == '') {
  560. k.val(default_value);
  561. k.css("color","#A9A9A9");
  562. }
  563. });
  564. });
  565. $(function(){
  566. var p = $('#myinput2');
  567. p.css("color","#A9A9A9");
  568. p.val("请输入内容");
  569. var default_value = p.val();
  570. p.focus(function() {
  571. p.css("color","black");
  572. if (p.val() == default_value) {
  573. p.val('');
  574. }
  575. });
  576. p.blur(function() {
  577. p.css("color","black");
  578. if (p.val() == '') {
  579. p.val(default_value);
  580. p.css("color","#A9A9A9");
  581. }
  582. });
  583. $(document).on('click','.button-end', function () {
  584. $.confirm('终止审批', function () {
  585. $.alert('您终止审批');
  586. });
  587. });
  588. $(document).on('click','.button-return', function () {
  589. $.confirm('退回审批', function () {
  590. $.alert('您退回审批');
  591. });
  592. });
  593. $(document).on('click','.button-agree', function () {
  594. $.confirm('同意审批', function () {
  595. $.alert('您同意审批');
  596. });
  597. });
  598. });
  599. $(document).ready(function(){
  600. //加的效果
  601. $(".add").click(function(){
  602. var n=$(this).prev().val();
  603. var num=parseInt(n)+1;
  604. if(num==0){ return;}
  605. $(this).prev().val(num);
  606. });
  607. //减的效果
  608. $(".jian").click(function(){
  609. var n=$(this).next().val();
  610. var num=parseInt(n)-1;
  611. if(num==0){ return}
  612. $(this).next().val(num);
  613. });
  614. });