| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>流水分析</title>
- <style>
- html {
- min-height: 100vh;
- padding: 0;
- margin: 0;
- box-sizing: border-box;
- }
- body {
- min-height: 100vh;
- padding: 0;
- margin: 0;
- box-sizing: border-box;
- iframe {
- width: 100%;
- height: calc(100vh - 5px);
- }
- }
- </style>
- </head>
- <body>
- <iframe id="iframe" frameborder="0"></iframe>
- <script>
-
- window.addEventListener('message', receiveMessage, false);
-
- let flowFilePage = null;
- let flowReportPage = null;
- function receiveMessage({ data } = {}) {
- const { purpose, payload } = data;
- const { surveyId, file } = payload;
- if (purpose === 'file') {
- flowFilePage = new FlowFilePage(surveyId, file);
- flowFilePage.init();
- } else {
- flowReportPage = new FlowReportPage(surveyId, purpose);
- flowReportPage.init();
- }
- }
- // 流水页面类
- class FlowPage {
- // 页面路由地址
- // static origin = 'http://210.12.198.139:9090/ai-manage-web';
- static origin = `${location.origin}/ai-manage-web`;
- static channelNo = 'znjd';
- constructor(surveyId) {
- // 尽调任务id
- this.surveyId = surveyId;
- // 组织跳转地址路由
- this.generatePath = ({ type, file } = {}) => {
- let path = '';
- if (type === 'file') {
- path = file && file.fileId ? `${FlowPage.origin}/#/content/trandetail/reportGenerateJd/index?channelNo=${FlowPage.channelNo}&surveyId=${this.surveyId}&fileId=${file.fileId}` : '';
- } else if (type === 'generate') {
- path = `${FlowPage.origin}/#/content/trandetail/reportGenerateJd/index?to=making&channelNo=${FlowPage.channelNo}&surveyId=${this.surveyId}`;
- } else if (type === 'detail') {
- path = `${FlowPage.origin}/#/content/trandetail/reportGenerateJd/index?to=finished&channelNo=${FlowPage.channelNo}&surveyId=${this.surveyId}`;
- }
- return path;
- };
- }
- init() {
- this.iframe = document.getElementById('iframe');
- }
- }
- // 流水文件页面类
- class FlowFilePage extends FlowPage {
- constructor(surveyId, file) {
- super(surveyId);
- this.file = file;
- }
- init() {
- super.init();
- if (this.iframe) {
- // 设置跳转流水页面的具体路由地址
- this.iframe.src = this.generatePath({ type: 'file', file: this.file });
- }
- }
- }
- // 流水报告页面类
- class FlowReportPage extends FlowPage {
- constructor(surveyId, type) {
- super(surveyId);
- this.type = type;
- }
- init() {
- super.init();
- if (this.iframe) {
- // 设置跳转流水页面的具体路由地址
- this.iframe.src = this.generatePath({ type: this.type, file: this.file });
- console.log(this.iframe.src)
- }
- }
- }
- </script>
- </body>
- </html>
|