api.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. export const defalutModalForm = {
  2. taskName: "", //任务名称
  3. priority: "", //优先级
  4. taskType: 0, // 任务类型
  5. customId: null, // 客户id 0
  6. businessOpportunityId: null, //商机id 1
  7. orderId: null, // 订单id 2
  8. clueId: null, //线索id 3
  9. contactsId: null, //联系人id
  10. executorId: null, //执行人id
  11. isRepeat: 0, //是否重复
  12. repeatType: 0, //重复类型
  13. endType: 1, //结束类型
  14. repeatEndNever: 1,
  15. repeatEndCount: null, //重复指定次数次数后结束
  16. repeatEndDate: null, //重复到指定日期后结束
  17. repeatDesignDay: null, //自定义日期
  18. repeatDesignSameday: null, //自定义周期
  19. startDate: "", //开始日期
  20. endDate: "", //截止日期
  21. taskDesc: "", //任务描述
  22. taskLogs: [],
  23. };
  24. export const PRIORITY = [
  25. //优先级
  26. { label: "高", value: 2 },
  27. { label: "中", value: 1 },
  28. { label: "低", value: 0 },
  29. ];
  30. const isExistBusiness = sessionStorage.getItem("isExistBusiness");
  31. const businessLabel = isExistBusiness === "1" ? "商机" : "项目";
  32. export const TASK_TYPE = [
  33. // 弹窗任务类型
  34. { label: "客户", value: 0, show: true },
  35. { label: businessLabel, value: 1, show: true },
  36. { label: "销售订单", value: 2, show: true },
  37. { label: "线索", value: 3, show: false },
  38. ];
  39. export const TASK_TYPE_FIELD: {
  40. type: string;
  41. field: "customId" | "businessOpportunityId" | "orderId" | "clueId";
  42. valueIndex: string;
  43. labelIndex: string;
  44. }[] = [
  45. {
  46. type: "0",
  47. field: "customId",
  48. valueIndex: "id",
  49. labelIndex: "customName",
  50. },
  51. {
  52. type: "1",
  53. field: "businessOpportunityId",
  54. valueIndex: "id",
  55. labelIndex: "name",
  56. },
  57. {
  58. type: "2",
  59. field: "orderId",
  60. valueIndex: "id",
  61. labelIndex: "orderName",
  62. },
  63. {
  64. type: "3",
  65. field: "clueId",
  66. valueIndex: "id",
  67. labelIndex: "clueName",
  68. },
  69. ];
  70. export const REPEAT_TYPE = [
  71. { label: "每天", value: 0 },
  72. { label: "每周", value: 1 },
  73. { label: "每月", value: 2 },
  74. { label: "自定义周期", value: 3 },
  75. { label: "自定义日期", value: 4 },
  76. ];
  77. export const defaultGenerateFormData = {
  78. list: [],
  79. config: {},
  80. };
  81. export const propertyToTaskTypeMap = {
  82. customId: 0,
  83. businessOpportunityId: 1,
  84. orderId: 2,
  85. clueId: 3,
  86. };
  87. export const propertyToEndTypeMap = {};
  88. /**
  89. * 获取任务类型的函数
  90. *
  91. * @param obj 任意对象,期望该对象包含特定的属性以确定任务类型
  92. * @returns 返回匹配到的任务类型值,如果没有匹配则返回null
  93. */
  94. export function getTaskType(obj: any) {
  95. if (!obj) {
  96. return
  97. }
  98. if (obj.taskType) {
  99. return obj.taskType;
  100. }
  101. let taskType = null;
  102. for (const [property, taskTypeValue] of Object.entries(
  103. propertyToTaskTypeMap
  104. )) {
  105. if (obj.hasOwnProperty(property)) {
  106. taskType = taskTypeValue;
  107. break;
  108. }
  109. }
  110. return taskType;
  111. }
  112. export const CUSTOMER_FORM_URL = "/sys-form/getListByCode/tasks"; //自定义form表单
  113. export const ALL_CUSTOM = "/custom/getAll"; //客户
  114. export const ALL_CLUE = "/clue/getAll"; //线索
  115. export const ALL_BUSINESS = "/business-opportunity/getAll"; //商机
  116. export const ALL_CONTACTS = "/contacts/allContacts"; //联系人
  117. export const ALL_USERS = "/user/getSimpleActiveUserList"; //获取所有人
  118. export const ALL_ORDERS = "/order/list"//销售订单