DownAllQualityReport.vue 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062
  1. <template>
  2. <div class="quality-report">
  3. <nav style="" class="nav-content">
  4. <a class="nav-list" v-for="(item, index) in navList" :key="index" @click="jump(index)" :class="index==currentIndex?'current-item':''">{{item}}</a>
  5. </nav>
  6. <div class="report-container" id="report" ref="downReport">
  7. <div class="report-header">
  8. <div class="header-title">数据质量报告</div>
  9. <div class="header-subtitle">
  10. <span>数据范围:全部</span>
  11. <span>报告类型:{{queryParams.reportClassName}}</span>
  12. <span v-if="queryParams.reportClassName == '日报' || queryParams.reportClassName == '年报'">时间范围:{{queryParams.beginDate}}</span>
  13. <span v-else>时间范围:{{queryParams.beginDate}}~{{queryParams.endDate}}</span>
  14. </div>
  15. </div>
  16. <div class="report-content">
  17. <div class="report-section">
  18. <div class="title-content">
  19. <div class="title-line">
  20. <span></span>综合数据质量分析
  21. </div>
  22. </div>
  23. <div class="report-echarts">
  24. <Row :gutter="16" class-name="report-echarts-row">
  25. <Col :span="12">
  26. <div class="report-echarts-main">
  27. <div class="echarts-title">1. 综合得分</div>
  28. <div id="guage" class="echart-detail"></div>
  29. </div>
  30. </Col>
  31. <Col :span="12">
  32. <div class="report-echarts-main">
  33. <div class="echarts-title">2. 评估维度</div>
  34. <div id="radar" class="echart-detail"></div>
  35. </div>
  36. </Col>
  37. </Row>
  38. <Row :gutter="16" class-name="report-echarts-row">
  39. <Col :span="24">
  40. <div class="report-echarts-main">
  41. <div class="echarts-title">3. 综合数据质量趋势</div>
  42. <div id="line3" class="echart-detail"></div>
  43. </div>
  44. </Col>
  45. </Row>
  46. <Row :gutter="16" class-name="report-echarts-row">
  47. <Col :span="24">
  48. <div class="report-echarts-main no-truncation">
  49. <div class="echarts-title">4. 综合数据质量分析-按应用</div>
  50. <div id="bar4" class="echart-detail"></div>
  51. <div class="report-echarts-table">
  52. <Table :columns="columns4" :data="tableData4" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  53. <template slot-scope="{row,index}" slot="paramDou01">
  54. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou01+'%'}}</span>
  55. </template>
  56. <template slot-scope="{row,index}" slot="paramDou02">
  57. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou02+'%'}}</span>
  58. </template>
  59. <template slot-scope="{row}" slot="paramDou04">
  60. <Icon type="md-arrow-up" style="color: #09CB09;font-size:20px" v-show="row.paramDou04>0"/>
  61. <Icon type="md-arrow-down" style="color: #F32F2F;font-size:20px" v-show="row.paramDou04<0" />
  62. {{Math.abs(row.paramDou04)+'%'}}
  63. </template>
  64. </Table>
  65. </div>
  66. </div>
  67. </Col>
  68. </Row>
  69. <Row :gutter="16" class-name="report-echarts-row">
  70. <Col :span="24">
  71. <div class="report-echarts-main no-truncation">
  72. <div class="echarts-title">5. 综合数据质量分析-按规则类型</div>
  73. <div id="bar5" class="echart-detail"></div>
  74. <div class="report-echarts-table">
  75. <Table :columns="columns5" :data="tableData5" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  76. <template slot-scope="{row,index}" slot="paramDou01">
  77. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou01+'%'}}</span>
  78. </template>
  79. <template slot-scope="{row,index}" slot="paramDou02">
  80. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou02+'%'}}</span>
  81. </template>
  82. <template slot-scope="{row}" slot="paramDou04">
  83. <Icon type="md-arrow-up" style="color: #09CB09;font-size:20px" v-show="row.paramDou04>0"/>
  84. <Icon type="md-arrow-down" style="color: #F32F2F;font-size:20px" v-show="row.paramDou04<0" />
  85. {{Math.abs(row.paramDou04)+'%'}}
  86. </template>
  87. </Table>
  88. </div>
  89. </div>
  90. </Col>
  91. </Row>
  92. </div>
  93. </div>
  94. <div class="report-section">
  95. <div class="title-content no-truncation">
  96. <div class="title-line">
  97. <span></span>数据异常分析
  98. </div>
  99. </div>
  100. <div class="report-echarts">
  101. <Row :gutter="16" class-name="report-echarts-row">
  102. <Col :span="24">
  103. <div class="report-echarts-main no-truncation">
  104. <div class="echarts-title">6. 数据异常分析 - 按应用</div>
  105. <div class="echarts-sub-title">数据质量检测异常,按来源应用区分数据如下:</div>
  106. <Row :gutter="16" align="middle">
  107. <Col :span="8">
  108. <div id="pie6" class="echart-detail echart-pie"></div>
  109. </Col>
  110. <Col :span="16">
  111. <div class="report-echarts-table report-echarts-right-table">
  112. <Table :columns="columnsApp" :data="tableData6" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  113. <template slot-scope="{ index }" slot="xAxis">
  114. <span class="table-legend" :style="'background:'+tableColumnColor6[index]" v-show="index>0"></span>
  115. </template>
  116. <template slot-scope="{row,index}" slot="paramDou01">
  117. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  118. </template>
  119. </Table>
  120. </div>
  121. </Col>
  122. </Row>
  123. </div>
  124. </Col>
  125. </Row>
  126. <Row :gutter="16" class-name="report-echarts-row">
  127. <Col :span="24">
  128. <div class="report-echarts-main no-truncation">
  129. <div class="echarts-title">7. 数据异常分析 - 按规则类型</div>
  130. <div class="echarts-sub-title">数据质量检测异常,按来源规则类型区分数据如下:</div>
  131. <Row :gutter="16" align="middle">
  132. <Col :span="8">
  133. <div id="pie7" class="echart-detail"></div>
  134. </Col>
  135. <Col :span="16">
  136. <div class="report-echarts-table report-echarts-right-table">
  137. <Table :columns="columnsRule" :data="tableData7" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  138. <template slot-scope="{ index }" slot="xAxis">
  139. <span class="table-legend" :style="'background:'+tableColumnColor7[index]" v-show="index>0"></span>
  140. </template>
  141. <template slot-scope="{row,index}" slot="paramDou01">
  142. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  143. </template>
  144. </Table>
  145. </div>
  146. </Col>
  147. </Row>
  148. </div>
  149. </Col>
  150. </Row>
  151. </div>
  152. <div class="report-section">
  153. <div class="title-content no-truncation">
  154. <div class="title-line">
  155. <span></span>分规则数据质量分析
  156. </div>
  157. </div>
  158. <div class="report-echarts">
  159. <Row :gutter="16" class-name="report-echarts-row">
  160. <Col :span="24">
  161. <div class="report-echarts-main no-truncation">
  162. <div class="echarts-title">8. 分规则数据质量分析 - 一致性</div>
  163. <div class="echarts-sub-title">数据一致性检测异常,按来源应用区分数据如下:</div>
  164. <Row :gutter="16" align="middle">
  165. <Col :span="8">
  166. <div id="pie8" class="echart-detail"></div>
  167. </Col>
  168. <Col :span="16">
  169. <div class="report-echarts-table report-echarts-right-table">
  170. <Table :columns="columnsApp" :data="tableData8" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  171. <template slot-scope="{ index }" slot="xAxis">
  172. <span class="table-legend" :style="'background:'+tableColumnColor8[index]" v-show="index>0"></span>
  173. </template>
  174. <template slot-scope="{row,index}" slot="paramDou01">
  175. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  176. </template>
  177. </Table>
  178. </div>
  179. </Col>
  180. </Row>
  181. </div>
  182. </Col>
  183. </Row>
  184. <Row :gutter="16" class-name="report-echarts-row">
  185. <Col :span="24">
  186. <div class="report-echarts-main no-truncation">
  187. <div class="echarts-title">9. 分规则数据质量分析 - 完整性</div>
  188. <div class="echarts-sub-title">数据完整性检测异常,按来源应用区分数据如下:</div>
  189. <Row :gutter="16" align="middle">
  190. <Col :span="8">
  191. <div id="pie9" class="echart-detail"></div>
  192. </Col>
  193. <Col :span="16">
  194. <div class="report-echarts-table report-echarts-right-table">
  195. <Table :columns="columnsApp" :data="tableData9" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  196. <template slot-scope="{ index }" slot="xAxis">
  197. <span class="table-legend" :style="'background:'+tableColumnColor9[index]" v-show="index>0"></span>
  198. </template>
  199. <template slot-scope="{row,index}" slot="paramDou01">
  200. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  201. </template>
  202. </Table>
  203. </div>
  204. </Col>
  205. </Row>
  206. </div>
  207. </Col>
  208. </Row>
  209. <Row :gutter="16" class-name="report-echarts-row">
  210. <Col :span="24">
  211. <div class="report-echarts-main no-truncation">
  212. <div class="echarts-title">10. 分规则数据质量分析 - 准确性</div>
  213. <div class="echarts-sub-title">数据准确性检测异常,按来源应用区分数据如下:</div>
  214. <Row :gutter="16" align="middle">
  215. <Col :span="8">
  216. <div id="pie10" class="echart-detail"></div>
  217. </Col>
  218. <Col :span="16">
  219. <div class="report-echarts-table report-echarts-right-table">
  220. <Table :columns="columnsApp" :data="tableData10" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  221. <template slot-scope="{ index }" slot="xAxis">
  222. <span class="table-legend" :style="'background:'+tableColumnColor10[index]" v-show="index>0"></span>
  223. </template>
  224. <template slot-scope="{row,index}" slot="paramDou01">
  225. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  226. </template>
  227. </Table>
  228. </div>
  229. </Col>
  230. </Row>
  231. </div>
  232. </Col>
  233. </Row>
  234. <Row :gutter="16" class-name="report-echarts-row">
  235. <Col :span="24">
  236. <div class="report-echarts-main no-truncation">
  237. <div class="echarts-title">11. 分规则数据质量分析 - 及时性(数据采集)</div>
  238. <div class="echarts-sub-title">数据采集及时性检测异常,按来源应用区分数据如下:</div>
  239. <Row :gutter="16" align="middle">
  240. <Col :span="8">
  241. <div id="pie11" class="echart-detail"></div>
  242. </Col>
  243. <Col :span="16">
  244. <div class="report-echarts-table report-echarts-right-table">
  245. <Table :columns="columnsApp" :data="tableData11" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  246. <template slot-scope="{ index }" slot="xAxis">
  247. <span class="table-legend" :style="'background:'+tableColumnColor11[index]" v-show="index>0"></span>
  248. </template>
  249. <template slot-scope="{row,index}" slot="paramDou01">
  250. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  251. </template>
  252. </Table>
  253. </div>
  254. </Col>
  255. </Row>
  256. </div>
  257. </Col>
  258. </Row>
  259. <Row :gutter="16" class-name="report-echarts-row">
  260. <Col :span="24">
  261. <div class="report-echarts-main no-truncation">
  262. <div class="echarts-title">12. 分规则数据质量分析 - 及时性(数据入库)</div>
  263. <div class="echarts-sub-title">数据入库及时性检测异常,按来源应用区分数据如下:</div>
  264. <Row :gutter="16" align="middle">
  265. <Col :span="8">
  266. <div id="pie12" class="echart-detail"></div>
  267. </Col>
  268. <Col :span="16">
  269. <div class="report-echarts-table report-echarts-right-table">
  270. <Table :columns="columnsApp" :data="tableData12" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  271. <template slot-scope="{ index }" slot="xAxis">
  272. <span class="table-legend" :style="'background:'+tableColumnColor12[index]" v-show="index>0"></span>
  273. </template>
  274. <template slot-scope="{row,index}" slot="paramDou01">
  275. <span :style="index==0 ? 'color:#ECCF0C': ''">{{row.paramDou01}}%</span>
  276. </template>
  277. </Table>
  278. </div>
  279. </Col>
  280. </Row>
  281. </div>
  282. </Col>
  283. </Row>
  284. </div>
  285. </div>
  286. <div class="report-section">
  287. <div class="title-content no-truncation">
  288. <div class="title-line">
  289. <span></span>数据质量排名统计
  290. </div>
  291. </div>
  292. <div class="report-echarts">
  293. <Row :gutter="16" class-name="report-echarts-row">
  294. <Col :span="24">
  295. <div class="report-echarts-main no-truncation">
  296. <div class="echarts-title">13. 异常数来源 - 应用排名 TOP10</div>
  297. <div class="echarts-sub-title">数据质量检查错数按来源应用排名如下:</div>
  298. <Row :gutter="16">
  299. <Col :span="24">
  300. <div id="bar13" class="echart-detail"></div>
  301. <div class="report-echarts-table">
  302. <Table :columns="columnsQuality" :data="tableData13" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  303. <template slot-scope="{row,index}" slot="paramDou01">
  304. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou01+'%'}}</span>
  305. </template>
  306. <template slot-scope="{row,index}" slot="paramDou02">
  307. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou02+'%'}}</span>
  308. </template>
  309. </Table>
  310. </div>
  311. </Col>
  312. </Row>
  313. </div>
  314. </Col>
  315. </Row>
  316. <Row :gutter="16" class-name="report-echarts-row">
  317. <Col :span="24">
  318. <div class="report-echarts-main no-truncation">
  319. <div class="echarts-title">14. 异常数来源 - 质量规则 TOP10</div>
  320. <div class="echarts-sub-title">数据质量检查错数按规则排名如下:</div>
  321. <Row :gutter="16">
  322. <Col :span="24">
  323. <div id="bar14" class="echart-detail"></div>
  324. <div class="report-echarts-table">
  325. <Table :columns="columnsException" :data="tableData14" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  326. <template slot-scope="{row,index}" slot="paramDou01">
  327. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou01+'%'}}</span>
  328. </template>
  329. <template slot-scope="{row,index}" slot="paramDou02">
  330. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou02+'%'}}</span>
  331. </template>
  332. </Table>
  333. </div>
  334. </Col>
  335. </Row>
  336. </div>
  337. </Col>
  338. </Row>
  339. </div>
  340. </div>
  341. <div class="report-section">
  342. <div class="title-content no-truncation">
  343. <div class="title-line">
  344. <div class="num-title">
  345. <span></span>规则配置状况
  346. </div>
  347. </div>
  348. </div>
  349. <div class="report-echarts">
  350. <Row :gutter="16" class-name="report-echarts-row">
  351. <Col :span="24">
  352. <div class="report-echarts-main no-truncation">
  353. <div class="echarts-title">15.规则配置状况</div>
  354. <div class="echarts-sub-title">规则配置数量级及占比</div>
  355. <Row :gutter="16" align="middle">
  356. <Col :span="8">
  357. <div id="pie15" class="echart-detail"></div>
  358. </Col>
  359. <Col :span="16">
  360. <div class="report-echarts-table report-echarts-right-table">
  361. <Table :columns="columnsConfig" :data="tableData15" class="common-table report-table-detail" no-data-text="" :row-class-name="rowClassName">
  362. <template slot-scope="{ index }" slot="xAxis">
  363. <span class="table-legend" :style="'background:'+tableColumnColor15[index]" v-show="index>0"></span>
  364. </template>
  365. <template slot-scope="{row,index}" slot="paramDou05">
  366. <span :style="index==0 ? 'color:#5EB6FC': ''">{{row.paramDou05+'%'}}</span>
  367. </template>
  368. <template slot-scope="{row}" slot="paramDou04">
  369. <Icon type="md-arrow-up" style="color: #09CB09;font-size:20px" v-show="row.paramDou04>0"/>
  370. <Icon type="md-arrow-down" style="color: #F32F2F;font-size:20px" v-show="row.paramDou04<0" />
  371. {{Math.abs(row.paramDou04)+'%'}}
  372. </template>
  373. </Table>
  374. </div>
  375. </Col>
  376. </Row>
  377. </div>
  378. </Col>
  379. </Row>
  380. </div>
  381. </div>
  382. </div>
  383. </div>
  384. </div>
  385. </div>
  386. </template>
  387. <script>
  388. import * as echarts from "echarts"
  389. import html2canvas from 'html2canvas';
  390. import JsPDF from 'jspdf'
  391. export default {
  392. name: "DownQualityReport",
  393. data() {
  394. return {
  395. scroll: '',
  396. navList: ['综合数据质量分析', '数据异常分析', '分规则数据质量分析', '数据质量排名统计', '规则配置状况'],
  397. currentIndex:0,
  398. listBoxState: true,//点击导航栏时,暂时停止监听页面滚动
  399. queryParams: {reportClassName:'',beginDate:'',endDate: ''},
  400. columns4: [
  401. {
  402. title: '来源应用',
  403. key: 'xAxis',
  404. align: 'center',
  405. ellipsis: true,
  406. tooltip: true
  407. },
  408. {
  409. title: '记录总数',
  410. key: 'paramNum01',
  411. align: 'center',
  412. ellipsis: true,
  413. tooltip: true
  414. },
  415. {
  416. title: '本期质量',
  417. slot: 'paramDou01',
  418. align: 'center',
  419. },
  420. {
  421. title: '上期质量',
  422. slot: 'paramDou02',
  423. align: 'center',
  424. },
  425. {
  426. title: '趋势',
  427. slot: 'paramDou04',
  428. align: 'center',
  429. },
  430. ],
  431. columns5: [
  432. {
  433. title: '规则类型',
  434. key: 'xAxis',
  435. align: 'center',
  436. ellipsis: true,
  437. tooltip: true
  438. },
  439. {
  440. title: '记录总数',
  441. key: 'paramLong01',
  442. align: 'center',
  443. ellipsis: true,
  444. tooltip: true
  445. },
  446. {
  447. title: '本期质量',
  448. slot: 'paramDou01',
  449. align: 'center',
  450. },
  451. {
  452. title: '上期质量',
  453. slot: 'paramDou02',
  454. align: 'center',
  455. },
  456. {
  457. title: '趋势',
  458. slot: 'paramDou04',
  459. align: 'center',
  460. },
  461. ],
  462. tableData4: [],
  463. tableData5: [],
  464. tableData6: [],
  465. tableData7: [],
  466. tableData8: [],
  467. tableData9: [],
  468. tableData10: [],
  469. tableData11: [],
  470. tableData12: [],
  471. tableData13: [],
  472. tableData14: [],
  473. tableData15: [],
  474. columnsApp: [
  475. {
  476. title: '图例颜色',
  477. slot: 'xAxis',
  478. align: 'right',
  479. width: 70,
  480. className: 'table-legend-list',
  481. },
  482. {
  483. title: '来源应用',
  484. key: 'xAxis',
  485. align: 'center',
  486. ellipsis: true,
  487. tooltip: true
  488. },
  489. {
  490. title: '记录总数',
  491. key: 'paramNum01',
  492. align: 'center',
  493. ellipsis: true,
  494. tooltip: true
  495. },
  496. {
  497. title: '异常总数',
  498. key: 'paramNum02',
  499. align: 'center',
  500. ellipsis: true,
  501. tooltip: true
  502. },
  503. {
  504. title: '异常占比',
  505. slot: 'paramDou01',
  506. align: 'center',
  507. }
  508. ],
  509. columnsRule: [
  510. {
  511. title: '图例颜色',
  512. slot: 'xAxis',
  513. align: 'right',
  514. width: 70,
  515. className: 'table-legend-list',
  516. },
  517. {
  518. title: '规则类型',
  519. key: 'xAxis',
  520. align: 'center',
  521. ellipsis: true,
  522. tooltip: true
  523. },
  524. {
  525. title: '记录总数',
  526. key: 'paramNum01',
  527. align: 'center',
  528. ellipsis: true,
  529. tooltip: true
  530. },
  531. {
  532. title: '异常总数',
  533. key: 'paramNum02',
  534. align: 'center',
  535. ellipsis: true,
  536. tooltip: true
  537. },
  538. {
  539. title: '异常占比',
  540. slot: 'paramDou01',
  541. align: 'center',
  542. }
  543. ],
  544. columnsQuality: [
  545. {
  546. title: '来源应用',
  547. key: 'xAxis',
  548. align: 'center',
  549. ellipsis: true,
  550. tooltip: true
  551. },
  552. {
  553. title: '本期质量',
  554. slot: 'paramDou01',
  555. align: 'center',
  556. },
  557. {
  558. title: '异常总数',
  559. key: 'paramLong02',
  560. align: 'center',
  561. ellipsis: true,
  562. tooltip: true
  563. },
  564. {
  565. title: '异常数\n总体占比',
  566. slot: 'paramDou02',
  567. align: 'center',
  568. },
  569. {
  570. title: '准确性策略\n异常总数',
  571. key: 'paramNum01',
  572. align: 'center',
  573. ellipsis: true,
  574. tooltip: true
  575. },
  576. {
  577. title: '一致性策略\n异常总数',
  578. key: 'paramNum02',
  579. align: 'center',
  580. ellipsis: true,
  581. tooltip: true
  582. },
  583. {
  584. title: '完整性策略\n异常总数',
  585. key: 'paramNum03',
  586. align: 'center',
  587. ellipsis: true,
  588. tooltip: true
  589. },
  590. {
  591. title: '及时性\n(数据采集)异常',
  592. key: 'paramNum04',
  593. align: 'center',
  594. ellipsis: true,
  595. tooltip: true
  596. },{
  597. title: '及时性\n(数据入库)异常',
  598. key: 'paramNum05',
  599. align: 'center',
  600. ellipsis: true,
  601. tooltip: true
  602. }],
  603. columnsException: [
  604. {
  605. title: '来源规则名称',
  606. key: 'xAxis',
  607. align: 'center',
  608. ellipsis: true,
  609. tooltip: true
  610. },
  611. {
  612. title: '记录总数',
  613. key: 'paramLong01',
  614. align: 'center',
  615. ellipsis: true,
  616. tooltip: true
  617. },
  618. {
  619. title: '异常总数',
  620. key: 'paramNum01',
  621. align: 'center',
  622. ellipsis: true,
  623. tooltip: true
  624. },
  625. {
  626. title: '本期质量',
  627. slot: 'paramDou01',
  628. align: 'center',
  629. },
  630. {
  631. title: '异常数\n总体占比', // iview的table表头文字换行需要\n和.ivu-table-cell {white-space: pre;}
  632. slot: 'paramDou02',
  633. align: 'center',
  634. },
  635. ],
  636. columnsConfig: [
  637. {
  638. title: '图例颜色',
  639. slot: 'xAxis',
  640. align: 'right',
  641. width: 70,
  642. className: 'table-legend-list',
  643. },
  644. {
  645. title: '规则类型',
  646. key: 'xAxis',
  647. align: 'center',
  648. ellipsis: true,
  649. tooltip: true
  650. },
  651. {
  652. title: '数量',
  653. key: 'paramNum01',
  654. align: 'center',
  655. ellipsis: true,
  656. tooltip: true
  657. },
  658. {
  659. title: '占比',
  660. slot: 'paramDou05',
  661. align: 'center',
  662. },
  663. {
  664. title: '趋势',
  665. slot: 'paramDou04',
  666. align: 'center',
  667. },
  668. ],
  669. pieColumnColor6: ['#58D9F9','#4992FF','#7CFFB2','#FF6E76','#FDDD60','#646AD9'],
  670. tableColumnColor6: ['','#58D9F9','#4992FF','#7CFFB2','#FF6E76','#FDDD60'],
  671. pieColumnColor7: ['#646AD9','#FDDD60','#FF6E76','#7CFFB2','#4992FF','#58D9F9'],
  672. tableColumnColor7: ['','#646AD9','#FDDD60','#FF6E76','#7CFFB2','#4992FF'],
  673. pieColumnColor8: ['#FDDD60','#FF6E76','#7CFFB2','#4992FF','#58D9F9','#646AD9'],
  674. tableColumnColor8: ['','#FDDD60','#FF6E76','#7CFFB2','#4992FF','#58D9F9'],
  675. pieColumnColor9: ['#FF6E76','#7CFFB2','#4992FF','#58D9F9','#646AD9','#FDDD60'],
  676. tableColumnColor9: ['','#FF6E76','#7CFFB2','#4992FF','#58D9F9','#646AD9'],
  677. pieColumnColor10: ['#7CFFB2','#4992FF','#58D9F9','#646AD9','#FDDD60','#FF6E76'],
  678. tableColumnColor10: ['','#7CFFB2','#4992FF','#58D9F9','#646AD9','#FDDD60'],
  679. pieColumnColor11: ['#4992FF','#58D9F9','#646AD9','#FDDD60','#FF6E76','#7CFFB2'],
  680. tableColumnColor11: ['','#4992FF','#58D9F9','#646AD9','#FDDD60','#FF6E76'],
  681. pieColumnColor12: ['#4992FF','#7CFFB2','#FF6E76','#FDDD60','#646AD9','#58D9F9'],
  682. tableColumnColor12: ['','#4992FF','#7CFFB2','#FF6E76','#FDDD60','#646AD9'],
  683. pieColumnColor15: ['#FF6E76','#646AD9','#FDDD60','#7CFFB2','#4992FF','#58D9F9'],
  684. tableColumnColor15: ['','#FF6E76','#646AD9','#FDDD60','#7CFFB2','#4992FF'],
  685. downloadStatus: false,
  686. };
  687. },
  688. watch: {
  689. scroll: function () {
  690. this.loadSroll()
  691. },
  692. },
  693. created () {
  694. if (this.$route.query.reportClassName) {
  695. this.queryParams = this.$route.query
  696. let parmasObj = {
  697. beginDate: this.queryParams.beginDate,
  698. endDate: this.queryParams.endDate
  699. }
  700. this.downloadStatus = false
  701. // this.getEchartData(parmasObj)
  702. this.getData(parmasObj)
  703. }
  704. },
  705. mounted() {
  706. //vue通过window.addEventListener('scroll', XXXX)无法监听屏幕滚动事件,上一个页面可以,换了一个页面,却不行了,后来百度,往后面加了一个true
  707. window.addEventListener('scroll', this.dataScroll,true)
  708. },
  709. methods: {
  710. // js 节流浏览器性能优化
  711. dataScroll: function () {
  712. this.scroll = document.documentElement.scrollTop || document.body.scrollTop;
  713. // if (this.scroll >= 400) { //滚动条滚动的距离大于等于400时,显示BackTop组件
  714. // this.$refs.BackTop.backTop = true
  715. // } else {
  716. // this.$refs.BackTop.backTop = false
  717. // }
  718. },
  719. jump(index) {
  720. let jump = document.getElementsByClassName('report-section');
  721. // 获取需要滚动的距离
  722. let total = jump[index].offsetTop;
  723. // Chrome
  724. document.body.scrollTop = total;
  725. // Firefox
  726. document.documentElement.scrollTop = total;
  727. // Safari
  728. window.pageYOffset = total;
  729. this.currentIndex = index
  730. this.listBoxState = false
  731. let timeId;
  732. clearTimeout(timeId);
  733. timeId = setTimeout(() => {
  734. this.listBoxState = true
  735. },100)
  736. // $('html, body').animate({
  737. // 'scrollheader': total
  738. // }, 400);
  739. },
  740. loadSroll: function () {
  741. var self = this;
  742. var sections = document.getElementsByClassName('report-section');
  743. if (this.listBoxState) {
  744. for (var i = sections.length - 1; i >= 0; i--) {
  745. if (self.scroll >= sections[i].offsetTop-100) {
  746. this.currentIndex = i
  747. break;
  748. }
  749. }
  750. }
  751. },
  752. rowClassName(row, index) {
  753. if (index % 2 == 0) {
  754. return "ivu-table-stripe-even";
  755. } else {
  756. return "ivu-table-stripe-odd";
  757. }
  758. },
  759. creatGauge(gaugeData) {
  760. let myChart = echarts.init(document.getElementById(gaugeData.id))
  761. let option = {
  762. series: [
  763. {
  764. type: 'gauge',
  765. center: ['50%', '68%'],
  766. radius:'90%',
  767. startAngle: 200,
  768. endAngle: -20,
  769. min: 0,
  770. max: 100,
  771. splitNumber: 10,
  772. itemStyle: {
  773. color: '#FFAB91'
  774. },
  775. progress: {
  776. show: true,
  777. width: 15
  778. },
  779. pointer: {
  780. show: false
  781. },
  782. axisLine: {
  783. lineStyle: {
  784. color:[[1, '#284677']],
  785. width: 15
  786. }
  787. },
  788. axisTick: {
  789. distance: -35,
  790. splitNumber: 5,
  791. lineStyle: {
  792. width: 2,
  793. color: '#4D5F7D'
  794. }
  795. },
  796. splitLine: {
  797. distance: -52,
  798. length: 14,
  799. lineStyle: {
  800. width: 3,
  801. color: '#4D5F7D'
  802. }
  803. },
  804. axisLabel: {
  805. distance: -20,
  806. color: '#5D6B82',
  807. fontSize: 12
  808. },
  809. anchor: {
  810. show: false
  811. },
  812. title: {
  813. show: false
  814. },
  815. detail: {
  816. valueAnimation: true,
  817. width: '60%',
  818. lineHeight: 40,
  819. borderRadius: 8,
  820. offsetCenter: [0, '-15%'],
  821. fontSize: 30,
  822. fontWeight: 'bolder',
  823. formatter: '{value} %',
  824. color: 'auto'
  825. },
  826. data: [
  827. {
  828. value: gaugeData.scores
  829. }
  830. ]
  831. },
  832. {
  833. type: 'gauge',
  834. center: ['50%', '68%'],
  835. radius:'90%',
  836. startAngle: 200,
  837. endAngle: -20,
  838. min: 0,
  839. max: 100,
  840. itemStyle: {
  841. color: '#FD6636'
  842. },
  843. progress: {
  844. show: true,
  845. width: 5
  846. },
  847. pointer: {
  848. show: false
  849. },
  850. axisLine: {
  851. show: false
  852. },
  853. axisTick: {
  854. show: false
  855. },
  856. splitLine: {
  857. show: false
  858. },
  859. axisLabel: {
  860. show: false
  861. },
  862. detail: {
  863. show: false
  864. },
  865. data: [
  866. {
  867. value: gaugeData.scores
  868. }
  869. ]
  870. }
  871. ]
  872. }
  873. myChart.resize()
  874. myChart.clear()
  875. myChart.setOption(option)
  876. window.addEventListener("resize", function() {
  877. myChart.resize()
  878. })
  879. },
  880. //雷达图显示文字
  881. contains(arr, val) {
  882. var i = arr.length;
  883. while (i--) {
  884. if (arr[i].name === val) {
  885. return i;
  886. }
  887. }
  888. return false;
  889. },
  890. creatSolidRadar (SolidRadarData) {
  891. if (echarts.init(document.getElementById(SolidRadarData.id))) {
  892. let myChart = echarts.init(document.getElementById(SolidRadarData.id));
  893. myChart.clear()
  894. const createSvg = ({width, height, shadowColor, shadowBlur, points}) => {
  895. const ret = [`M${points[0][0]} ${points[0][1]}`];
  896. for (let i = 1; i < points.length; i++) {
  897. ret.push(`L${points[i][0]} ${points[i][1]}`);
  898. }
  899. ret.push('Z');
  900. const rectPath = ret.join(' ');
  901. return (`
  902. <svg version="1.1" xmlns="http://www.w3.org/2000/svg"
  903. x="0px" y="0px"
  904. width="${width}"
  905. height="${height}"
  906. >
  907. <style>
  908. .st1 {
  909. fill: transparent;
  910. stroke: ${shadowColor};
  911. stroke-width: ${shadowBlur}px;
  912. filter: url(#chart-inset-shadow);
  913. clip-path: url(#chart-clip);
  914. }
  915. </style>
  916. <defs>
  917. <clipPath id="chart-clip">
  918. <path d="${rectPath}" />
  919. </clipPath>
  920. <filter id="chart-inset-shadow" width="200%" height="200%" x="-50%" y="-50%">
  921. <feGaussianBlur in="SourceGraphic" result="gass" stdDeviation="${shadowBlur * 0.75}" />
  922. <feMerge>
  923. <feMergeNode in="gass" />
  924. </feMerge>
  925. </filter>
  926. </defs>
  927. <g>
  928. <path class="st1" d="${rectPath}" />
  929. </g>
  930. </svg>
  931. `);
  932. };
  933. const cretateSvgUrl = (svgOption) => {
  934. const svgString = createSvg(svgOption);
  935. const svg = new Blob([svgString], {type: "image/svg+xml;charset=utf-8"});
  936. const DOMURL = window.URL || window.webkitURL || window;
  937. const insetShadowUrl = DOMURL.createObjectURL(svg);
  938. return insetShadowUrl;
  939. };
  940. const dataSet = [], nameArr = []
  941. SolidRadarData.category[0].forEach((item,index)=> {
  942. nameArr.push(item.name)
  943. })
  944. dataSet[0] = nameArr
  945. dataSet[1] = [100,100,100,100,100]
  946. dataSet[2] = SolidRadarData.data[0].value
  947. const maxValue = [...dataSet[1], ...dataSet[2]].reduce((m, v) => Math.max(m, v), -Infinity);
  948. const radius = 0.8;
  949. const theta = Math.PI * 2 / dataSet[2].length
  950. const getPoints = (R, ps, max) => ps.map((v, i) => {
  951. const t = i * theta;
  952. const d = v / max;
  953. const x = R - Math.sin(t) * R * d;
  954. const y = R - Math.cos(t) * R * d;
  955. return [x, y];
  956. });
  957. // let i = -1;
  958. let option = {
  959. polar: {
  960. radius: radius * 100 + '%',
  961. // center: ['50%', '58%'],
  962. center: ['50%', '50%'],
  963. },
  964. angleAxis: {
  965. type: 'category',
  966. clockwise: false,
  967. boundaryGap: false,
  968. splitLine: {
  969. show: false,
  970. },
  971. axisLine: {
  972. show: false
  973. }
  974. },
  975. radiusAxis: {
  976. type: 'value',
  977. min: 0,
  978. max: 100,
  979. splitLine: {
  980. show: false,
  981. },
  982. axisTick: {
  983. show: false,
  984. },
  985. axisLabel: {
  986. show: false,
  987. color:'#fff',
  988. formatter: '{value} %'
  989. },
  990. },
  991. radar: {
  992. indicator: SolidRadarData.category[0],
  993. radius: radius * 100 + '%',
  994. center: ['50%', '50%'],
  995. shape: 'polygon',
  996. splitNumber: 5,
  997. // nameGap : 1,
  998. name: {
  999. // rich: {
  1000. // a: {
  1001. // color: '#fff',
  1002. // lineHeight: 20,
  1003. // },
  1004. // b: {
  1005. // color: '#fff',
  1006. // align: 'center',
  1007. // padding: 2,
  1008. // borderRadius: 4
  1009. // }
  1010. // },
  1011. // formatter: (value)=>{
  1012. // let i = this.contains(SolidRadarData.category[0], value); // 处理对应要显示的样式
  1013. // return `{a|${value}}{b|${dataSet[2][i]}%}`
  1014. // },
  1015. textStyle: {
  1016. color: '#fff',
  1017. fontSize: 12,
  1018. padding: [-10, -10]
  1019. }
  1020. },
  1021. splitArea: {
  1022. areaStyle: {
  1023. color: [
  1024. 'rgba(8,20,58,0.1)',
  1025. 'rgba(,20,58,0.03)',
  1026. 'rgba(,20,58,0.1)',
  1027. 'rgba(,20,58,0.03)',
  1028. ]
  1029. }
  1030. },
  1031. splitLine: {
  1032. lineStyle: {
  1033. color: [
  1034. '#2A3A6E', '#2A3A6E',
  1035. '#2A3A6E', '#2A3A6E',
  1036. '#2A3A6E'
  1037. ].reverse(),
  1038. width: 3
  1039. }
  1040. },
  1041. axisLine: {
  1042. lineStyle: {
  1043. color: '#264474'
  1044. }
  1045. }
  1046. },
  1047. animationDuration: 3000,
  1048. series: [
  1049. {
  1050. type: 'custom',
  1051. name: 's1-inset-shadow',
  1052. silent: true,
  1053. coordinateSystem : 'polar',
  1054. // data: [0],
  1055. renderItem: (params,api) => {
  1056. const R = params.coordSys.r;
  1057. const cx = params.coordSys.cx;
  1058. const cy = params.coordSys.cy;
  1059. const x = cx - R;
  1060. const y = cy - R;
  1061. const width = 2 * R;
  1062. const height = 2 * R;
  1063. return {
  1064. type: 'image',
  1065. style: {
  1066. image: cretateSvgUrl({
  1067. width, height,
  1068. shadowColor: '#00A0E9',
  1069. shadowBlur: 6,
  1070. points: getPoints(R, dataSet[1], 100)
  1071. }),
  1072. x,
  1073. y,
  1074. width,
  1075. height,
  1076. },
  1077. };
  1078. },
  1079. },
  1080. {
  1081. name: 's2',
  1082. type: 'radar',
  1083. data: [
  1084. { value: dataSet[2] }
  1085. ],
  1086. // symbol: 'none',
  1087. label: {
  1088. show: true,
  1089. formatter: function(params) {
  1090. return params.value + '%';
  1091. },
  1092. color: '#fff',
  1093. position: [-10, -10],
  1094. // align: 'left',
  1095. // distance: -25,
  1096. },
  1097. symbolSize: [6, 6],
  1098. itemStyle: {
  1099. shadowColor: 'rgba(0, 0, 0, 0.5)',
  1100. shadowBlur: 20,
  1101. normal: {
  1102. color: 'rgba(87,201,255,0.8)',
  1103. borderColor: 'rgba(87,201,255,0.2)',
  1104. borderWidth: 12,
  1105. }
  1106. },
  1107. areaStyle: {
  1108. normal: {
  1109. color: '#383F2F',
  1110. }
  1111. },
  1112. lineStyle: {
  1113. normal: {
  1114. color: '#FAEC05',
  1115. width: 2,
  1116. }
  1117. },
  1118. z: 3,
  1119. },
  1120. ]
  1121. };
  1122. myChart.resize()
  1123. myChart.setOption(option)
  1124. window.addEventListener("resize", function () {
  1125. myChart.resize()
  1126. })
  1127. }
  1128. },
  1129. creatLine (lineData) {
  1130. let toplinechart = echarts.init(document.getElementById(lineData.id));
  1131. let seriesData = _.map(lineData.data, (item,index)=>({
  1132. name: lineData.legend[index], type: 'line', symbol: 'circle', symbolSize: 2,smooth: true, // 平滑曲线
  1133. lineStyle: {color: lineData.lineColor[index], width: 2},
  1134. itemStyle: {color: lineData.lineColor[index], borderColor: lineData.lineColor[index], borderWidth: 2,
  1135. emphasis: { color: '#fff' }
  1136. },
  1137. areaStyle: { opacity:0.4,color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0.3, color: lineData.lineColor[index]}, { offset: 1, color: 'rgba(0,0,0,0)' }])},
  1138. data: item
  1139. }))
  1140. let toplineoption = {
  1141. // title: {
  1142. // text: '单位:'+lineData.unit,
  1143. // top: '5%',
  1144. // right: 10,
  1145. // textStyle: {
  1146. // color: '#666666',
  1147. // fontSize: 14
  1148. // }
  1149. // },
  1150. legend: {
  1151. top: '5%', left: 'center', itemWidth: 10, itemHeight: 10, itemGap: 25,
  1152. textStyle: { color: '#fff', fontSize: 12 },
  1153. data: lineData.legend
  1154. },
  1155. tooltip: { trigger: "axis",
  1156. confine: true,
  1157. backgroundColor: '#011235',
  1158. borderWidth: 0,
  1159. extraCssText: 'opacity:0.8',
  1160. textStyle: {
  1161. color: '#fff'
  1162. },
  1163. formatter: function (params) {
  1164. let res = ''
  1165. params.forEach((item,i) => {
  1166. res += '<div style="display: flex;align-items:center;justify-content:space-between"><span>'+ item.marker + item.seriesName + ':</span><span>' + item.value + lineData.unit+'</span></div> '
  1167. })
  1168. return params[0].name + res
  1169. }
  1170. },
  1171. grid: {
  1172. top: '18%',
  1173. left: "4%",
  1174. right: "4%",
  1175. bottom: "4%",
  1176. containLabel: true
  1177. },
  1178. xAxis: [{
  1179. type: 'category',
  1180. data: lineData.category,
  1181. boundaryGap: false,
  1182. axisLine: {
  1183. lineStyle: {
  1184. color: '#00479D',
  1185. width: 1
  1186. }
  1187. },
  1188. axisLabel: {
  1189. color: '#fff',
  1190. },
  1191. axisTick: {
  1192. alignWithLabel: true
  1193. }
  1194. }],
  1195. yAxis: [{
  1196. type: 'value',
  1197. axisLine: {
  1198. show: true,
  1199. lineStyle: {
  1200. color: '#00479D',
  1201. width: 1
  1202. }
  1203. },
  1204. axisTick: {
  1205. show: true
  1206. },
  1207. splitLine: {
  1208. show: true,
  1209. lineStyle: {
  1210. type: "solid",
  1211. width: 1,
  1212. color: "#153068"
  1213. }
  1214. },
  1215. axisLabel: {
  1216. show: true,
  1217. color: '#fff'
  1218. }
  1219. }],
  1220. series: seriesData
  1221. }
  1222. toplinechart.resize()
  1223. toplinechart.clear()
  1224. toplinechart.setOption(toplineoption)
  1225. window.addEventListener("resize", function () { toplinechart.resize() })
  1226. },
  1227. creatBar(botmLeftBarData) {
  1228. let botmLeftChart = echarts.init(document.getElementById(botmLeftBarData.id))
  1229. let barseries = []
  1230. for (var i = 0; i < botmLeftBarData.legend.length; i++) {
  1231. let itemStyle = {}
  1232. if (botmLeftBarData.showStack) {
  1233. itemStyle = {
  1234. color:botmLeftBarData.color[i]
  1235. }
  1236. } else {
  1237. itemStyle = {
  1238. normal: {
  1239. color: {
  1240. type: 'linear',
  1241. x: 0,
  1242. y: 0,
  1243. x2: 0,
  1244. y2: 1,
  1245. colorStops: [{
  1246. offset: 0,
  1247. color: botmLeftBarData.color[i][0]
  1248. }, {
  1249. offset: 1,
  1250. color: botmLeftBarData.color[i][1]
  1251. }],
  1252. globalCoord: false // 缺省为 false
  1253. },
  1254. }
  1255. }
  1256. }
  1257. barseries.push({
  1258. name: botmLeftBarData.legend[i],
  1259. type: 'bar',
  1260. stack: botmLeftBarData.showStack ? 'total' : false,
  1261. barMaxWidth: 28,
  1262. itemStyle: itemStyle,
  1263. data: botmLeftBarData.data[i]
  1264. })
  1265. }
  1266. let botmLeftOption = {
  1267. tooltip: {
  1268. trigger: botmLeftBarData.legend.length==1 ? 'item' : 'axis',
  1269. axisPointer: { type: 'shadow' },
  1270. confine: true,
  1271. backgroundColor: '#011235',
  1272. borderWidth: 0,
  1273. extraCssText: 'opacity:0.8',
  1274. textStyle: {
  1275. color: '#fff'
  1276. },
  1277. formatter: function(params) {
  1278. if (Array.isArray(params)) {
  1279. let res = ''
  1280. params.forEach((item,i) => {
  1281. res += '<div style="display: flex;align-items:center;justify-content:space-between"><span>'+ item.marker + item.seriesName + ':</span><span>' + item.value + botmLeftBarData.unit+'</span></div> '
  1282. })
  1283. return params[0].name + res
  1284. } else {
  1285. return params.marker + params.name+':'+ params.value + botmLeftBarData.unit
  1286. }
  1287. }
  1288. },
  1289. legend: {
  1290. show: botmLeftBarData.legend.length>1 ? true : false,
  1291. orient: 'horizontal', left: 'center', top: 2, itemWidth: 10, itemHeight: 10,
  1292. textStyle: { color: '#ffffff', fontSize: 12 },
  1293. data: botmLeftBarData.legend
  1294. },
  1295. grid: {
  1296. top: '14%',
  1297. left: "4%",
  1298. right: "8%",
  1299. bottom: "2%",
  1300. containLabel: true
  1301. },
  1302. xAxis: [{
  1303. type: 'category',
  1304. axisLine: {
  1305. show: true,
  1306. lineStyle: {
  1307. color: '#00479D'
  1308. }
  1309. },
  1310. axisLabel: {
  1311. textStyle: {
  1312. color: '#ffffff',
  1313. fontSize: 12
  1314. },
  1315. },
  1316. axisTick: {
  1317. alignWithLabel: true
  1318. },
  1319. data: botmLeftBarData.category
  1320. }],
  1321. yAxis: [{
  1322. type: 'value',
  1323. splitLine: {
  1324. show: true,
  1325. lineStyle: {
  1326. type: "solid",
  1327. width: 1,
  1328. color: "#153068"
  1329. }
  1330. },
  1331. axisLine: {
  1332. show: true,
  1333. lineStyle: {
  1334. color: '#00479D',
  1335. width: 1
  1336. }
  1337. },
  1338. axisLabel: {
  1339. textStyle: {
  1340. color: '#ffffff',
  1341. fontSize: 12
  1342. }
  1343. },
  1344. axisTick: {
  1345. show: true
  1346. },
  1347. }],
  1348. series: barseries
  1349. }
  1350. botmLeftChart.resize()
  1351. botmLeftChart.clear()
  1352. botmLeftChart.setOption(botmLeftOption)
  1353. window.addEventListener("resize", function() {
  1354. botmLeftChart.resize()
  1355. })
  1356. },
  1357. creatPie(pieData) {
  1358. let sum = pieData.data.reduce((prev, current) => prev + current.value, 0) // 数组求和
  1359. pieData.data.forEach((item)=> {
  1360. if (item.name == '其他') {
  1361. item.labelLine = {
  1362. lineStyle: {
  1363. color: pieData.color[pieData.color.length-1]
  1364. }
  1365. }
  1366. } else {
  1367. item.labelLine = {
  1368. lineStyle: {
  1369. color: 'transparent'
  1370. }
  1371. }
  1372. }
  1373. })
  1374. let myChart = echarts.init(document.getElementById(pieData.id))
  1375. let option = {
  1376. title: {
  1377. text: '{a|' + sum + '}{c|条}',
  1378. x: 'center',
  1379. y: 'center',
  1380. textStyle: {
  1381. rich: {
  1382. a: {
  1383. padding: [10, 0],
  1384. color: '#1EAFF5',
  1385. fontSize: 20,
  1386. align: 'center',
  1387. fontWeight: 'bold'
  1388. },
  1389. c: {
  1390. color: "#fff",
  1391. fontSize: 12,
  1392. }
  1393. }
  1394. },
  1395. },
  1396. tooltip: {
  1397. trigger: "item",
  1398. labelLine: false,
  1399. confine: true,
  1400. backgroundColor: '#011235',
  1401. borderWidth: 0,
  1402. extraCssText: 'opacity:0.8',
  1403. textStyle: {
  1404. color: '#fff'
  1405. },
  1406. formatter: function(params) {
  1407. return params.name + ':' + params.percent + '% (' + params.value + pieData.unit + ')'
  1408. }
  1409. },
  1410. series: [{
  1411. type: 'pie',
  1412. radius: ['50%', '70%'],
  1413. center: ['50%', '50%'],
  1414. label: {
  1415. position: 'outer',
  1416. alignTo: 'none',
  1417. bleedMargin: 0,
  1418. color: '#FFFFFF',
  1419. fontSize: 12,
  1420. formatter: function(params) {
  1421. if (params.data.name == '其他') {
  1422. return params.name + ':' + params.percent + '% (' + params.value + pieData.unit + ')'
  1423. } else {
  1424. return ''
  1425. }
  1426. }
  1427. },
  1428. itemStyle: {
  1429. color: function (params) {
  1430. return pieData.color[params.dataIndex]
  1431. }
  1432. },
  1433. data: pieData.data,
  1434. }, ]
  1435. };
  1436. myChart.resize();
  1437. myChart.clear();
  1438. myChart.setOption(option);
  1439. window.addEventListener("resize", function() {
  1440. myChart.resize();
  1441. })
  1442. },
  1443. getEchartData (params) {
  1444. this.$get('metroapi/dataQuality/report/comScores',params).then(res => {
  1445. if (res.httpCode == 1) {
  1446. let obj = res.data
  1447. obj.id = 'guage'
  1448. this.$nextTick(() => this.creatGauge(obj))
  1449. }
  1450. })
  1451. this.$get('metroapi/dataQuality/report/difDimScores',params).then(res => {
  1452. if (res.httpCode == 1) {
  1453. let obj2 = res.data
  1454. obj2.id = 'radar'
  1455. this.$nextTick(() => this.creatSolidRadar(obj2))
  1456. }
  1457. })
  1458. this.$get('metroapi/dataQuality/report/comScoresTrend',params).then(res => {
  1459. if (res.httpCode == 1) {
  1460. let obj3 = res.data
  1461. obj3.id = 'line3'
  1462. obj3.unit = '%'
  1463. obj3.lineColor = ['#31A4FD', '#86BE73']
  1464. this.$nextTick(() => this.creatLine(obj3))
  1465. }
  1466. })
  1467. this.$get('metroapi/dataQuality/report/comScores/appType/bar',params).then(res => {
  1468. if (res.httpCode == 1) {
  1469. let obj4 = res.data
  1470. obj4.id = 'bar4'
  1471. obj4.unit = '%'
  1472. obj4.color = [['#0874E2','#62BAFD'], ['#86BE73', '#42A76D']]
  1473. this.$nextTick(() => this.creatBar(obj4))
  1474. }
  1475. })
  1476. this.$get('metroapi/dataQuality/report/comScores/appType/list',params).then(res => {
  1477. if (res.httpCode == 1) {
  1478. this.tableData4 = res[4].data.data
  1479. this.tableData4.forEach((item,index)=> {
  1480. if (index == 0) {
  1481. item.cellClassName = {
  1482. paramNum01: 'total-records-table-cell',
  1483. paramDou01: 'quality-table-cell',
  1484. paramDou02: 'quality-table-cell',
  1485. }
  1486. }
  1487. })
  1488. }
  1489. })
  1490. this.$get('metroapi/dataQuality/report/comScores/model/bar',params).then(res => {
  1491. if (res.httpCode == 1) {
  1492. let obj5 = res.data
  1493. obj5.id = 'bar5'
  1494. obj5.unit = '%'
  1495. obj5.color = [['#0874E2','#62BAFD'], ['#86BE73', '#42A76D']]
  1496. this.$nextTick(() => this.creatBar(obj5))
  1497. }
  1498. })
  1499. },
  1500. downReport(row) {
  1501. this.downloadStatus = true
  1502. this.queryParams = row
  1503. let paramsObj = {
  1504. beginDate: row.beginDate,
  1505. endDate: row.endDate
  1506. }
  1507. this.getData(paramsObj)
  1508. },
  1509. async getEchartData1(url,params) { //async 函数返回的是一个 Promise 对象,所以在最外层不能用 await 获取其返回值的情况下,我们当然应该用原来的方式:then() 链来处理这个 Promise 对象
  1510. let rtnData
  1511. await this.$get( url, params).then(res=>{ //await让被调用的函数都完成后并返回结果 (await只在 async 函数中有效)
  1512. rtnData = res
  1513. })
  1514. return rtnData
  1515. },
  1516. getData(params){
  1517. let interface1 = this.getEchartData1('metroapi/dataQuality/report/comScores',params)
  1518. let interface2 = this.getEchartData1('metroapi/dataQuality/report/difDimScores',params)
  1519. let interface3 = this.getEchartData1('metroapi/dataQuality/report/comScoresTrend',params)
  1520. let interface4 = this.getEchartData1('metroapi/dataQuality/report/comScores/appType/bar',params)
  1521. let interfaceTable4 = this.getEchartData1('metroapi/dataQuality/report/comScores/appType/list',params)
  1522. let interface5 = this.getEchartData1('metroapi/dataQuality/report/comScores/model/bar',params)
  1523. let interfaceTable5 = this.getEchartData1('metroapi/dataQuality/report/comScores/model/list',params)
  1524. let interface6 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/pie',params)
  1525. let interfaceTable6 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/list',params)
  1526. let interface7 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/model/pie',params)
  1527. let interfaceTable7 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/model/list',params)
  1528. let params8 = params
  1529. params8.modelType = '一致性'
  1530. let interface8 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/pie',params8)
  1531. let interfaceTable8 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/list',params8)
  1532. let params9 = params
  1533. params9.modelType = '完整性'
  1534. let interface9 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/pie',params9)
  1535. let interfaceTable9 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/list',params9)
  1536. let params10 = params
  1537. params10.modelType = '准确性'
  1538. let interface10 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/pie',params10)
  1539. let interfaceTable10 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/list',params10)
  1540. let params11 = params
  1541. params11.modelType = '及时性(数据采集)'
  1542. let interface11 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/pie',params11)
  1543. let interfaceTable11 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/list',params11)
  1544. let params12 = params
  1545. params12.modelType = '及时性(数据入库)'
  1546. let interface12 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/pie',params12)
  1547. let interfaceTable12 = this.getEchartData1('metroapi/dataQuality/report/abnDataAnalysis/appType/model/list',params12)
  1548. let interface13 = this.getEchartData1('metroapi/dataQuality/report/abnSource/appType/bar',params)
  1549. let interfaceTable13 = this.getEchartData1('metroapi/dataQuality/report/abnSource/appType/list',params)
  1550. let interface14 = this.getEchartData1('metroapi/dataQuality/report/abnSource/rule/bar',params)
  1551. let interfaceTable14 = this.getEchartData1('metroapi/dataQuality/report/abnSource/rule/list',params)
  1552. let interface15 = this.getEchartData1('metroapi/dataQuality/report/ruleConf/pie',params)
  1553. let interfaceTable15 = this.getEchartData1('metroapi/dataQuality/report/ruleConf/list',params)
  1554. this.$axiosAll([interface1,interface2,interface3,interface4,interfaceTable4,interface5,interfaceTable5,interface6,interfaceTable6,interface7,interfaceTable7,interface8,interfaceTable8,interface9,interfaceTable9,interface10,interfaceTable10,interface11,interfaceTable11,interface12,interfaceTable12,interface13,interfaceTable13,interface14,interfaceTable14,interface15,interfaceTable15]).then(res=> {
  1555. if (res[0].httpCode == 1) {
  1556. let obj = res[0].data
  1557. obj.id = 'guage'
  1558. this.$nextTick(() => this.creatGauge(obj))
  1559. }
  1560. if (res[1].httpCode == 1) {
  1561. let obj2 = res[1].data
  1562. obj2.id = 'radar'
  1563. this.$nextTick(() => this.creatSolidRadar(obj2))
  1564. }
  1565. if (res[2].httpCode == 1) {
  1566. let obj3 = res[2].data
  1567. obj3.id = 'line3'
  1568. obj3.unit = '%'
  1569. obj3.lineColor = ['#31A4FD', '#86BE73']
  1570. this.$nextTick(() => this.creatLine(obj3))
  1571. }
  1572. if (res[3].httpCode == 1) {
  1573. let obj4 = res[3].data
  1574. obj4.id = 'bar4'
  1575. obj4.unit = '%'
  1576. obj4.color = [['#0874E2','#62BAFD'], ['#86BE73', '#42A76D']]
  1577. this.$nextTick(() => this.creatBar(obj4))
  1578. }
  1579. if (res[4].httpCode == 1) {
  1580. this.tableData4 = res[4].data.data
  1581. this.tableData4.forEach((item,index)=> {
  1582. if (index == 0) {
  1583. item.cellClassName = {
  1584. paramNum01: 'total-records-table-cell',
  1585. paramDou01: 'quality-table-cell',
  1586. paramDou02: 'quality-table-cell',
  1587. }
  1588. }
  1589. })
  1590. }
  1591. if (res[5].httpCode == 1) {
  1592. let obj5 = res[5].data
  1593. obj5.id = 'bar5'
  1594. obj5.unit = '%'
  1595. obj5.color = [['#0874E2','#62BAFD'], ['#86BE73', '#42A76D']]
  1596. this.$nextTick(() => this.creatBar(obj5))
  1597. }
  1598. if (res[6].httpCode == 1) {
  1599. this.tableData5 = res[6].data.data
  1600. this.tableData5.forEach((item,index)=> {
  1601. if (index == 0) {
  1602. item.cellClassName = {
  1603. paramLong01: 'total-records-table-cell',
  1604. paramDou01: 'quality-table-cell',
  1605. paramDou02: 'quality-table-cell',
  1606. }
  1607. }
  1608. })
  1609. }
  1610. if (res[7].httpCode == 1) {
  1611. let obj6 = res[7].data
  1612. obj6.id = 'pie6'
  1613. obj6.unit = '条'
  1614. obj6.color = this.pieColumnColor6
  1615. this.$nextTick(() => this.creatPie(obj6))
  1616. }
  1617. if (res[8].httpCode == 1) {
  1618. this.tableData6 = res[8].data.data
  1619. this.tableData6.forEach((item,index)=> {
  1620. if (index == 0) {
  1621. item.cellClassName = {
  1622. paramNum01: 'total-records-table-cell',
  1623. paramNum02: 'total-exceptions-table-cell',
  1624. }
  1625. }
  1626. })
  1627. }
  1628. if (res[9].httpCode == 1) {
  1629. let obj7 = res[9].data
  1630. obj7.id = 'pie7'
  1631. obj7.unit = '条'
  1632. obj7.color = this.pieColumnColor7
  1633. this.$nextTick(() => this.creatPie(obj7))
  1634. }
  1635. if (res[10].httpCode == 1) {
  1636. this.tableData7 = res[10].data.data
  1637. this.tableData7.forEach((item,index)=> {
  1638. if (index == 0) {
  1639. item.cellClassName = {
  1640. paramNum01: 'total-records-table-cell',
  1641. paramNum02: 'total-exceptions-table-cell',
  1642. }
  1643. }
  1644. })
  1645. }
  1646. if (res[11].httpCode == 1) {
  1647. let obj8 = res[11].data
  1648. obj8.id = 'pie8'
  1649. obj8.unit = '条'
  1650. obj8.color = this.pieColumnColor8
  1651. this.$nextTick(() => this.creatPie(obj8))
  1652. }
  1653. if (res[12].httpCode == 1) {
  1654. this.tableData8 = res[12].data.data
  1655. this.tableData8.forEach((item,index)=> {
  1656. if (index == 0) {
  1657. item.cellClassName = {
  1658. paramNum01: 'total-records-table-cell',
  1659. paramNum02: 'total-exceptions-table-cell',
  1660. }
  1661. }
  1662. })
  1663. }
  1664. if (res[13].httpCode == 1) {
  1665. let obj9 = res[13].data
  1666. obj9.id = 'pie9'
  1667. obj9.unit = '条'
  1668. obj9.color = this.pieColumnColor9
  1669. this.$nextTick(() => this.creatPie(obj9))
  1670. }
  1671. if (res[14].httpCode == 1) {
  1672. this.tableData9 = res[14].data.data
  1673. this.tableData9.forEach((item,index)=> {
  1674. if (index == 0) {
  1675. item.cellClassName = {
  1676. paramNum01: 'total-records-table-cell',
  1677. paramNum02: 'total-exceptions-table-cell',
  1678. }
  1679. }
  1680. })
  1681. }
  1682. if (res[15].httpCode == 1) {
  1683. let obj10 = res[15].data
  1684. obj10.id = 'pie10'
  1685. obj10.unit = '条'
  1686. obj10.color = this.pieColumnColor10
  1687. this.$nextTick(() => this.creatPie(obj10))
  1688. }
  1689. if (res[16].httpCode == 1) {
  1690. this.tableData10 = res[16].data.data
  1691. this.tableData10.forEach((item,index)=> {
  1692. if (index == 0) {
  1693. item.cellClassName = {
  1694. paramNum01: 'total-records-table-cell',
  1695. paramNum02: 'total-exceptions-table-cell',
  1696. }
  1697. }
  1698. })
  1699. }
  1700. if (res[17].httpCode == 1) {
  1701. let obj11 = res[17].data
  1702. obj11.id = 'pie11'
  1703. obj11.unit = '条'
  1704. obj11.color = this.pieColumnColor11
  1705. this.$nextTick(() => this.creatPie(obj11))
  1706. }
  1707. if (res[18].httpCode == 1) {
  1708. this.tableData11 = res[18].data.data
  1709. this.tableData11.forEach((item,index)=> {
  1710. if (index == 0) {
  1711. item.cellClassName = {
  1712. paramNum01: 'total-records-table-cell',
  1713. paramNum02: 'total-exceptions-table-cell',
  1714. }
  1715. }
  1716. })
  1717. }
  1718. if (res[19].httpCode == 1) {
  1719. let obj12 = res[19].data
  1720. obj12.id = 'pie12'
  1721. obj12.unit = '条'
  1722. obj12.color = this.pieColumnColor12
  1723. this.$nextTick(() => this.creatPie(obj12))
  1724. }
  1725. if (res[20].httpCode == 1) {
  1726. this.tableData12 = res[20].data.data
  1727. this.tableData12.forEach((item,index)=> {
  1728. if (index == 0) {
  1729. item.cellClassName = {
  1730. paramNum01: 'total-records-table-cell',
  1731. paramNum02: 'total-exceptions-table-cell',
  1732. }
  1733. }
  1734. })
  1735. }
  1736. if (res[21].httpCode == 1) {
  1737. let obj13 = res[21].data
  1738. obj13.id = 'bar13'
  1739. obj13.unit = '条'
  1740. obj13.showStack = true
  1741. obj13.color = ['#31A4FD','#62BAFD','#646AD9', '#58D9F9','#d5affb']
  1742. this.$nextTick(() => this.creatBar(obj13))
  1743. }
  1744. if (res[22].httpCode == 1) {
  1745. this.tableData13 = res[22].data.data
  1746. this.tableData13.forEach((item,index)=> {
  1747. if (index == 0) {
  1748. item.cellClassName = {
  1749. paramNum01: 'quality-table-cell',
  1750. paramNum02: 'quality-table-cell',
  1751. paramNum03: 'quality-table-cell',
  1752. paramNum04: 'quality-table-cell',
  1753. paramNum05: 'quality-table-cell',
  1754. paramLong02: 'quality-table-cell',
  1755. }
  1756. }
  1757. })
  1758. }
  1759. if (res[23].httpCode == 1) {
  1760. let obj14 = res[23].data
  1761. obj14.id = 'bar14'
  1762. obj14.unit = '条'
  1763. obj14.legend = ['']
  1764. obj14.color = [['#0874E2','#62BAFD']]
  1765. this.$nextTick(() => this.creatBar(obj14))
  1766. }
  1767. if (res[24].httpCode == 1) {
  1768. this.tableData14 = res[24].data.data
  1769. this.tableData14.forEach((item,index)=> {
  1770. if (index == 0) {
  1771. item.cellClassName = {
  1772. paramLong01: 'total-records-table-cell',
  1773. paramNum01: 'total-exceptions-table-cell'
  1774. }
  1775. }
  1776. })
  1777. }
  1778. if (res[25].httpCode == 1) {
  1779. let obj15 = res[25].data
  1780. obj15.id = 'pie15'
  1781. obj15.unit = '条'
  1782. obj15.color = this.pieColumnColor15
  1783. this.$nextTick(() => this.creatPie(obj15))
  1784. }
  1785. if (res[26].httpCode == 1) {
  1786. this.tableData15 = res[26].data.data
  1787. this.tableData15.forEach((item,index)=> {
  1788. if (index == 0) {
  1789. item.cellClassName = {
  1790. paramNum01: 'quality-table-cell',
  1791. }
  1792. }
  1793. })
  1794. }
  1795. this.$nextTick(()=> {
  1796. if (this.downloadStatus) {
  1797. setTimeout(() => {
  1798. this.downPdf()
  1799. }, 1000)
  1800. }
  1801. })
  1802. })
  1803. },
  1804. downPdf () {
  1805. this.$nextTick(()=> {
  1806. let title = this.queryParams.reportName+'-'+this.queryParams.appName
  1807. // 如果这个页面有左右移动,canvas 也要做响应的移动,不然会出现canvas 内容不全
  1808. const xOffset = window.pageXOffset
  1809. // 避免笔下误 灯下黑 统一写
  1810. const A4_WIDTH = 592.28
  1811. // const A4_HEIGHT = 841.89
  1812. const A4_HEIGHT = 841.89
  1813. let printDom = this.$refs.downReport
  1814. // 根据A4的宽高计算DOM页面一页应该对应的高度
  1815. let pageHeight = printDom.offsetWidth / A4_WIDTH * A4_HEIGHT
  1816. // 将所有不允许被截断的元素进行处理
  1817. let wholeNodes = document.querySelectorAll('.no-truncation') //pdf加分页防止内容截断
  1818. for (let i = 0; i < wholeNodes.length; i++) {
  1819. //1、 判断当前的不可分页元素是否在两页显示
  1820. const topPageNum = Math.ceil((wholeNodes[i].offsetTop) / pageHeight) // wholeNodes[i].offsetTop 它返回当前元素相对于其 offsetParent 元素的顶部内边距的距离 如果算距离对顶部的距离它的父级不能设置定位,,否则结果为0
  1821. const bottomPageNum = Math.ceil((wholeNodes[i].offsetTop + wholeNodes[i].offsetHeight) / pageHeight)
  1822. if (topPageNum !== bottomPageNum) {
  1823. //说明该dom会被截断
  1824. // 2、插入空白块使被截断元素下移
  1825. let divParent = wholeNodes[i].parentNode
  1826. let newBlock = document.createElement('div')
  1827. newBlock.className = 'emptyDiv'
  1828. newBlock.style.background = '#06214d'
  1829. // 3、计算插入空白块的高度 可以适当流出空间使得内容太靠边,根据自己需求而定
  1830. let _H = topPageNum * pageHeight - wholeNodes[i].offsetTop
  1831. newBlock.style.height = _H + 30 + 'px'
  1832. divParent.insertBefore(newBlock, wholeNodes[i])
  1833. }
  1834. }
  1835. // 以上完成dom层面的分页 可以转为图片进一步处理了
  1836. html2canvas(printDom, { height: printDom.offsetHeight, width: printDom.offsetWidth, scrollX: -xOffset,backgroundColor: "#fff",allowTaint: true ,}).then(canvas => {
  1837. //dom 已经转换为canvas 对象,可以将插入的空白块删除了
  1838. let emptyDivs = document.querySelectorAll('.emptyDiv')
  1839. for (let i = 0; i < emptyDivs.length; i++) {
  1840. emptyDivs[i].parentNode.removeChild(emptyDivs[i])
  1841. }
  1842. // 有一点重复的代码
  1843. let contentWidth = canvas.width
  1844. let contentHeight = canvas.height
  1845. let pageHeight = contentWidth / A4_WIDTH * A4_HEIGHT
  1846. let leftHeight = contentHeight
  1847. let position = 0
  1848. let imgWidth = A4_WIDTH
  1849. let imgHeight = A4_WIDTH / contentWidth * contentHeight
  1850. let pageData = canvas.toDataURL('image/jpeg', 1.0)
  1851. // if (isPrint) {
  1852. // //如果是打印,可以拿着分号页的数据 直接使用
  1853. // printJs({ printable: pageData, type: 'image', base64: true, documentTitle: '\u200E' })
  1854. // return
  1855. // }
  1856. //计算分页的pdf
  1857. let PDF = new JsPDF('', 'pt', 'a4')
  1858. if (leftHeight <= pageHeight) {
  1859. PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight)
  1860. } else {
  1861. while (leftHeight > 0) {
  1862. PDF.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
  1863. leftHeight -= pageHeight
  1864. position -= A4_HEIGHT
  1865. if (leftHeight > 0) {
  1866. PDF.addPage()
  1867. }
  1868. }
  1869. }
  1870. this.downloadStatus = false
  1871. PDF.save(title + '.pdf')
  1872. })
  1873. })
  1874. },
  1875. }
  1876. };
  1877. </script>
  1878. <style lang="stylus">
  1879. * {
  1880. margin: 0;
  1881. padding: 0;
  1882. }
  1883. .quality-report {
  1884. // z-index:9999;
  1885. width: 100%;
  1886. position: relative;
  1887. display: flex;
  1888. justify-content: center;
  1889. background: #06214D;
  1890. }
  1891. </style>
  1892. <style lang="stylus" scoped>
  1893. .nav-content {
  1894. position:fixed;
  1895. right: 10PX;
  1896. top: 164px;
  1897. display: flex;
  1898. flex-direction: column;
  1899. z-index: 99;
  1900. // width: 108px;
  1901. /* height: 44px; */
  1902. // background: #214388;
  1903. // header:300px;
  1904. }
  1905. .nav-list {
  1906. height: 48px;
  1907. line-height: 48px;
  1908. text-align: center;
  1909. color: #FFFFFF;
  1910. font-size: 16px;
  1911. font-weight: bold;
  1912. margin-bottom: 20px;
  1913. background: linear-gradient(-79deg, #062D6F, #0185EA);
  1914. opacity: 0.6;
  1915. padding: 0 10px;
  1916. }
  1917. .report-container {
  1918. width: 70%;
  1919. margin-bottom: 20px;
  1920. position: relative;
  1921. }
  1922. .report-header {
  1923. text-align: center;
  1924. background: url('../assets/images/reportBg.png') no-repeat center;
  1925. background-size: 100% 100%;
  1926. height: 132px;
  1927. }
  1928. .header-title {
  1929. font-size: 36px;
  1930. font-weight: bold;
  1931. color: #FFFFFF;
  1932. padding-top: 32px;
  1933. line-height: 38px;
  1934. }
  1935. .header-subtitle {
  1936. font-size: 14px;
  1937. font-weight: 400;
  1938. color: #FFFFFF;
  1939. margin: 28px 0 22px;
  1940. line-height: 14px;
  1941. display: flex;
  1942. justify-content: space-around;
  1943. }
  1944. .report-content {
  1945. background: #0F2D5E;
  1946. padding: 0 16px;
  1947. }
  1948. .report-section {
  1949. margin: 18px 0;
  1950. }
  1951. .report-section:first-child {
  1952. margin-top: 0;
  1953. padding-top: 18px;
  1954. }
  1955. .title-content{
  1956. width: 100%;
  1957. height: 33px;
  1958. padding-bottom: 20px;
  1959. border-bottom: 2px solid #E5E5E5;
  1960. margin-bottom: 24px;
  1961. }
  1962. .title-line {
  1963. background: #1E58B8;
  1964. border-radius: 4px;
  1965. height: 45px;
  1966. padding-left: 20px;
  1967. display: flex;
  1968. align-items: center;
  1969. font-size: 14px;
  1970. color: #FFFFFF;
  1971. span {
  1972. height: 18px;
  1973. border-left: 1PX solid #FFFFFF;
  1974. padding-left: 10px;
  1975. }
  1976. }
  1977. .report-echarts {
  1978. .report-echarts-row {
  1979. margin-top: 10px;
  1980. margin-bottom: 10px;
  1981. }
  1982. .report-echarts-main {
  1983. // height: 310px;
  1984. border: 1px solid #2259B3;
  1985. border-radius: 4px;
  1986. }
  1987. .echarts-title {
  1988. font-size: 16px;
  1989. font-weight: 400;
  1990. color: #31A4FD;
  1991. line-height: 16px;
  1992. padding: 18px 18px 0 18px;
  1993. }
  1994. .echarts-sub-title {
  1995. font-size: 12px;
  1996. color: #fff;
  1997. padding: 20px 18px 0 18px;
  1998. }
  1999. }
  2000. .echart-detail {
  2001. width: 100%;
  2002. height: 290px;
  2003. // height: 100%;
  2004. }
  2005. // .echart-pie {
  2006. // width: 100%;
  2007. // height: 350px;
  2008. // }
  2009. .current-item {
  2010. background: linear-gradient(-79deg, #0185EA, #9FD0F5);
  2011. }
  2012. >>> .table-legend-list .ivu-table-cell{
  2013. display: flex;
  2014. align-items: center;
  2015. justify-content: center;
  2016. }
  2017. .table-legend {
  2018. width: 12px;
  2019. height: 12px;
  2020. border-radius: 4px;
  2021. display:inline-block;
  2022. }
  2023. .report-echarts-table {
  2024. padding: 20px 40px;
  2025. }
  2026. .report-echarts-right-table {
  2027. padding-top: 0;
  2028. padding-left: 0;
  2029. }
  2030. >>> .report-table-detail .ivu-table-stripe-even td {
  2031. background-color: #0F2D5E;
  2032. height: 40px;
  2033. }
  2034. >>> .report-table-detail .ivu-table-stripe-odd td {
  2035. background-color: #15376F;
  2036. height: 40px;
  2037. }
  2038. >>> .report-echarts-table .ivu-table .ivu-table-header .ivu-table-cell {
  2039. white-space: pre;
  2040. }
  2041. >>> .ivu-row .ivu-col {
  2042. position: static;
  2043. }
  2044. >>> .quality-table-cell span{
  2045. color:#5EB6FC;
  2046. }
  2047. >>> .total-records-table-cell span {
  2048. color: #42C151;
  2049. }
  2050. >>> .total-exceptions-table-cell span {
  2051. color: #D70101;
  2052. }
  2053. </style>