account_permission.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. { title: '删除附件', value: 7, hint: '开启该选项,可删除审批通过前自己上传的附件', hintIcon: 'fa-question-circle' },
  34. ],
  35. tips: '勾选「创建标段」该用户默认具有「新建标段」及标段内「台账分解」「创建台账修订」「创建计量期」「创建工程变更」的权限。',
  36. },
  37. change: {
  38. class: 'fa fa-retweet',
  39. title: '工程变更',
  40. type: 'checkbox',
  41. children: [
  42. { title: '创建变更令', value: 3, hint: '开启该选项,非本人创建的标段也可创建变更令', hintIcon: 'fa-question-circle' },
  43. { title: '变更意向', value: 1, hint: '开启该选项,变更立项可新建变更意向书', hintIcon: 'fa-question-circle' },
  44. { title: '删除附件', value: 2, hint: '开启该选项,可删除审批通过前自己上传的附件', hintIcon: 'fa-question-circle' },
  45. ],
  46. },
  47. material: {
  48. class: 'fa fa-line-chart fa-fw',
  49. title: '材料调差',
  50. type: 'checkbox',
  51. children: [
  52. { title: '批量设置材差清单', value: 1, hint: '开启该选项,当前账号可设置允许调差的清单', hintIcon: 'fa-question-circle' },
  53. { title: '修改调差工料消耗量', value: 2, hint: '开启该选项,可在新材差期修改工料的消耗量', hintIcon: 'fa-question-circle' },
  54. // { title: '修改材料税税率', value: 3, hint: '开启该选项,可在新材差期修改材料税税率', hintIcon: 'fa-question-circle' },
  55. ],
  56. },
  57. other: {
  58. class: 'fa fa-pencil-square-o',
  59. title: '其他权限',
  60. type: 'checkbox',
  61. children: [
  62. { title: '授权单位章', value: 1, text_modal: '选择章', modal: 'sign_permission' },
  63. ],
  64. },
  65. construction: {
  66. class: 'fa fa-pencil-square-o',
  67. title: '施工日志',
  68. type: 'checkbox',
  69. children: [
  70. { title: '查阅所有施工标段', value: 1 },
  71. ],
  72. },
  73. // cooperation: {
  74. // class: '',
  75. // title: '协作办公',
  76. // type: 'radio',
  77. // children: [
  78. // { title: '启用', value: 1 },
  79. // { title: '关闭', value: 0 },
  80. // ],
  81. // tips: '启用「协作办公」,则该用户可以为他创建的标段添加其他用户进行协作办公。',
  82. // },
  83. project_msg: {
  84. class: '',
  85. title: '发布项目通知',
  86. type: 'radio',
  87. children: [
  88. { title: '启用', value: 1 },
  89. { title: '关闭', value: 0 },
  90. ],
  91. },
  92. };
  93. const PermissionCheck = {
  94. check: function (permission, key) {
  95. if (!permission) return false;
  96. switch (key) {
  97. case 'viewPmData': return permission && permission.tender ? permission.tender.indexOf('6') >= 0 : false;
  98. case 'delFile': return permission && permission.tender ? permission.tender.indexOf('7') >= 0 : false;
  99. default: return false;
  100. }
  101. },
  102. viewPmData: function (permission) {
  103. return this.check(permission, 'viewPmData');
  104. },
  105. delFile: function(permission) {
  106. return this.check(permission, 'delFile');
  107. }
  108. };
  109. // 用户重新发送权限默认值
  110. const noticeAgain = {
  111. checked: false,
  112. sp: {
  113. advance: { checked: false, name: '预付款' },
  114. ledger: { checked: false, name: '台账审批' },
  115. revise: { checked: false, name: '台账修订' },
  116. stage: { checked: false, name: '计量台账' },
  117. change: { checked: false, name: '工程变更' },
  118. material: { checked: false, name: '材料调差' },
  119. settle: { checked: false, name: '结算期' },
  120. },
  121. };
  122. module.exports = {
  123. tenderPermission: create_tender,
  124. tenderPermissionList: create_tender_group,
  125. permission,
  126. PermissionCheck,
  127. noticeAgain,
  128. };