我要出差_查看.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // 在页面初始化加载之后
  2. mbos('page').bind('afterLoad', function () {
  3. _this.operateState = mbos.getRequestParams().operateState // 页面状态
  4. _this.path = mbos.pageInfo.path // 轻应用的路径编码
  5. _this.editPageCode = mbos.pageInfo.name.replace('View', 'Add') // 详情页面的编码 (个别页面可特殊处理直接写入)
  6. _this.title = localeResource.Travel_Request
  7. toggleEntry() // 折叠\展开实体分录
  8. toggleApprove() // 折叠\展开 审批流程
  9. _this.decimal = 4
  10. getDecimal()// 获取pc配置的小数点数
  11. })
  12. mbos('entity').bind('afterLoad', function () {
  13. initCommon(_this.title)// 初始化公共部分
  14. })
  15. mbos('editgrid1').bind('afterRendered', function (e) {
  16. activedEntry() // 保证蓝色的下标在对应分录上
  17. var index = e.index
  18. initPage() // 页面初始化时数据调整
  19. timeStyle(e) // 起止时间的样式优化展示
  20. // 是否展示弹性算时长字段
  21. ////202412 向上取整
  22. var olddays =(mbos('timeLengthValue', index).value()).toFixed(_this.decimal);
  23. var resultval = Math.ceil(olddays * 7);
  24. mbos('entries_isElasticCalLen', index).value() ? mbos('entries_isElasticCalLen', index).show(): mbos('entries_isElasticCalLen', index).hide()
  25. $('#timeLength_' + index).find('label')[0].innerHTML = resultval + "小时";
  26. $("[id^='entries_remark'] textarea").attr('rows', 3) // 多行文本 默认3行
  27. $("[id^='entries_tripReason'] textarea").attr('rows', 3) // 多行文本 默认3行
  28. })
  29. // 获取pc配置的小数点数 默认为小数点后四位
  30. function getDecimal(i){
  31. var callback = function(res){
  32. _this.decimal = res.data.decimalPlaceSystem || 4
  33. }
  34. baseInterface('getDecimalPlace', callback) // 获取小数点数
  35. }
  36. // 编辑
  37. _this.edit = function (event) {
  38. editHandle(_this.path, _this.editPageCode)
  39. }
  40. // 删除
  41. _this.delete = function (event) {
  42. deleteHandle()
  43. }
  44. // 撤回
  45. _this.recall = function (event) {
  46. // 未审批
  47. recallHandle()
  48. }
  49. // 提交
  50. _this.toSubmit = function (event) {
  51. submitHandle()
  52. }
  53. // 分录中 时间的样式优化展示
  54. function timeStyle(e) {
  55. // 开始时间
  56. var start = mbos('startTime', e.index).value().split(" ");
  57. $('#sTime_' + e.index).find('label')[0].innerHTML = start[1];
  58. $('#sDate_' + e.index).find('label')[0].innerHTML = start[0];
  59. // 结束时间
  60. var end = mbos('endTime', e.index).value().split(" ");
  61. $('#eTime_' + e.index).find('label')[0].innerHTML = end[1];
  62. $('#eDate_' + e.index).find('label')[0].innerHTML = end[0];
  63. // 时长及箭头图标
  64. $('#timeLength_' + e.index).find('label')[0].innerHTML = mbos('timeLengthValue', e.index).value() + localeResource.days;
  65. $('#timeLength_' + e.index).find('label').addClass("lengthBottom");
  66. $("#arrow_" + e.index).find('label').addClass("arrowIcon");
  67. }