index.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="subPage">
  3. <div class="selectCase">
  4. <el-select v-model="postData.caseid" placeholder="请选择">
  5. <el-option
  6. v-for="item in cases"
  7. :key="item.CaseId"
  8. :label="item.CaseName"
  9. :value="item.CaseId">
  10. </el-option>
  11. </el-select>
  12. </div>
  13. <div class="flex-h" v-for="(item,index) in pageData" :key="index">
  14. <div class="flex-item" v-for="(subItem,subIndex) in item" :key="subIndex">
  15. <div v-if="subItem.type === 'dashboardList'">
  16. <dashboardList :data="subItem.data" :index="index + '-' + subIndex"></dashboardList>
  17. </div>
  18. <div v-if="subItem.type === 'histogram'">
  19. <histogram :data="subItem.data" :index="index + '-' + subIndex"></histogram>
  20. </div>
  21. <div v-if="subItem.type === 'pieDiagram'">
  22. <pieDiagram :data="subItem.data" :index="index + '-' + subIndex"></pieDiagram>
  23. </div>
  24. <div v-if="subItem.type === 'brokenLineGraph'">
  25. <brokenLineGraph :data="subItem.data" :index="index + '-' + subIndex"></brokenLineGraph>
  26. </div>
  27. <div v-if="subItem.type === 'ringChart'">
  28. <ringChart :data="subItem.data" :index="index + '-' + subIndex"></ringChart>
  29. </div>
  30. <div v-if="subItem.type === 'dashboard'">
  31. <dashboard :data="subItem.data" :index="index + '-' + subIndex"></dashboard>
  32. </div>
  33. <div v-if="subItem.type === 'brokenLineGraphGroup'">
  34. <brokenLineGraphGroup :data="subItem.data" :index="index + '-' + subIndex"></brokenLineGraphGroup>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { mapState, createNamespacedHelpers } from 'vuex'
  42. import dashboardList from '../../../components/dashboardList/index'
  43. import histogram from '../../../components/histogram/index'
  44. import pieDiagram from '../../../components/pieDiagram/index'
  45. import brokenLineGraph from '../../../components/brokenLineGraph/index'
  46. import ringChart from '../../../components/ringChart/index'
  47. import dashboard from '../../../components/dashboard/index'
  48. import brokenLineGraphGroup from '../../../components/brokenLineGraphGroup/index'
  49. const { mapActions: mapStaActions } = createNamespacedHelpers('sta')
  50. export default {
  51. name: '',
  52. data () {
  53. return {
  54. postData: {
  55. caseid: ''
  56. },
  57. pageData: [
  58. [
  59. { type: 'dashboardList', remark: '列表面板', data: { title: '', list: [{ name: '会员总数', value: '1000', }, { name: '课程预约总量', value: '1000', }, { name: '饮品下单总量', value: '1000', }] } }
  60. ],
  61. [
  62. { type: 'histogram', remark: '柱状图', data: { title: '今日数据', list: [{ x: '推荐会员新增', y: 38 }, { x: '课程数', y: 52 }, { x: '预约数', y: 61 }, { x: '到场人次', y: 145 }] } },
  63. { type: 'pieDiagram', remark: '扇形图', data: { title: '明日课程预约数据', list: [{ item: '小小体验官', count: 40, percent: 0.4 }, { item: '哈他瑜伽', count: 52, percent: 0.52 }, { item: '小小飞行家', count: 8, percent: 0.08 }] } }
  64. ],
  65. [
  66. { type: 'brokenLineGraph', remark: '折线图', data: { title: '下单饮品数据', list: [{ x: '09/05', y: 3 }, { x: '09/06', y: 4 }, { x: '09/07', y: 3.5 }, { x: '09/08', y: 5 }, { x: '09/09', y: 4.9 }, { x: '09/10', y: 6 }, { x: '09/11', y: 7 }, { x: '09/12', y: 9 }, { x: '09/13', y: 13 }] } },
  67. { type: 'ringChart', remark: '环形图', data: { title: '本月课程预约', list: [{ item: '健身课程', count: 40, percent: 0.4 }, { item: '社交课程', count: 21, percent: 0.21 }, { item: '教育课程', count: 17, percent: 0.17 }, { item: '健康课程', count: 13, percent: 0.13 }, { item: '艺术课程', count: 9, percent: 0.09 }] } },
  68. ],
  69. [
  70. { type: 'dashboard', remark: '仪表盘', data: { title: '参与率', list: [{ value: 5.6 }] } },
  71. { type: 'dashboard', remark: '仪表盘', data: { title: '参与率', list: [{ value: 3.1 }] } },
  72. ],
  73. [
  74. { type: 'brokenLineGraphGroup', remark: '折线图组合', data: { title: '下单饮品数据', list: [{ month: 'Jan', city: 'Tokyo', temperature: 7 }, { month: 'Jan', city: 'London', temperature: 3.9 }, { month: 'Feb', city: 'Tokyo', temperature: 6.9 }, { month: 'Feb', city: 'London', temperature: 4.2 }, { month: 'Mar', city: 'Tokyo', temperature: 9.5 }, { month: 'Mar', city: 'London', temperature: 5.7 }, { month: 'Apr', city: 'Tokyo', temperature: 14.5 }, { month: 'Apr', city: 'London', temperature: 8.5 }, { month: 'May', city: 'Tokyo', temperature: 18.4 }, { month: 'May', city: 'London', temperature: 11.9 }, { month: 'Jun', city: 'Tokyo', temperature: 21.5 }, { month: 'Jun', city: 'London', temperature: 15.2 }, { month: 'Jul', city: 'Tokyo', temperature: 25.2 }, { month: 'Jul', city: 'London', temperature: 17 }, { month: 'Aug', city: 'Tokyo', temperature: 26.5 }, { month: 'Aug', city: 'London', temperature: 16.6 }, { month: 'Sep', city: 'Tokyo', temperature: 23.3 }, { month: 'Sep', city: 'London', temperature: 14.2 }, { month: 'Oct', city: 'Tokyo', temperature: 18.3 }, { month: 'Oct', city: 'London', temperature: 10.3 }, { month: 'Nov', city: 'Tokyo', temperature: 13.9 }, { month: 'Nov', city: 'London', temperature: 6.6 }, { month: 'Dec', city: 'Tokyo', temperature: 9.6 }, { month: 'Dec', city: 'London', temperature: 4.8 }] } },
  75. ],
  76. ],
  77. }
  78. },
  79. components: {
  80. dashboardList,
  81. histogram,
  82. pieDiagram,
  83. brokenLineGraph,
  84. ringChart,
  85. dashboard,
  86. brokenLineGraphGroup,
  87. },
  88. computed: {
  89. ...mapState({
  90. cases: x => x.app.cases.list,
  91. defaultCaseId: x => x.app.cases.default
  92. }),
  93. CaseId: {
  94. get () {
  95. return this.postData.caseid || this.defaultCaseId || this.cases[0].CaseId
  96. },
  97. set (val) {
  98. this.postData.caseid = val
  99. }
  100. }
  101. },
  102. mounted () {
  103. this.$nextTick(function () {
  104. this.postData.caseid = this.postData.caseid || this.cases[0].CaseId
  105. this.getDashboardData({
  106. caseid: this.postData.caseid
  107. }).then((res) => {
  108. console.log(JSON.stringify(res))
  109. })
  110. this.getDashboardBottomData({
  111. caseid: this.postData.caseid,
  112. statype: 'week'
  113. }).then((res) => {
  114. console.log(JSON.stringify(res))
  115. })
  116. })
  117. },
  118. methods: {
  119. ...mapStaActions([
  120. 'getDashboardData',
  121. 'getDashboardBottomData',
  122. ]),
  123. }
  124. }
  125. </script>
  126. <!-- Add "scoped" attribute to limit CSS to this component only -->
  127. <style lang="scss" scoped>
  128. @import "page.scss";
  129. </style>