account_permission.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. // { title: '修改调差数量', value: 4, hint: '开启该选项,可在调差清单页修改本期调差数量', hintIcon: 'fa-question-circle' },
  56. ],
  57. },
  58. other: {
  59. class: 'fa fa-pencil-square-o',
  60. title: '其他权限',
  61. type: 'checkbox',
  62. children: [
  63. { title: '授权单位章', value: 1, text_modal: '选择章', modal: 'sign_permission' },
  64. ],
  65. },
  66. construction: {
  67. class: 'fa fa-pencil-square-o',
  68. title: '施工日志',
  69. type: 'checkbox',
  70. children: [
  71. { title: '查阅所有施工标段', value: 1 },
  72. ],
  73. },
  74. // cooperation: {
  75. // class: '',
  76. // title: '协作办公',
  77. // type: 'radio',
  78. // children: [
  79. // { title: '启用', value: 1 },
  80. // { title: '关闭', value: 0 },
  81. // ],
  82. // tips: '启用「协作办公」,则该用户可以为他创建的标段添加其他用户进行协作办公。',
  83. // },
  84. project_msg: {
  85. class: '',
  86. title: '发布项目通知',
  87. type: 'radio',
  88. children: [
  89. { title: '启用', value: 1 },
  90. { title: '关闭', value: 0 },
  91. ],
  92. },
  93. };
  94. const PermissionCheck = {
  95. check: function (permission, key) {
  96. if (!permission) return false;
  97. switch (key) {
  98. case 'viewPmData': return permission && permission.tender ? permission.tender.indexOf('6') >= 0 : false;
  99. case 'delFile': return permission && permission.tender ? permission.tender.indexOf('7') >= 0 : false;
  100. default: return false;
  101. }
  102. },
  103. viewPmData: function (permission) {
  104. return this.check(permission, 'viewPmData');
  105. },
  106. delFile: function(permission) {
  107. return this.check(permission, 'delFile');
  108. }
  109. };
  110. // 用户重新发送权限默认值
  111. const noticeAgain = {
  112. checked: false,
  113. sp: {
  114. advance: { checked: false, name: '预付款' },
  115. ledger: { checked: false, name: '台账审批' },
  116. revise: { checked: false, name: '台账修订' },
  117. stage: { checked: false, name: '计量台账' },
  118. change: { checked: false, name: '工程变更' },
  119. material: { checked: false, name: '材料调差' },
  120. settle: { checked: false, name: '结算期' },
  121. },
  122. };
  123. module.exports = {
  124. tenderPermission: create_tender,
  125. tenderPermissionList: create_tender_group,
  126. permission,
  127. PermissionCheck,
  128. noticeAgain,
  129. };