account_permission.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. 'use strict';
  2. /**
  3. * 用户权限相关常量
  4. *
  5. * @author Ellisran
  6. * @date 2019/3/26
  7. * @version
  8. */
  9. const create_tender = {
  10. tzfj: 0,
  11. cjtzxd: 1,
  12. cjjlq: 2,
  13. cjgcbg: 3,
  14. };
  15. const create_tender_group = [];
  16. create_tender_group[create_tender.tzfj] = '台账分解';
  17. create_tender_group[create_tender.cjtzxd] = '创建台账修订';
  18. create_tender_group[create_tender.cjjlq] = '创建计量期';
  19. create_tender_group[create_tender.cjgcbg] = '创建工程变更';
  20. // 权限管理页
  21. const permission = {
  22. tender: {
  23. class: 'fa fa-list-ul',
  24. title: '标段管理',
  25. type: 'checkbox',
  26. children: [
  27. { title: '创建标段', value: 1 },
  28. { title: '查阅所有标段', value: 2 },
  29. { title: '维护签约清单', value: 3, hint: '开启该选项,台账审批通过后,可上传签约清单', hintIcon: 'fa-question-circle' },
  30. { title: '批量设置材差清单', value: 4, show: false, hint: '开启该选项,当前账号可设置允许调差的清单', hintIcon: 'fa-question-circle' },
  31. { title: '变更意向', value: 5, show: false, hint: '开启该选项,变更立项可新建变更意向书', hintIcon: 'fa-question-circle' },
  32. { title: '查看项目管理报表数据', value: 6, hint: '开启该选项,当前账号在报表下可查看项目管理数据', hintIcon: 'fa-question-circle' },
  33. ],
  34. tips: '勾选「创建标段」该用户默认具有「新建标段」及标段内「台账分解」「创建台账修订」「创建计量期」「创建工程变更」的权限。',
  35. },
  36. change: {
  37. class: 'fa fa-retweet',
  38. title: '工程变更',
  39. type: 'checkbox',
  40. children: [
  41. { title: '变更意向', value: 1, hint: '开启该选项,变更立项可新建变更意向书', hintIcon: 'fa-question-circle' },
  42. { title: '删除附件', value: 2, hint: '开启该选项,可删除审批通过前自己上传的附件', hintIcon: 'fa-question-circle' },
  43. ],
  44. },
  45. material: {
  46. class: 'fa fa-line-chart fa-fw',
  47. title: '材料调差',
  48. type: 'checkbox',
  49. children: [
  50. { title: '批量设置材差清单', value: 1, hint: '开启该选项,当前账号可设置允许调差的清单', hintIcon: 'fa-question-circle' },
  51. { title: '修改调差工料消耗量', value: 2, hint: '开启该选项,可在新材差期修改工料的消耗量', hintIcon: 'fa-question-circle' },
  52. // { title: '修改材料税税率', value: 3, hint: '开启该选项,可在新材差期修改材料税税率', hintIcon: 'fa-question-circle' },
  53. ],
  54. },
  55. construction: {
  56. class: 'fa fa-pencil-square-o',
  57. title: '施工日志',
  58. type: 'checkbox',
  59. children: [
  60. { title: '查阅所有施工标段', value: 1 },
  61. ],
  62. },
  63. // cooperation: {
  64. // class: '',
  65. // title: '协作办公',
  66. // type: 'radio',
  67. // children: [
  68. // { title: '启用', value: 1 },
  69. // { title: '关闭', value: 0 },
  70. // ],
  71. // tips: '启用「协作办公」,则该用户可以为他创建的标段添加其他用户进行协作办公。',
  72. // },
  73. project_msg: {
  74. class: '',
  75. title: '发布项目通知',
  76. type: 'radio',
  77. children: [
  78. { title: '启用', value: 1 },
  79. { title: '关闭', value: 0 },
  80. ],
  81. },
  82. };
  83. const PermissionCheck = {
  84. check: function (permission, key) {
  85. if (!permission) return false;
  86. switch (key) {
  87. case 'viewPmData': return permission && permission.tender ? permission.tender.indexOf('6') >= 0 : false;
  88. default: return false;
  89. }
  90. },
  91. viewPmData: function (permission) {
  92. return this.check(permission, 'viewPmData');
  93. },
  94. };
  95. // 用户重新发送权限默认值
  96. const noticeAgain = {
  97. checked: false,
  98. sp: {
  99. advance: { checked: false, name: '预付款' },
  100. ledger: { checked: false, name: '台账审批' },
  101. revise: { checked: false, name: '台账修订' },
  102. stage: { checked: false, name: '计量台账' },
  103. change: { checked: false, name: '工程变更' },
  104. material: { checked: false, name: '材料调差' },
  105. settle: { checked: false, name: '结算期' },
  106. },
  107. };
  108. module.exports = {
  109. tenderPermission: create_tender,
  110. tenderPermissionList: create_tender_group,
  111. permission,
  112. PermissionCheck,
  113. noticeAgain,
  114. };