| | |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | clueList: [ |
| | | { |
| | | _factorNames: 'PM2.5', |
| | | _time: '10:22:28 - 10:22:34', |
| | | _riskRegion: 'é¿å®åºæ¸
溪路å¯ä¹ä¸è·¯', |
| | | _exceptionType: 'å¿«éä¸å', |
| | | _chart: '', |
| | | _conclusion: |
| | | 'å¨10:22:28è³10:22:34ä¹é´ï¼åºç°å¿«éä¸åï¼VOCæä½å¼ä¸º135.95μg/mÂ³ï¼æé«å¼ä¸º135.95μg/m³ï¼åå¼ä¸º135.95μg/m³ï¼åç°3个é£é©æºï¼å
å«2ä¸ªå æ²¹ç«ï¼1个汽修ã', |
| | | _scenes: |
| | | '1.䏿µ·ä¾å¾·æ±½è½¦ç»´ä¿®æéå
¬å¸ï¼æ±½ä¿®ä¼ä¸ï¼ä½äºä¸æµ·å¸é¿å®åºåè¹è·¯1079å·ï¼è·ä»éç«1887ç±³ã\r\nâ¦â¦' |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | |
| | | } |
| | | |
| | | function generateClueByRiskArea(param) { |
| | | const indexArr = [ |
| | | 'A', |
| | | 'B', |
| | | 'C', |
| | | 'D', |
| | | 'E', |
| | | 'F', |
| | | 'G', |
| | | 'H', |
| | | 'I', |
| | | 'J', |
| | | 'K', |
| | | 'L', |
| | | 'M', |
| | | 'N', |
| | | 'O', |
| | | 'P', |
| | | 'Q', |
| | | 'R', |
| | | 'S', |
| | | 'T', |
| | | 'U', |
| | | 'V', |
| | | 'W', |
| | | 'X', |
| | | 'Y', |
| | | 'Z' |
| | | ]; |
| | | const _param = { |
| | | area: param.area, |
| | | startTime: param.startTime, |
| | |
| | | .groupBy((e) => e.township) |
| | | .map((item, index) => { |
| | | const { key: township, values: clues } = item; |
| | | let typeCount = {}; |
| | | let lastSceneType; |
| | | let sceneIndex = 0; |
| | | |
| | | const _scenes = clues.flatMap((e) => |
| | | e.clue.pollutedSource.sceneList.map((s, index) => { |
| | | const i = lastSceneType == s.type ? ++sceneIndex : 0; |
| | | typeCount[s.type] = typeCount[s.type] ? typeCount[s.type] + 1 : 1; |
| | | lastSceneType = s.type; |
| | | return { |
| | | des: `${s.type}${i + 1}ï¼${s.name}ï¼ä½äº${s.location}ï¼è·${s.closestStation.name}${parseInt(s.length)}ç±³ï¼` |
| | | }; |
| | | }) |
| | | ); |
| | | let _sceneDes = `èµ°èªè¿ç¨ä¸æº¯æºå°${_scenes.length}个é£é©æº`; |
| | | if (_scenes.length > 0) { |
| | | _sceneDes += 'ï¼å
¶ç±»åæ¯'; |
| | | _sceneDes += Object.keys(typeCount) |
| | | .map((e) => `${e}ï¼${typeCount[e]}个ï¼`) |
| | | .join('ã'); |
| | | _sceneDes += 'ï¼'; |
| | | } else { |
| | | _sceneDes = 'èµ°èªè¿ç¨ä¸æªæº¯æºå°é£é©æºã'; |
| | | } |
| | | return { |
| | | _index: index + 1, |
| | | // _area: `${item.sceneInfo.type}${item.sceneInfo.name}å¨è¾¹`, |
| | | _area: `${township}`, |
| | | clueByFactorList: clues |
| | | .groupBy((e) => e.factorTag) |
| | | .map((item2, index2) => { |
| | | const { key: factorTag, values: clues2 } = item2; |
| | | const factorNames = [...new Set(clues2.flatMap((e) => e.factors))] |
| | | _sceneDes, |
| | | _scenes, |
| | | clueList: clues.map((item3, index3) => { |
| | | const clue = item3.clue; |
| | | let _riskRegion = ''; |
| | | if ( |
| | | clue.pollutedArea.address.indexOf( |
| | | clue.pollutedArea.streetNumber |
| | | ) == -1 |
| | | ) { |
| | | // _riskRegion += |
| | | // (clue.pollutedArea.address ?? '') + |
| | | // 'ï¼' + |
| | | // (clue.pollutedArea.street ?? '') + |
| | | // (clue.pollutedArea.streetNumber ?? '') + |
| | | // (clue.pollutedArea.direction ?? '') + |
| | | // 'ï¼'; |
| | | _riskRegion = clue.pollutedArea.address; |
| | | } else { |
| | | _riskRegion = clue.pollutedArea.address; |
| | | } |
| | | return { |
| | | index: indexArr[index3], |
| | | showPollutedArea: formObj.value.showPollutedArea, |
| | | _title: _riskRegion, |
| | | _factorNames: Object.keys(clue.pollutedData.statisticMap) |
| | | .map((e) => factorName[e]) |
| | | .join('ã'); |
| | | return { |
| | | index: index2 + 1, |
| | | factor: factorNames, |
| | | clues: clues2.map((item3, index3) => { |
| | | const clue = item3.clue; |
| | | let _riskRegion = ''; |
| | | if ( |
| | | clue.pollutedArea.address.indexOf( |
| | | clue.pollutedArea.streetNumber |
| | | ) == -1 |
| | | ) { |
| | | _riskRegion += |
| | | (clue.pollutedArea.address ?? '') + |
| | | 'ï¼' + |
| | | (clue.pollutedArea.street ?? '') + |
| | | (clue.pollutedArea.streetNumber ?? '') + |
| | | (clue.pollutedArea.direction ?? '') + |
| | | 'ï¼'; |
| | | } else { |
| | | _riskRegion = clue.pollutedArea.address; |
| | | } |
| | | return { |
| | | index: index3 + 1 + '', |
| | | showPollutedArea: formObj.value.showPollutedArea, |
| | | _title: |
| | | (clue.pollutedArea.street ?? '') + |
| | | (clue.pollutedArea.streetNumber ?? '') + |
| | | (clue.pollutedArea.direction ?? ''), |
| | | _factorNames: Object.keys(clue.pollutedData.statisticMap) |
| | | .map((e) => factorName[e]) |
| | | .join('ã'), |
| | | _time: |
| | | moment(clue.pollutedData.startTime).format( |
| | | 'YYYY-MM-DD HH:mm:ss' |
| | | ) + |
| | | ' - ' + |
| | | moment(clue.pollutedData.endTime).format('HH:mm:ss'), |
| | | _riskRegion: _riskRegion, |
| | | _exceptionType: clue.pollutedData.exception, |
| | | _images: generateChartImg(clue.pollutedData), |
| | | _conclusion: clue.pollutedSource.conclusion, |
| | | _hasScene: clue.pollutedSource.sceneList.length > 0, |
| | | // _scenes: |
| | | // clue.pollutedSource.sceneList.length > 0 |
| | | // ? clue.pollutedSource.sceneList |
| | | // .map( |
| | | // (s, index) => |
| | | // `${index + 1}. ${s.name}ï¼${s.type}ï¼ä½äº${s.location}ï¼è·${s.closestStation.name}${parseInt(s.length)}ç±³ï¼` |
| | | // ) |
| | | // .join('\r\n') |
| | | // : 'æ ', |
| | | _scenes: clue.pollutedSource.sceneList.map((s, index) => { |
| | | return { |
| | | des: `${index + 1}. ${s.name}ï¼${s.type}ï¼ä½äº${s.location}ï¼è·${s.closestStation.name}${parseInt(s.length)}ç±³ï¼` |
| | | }; |
| | | }) |
| | | }; |
| | | }) |
| | | }; |
| | | }) |
| | | .join('ã'), |
| | | _date: moment(clue.pollutedData.startTime).format('YYYY-MM-DD'), |
| | | _time: |
| | | moment(clue.pollutedData.startTime).format('HH:mm:ss') + |
| | | ' - ' + |
| | | moment(clue.pollutedData.endTime).format('HH:mm:ss'), |
| | | _riskRegion: _riskRegion, |
| | | _exceptionType: clue.pollutedData.exception, |
| | | _images: generateChartImg(clue.pollutedData), |
| | | _conclusion: clue.pollutedSource.conclusion.replace( |
| | | /ï¼åç°[0-9]*个é£é©æºï¼å
å«[0-9]*个.*ã/, |
| | | 'ã' |
| | | ), |
| | | _hasScene: clue.pollutedSource.sceneList.length > 0 |
| | | }; |
| | | }) |
| | | // clueByFactorList: clues |
| | | // .groupBy((e) => e.factorTag) |
| | | // .map((item2, index2) => { |
| | | // const { key: factorTag, values: clues2 } = item2; |
| | | // const factorNames = [...new Set(clues2.flatMap((e) => e.factors))] |
| | | // .map((e) => factorName[e]) |
| | | // .join('ã'); |
| | | // return { |
| | | // index: index2 + 1, |
| | | // factor: factorNames, |
| | | // clues: clues2.map((item3, index3) => { |
| | | // const clue = item3.clue; |
| | | // let _riskRegion = ''; |
| | | // if ( |
| | | // clue.pollutedArea.address.indexOf( |
| | | // clue.pollutedArea.streetNumber |
| | | // ) == -1 |
| | | // ) { |
| | | // _riskRegion += |
| | | // (clue.pollutedArea.address ?? '') + |
| | | // 'ï¼' + |
| | | // (clue.pollutedArea.street ?? '') + |
| | | // (clue.pollutedArea.streetNumber ?? '') + |
| | | // (clue.pollutedArea.direction ?? '') + |
| | | // 'ï¼'; |
| | | // } else { |
| | | // _riskRegion = clue.pollutedArea.address; |
| | | // } |
| | | // return { |
| | | // index: index3 + 1 + '', |
| | | // showPollutedArea: formObj.value.showPollutedArea, |
| | | // _title: |
| | | // (clue.pollutedArea.street ?? '') + |
| | | // (clue.pollutedArea.streetNumber ?? '') + |
| | | // (clue.pollutedArea.direction ?? ''), |
| | | // _factorNames: Object.keys(clue.pollutedData.statisticMap) |
| | | // .map((e) => factorName[e]) |
| | | // .join('ã'), |
| | | // _time: |
| | | // moment(clue.pollutedData.startTime).format( |
| | | // 'YYYY-MM-DD HH:mm:ss' |
| | | // ) + |
| | | // ' - ' + |
| | | // moment(clue.pollutedData.endTime).format('HH:mm:ss'), |
| | | // _riskRegion: _riskRegion, |
| | | // _exceptionType: clue.pollutedData.exception, |
| | | // _images: generateChartImg(clue.pollutedData), |
| | | // _conclusion: clue.pollutedSource.conclusion, |
| | | // _hasScene: clue.pollutedSource.sceneList.length > 0, |
| | | // // _scenes: |
| | | // // clue.pollutedSource.sceneList.length > 0 |
| | | // // ? clue.pollutedSource.sceneList |
| | | // // .map( |
| | | // // (s, index) => |
| | | // // `${index + 1}. ${s.name}ï¼${s.type}ï¼ä½äº${s.location}ï¼è·${s.closestStation.name}${parseInt(s.length)}ç±³ï¼` |
| | | // // ) |
| | | // // .join('\r\n') |
| | | // // : 'æ ', |
| | | // _scenes: clue.pollutedSource.sceneList.map((s, index) => { |
| | | // return { |
| | | // des: `${index + 1}. ${s.name}ï¼${s.type}ï¼ä½äº${s.location}ï¼è·${s.closestStation.name}${parseInt(s.length)}ç±³ï¼` |
| | | // }; |
| | | // }) |
| | | // }; |
| | | // }) |
| | | // }; |
| | | // }) |
| | | }; |
| | | }); |
| | | }); |