aiManageWeb.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>流水分析</title>
  7. <style>
  8. html {
  9. min-height: 100vh;
  10. padding: 0;
  11. margin: 0;
  12. box-sizing: border-box;
  13. }
  14. body {
  15. min-height: 100vh;
  16. padding: 0;
  17. margin: 0;
  18. box-sizing: border-box;
  19. iframe {
  20. width: 100%;
  21. height: calc(100vh - 5px);
  22. }
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <iframe id="iframe" frameborder="0"></iframe>
  28. <script>
  29. window.addEventListener('message', receiveMessage, false);
  30. let flowFilePage = null;
  31. let flowReportPage = null;
  32. function receiveMessage({ data } = {}) {
  33. const { purpose, payload } = data;
  34. const { surveyId, file } = payload;
  35. if (purpose === 'file') {
  36. flowFilePage = new FlowFilePage(surveyId, file);
  37. flowFilePage.init();
  38. } else {
  39. flowReportPage = new FlowReportPage(surveyId, purpose);
  40. flowReportPage.init();
  41. }
  42. }
  43. // 流水页面类
  44. class FlowPage {
  45. // 页面路由地址
  46. // static origin = 'http://210.12.198.139:9090/ai-manage-web';
  47. static origin = `${location.origin}/ai-manage-web`;
  48. static channelNo = 'znjd';
  49. constructor(surveyId) {
  50. // 尽调任务id
  51. this.surveyId = surveyId;
  52. // 组织跳转地址路由
  53. this.generatePath = ({ type, file } = {}) => {
  54. let path = '';
  55. if (type === 'file') {
  56. path = file && file.fileId ? `${FlowPage.origin}/#/content/trandetail/reportGenerateJd/index?channelNo=${FlowPage.channelNo}&surveyId=${this.surveyId}&fileId=${file.fileId}` : '';
  57. } else if (type === 'generate') {
  58. path = `${FlowPage.origin}/#/content/trandetail/reportGenerateJd/index?to=making&channelNo=${FlowPage.channelNo}&surveyId=${this.surveyId}`;
  59. } else if (type === 'detail') {
  60. path = `${FlowPage.origin}/#/content/trandetail/reportGenerateJd/index?to=finished&channelNo=${FlowPage.channelNo}&surveyId=${this.surveyId}`;
  61. }
  62. return path;
  63. };
  64. }
  65. init() {
  66. this.iframe = document.getElementById('iframe');
  67. }
  68. }
  69. // 流水文件页面类
  70. class FlowFilePage extends FlowPage {
  71. constructor(surveyId, file) {
  72. super(surveyId);
  73. this.file = file;
  74. }
  75. init() {
  76. super.init();
  77. if (this.iframe) {
  78. // 设置跳转流水页面的具体路由地址
  79. this.iframe.src = this.generatePath({ type: 'file', file: this.file });
  80. }
  81. }
  82. }
  83. // 流水报告页面类
  84. class FlowReportPage extends FlowPage {
  85. constructor(surveyId, type) {
  86. super(surveyId);
  87. this.type = type;
  88. }
  89. init() {
  90. super.init();
  91. if (this.iframe) {
  92. // 设置跳转流水页面的具体路由地址
  93. this.iframe.src = this.generatePath({ type: this.type, file: this.file });
  94. console.log(this.iframe.src)
  95. }
  96. }
  97. }
  98. </script>
  99. </body>
  100. </html>