script.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { UN_REQ_NUM } from "@/constant/sys";
  2. import {
  3. getCaseScriptSaveOrUpdateUrl,
  4. getCaseScriptInfoUrl,
  5. getVideoCover,
  6. axios,
  7. } from "@/request";
  8. export enum FireStatus {
  9. all = UN_REQ_NUM,
  10. incomplete = 0,
  11. complete = 1,
  12. }
  13. export type Fire = {
  14. accidentDate: string;
  15. createTime: string;
  16. creatorDeptId: string;
  17. caseId: number;
  18. mapShow: boolean;
  19. creatorId: string;
  20. creatorName: string;
  21. deptId: string;
  22. editTime: string;
  23. editorId: string;
  24. editorName: string;
  25. fireReason: string;
  26. id: string;
  27. isTeached: number;
  28. organizerDeptName: string;
  29. organizerUsers: string;
  30. projectAddress: string;
  31. latAndLong: string;
  32. latlng: string;
  33. projectName: string;
  34. projectSite: string;
  35. projectSiteCode: string;
  36. projectSn: string;
  37. status: FireStatus;
  38. statusDesc: string;
  39. updateTime: string;
  40. isDelete?: number;
  41. field1: string;
  42. field2: string;
  43. field3: string;
  44. field4: string;
  45. field5: string;
  46. field6: string;
  47. field7: string;
  48. field8: string;
  49. field9: string;
  50. field10: string;
  51. };
  52. export enum FirePaggingRoute {
  53. fire = 1,
  54. teached = 2,
  55. }
  56. export const getCaseScriptInfo = async (caseId) => {
  57. let res = await axios.get(getCaseScriptInfoUrl, { params: { caseId, ingoreRes: true } });
  58. console.log(res);
  59. if (res && res.code === 0) {
  60. return res.data;
  61. } else {
  62. // window.location.href = '/'
  63. throw "用户未登录";
  64. }
  65. }
  66. export const CaseScriptSaveOrUpdate = async (fire: Omit<Fire, "id">) =>
  67. axios.post(getCaseScriptSaveOrUpdateUrl, fire, { params: { ingoreRes: true } });
  68. export const CaseScriptGetCover = async (url: string, width = 200, height = 200) =>
  69. (await axios.get(getVideoCover, { params: { videoPath: url, width, height } })).data;