newHome.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. <template>
  2. <div class="homePage">
  3. <div class="topBox">
  4. <a-row :gutter="16">
  5. <a-col :sm="24" :md="6" :xl="6" :xxl="6">
  6. <div class="showBox">
  7. <h2 class="title">
  8. Top7项目消耗
  9. <a-tooltip>
  10. <template slot="title">最近七天的top7项目消耗</template>
  11. <span>
  12. <a-icon type="exclamation-circle" />
  13. </span>
  14. </a-tooltip>
  15. </h2>
  16. <div id="topChart" style="width:100%;height:130px" ref="topChart"></div>
  17. <div class="footerInfo">TOP1项目消耗数:¥{{this.topOption.series[0].data[0]}}</div>
  18. </div>
  19. </a-col>
  20. <a-col :sm="24" :md="6" :xl="6" :xxl="6">
  21. <div class="showBox">
  22. <h2 class="title">
  23. 总消耗
  24. <p class="numshow">¥{{cost.weekCostSum}}</p>
  25. <a-tooltip>
  26. <template slot="title">最近七天的总消耗</template>
  27. <span>
  28. <a-icon type="exclamation-circle" />
  29. </span>
  30. </a-tooltip>
  31. </h2>
  32. <div id="costChart" style="width:100%;height:100px" ref="costChart"></div>
  33. <div class="footerInfo">
  34. 周同比
  35. <span class="num">
  36. {{cost.weekCostSumLink|toPercentage}}
  37. <span
  38. class="greenIcon"
  39. v-if="cost.weekCostSumLink>0"
  40. ></span>
  41. <span class="redIcon" v-else></span>
  42. </span>
  43. </div>
  44. </div>
  45. </a-col>
  46. <a-col :sm="24" :md="6" :xl="6" :xxl="6">
  47. <div class="showBox">
  48. <h2 class="title">
  49. 点击数
  50. <p class="numshow">{{click.weekClickSum}}</p>
  51. <a-tooltip>
  52. <template slot="title">最近七天的点击数</template>
  53. <span>
  54. <a-icon type="exclamation-circle" />
  55. </span>
  56. </a-tooltip>
  57. </h2>
  58. <div id="clickChart" style="width:100%;height:100px" ref="clickChart"></div>
  59. <div class="footerInfo">
  60. 周同比
  61. <span class="num">
  62. {{click.weekClickSumLink|toPercentage}}
  63. <span
  64. class="greenIcon"
  65. v-if="click.weekClickSumLink>0"
  66. ></span>
  67. <span class="redIcon" v-else></span>
  68. </span>
  69. </div>
  70. </div>
  71. </a-col>
  72. <a-col :sm="24" :md="6" :xl="6" :xxl="6">
  73. <div class="showBox">
  74. <h2 class="title">
  75. 展示数
  76. <p class="numshow">{{showNum.weekShowNumSum}}</p>
  77. <a-tooltip>
  78. <template slot="title">最近七天的展示数</template>
  79. <span>
  80. <a-icon type="exclamation-circle" />
  81. </span>
  82. </a-tooltip>
  83. </h2>
  84. <div id="showChart" style="width:100%;height:100px" ref="showChart"></div>
  85. <div class="footerInfo">
  86. 周同比
  87. <span class="num">
  88. {{showNum.weekShowNumSumLink | toPercentage}}
  89. <span
  90. class="greenIcon"
  91. v-if="showNum.weekShowNumSumLink>0"
  92. ></span>
  93. <span class="redIcon" v-else></span>
  94. </span>
  95. </div>
  96. </div>
  97. </a-col>
  98. </a-row>
  99. </div>
  100. <!-- 折线图模块 -->
  101. <div class="section">
  102. <a-tabs default-active-key="cost" @change="callback" >
  103. <a-tab-pane key="cost" tab="总消耗">
  104. </a-tab-pane>
  105. <a-tab-pane key="click" tab="点击数" >
  106. </a-tab-pane>
  107. <a-tab-pane key="showNum" tab="展示数">
  108. </a-tab-pane>
  109. </a-tabs>
  110. <div id="sectionChart" style='width:100%;height:300px' ref="sectionChart"></div>
  111. <div class="duibi" @click="comparehandle">对比</div>
  112. <div class="time" @click="opendate">
  113. <DatePicker :openOptions='openOptions'/>
  114. </div>
  115. </div>
  116. <!-- table数据 -->
  117. <div class="tableshow">
  118. <p><span>{{dateValue[0].format('YYYY-MM-DD')+'~'+dateValue[1].format('YYYY-MM-DD')}}</span></p>
  119. <a-table
  120. size="middle"
  121. :columns="columns"
  122. :dataSource="tableData"
  123. :pagination=false
  124. bordered
  125. id="outTable"
  126. :loading="loading"
  127. style="word-break: break-all;"
  128. >
  129. <span slot="costProportion" slot-scope="costProportion">{{ costProportion | toPercentage }}</span>
  130. <!-- <span slot="statDatetime" slot-scope>{{ dateValue[0].format('YYYY-MM-DD')+'~'+dateValue[1].format('YYYY-MM-DD')}}</span> -->
  131. </a-table>
  132. </div>
  133. <!-- <p class="footertip">我们是有底线的~</p> -->
  134. <CompareData :compareVisiable.sync='compareVisiable' @close_modal='close_modal' ref="compareData"/>
  135. </div>
  136. </template>
  137. <script>
  138. import moment from 'moment'
  139. import DatePicker from '@/components/DatePicker.vue'
  140. import CompareData from './CompareData.vue'
  141. import { getAction, postAction, downFile, downFilePost } from '@/api/manage'
  142. // import vueEchart from './components/vueEchart'
  143. // 引入基本模板
  144. var echarts = require('echarts')
  145. // 引入柱状图组件
  146. require('echarts/lib/chart/bar')
  147. require('echarts/lib/chart/pie')
  148. require('echarts/lib/chart/line')
  149. // 引入提示框和title组件
  150. require('echarts/lib/component/tooltip')
  151. require('echarts/lib/component/title')
  152. require('echarts/lib/component/graphic')
  153. require('echarts/lib/component/toolbox')
  154. require('echarts/lib/component/legend')
  155. let option = {
  156. color: ['#1890ff'],
  157. tooltip: {
  158. trigger: 'axis',
  159. axisPointer: {
  160. // 坐标轴指示器,坐标轴触发有效
  161. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  162. }
  163. },
  164. grid: {
  165. left: '0%',
  166. // right: '4%',
  167. bottom: '-10%',
  168. top: '12%',
  169. containLabel: false,
  170. },
  171. xAxis: [
  172. {
  173. type: 'category',
  174. data: [],
  175. show: false,
  176. axisTick: {
  177. alignWithLabel: true
  178. }
  179. }
  180. ],
  181. yAxis: [
  182. {
  183. type: 'value',
  184. show: false
  185. }
  186. ],
  187. series: [
  188. {
  189. name: '',
  190. type: 'bar',
  191. barWidth: '40%',
  192. smooth: true,
  193. areaStyle:{},
  194. itemStyle: {
  195. color: new echarts.graphic.LinearGradient(
  196. 0, 0, 0, 1,
  197. [
  198. {offset: 0, color: '#1890ff'},
  199. {offset: 1, color: '#FFF'}
  200. ]
  201. )
  202. },
  203. data: []
  204. }
  205. ]
  206. }
  207. let lineStyle= {
  208. color:{
  209. type: 'linear',
  210. x: 0,
  211. y: 0,
  212. x2: 0,
  213. y2: 1,
  214. colorStops: [{
  215. offset: 0, color: '#1890ff' // 0% 处的颜色
  216. }, {
  217. offset: 1, color: '#fff' // 100% 处的颜色
  218. }],
  219. global: false // 缺省为 false
  220. },
  221. // color: '#1890ff'
  222. }
  223. let sectionOption={
  224. tooltip: {
  225. trigger: 'axis',
  226. axisPointer: {
  227. // 坐标轴指示器,坐标轴触发有效
  228. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  229. }
  230. },
  231. legend: {
  232. data: ['总消耗']
  233. },
  234. grid: {
  235. left: '2%',
  236. right: '0%',
  237. bottom: '0%',
  238. top: '12%',
  239. containLabel: true
  240. },
  241. xAxis: [
  242. {
  243. type: 'category',
  244. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  245. axisTick: {
  246. alignWithLabel: true
  247. }
  248. }
  249. ],
  250. yAxis: [
  251. {
  252. type: 'value',
  253. show: true
  254. }
  255. ],
  256. series: [
  257. {
  258. name: '总消耗',
  259. type: 'line',
  260. smooth: true,
  261. data: [820, 932, 901, 934, 1290, 1330, 1320],
  262. color:'#32CD32'
  263. },
  264. {
  265. name: '',
  266. type: 'line',
  267. smooth: true,
  268. data: [],
  269. color:'#8A2BE2'
  270. },
  271. ]
  272. }
  273. let init={
  274. today:{
  275. x:['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00','07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00','19:00', '20:00', '21:00', '22:00', '23:00'],
  276. y:[],
  277. name:"今天"
  278. },
  279. yesterday:{
  280. x:['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00','07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00','19:00', '20:00', '21:00', '22:00', '23:00'],
  281. y:[],
  282. name:"昨天"
  283. }
  284. }
  285. let columns = [
  286. {
  287. title: '日期/时间',
  288. dataIndex: 'statDate',
  289. scopedSlots: { customRender: 'statDate' },
  290. align: 'center',
  291. key:'statDate'
  292. },
  293. {
  294. title: '消耗',
  295. dataIndex: 'cost',
  296. scopedSlots: { customRender: 'cost' },
  297. align: 'center',
  298. key:'cost'
  299. },
  300. {
  301. title: '消耗环比',
  302. dataIndex: 'costProportion',
  303. scopedSlots: { customRender: 'costProportion' },
  304. align: 'center',
  305. key:"costProportion"
  306. },
  307. {
  308. title: '点击数',
  309. dataIndex: 'click',
  310. align: 'center',
  311. scopedSlots: { customRender: 'click' },
  312. key:'click'
  313. },
  314. {
  315. title: '点击率',
  316. dataIndex: 'clickRate',
  317. align: 'center',
  318. scopedSlots: { customRender: 'clickRate' },
  319. key:'clickRate'
  320. },
  321. {
  322. title: '展示数',
  323. dataIndex: 'showNum',
  324. align: 'center',
  325. scopedSlots: { customRender: 'showNum' },
  326. key:"showNum"
  327. },
  328. {
  329. title: '平均千次展现费用',
  330. dataIndex: 'cpm',
  331. align: 'center',
  332. scopedSlots: { customRender: 'cpm' },
  333. key:'cpm'
  334. },
  335. {
  336. title: '平均点击单价',
  337. dataIndex: 'cp',
  338. align: 'center',
  339. scopedSlots: { customRender: 'cp' },
  340. key:"cp"
  341. },
  342. ]
  343. export default {
  344. components:{
  345. DatePicker,
  346. CompareData
  347. },
  348. data() {
  349. return {
  350. //echart的配置项option
  351. topOption: JSON.parse(JSON.stringify(option)),
  352. costOption: JSON.parse(JSON.stringify(option)),
  353. clickOption: JSON.parse(JSON.stringify(option)),
  354. showOption: JSON.parse(JSON.stringify(option)),
  355. sectionOption:JSON.parse(JSON.stringify(sectionOption)),
  356. //页面四个块的数据
  357. cost: {},
  358. click: {},
  359. showNum: {},
  360. //tab的选中key
  361. tabKey:'',
  362. tabCost:{},
  363. tabClick:{},
  364. tabShowNum:{},
  365. //对比的模态框
  366. compareVisiable:false,
  367. //table
  368. loading: false,
  369. columns,
  370. tableData:[],
  371. //子元素的数据存储
  372. type:1,
  373. dateValue:[moment(),moment()],
  374. //日期矿打开
  375. openOptions:false,
  376. }
  377. },
  378. watch:{
  379. type(n,o){
  380. // console.log(n,o)
  381. // console.log(this.type)
  382. if(this.type<9){
  383. this.sectionHttp({type:this.type})
  384. }else if(this.type==9){
  385. this.sectionHttp({
  386. type:this.type,
  387. startDate:this.dateValue[0].format('YYYY-MM-DD'),
  388. endDate:this.dateValue[1].format('YYYY-MM-DD')
  389. })
  390. }
  391. },
  392. },
  393. methods: {
  394. //获取echart的值
  395. getEchartData(idName, optionName) {
  396. const chart = this.$refs[idName]
  397. // console.log(chart)
  398. if (chart) {
  399. const myChart = echarts.init(document.getElementById(idName))
  400. myChart.setOption(optionName)
  401. window.addEventListener('resize', function() {
  402. myChart.resize()
  403. })
  404. }
  405. },
  406. //网络请求方法
  407. echartsHttp() {
  408. return new Promise((resolve, reject) => {
  409. postAction('/ctop/byteDance/homePage/report/week', {}).then(res => {
  410. // console.log(res)
  411. if (res.success) {
  412. this.loading = false
  413. this.cost = res.result.costWeekLink
  414. this.click = res.result.clickWeekLink
  415. this.showNum = res.result.showNumWeekLink
  416. res.result.top.top7.forEach((element, index) => {
  417. this.topOption.xAxis[0].data.push(element.authName)
  418. this.topOption.series[0].data.push(element.cost)
  419. })
  420. for (let [key, value] of Object.entries(res.result.costWeek)) {
  421. this.costOption.xAxis[0].data.push(key)
  422. this.costOption.series[0].data.push(value)
  423. }
  424. for (let [key, value] of Object.entries(res.result.clickWeek)) {
  425. this.clickOption.xAxis[0].data.push(key)
  426. this.clickOption.series[0].data.push(value)
  427. }
  428. for (let [key, value] of Object.entries(res.result.showNumWeek)) {
  429. this.showOption.xAxis[0].data.push(key)
  430. this.showOption.series[0].data.push(value)
  431. }
  432. this.getEchartData('topChart', this.topOption)
  433. this.getEchartData('costChart', this.costOption)
  434. this.getEchartData('clickChart', this.clickOption)
  435. this.getEchartData('showChart', this.showOption)
  436. }
  437. })
  438. })
  439. },
  440. //处理echart
  441. sectionHttp(params) {
  442. this.loading = true
  443. this.sectionOption=JSON.parse(JSON.stringify(sectionOption));
  444. return new Promise((resolve, reject) => {
  445. postAction('/ctop/byteDance/homePage/report/chart', params).then(res => {
  446. // console.log(res)
  447. if (res.success) {
  448. this.loading = false
  449. //处理今天
  450. if(res.result.chart[0].afterData && res.result.chart[0].afterData.statDate==moment().format('YYYY-MM-DD')){
  451. this.tabCost=JSON.parse(JSON.stringify(init))
  452. this.tabClick=JSON.parse(JSON.stringify(init))
  453. this.tabShowNum=JSON.parse(JSON.stringify(init))
  454. res.result.chart.forEach((item,index)=>{
  455. this.tabClick.yesterday.y.push(item.click)
  456. this.tabCost.yesterday.y.push(item.cost)
  457. this.tabShowNum.yesterday.y.push(item.showNum)
  458. if(item.afterData){
  459. this.tabClick.today.y.push(item.afterData.click)
  460. this.tabCost.today.y.push(item.afterData.cost)
  461. this.tabShowNum.today.y.push(item.afterData.showNum)
  462. }else{
  463. this.tabClick.today.y.push(0)
  464. this.tabCost.today.y.push(0)
  465. this.tabShowNum.today.y.push(0)
  466. }
  467. });
  468. this.sectionOption.legend.data=['今天','昨天'];
  469. this.sectionOption.xAxis[0].data=this.tabCost.today.x;
  470. this.sectionOption.series[0].data=this.tabCost.today.y;
  471. this.sectionOption.series[0].name=this.tabCost.today.name;
  472. this.sectionOption.series[1].data=this.tabCost.yesterday.y;
  473. this.sectionOption.series[1].name=this.tabCost.yesterday.name;
  474. }else if(res.result.chart[0].afterData&& res.result.chart[0].afterData.statDate==moment().subtract(1,'days').format('YYYY-MM-DD')){
  475. //处理昨天
  476. this.tabCost=[]
  477. this.tabClick=[]
  478. this.tabShowNum=[]
  479. res.result.chart.forEach((item,index)=>{
  480. if(item.afterData){
  481. this.tabClick.push(item.afterData.click)
  482. this.tabCost.push(item.afterData.cost)
  483. this.tabShowNum.push(item.afterData.showNum)
  484. }else{
  485. this.tabClick.push(0)
  486. this.tabCost.push(0)
  487. this.tabShowNum.push(0)
  488. }
  489. });
  490. this.sectionOption.xAxis[0].data=init.today.x;
  491. this.sectionOption.series[0].data=this.tabCost;
  492. }else{
  493. this.tabCost={x:[],y:[]}
  494. this.tabClick={x:[],y:[]}
  495. this.tabShowNum={x:[],y:[]}
  496. res.result.chart.forEach((item,index)=>{
  497. this.tabClick.y.push(item.click)
  498. this.tabCost.y.push(item.cost)
  499. this.tabShowNum.y.push(item.showNum)
  500. this.tabClick.x.push(item.statDate)
  501. this.tabCost.x.push(item.statDate)
  502. this.tabShowNum.x.push(item.statDate)
  503. });
  504. this.sectionOption.xAxis[0].data=this.tabCost.x;
  505. this.sectionOption.series[0].data=this.tabCost.y;
  506. }
  507. this.getEchartData('sectionChart', this.sectionOption);
  508. //处理表格数据
  509. let total={
  510. statDate:'总计',
  511. cost:0,
  512. click:0,
  513. clickRate:0,
  514. costProportion:'-',
  515. cp:0,
  516. cpm:0,
  517. showNum:0
  518. }
  519. res.result.list.forEach((ele)=>{
  520. if(!ele.costProportion){
  521. ele.costProportion='-'
  522. }
  523. if(ele.statHour||ele.statHour==0){
  524. ele.statHour=ele.statHour > 9 ? `${ele.statHour}:00` : ` 0${ele.statHour}:00`
  525. ele.statDate=ele.statDate+' '+ele.statHour
  526. }
  527. total.click+=ele.click
  528. total.cost+=ele.cost
  529. total.showNum+=ele.showNum
  530. })
  531. total.cost=(total.cost).toFixed(2)
  532. total.clickRate=(total.click/total.showNum*100).toFixed(2)+'%'
  533. total.cp=(total.cost/total.click).toFixed(2)
  534. total.cpm=(total.cost/total.showNum*1000).toFixed(2)
  535. this.tableData=[total,...res.result.list]
  536. }
  537. })
  538. })
  539. },
  540. //tab切换页的事件
  541. callback(key) {
  542. // console.log(key);
  543. // this.tabKey=key;
  544. this.sectionOption=JSON.parse(JSON.stringify(sectionOption))
  545. if(key=='cost'){
  546. if(this.type==1){
  547. this.sectionOption.legend.data=['今天','昨天'];
  548. this.sectionOption.xAxis[0].data=this.tabCost.today.x;
  549. this.sectionOption.series[0].data=this.tabCost.today.y;
  550. this.sectionOption.series[0].name=this.tabCost.today.name;
  551. this.sectionOption.series[1].data=this.tabCost.yesterday.y;
  552. this.sectionOption.series[1].name=this.tabCost.yesterday.name;
  553. }else if(this.type==2){
  554. this.sectionOption.xAxis[0].data=init.today.x;
  555. this.sectionOption.series[0].data=this.tabCost;
  556. }else{
  557. this.sectionOption.xAxis[0].data=this.tabCost.x;
  558. this.sectionOption.series[0].data=this.tabCost.y;
  559. }
  560. }else if(key=='click'){
  561. if(this.type==1){
  562. this.sectionOption.legend.data=['今天','昨天'];
  563. this.sectionOption.xAxis[0].data=this.tabClick.today.x;
  564. this.sectionOption.series[0].data=this.tabClick.today.y;
  565. this.sectionOption.series[0].name=this.tabClick.today.name;
  566. this.sectionOption.series[1].data=this.tabClick.yesterday.y;
  567. this.sectionOption.series[1].name=this.tabClick.yesterday.name;
  568. }else if(this.type==2){
  569. this.sectionOption.legend.data=['点击数'];
  570. this.sectionOption.xAxis[0].data=init.today.x;
  571. this.sectionOption.series[0].data=this.tabClick;
  572. this.sectionOption.series[0].name='点击数';
  573. }else{
  574. this.sectionOption.legend.data=['点击数'];
  575. this.sectionOption.xAxis[0].data=this.tabClick.x;
  576. this.sectionOption.series[0].data=this.tabClick.y;
  577. this.sectionOption.series[0].name='点击数';
  578. }
  579. }else{
  580. if(this.type==1){
  581. this.sectionOption.legend.data=['今天','昨天'];
  582. this.sectionOption.xAxis[0].data=this.tabShowNum.today.x;
  583. this.sectionOption.series[0].data=this.tabShowNum.today.y;
  584. this.sectionOption.series[0].name=this.tabShowNum.today.name;
  585. this.sectionOption.series[1].data=this.tabShowNum.yesterday.y;
  586. this.sectionOption.series[1].name=this.tabShowNum.yesterday.name;
  587. }else if(this.type==2){
  588. this.sectionOption.legend.data=['展示数'];
  589. this.sectionOption.xAxis[0].data=init.today.x;
  590. this.sectionOption.series[0].data=this.tabShowNum;
  591. this.sectionOption.series[0].name='展示数';
  592. }else{
  593. this.sectionOption.legend.data=['展示数'];
  594. this.sectionOption.xAxis[0].data=this.tabShowNum.x;
  595. this.sectionOption.series[0].data=this.tabShowNum.y;
  596. this.sectionOption.series[0].name='展示数';
  597. }
  598. }
  599. this.getEchartData('sectionChart', this.sectionOption)
  600. },
  601. //打开日期框
  602. opendate(){
  603. this.openOptions=!this.openOptions;
  604. // console.log(this.openOptions)
  605. },
  606. //对比按钮的事件
  607. comparehandle(){
  608. this.compareVisiable=true;
  609. this.$refs.compareData.sectionHttp({
  610. type: 10,
  611. sign: 'month',
  612. smallDate: moment()
  613. .subtract(1, 'months')
  614. .format('YYYY-MM'),
  615. bigDate: moment().format('YYYY-MM')
  616. })
  617. },
  618. close_modal(n){
  619. // console.log(n)
  620. this.compareVisiable=n;
  621. },
  622. //对比模块的tab事件
  623. compareTab(key){
  624. console.log(key)
  625. }
  626. },
  627. mounted() {
  628. //处理四个图标的样式
  629. this.costOption.series[0].type = 'line';
  630. this.costOption.series[0].itemStyle = {};
  631. this.costOption.series[0].areaStyle = lineStyle;
  632. this.costOption.xAxis[0].boundaryGap = false
  633. this.showOption.series[0].type = 'line'
  634. this.showOption.series[0].itemStyle = {};
  635. this.showOption.series[0].areaStyle = lineStyle;
  636. this.showOption.xAxis[0].boundaryGap = false
  637. this.echartsHttp();
  638. this.sectionHttp({type:this.type});
  639. },
  640. filters: {
  641. toPercentage(val) {
  642. if(typeof val != 'string'){
  643. return (val * 100).toFixed(2) + '%'
  644. }else{
  645. return val
  646. }
  647. }
  648. }
  649. }
  650. </script>
  651. <style lang="scss" scoped>
  652. .homePage {
  653. .topBox{
  654. margin-bottom: 20px;;
  655. }
  656. .showBox {
  657. width: 98%;
  658. box-sizing: border-box;
  659. margin-right: 20px;
  660. padding: 25px;
  661. background-color: #fff;
  662. .title {
  663. position: relative;
  664. span {
  665. position: absolute;
  666. top: 0;
  667. right: 0;
  668. cursor: pointer;
  669. }
  670. }
  671. .numshow {
  672. padding: 5px 0;
  673. height: 30px;
  674. margin-bottom: 0;
  675. }
  676. }
  677. .footerInfo {
  678. border-top: 1px solid #333;
  679. padding-top: 10px;
  680. font-weight: 500;
  681. font-size: 16px;
  682. position: relative;
  683. height: 60px;
  684. .num {
  685. display: inline-block;
  686. margin-left: 10px;
  687. padding-right: 15px;
  688. position: relative;
  689. }
  690. .greenIcon {
  691. width: 0;
  692. height: 0;
  693. border-left: 4px solid transparent;
  694. border-right: 4px solid transparent;
  695. border-bottom: 8px solid green;
  696. position: absolute;
  697. top: 40%;
  698. right: 0;
  699. }
  700. .redIcon {
  701. width: 0;
  702. height: 0;
  703. border-left: 4px solid transparent;
  704. border-right: 4px solid transparent;
  705. border-top: 8px solid red;
  706. position: absolute;
  707. top: 40%;
  708. right: 0;
  709. }
  710. }
  711. .section{
  712. width: 100%;
  713. background-color: #fff;
  714. padding: 10px 15px 20px;
  715. position: relative;
  716. margin-bottom: 20px;;
  717. .duibi{
  718. position: absolute;
  719. height: 30px;
  720. line-height: 30px;
  721. padding: 0 15px;
  722. top: 15px;
  723. right: 300px;
  724. border: 1px solid #666;
  725. cursor: pointer;
  726. }
  727. .time{
  728. position: absolute;
  729. width:280px;
  730. top: 15px;
  731. right: 0px;
  732. cursor: pointer;
  733. }
  734. }
  735. .tableshow{
  736. width: 100%;
  737. padding: 20px 15px;
  738. background-color: #fff;
  739. p{
  740. width: 100%;
  741. border-bottom: 1px solid #666;
  742. padding-bottom: 20px;
  743. span{
  744. display: inline-block;
  745. border: 1px solid #666;
  746. padding: 5px 15px;
  747. }
  748. }
  749. }
  750. .footertip{
  751. background: #fff;
  752. padding: 0 15px 20px;
  753. font-size: 16px;
  754. text-align: center;
  755. }
  756. }
  757. </style>