use-config.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. import { ref,computed } from 'vue'
  2. import { useRoute } from 'vue-router'
  3. //ETA试用列表 表格column 和mock数据
  4. //ETA试用列表
  5. export const etaTrialColumn = [
  6. {
  7. key:'UserName',
  8. label:'姓名'
  9. },
  10. {
  11. key:'CompanyName',
  12. label:'公司名称'
  13. },{
  14. key:'Position',
  15. label:'职位',
  16. minWidth:'50'
  17. },{
  18. key:'Seller',
  19. label:'申请人',
  20. minWidth:'50'
  21. },{
  22. key:'Expiration',
  23. label:'账号到期时长',
  24. minWidth:'80'
  25. },{
  26. key:'ModifyTime',
  27. label:'账号更新时间',
  28. minWidth:'120'
  29. },{
  30. key:'LastLoginTime',
  31. label:'最近一次登录时间',
  32. minWidth:'120'
  33. },{
  34. key:'LastLoginDuration',
  35. label:'最近一次登录时长',
  36. },{
  37. key:'LoginNum',
  38. label:'累计登录次数',
  39. },{
  40. key:'ActiveTime',
  41. label:'累计活跃时长',
  42. },{
  43. key:'IndexNum',
  44. label:'累计添加指标',
  45. minWidth:'80'
  46. },
  47. {
  48. key:'ChartNum',
  49. label:'累计添加图表',
  50. minWidth:'80'
  51. },
  52. {
  53. key:'InterestModule',
  54. label:'感兴趣模块',
  55. minWidth:'140'
  56. }
  57. ]
  58. //管理员-审批列表 非管理员-我的审批
  59. export const adminApprovalList=[
  60. {
  61. key:'UserName',
  62. label:'姓名'
  63. },
  64. {
  65. key:'CompanyName',
  66. label:'公司名称'
  67. },{
  68. key:'Position',
  69. label:'职位',
  70. minWidth:'50'
  71. },
  72. {
  73. key:'Mobile',
  74. label:'手机号码',
  75. },{
  76. key:'Seller',
  77. label:'申请人',
  78. minWidth:'50'
  79. },{
  80. key:'ModifyTime',
  81. label:'提交申请时间',
  82. minWidth:'120'
  83. },{
  84. key:'ApprovalContent',
  85. label:'待审内容',
  86. },{
  87. key:'ApprovalStatus',
  88. label:'当前状态',
  89. }
  90. ]
  91. //非管理员-账号列表
  92. export const approvedList=[
  93. {
  94. key:'UserName',
  95. label:'姓名'
  96. },
  97. {
  98. key:'CompanyName',
  99. label:'公司名称'
  100. },{
  101. key:'Position',
  102. label:'职位',
  103. minWidth:'50'
  104. },
  105. {
  106. key:'Mobile',
  107. label:'手机号码',
  108. },{
  109. key:'Account',
  110. label:'账号',
  111. minWidth:'50'
  112. },{
  113. key:'Password',
  114. label:'密码',
  115. minWidth:'50'
  116. },{
  117. key:'Enabled',
  118. label:'用户状态',
  119. },{
  120. key:'Expiration',
  121. label:'账号到期时长',
  122. minWidth:'80'
  123. },{
  124. key:'ModifyTime',
  125. label:'更新时间',
  126. minWidth:'80'
  127. }
  128. ]
  129. //申请启用审批/申请账号审批
  130. export const applyApprovalList=[
  131. {
  132. key:'UserName',
  133. label:'姓名'
  134. },{
  135. key:'CompanyName',
  136. label:'公司名称'
  137. },{
  138. key:'Position',
  139. label:'职位'
  140. },{
  141. key:'Mobile',
  142. label:'手机号'
  143. },{
  144. key:'Seller',
  145. label:'申请人'
  146. }]
  147. //审批列表-当前状态
  148. /* export const ApprovalStatus = {
  149. 0:'未审批',
  150. 1:'已审批',
  151. 2:'已撤回',
  152. 3:'已驳回'
  153. } */
  154. export const ApprovalStatus={
  155. '待审批':0,
  156. '已审批':1,
  157. '已撤回':2,
  158. '驳回':3
  159. }
  160. //启用,账号重复提示弹窗
  161. export const textMap = {
  162. 0:'该用户账号已禁用,是否申请启用',
  163. 1:'该用户信息已提交申请 ,请勿重复提交'
  164. }
  165. export function useConfig() {
  166. const route = useRoute()
  167. const columnList = ref([])
  168. const canEdit = ref(false)
  169. const listType = sessionStorage.getItem('etaApprovalListType')||'all';
  170. const Role = computed(() => {
  171. return localStorage.getItem("Role");
  172. })
  173. let interenceName = ''
  174. if(route.path === '/etaTrialList') {
  175. columnList.value = etaTrialColumn
  176. canEdit.value = false
  177. interenceName = 'getETATrialList'
  178. }else if(route.path === '/etaApprovalList') {
  179. canEdit.value = true
  180. //管理员-审批列表
  181. if(Role.value.includes('admin')){
  182. columnList.value = adminApprovalList
  183. interenceName='getAdminApprovalList'
  184. }
  185. //非管理员-我的审批
  186. if(!Role.value.includes('admin')&&listType==='all'){
  187. columnList.value = adminApprovalList
  188. interenceName='getApprovalAllList'
  189. }
  190. //非管理员-账号列表
  191. if(!Role.value.includes('admin')&&listType!=='all'){
  192. columnList.value = approvedList
  193. interenceName='getApprovalList'
  194. }
  195. }
  196. return {
  197. columnList,
  198. canEdit,
  199. listType,
  200. interenceName,
  201. ApprovalStatus
  202. }
  203. }