api.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. export const TASK_TYPE = [
  31. // 弹窗任务类型
  32. { label: "客户", value: 0, show: true },
  33. { label: "商机", value: 1, show: true },
  34. { label: "销售订单", value: 2, show: true },
  35. { label: "线索", value: 3, show: false },
  36. ];
  37. export const TASK_TYPE_FIELD: {
  38. type: string;
  39. field: "customId" | "businessOpportunityId" | "orderId" | "clueId";
  40. valueIndex: string;
  41. labelIndex: string;
  42. }[] = [
  43. {
  44. type: "0",
  45. field: "customId",
  46. valueIndex: "id",
  47. labelIndex: "customName",
  48. },
  49. {
  50. type: "1",
  51. field: "businessOpportunityId",
  52. valueIndex: "id",
  53. labelIndex: "name",
  54. },
  55. {
  56. type: "2",
  57. field: "orderId",
  58. valueIndex: "id",
  59. labelIndex: "orderName",
  60. },
  61. {
  62. type: "3",
  63. field: "clueId",
  64. valueIndex: "id",
  65. labelIndex: "clueName",
  66. },
  67. ];
  68. export const REPEAT_TYPE = [
  69. { label: "每天", value: 0 },
  70. { label: "每周", value: 1 },
  71. { label: "每月", value: 2 },
  72. { label: "自定义周期", value: 3 },
  73. { label: "自定义日期", value: 4 },
  74. ];
  75. export const defaultGenerateFormData = {
  76. list: [],
  77. config: {},
  78. };
  79. export const propertyToTaskTypeMap = {
  80. customId: 0,
  81. businessOpportunityId: 1,
  82. orderId: 2,
  83. clueId: 3,
  84. };
  85. export const propertyToEndTypeMap = {};
  86. /**
  87. * 获取任务类型的函数
  88. *
  89. * @param obj 任意对象,期望该对象包含特定的属性以确定任务类型
  90. * @returns 返回匹配到的任务类型值,如果没有匹配则返回null
  91. */
  92. export function getTaskType(obj: any) {
  93. if (!obj) {
  94. return
  95. }
  96. if (obj.taskType) {
  97. return obj.taskType;
  98. }
  99. let taskType = null;
  100. for (const [property, taskTypeValue] of Object.entries(
  101. propertyToTaskTypeMap
  102. )) {
  103. if (obj.hasOwnProperty(property)) {
  104. taskType = taskTypeValue;
  105. break;
  106. }
  107. }
  108. return taskType;
  109. }
  110. export const CUSTOMER_FORM_URL = "/sys-form/getListByCode/tasks"; //自定义form表单
  111. export const ALL_CUSTOM = "/custom/getAll"; //客户
  112. export const ALL_CLUE = "/clue/getAll"; //线索
  113. export const ALL_BUSINESS = "/business-opportunity/getAll"; //商机
  114. export const ALL_CONTACTS = "/contacts/allContacts"; //联系人
  115. export const ALL_USERS = "/user/getSimpleActiveUserList"; //获取所有人
  116. export const ALL_ORDERS = "/order/list"//销售订单