common.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // 研究员
  2. export const RESEARCHLIST = ['ficc_researcher', 'researcher', 'rai_researcher','ficc_admin',];
  3. // 销售/组长
  4. const SELLERLIST = ['ficc_seller', 'ficc_group', 'ficc_team'];
  5. // 权益销售/组长
  6. const SELLERLIST_RAI = [ 'rai_seller', 'rai_group', 'rai_admin'];
  7. // admin
  8. const ADMINLIST = ['admin'];
  9. /* 获取默认选中活动类型和 活动类型数组 默认时间 fromType: 1 点击日历表格添加 2点击添加活动按钮 */
  10. export const getDefaultOption = (role,fromType) => {
  11. const defaultStartTime = () => {
  12. let date = new Date();
  13. date = new Date(date.toLocaleDateString() + " 15:30");
  14. return new Date(date.setDate(date.getDate() + 1)).getTime();
  15. }
  16. // 默认结束时间为当前第二天的16.00
  17. const defaultEndTime = () => {
  18. let date = new Date();
  19. date = new Date(date.toLocaleDateString() + " 16:00");
  20. return new Date(date.setDate(date.getDate() + 1)).getTime();
  21. }
  22. let type = SELLERLIST_RAI.includes(role) ? 5 : RESEARCHLIST.includes(role) ? 1 : SELLERLIST.includes(role) ? 2 : 3;
  23. let res;
  24. switch(type) {
  25. case 1:
  26. res = {
  27. defaultActivityType: '内部会议',
  28. activityTypeList:['内部会议'],
  29. startTime: defaultStartTime(),
  30. endTime: defaultEndTime()
  31. }
  32. break;
  33. case 2:
  34. res = {
  35. defaultActivityType: fromType === 1 ? '路演' : '内部会议',
  36. activityTypeList:['路演','内部会议','公开会议'],
  37. startTime: defaultStartTime(),
  38. endTime: defaultEndTime()
  39. }
  40. break;
  41. case 3:
  42. res = {
  43. defaultActivityType: '报告电话会',
  44. activityTypeList:['报告电话会','内部会议'],
  45. startTime: defaultStartTime(),
  46. endTime: defaultEndTime()
  47. }
  48. break;
  49. case 5:
  50. res = {
  51. defaultActivityType: fromType === 1 ? '路演' : '内部会议',
  52. activityTypeList:['路演','沙龙'],
  53. startTime: defaultStartTime(),
  54. endTime: defaultEndTime()
  55. }
  56. break;
  57. }
  58. return res;
  59. }