我要出差_查看_备份 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. mbos('entries_isElasticCalLen', index).value() ? mbos('entries_isElasticCalLen', index).show(): mbos('entries_isElasticCalLen', index).hide()
  22. $('#timeLength_' + index).find('label')[0].innerHTML = (mbos('timeLengthValue', index).value()).toFixed(_this.decimal) + localeResource.days;
  23. $("[id^='entries_remark'] textarea").attr('rows', 3) // 多行文本 默认3行
  24. $("[id^='entries_tripReason'] textarea").attr('rows', 3) // 多行文本 默认3行
  25. })
  26. // 获取pc配置的小数点数 默认为小数点后四位
  27. function getDecimal(i){
  28. var callback = function(res){
  29. _this.decimal = res.data.decimalPlaceSystem || 4
  30. }
  31. baseInterface('getDecimalPlace', callback) // 获取小数点数
  32. }
  33. // 编辑
  34. _this.edit = function (event) {
  35. editHandle(_this.path, _this.editPageCode)
  36. }
  37. // 删除
  38. _this.delete = function (event) {
  39. deleteHandle()
  40. }
  41. // 撤回
  42. _this.recall = function (event) {
  43. // 未审批
  44. recallHandle()
  45. }
  46. // 提交
  47. _this.toSubmit = function (event) {
  48. submitHandle()
  49. }
  50. // 分录中 时间的样式优化展示
  51. function timeStyle(e) {
  52. // 开始时间
  53. var start = mbos('startTime', e.index).value().split(" ");
  54. $('#sTime_' + e.index).find('label')[0].innerHTML = start[1];
  55. $('#sDate_' + e.index).find('label')[0].innerHTML = start[0];
  56. // 结束时间
  57. var end = mbos('endTime', e.index).value().split(" ");
  58. $('#eTime_' + e.index).find('label')[0].innerHTML = end[1];
  59. $('#eDate_' + e.index).find('label')[0].innerHTML = end[0];
  60. // 时长及箭头图标
  61. $('#timeLength_' + e.index).find('label')[0].innerHTML = mbos('timeLengthValue', e.index).value() + localeResource.days;
  62. $('#timeLength_' + e.index).find('label').addClass("lengthBottom");
  63. $("#arrow_" + e.index).find('label').addClass("arrowIcon");
  64. }