InformationData.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="rf-category informationData">
  3. <navbar-search
  4. :list="search.searchList"
  5. @selectedItem="getSelectedItem">
  6. </navbar-search>
  7. <u-tabs
  8. :list="tabs.tabsList"
  9. :is-scroll="false"
  10. bar-width="140"
  11. :current="tabs.current"
  12. @change="tabsChange">
  13. </u-tabs>
  14. <view class="viewContent">
  15. <indicatorDataQuery
  16. v-if="tabs.current===0"
  17. :searchItem="search.searchItem"
  18. @reset="ResetParent"
  19. ></indicatorDataQuery>
  20. <indicatorDataRankings
  21. v-if="tabs.current===1"
  22. :searchItem="search.searchItem"
  23. @reset="ResetParent"
  24. ></indicatorDataRankings>
  25. <dataExportTool
  26. v-if="tabs.current===2"
  27. @reset="ResetParent"
  28. ></dataExportTool>
  29. </view>
  30. <u-toast ref="uToast" />
  31. </view>
  32. </template>
  33. <script>
  34. import navbarSearch from "./dom/navbarSearch1";
  35. import indicatorDataQuery from "./dom/indicatorDataQuery";
  36. import indicatorDataRankings from "./dom/indicatorDataRankings";
  37. import dataExportTool from "./dom/dataExportTool";
  38. let _self;
  39. export default {
  40. name:'informationData',
  41. components:{
  42. navbarSearch,
  43. indicatorDataQuery,
  44. indicatorDataRankings,
  45. dataExportTool
  46. },
  47. data(){
  48. return {
  49. /**
  50. * 搜索栏
  51. */
  52. search:{
  53. searchList: [],
  54. searchItem: {},
  55. },
  56. /**
  57. * 标签栏
  58. */
  59. tabs:{
  60. tabsList:[
  61. {
  62. name: this.$i18n.locale == 'zh' ? '指标数据查询' : 'Data Query'
  63. }, {
  64. name: this.$i18n.locale == 'zh' ? '指标数据排行' : 'Data Ranking'
  65. }, {
  66. name: this.$i18n.locale == 'zh' ? '数据导出工具' : 'Export Tool'
  67. }
  68. ],
  69. current:0
  70. },
  71. }
  72. },
  73. onLoad(option) {
  74. _self = this;
  75. if([0,1,2].includes(Number(option.current))){
  76. this.tabs.current = Number(option.current)
  77. }
  78. this.init()
  79. },
  80. methods:{
  81. async init() {
  82. await this.getServerData()
  83. },
  84. i18n(data) {
  85. return this.$t('common.' + data);
  86. },
  87. /**
  88. * 搜索栏
  89. */
  90. async getServerData() {
  91. const res = await this.$myRequest({
  92. url: '/op/geiIntegratedDataMenus/getMenu',
  93. data: {}
  94. });
  95. this.setNodeId(res.data,'child')
  96. this.search.searchList = res.data;
  97. },
  98. setNodeId(data,childrenName='children',id=''){
  99. data.forEach((item,index)=>{
  100. let nodeId = id?`${id}_${index}`:`${index}`;
  101. this.$set(item,'nodeId',nodeId)
  102. if(item[childrenName] && item[childrenName].length > 0){
  103. this.setNodeId(item[childrenName],childrenName,nodeId)
  104. }
  105. })
  106. },
  107. getSelectedItem(e) {
  108. this.search.searchItem = e
  109. },
  110. /**
  111. * 标签栏
  112. */
  113. tabsChange(index) {
  114. this.tabs.current = index;
  115. },
  116. ResetParent(e){
  117. console.log(e)
  118. uni.redirectTo({
  119. url: '/pages/information/InformationData/InformationData?current='+ e
  120. });
  121. }
  122. }
  123. }
  124. </script>
  125. <style scoped lang="scss">
  126. uni-page-body {
  127. padding-top: 0;
  128. }
  129. page {
  130. background: #fff;
  131. width: 750upx;
  132. overflow-x: hidden;
  133. height: 100%;
  134. overflow: hidden;
  135. }
  136. .informationData{
  137. height: 100%;
  138. .viewContent{
  139. height: calc(100% - 88upx)
  140. }
  141. }
  142. </style>